summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen/SelectionDAG/FunctionLoweringInfo.cpp
diff options
context:
space:
mode:
authorReid Kleckner <rnk@google.com>2015-08-27 23:27:47 +0000
committerReid Kleckner <rnk@google.com>2015-08-27 23:27:47 +0000
commit0e2882345daead6cd9368eda4107e860d9141e35 (patch)
treebe2bbccebdc6d0f2648fe9612ff4338b1f8b4f2f /llvm/lib/CodeGen/SelectionDAG/FunctionLoweringInfo.cpp
parent67bc8d6b3f69f83e6f2688d960b8a273cee57a20 (diff)
downloadbcm5719-llvm-0e2882345daead6cd9368eda4107e860d9141e35.tar.gz
bcm5719-llvm-0e2882345daead6cd9368eda4107e860d9141e35.zip
[WinEH] Add some support for code generating catchpad
We can now run 32-bit programs with empty catch bodies. The next step is to change PEI so that we get funclet prologues and epilogues. llvm-svn: 246235
Diffstat (limited to 'llvm/lib/CodeGen/SelectionDAG/FunctionLoweringInfo.cpp')
-rw-r--r--llvm/lib/CodeGen/SelectionDAG/FunctionLoweringInfo.cpp20
1 files changed, 13 insertions, 7 deletions
diff --git a/llvm/lib/CodeGen/SelectionDAG/FunctionLoweringInfo.cpp b/llvm/lib/CodeGen/SelectionDAG/FunctionLoweringInfo.cpp
index ec3dab55464..c0d14c1780d 100644
--- a/llvm/lib/CodeGen/SelectionDAG/FunctionLoweringInfo.cpp
+++ b/llvm/lib/CodeGen/SelectionDAG/FunctionLoweringInfo.cpp
@@ -252,16 +252,17 @@ void FunctionLoweringInfo::set(const Function &fn, MachineFunction &mf,
// Mark landing pad blocks.
SmallVector<const LandingPadInst *, 4> LPads;
for (BB = Fn->begin(); BB != EB; ++BB) {
- if (const auto *Invoke = dyn_cast<InvokeInst>(BB->getTerminator()))
- MBBMap[Invoke->getSuccessor(1)]->setIsLandingPad();
- if (BB->isLandingPad())
- LPads.push_back(BB->getLandingPadInst());
+ if (BB->isEHPad())
+ MBBMap[BB]->setIsEHPad();
+ const Instruction *FNP = BB->getFirstNonPHI();
+ if (const auto *LPI = dyn_cast<LandingPadInst>(FNP))
+ LPads.push_back(LPI);
}
// If this is an MSVC EH personality, we need to do a bit more work.
- EHPersonality Personality = EHPersonality::Unknown;
- if (Fn->hasPersonalityFn())
- Personality = classifyEHPersonality(Fn->getPersonalityFn());
+ if (!Fn->hasPersonalityFn())
+ return;
+ EHPersonality Personality = classifyEHPersonality(Fn->getPersonalityFn());
if (!isMSVCEHPersonality(Personality))
return;
@@ -272,8 +273,13 @@ void FunctionLoweringInfo::set(const Function &fn, MachineFunction &mf,
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);
+ for (WinEHTryBlockMapEntry &TBME : EHInfo.TryBlockMap)
+ for (WinEHHandlerType &H : TBME.HandlerArray)
+ if (const auto *BB = dyn_cast<BasicBlock>(H.Handler))
+ H.HandlerMBB = MBBMap[BB];
}
// Copy the state numbers to LandingPadInfo for the current function, which
OpenPOWER on IntegriCloud