diff options
author | Joseph Tremoulet <jotrem@microsoft.com> | 2015-10-06 20:28:16 +0000 |
---|---|---|
committer | Joseph Tremoulet <jotrem@microsoft.com> | 2015-10-06 20:28:16 +0000 |
commit | 2afea5438f924af932cf62e39daa4a06e298fb37 (patch) | |
tree | 6ddf7b58761a8eb26d3e00a4856588b75bc9e936 /llvm/lib/CodeGen/SelectionDAG | |
parent | a087fd21daaa43a04c9721976bf8f57a92a4f492 (diff) | |
download | bcm5719-llvm-2afea5438f924af932cf62e39daa4a06e298fb37.tar.gz bcm5719-llvm-2afea5438f924af932cf62e39daa4a06e298fb37.zip |
[WinEH] Recognize CoreCLR personality function
Summary:
- Add CoreCLR to if/else ladders and switches as appropriate.
- Rename isMSVCEHPersonality to isFuncletEHPersonality to better
reflect what it captures.
Reviewers: majnemer, andrew.w.kaylor, rnk
Subscribers: pgavlin, AndyAyers, llvm-commits
Differential Revision: http://reviews.llvm.org/D13449
llvm-svn: 249455
Diffstat (limited to 'llvm/lib/CodeGen/SelectionDAG')
-rw-r--r-- | llvm/lib/CodeGen/SelectionDAG/FunctionLoweringInfo.cpp | 4 | ||||
-rw-r--r-- | llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp | 10 | ||||
-rw-r--r-- | llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp | 4 |
3 files changed, 10 insertions, 8 deletions
diff --git a/llvm/lib/CodeGen/SelectionDAG/FunctionLoweringInfo.cpp b/llvm/lib/CodeGen/SelectionDAG/FunctionLoweringInfo.cpp index 7da68deaaa3..fb455943f90 100644 --- a/llvm/lib/CodeGen/SelectionDAG/FunctionLoweringInfo.cpp +++ b/llvm/lib/CodeGen/SelectionDAG/FunctionLoweringInfo.cpp @@ -273,11 +273,11 @@ void FunctionLoweringInfo::set(const Function &fn, MachineFunction &mf, LPads.push_back(LPI); } - // If this is an MSVC EH personality, we need to do a bit more work. + // If this personality uses funclets, we need to do a bit more work. if (!Fn->hasPersonalityFn()) return; EHPersonality Personality = classifyEHPersonality(Fn->getPersonalityFn()); - if (!isMSVCEHPersonality(Personality)) + if (!isFuncletEHPersonality(Personality)) return; if (Personality == EHPersonality::MSVC_Win64SEH || diff --git a/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp b/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp index d498c547bfd..fc140f65571 100644 --- a/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp +++ b/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp @@ -1207,8 +1207,10 @@ static void findUnwindDestinations(FunctionLoweringInfo &FuncInfo, const BasicBlock *EHPadBB, SmallVectorImpl<MachineBasicBlock *> &UnwindDests) { - bool IsMSVCCXX = classifyEHPersonality(FuncInfo.Fn->getPersonalityFn()) == - EHPersonality::MSVC_CXX; + EHPersonality Personality = + classifyEHPersonality(FuncInfo.Fn->getPersonalityFn()); + bool IsMSVCCXX = Personality == EHPersonality::MSVC_CXX; + bool IsCoreCLR = Personality == EHPersonality::CoreCLR; while (EHPadBB) { const Instruction *Pad = EHPadBB->getFirstNonPHI(); if (isa<LandingPadInst>(Pad)) { @@ -1224,8 +1226,8 @@ findUnwindDestinations(FunctionLoweringInfo &FuncInfo, } 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) + // In MSVC C++ and CoreCLR, catchblocks are funclets and need prologues. + if (IsMSVCCXX || IsCoreCLR) UnwindDests.back()->setIsEHFuncletEntry(); EHPadBB = CPI->getUnwindDest(); } else if (const auto *CEPI = dyn_cast<CatchEndPadInst>(Pad)) { diff --git a/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp b/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp index c449ea8ba91..c20270d9a7e 100644 --- a/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp +++ b/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp @@ -941,7 +941,7 @@ bool SelectionDAGISel::PrepareEHLandingPad() { BuildMI(*MBB, FuncInfo->InsertPt, SDB->getCurDebugLoc(), II) .addSym(Label); - // If this is an MSVC-style personality function, we need to split the landing + // If this personality function uses funclets, we need to split the landing // pad into several BBs. const BasicBlock *LLVMBB = MBB->getBasicBlock(); const Constant *Personality = MF->getFunction()->getPersonalityFn(); @@ -949,7 +949,7 @@ bool SelectionDAGISel::PrepareEHLandingPad() { MF->getMMI().addPersonality(PF); EHPersonality PersonalityType = classifyEHPersonality(Personality); - if (isMSVCEHPersonality(PersonalityType)) { + if (isFuncletEHPersonality(PersonalityType)) { SmallVector<MachineBasicBlock *, 4> ClauseBBs; const IntrinsicInst *ActionsCall = dyn_cast<IntrinsicInst>(LLVMBB->getFirstInsertionPt()); |