summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen/SelectionDAG/FunctionLoweringInfo.cpp
diff options
context:
space:
mode:
authorReid Kleckner <rnk@google.com>2015-09-09 21:10:03 +0000
committerReid Kleckner <rnk@google.com>2015-09-09 21:10:03 +0000
commit94b704c4691a8b10eff156277976702475bdfd3e (patch)
treee1a2622631516e9ea1177e4bc60ef8c45dfcaa7f /llvm/lib/CodeGen/SelectionDAG/FunctionLoweringInfo.cpp
parent81f3ccb505f8a594703bfc574442bb5c8bb841e3 (diff)
downloadbcm5719-llvm-94b704c4691a8b10eff156277976702475bdfd3e.tar.gz
bcm5719-llvm-94b704c4691a8b10eff156277976702475bdfd3e.zip
[SEH] Emit 32-bit SEH tables for the new EH IR
The 32-bit tables don't actually contain PC range data, so emitting them is incredibly simple. The 64-bit tables, on the other hand, use the same table for state numbering as well as label ranges. This makes things more difficult, so it will be implemented later. llvm-svn: 247192
Diffstat (limited to 'llvm/lib/CodeGen/SelectionDAG/FunctionLoweringInfo.cpp')
-rw-r--r--llvm/lib/CodeGen/SelectionDAG/FunctionLoweringInfo.cpp26
1 files changed, 18 insertions, 8 deletions
diff --git a/llvm/lib/CodeGen/SelectionDAG/FunctionLoweringInfo.cpp b/llvm/lib/CodeGen/SelectionDAG/FunctionLoweringInfo.cpp
index 7bbb194ac19..15793f666ea 100644
--- a/llvm/lib/CodeGen/SelectionDAG/FunctionLoweringInfo.cpp
+++ b/llvm/lib/CodeGen/SelectionDAG/FunctionLoweringInfo.cpp
@@ -287,21 +287,31 @@ void FunctionLoweringInfo::set(const Function &fn, MachineFunction &mf,
addSEHHandlersForLPads(LPads);
}
+ // Calculate state numbers if we haven't already.
WinEHFuncInfo &EHInfo = MMI.getWinEHFuncInfo(&fn);
if (Personality == EHPersonality::MSVC_CXX) {
- // Calculate state numbers and then map from funclet BBs to MBBs.
const Function *WinEHParentFn = MMI.getWinEHParent(&fn);
calculateWinCXXEHStateNumbers(WinEHParentFn, EHInfo);
+ } else {
+ const Function *WinEHParentFn = MMI.getWinEHParent(&fn);
+ calculateSEHStateNumbers(WinEHParentFn, EHInfo);
+ }
+
+ // Map all BB references in the EH data to MBBs.
for (WinEHTryBlockMapEntry &TBME : EHInfo.TryBlockMap)
for (WinEHHandlerType &H : TBME.HandlerArray)
- if (const auto *BB = dyn_cast<BasicBlock>(H.Handler))
- H.HandlerMBB = MBBMap[BB];
- // If there's an explicit EH registration node on the stack, record its
- // frame index.
- if (EHInfo.EHRegNode && EHInfo.EHRegNode->getParent()->getParent() == Fn) {
- assert(StaticAllocaMap.count(EHInfo.EHRegNode));
- EHInfo.EHRegNodeFrameIndex = StaticAllocaMap[EHInfo.EHRegNode];
+ if (const auto *BB =
+ dyn_cast<BasicBlock>(H.Handler.get<const Value *>()))
+ H.Handler = MBBMap[BB];
+ for (SEHUnwindMapEntry &UME : EHInfo.SEHUnwindMap) {
+ const BasicBlock *BB = UME.Handler.get<const BasicBlock *>();
+ UME.Handler = MBBMap[BB];
}
+ // If there's an explicit EH registration node on the stack, record its
+ // frame index.
+ if (EHInfo.EHRegNode && EHInfo.EHRegNode->getParent()->getParent() == Fn) {
+ assert(StaticAllocaMap.count(EHInfo.EHRegNode));
+ EHInfo.EHRegNodeFrameIndex = StaticAllocaMap[EHInfo.EHRegNode];
}
// Copy the state numbers to LandingPadInfo for the current function, which
OpenPOWER on IntegriCloud