diff options
author | Bill Wendling <isanbard@gmail.com> | 2011-07-28 23:42:57 +0000 |
---|---|---|
committer | Bill Wendling <isanbard@gmail.com> | 2011-07-28 23:42:57 +0000 |
commit | e963a3814f3f8fde394da263340bc0888011291c (patch) | |
tree | 265b24788441cc2f5ff3429a33d3b48713b582d5 /lib/CodeGen/SelectionDAG/FunctionLoweringInfo.cpp | |
parent | 3d8b15ea709ec7fc84e6de191d4eb9858b0b4edf (diff) |
Add the AddLandingPadInfo function.
AddLandingPadInfo takes a landingpad instruction and grabs all of the
information from it that it needs for EH table generation.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@136429 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/SelectionDAG/FunctionLoweringInfo.cpp')
-rw-r--r-- | lib/CodeGen/SelectionDAG/FunctionLoweringInfo.cpp | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/lib/CodeGen/SelectionDAG/FunctionLoweringInfo.cpp b/lib/CodeGen/SelectionDAG/FunctionLoweringInfo.cpp index d5bf12055e..1f41f043db 100644 --- a/lib/CodeGen/SelectionDAG/FunctionLoweringInfo.cpp +++ b/lib/CodeGen/SelectionDAG/FunctionLoweringInfo.cpp @@ -454,3 +454,37 @@ void llvm::CopyCatchInfo(const BasicBlock *SuccBB, const BasicBlock *LPad, break; } } + +//--------- NEW EH - Begin --------- + +/// AddLandingPadInfo - Extract the exception handling information from the +/// landingpad instruction and add them to the specified machine module info. +void llvm::AddLandingPadInfo(const LandingPadInst &I, MachineModuleInfo &MMI, + MachineBasicBlock *MBB) { + MMI.addPersonality(MBB, I.getPersonalityFn()); + + if (I.isCleanup()) + MMI.addCleanup(MBB); + + for (unsigned i = 0, e = I.getNumClauses(); i != e; ) { + switch (I.getClauseType(i)) { + case LandingPadInst::Catch: + MMI.addCatchTypeInfo(MBB, dyn_cast<GlobalVariable>(I.getClauseValue(i))); + ++i; + break; + case LandingPadInst::Filter: { + // Add filters in a list. + SmallVector<const GlobalVariable*, 4> FilterList; + do { + FilterList.push_back(cast<GlobalVariable>(I.getClauseValue(i))); + ++i; + } while (i != e && I.getClauseType(i) == LandingPadInst::Filter); + + MMI.addFilterTypeInfo(MBB, FilterList); + break; + } + } + } +} + +//--------- NEW EH - End --------- |