diff options
| author | Joseph Tremoulet <jotrem@microsoft.com> | 2015-10-07 17:16:25 +0000 |
|---|---|---|
| committer | Joseph Tremoulet <jotrem@microsoft.com> | 2015-10-07 17:16:25 +0000 |
| commit | bde46c5642c859d3340d871cc41e7e5d31001b6f (patch) | |
| tree | fea7d9236fa8eeffaf7b37f3edc430ad58c2b745 /llvm | |
| parent | b4908761f834b532dd9a1bb9e5e0dc5e1a62e29d (diff) | |
| download | bcm5719-llvm-bde46c5642c859d3340d871cc41e7e5d31001b6f.tar.gz bcm5719-llvm-bde46c5642c859d3340d871cc41e7e5d31001b6f.zip | |
[WinEH] Update CoreCLR EH for catchpad MBBs
Summary:
Set the pad MBB as a funclet entry for CoreCLR as well as MSVCCXX, and
update state numbering to put the catchpad block rather than its normal
successor into the unwind map.
Reviewers: majnemer
Subscribers: llvm-commits
Differential Revision: http://reviews.llvm.org/D13492
llvm-svn: 249569
Diffstat (limited to 'llvm')
| -rw-r--r-- | llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp | 5 | ||||
| -rw-r--r-- | llvm/lib/CodeGen/WinEHPrepare.cpp | 4 |
2 files changed, 5 insertions, 4 deletions
diff --git a/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp b/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp index ed96742db7c..9e315194c98 100644 --- a/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp +++ b/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp @@ -1163,9 +1163,10 @@ void SelectionDAGBuilder::visitCatchPad(const CatchPadInst &I) { auto Pers = classifyEHPersonality(FuncInfo.Fn->getPersonalityFn()); bool IsMSVCCXX = Pers == EHPersonality::MSVC_CXX; bool IsSEH = isAsynchronousEHPersonality(Pers); + bool IsCoreCLR = Pers == EHPersonality::CoreCLR; MachineBasicBlock *CatchPadMBB = FuncInfo.MBB; - // In MSVC C++, catchblocks are funclets and need prologues. - if (IsMSVCCXX) + // In MSVC C++ and CoreCLR, catchblocks are funclets and need prologues. + if (IsMSVCCXX || IsCoreCLR) CatchPadMBB->setIsEHFuncletEntry(); MachineBasicBlock *NormalDestMBB = FuncInfo.MBBMap[I.getNormalDest()]; diff --git a/llvm/lib/CodeGen/WinEHPrepare.cpp b/llvm/lib/CodeGen/WinEHPrepare.cpp index 86b511cfb67..3f930c892e2 100644 --- a/llvm/lib/CodeGen/WinEHPrepare.cpp +++ b/llvm/lib/CodeGen/WinEHPrepare.cpp @@ -2928,11 +2928,11 @@ void llvm::calculateClrEHStateNumbers(const Function *Fn, // Preds of the endpad should get the parent state. PredState = ParentState; } else if (const CatchPadInst *Catch = dyn_cast<CatchPadInst>(Pad)) { - const BasicBlock *Handler = Catch->getNormalDest(); + const BasicBlock *PadBlock = Catch->getParent(); uint32_t TypeToken = static_cast<uint32_t>( cast<ConstantInt>(Catch->getArgOperand(0))->getZExtValue()); int NewState = addClrEHHandler(FuncInfo, ParentState, - ClrHandlerType::Catch, TypeToken, Handler); + ClrHandlerType::Catch, TypeToken, PadBlock); FuncInfo.EHPadStateMap[Catch] = NewState; // Preds of the catch get its state PredState = NewState; |

