diff options
author | Reid Kleckner <rnk@google.com> | 2015-09-09 21:10:03 +0000 |
---|---|---|
committer | Reid Kleckner <rnk@google.com> | 2015-09-09 21:10:03 +0000 |
commit | 94b704c4691a8b10eff156277976702475bdfd3e (patch) | |
tree | e1a2622631516e9ea1177e4bc60ef8c45dfcaa7f /llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp | |
parent | 81f3ccb505f8a594703bfc574442bb5c8bb841e3 (diff) | |
download | bcm5719-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/SelectionDAGBuilder.cpp')
-rw-r--r-- | llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp | 23 |
1 files changed, 15 insertions, 8 deletions
diff --git a/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp b/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp index 1df4245bf0b..6fba18d60b2 100644 --- a/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp +++ b/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp @@ -1989,7 +1989,6 @@ void SelectionDAGBuilder::visitInvoke(const InvokeInst &I) { // and catchendpads for successors. MachineBasicBlock *Return = FuncInfo.MBBMap[I.getSuccessor(0)]; const BasicBlock *EHPadBB = I.getSuccessor(1); - bool IsLandingPad = EHPadBB->isLandingPad(); const Value *Callee(I.getCalledValue()); const Function *Fn = dyn_cast<Function>(Callee); @@ -2025,16 +2024,26 @@ void SelectionDAGBuilder::visitInvoke(const InvokeInst &I) { // Catchpads are conditional branches that add real MBB destinations and // continue the loop. EH "end" pads are not real BBs and simply continue. SmallVector<MachineBasicBlock *, 1> UnwindDests; + bool IsMSVCCXX = classifyEHPersonality(FuncInfo.Fn->getPersonalityFn()) == + EHPersonality::MSVC_CXX; while (EHPadBB) { const Instruction *Pad = EHPadBB->getFirstNonPHI(); - if (isa<CleanupPadInst>(Pad) || isa<LandingPadInst>(Pad)) { - assert(FuncInfo.MBBMap[EHPadBB]); - // Stop on cleanup pads and landingpads. + if (isa<LandingPadInst>(Pad)) { + // Stop on landingpads. They are not funclets. UnwindDests.push_back(FuncInfo.MBBMap[EHPadBB]); break; + } else if (isa<CleanupPadInst>(Pad) || isa<LandingPadInst>(Pad)) { + // Stop on cleanup pads. Cleanups are always funclet entries for all known + // personalities. + UnwindDests.push_back(FuncInfo.MBBMap[EHPadBB]); + UnwindDests.back()->setIsEHFuncletEntry(); + break; } else if (const auto *CPI = dyn_cast<CatchPadInst>(Pad)) { // Add the catchpad handler to the possible destinations. UnwindDests.push_back(FuncInfo.MBBMap[CPI->getNormalDest()]); + // In MSVC C++, catchblocks are funclets and need prologues. + if (IsMSVCCXX) + UnwindDests.back()->setIsEHFuncletEntry(); EHPadBB = CPI->getUnwindDest(); } else if (const auto *CEPI = dyn_cast<CatchEndPadInst>(Pad)) { EHPadBB = CEPI->getUnwindDest(); @@ -2043,13 +2052,11 @@ void SelectionDAGBuilder::visitInvoke(const InvokeInst &I) { } } - // Update successor info + // Update successor info. // FIXME: The weights for catchpads will be wrong. addSuccessorWithWeight(InvokeMBB, Return); - for (auto *UnwindDest : UnwindDests) { + for (MachineBasicBlock *UnwindDest : UnwindDests) { UnwindDest->setIsEHPad(); - if (!IsLandingPad) - UnwindDest->setIsEHFuncletEntry(); addSuccessorWithWeight(InvokeMBB, UnwindDest); } |