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 | 7fa7fe6b58349c6ae53ccb45a3d7cd7c618b905f (patch) | |
tree | 2a115c07cfeab7f4a6d22b015092df41d059608b | |
parent | eec01ccbf9132a5c317dbfb7e297482b13fe8eed (diff) | |
download | bcm5719-llvm-7fa7fe6b58349c6ae53ccb45a3d7cd7c618b905f.tar.gz bcm5719-llvm-7fa7fe6b58349c6ae53ccb45a3d7cd7c618b905f.zip |
Add the AddLandingPadInfo function.
AddLandingPadInfo takes a landingpad instruction and grabs all of the
information from it that it needs for EH table generation.
llvm-svn: 136429
-rw-r--r-- | llvm/include/llvm/CodeGen/FunctionLoweringInfo.h | 5 | ||||
-rw-r--r-- | llvm/lib/CodeGen/SelectionDAG/FunctionLoweringInfo.cpp | 34 |
2 files changed, 39 insertions, 0 deletions
diff --git a/llvm/include/llvm/CodeGen/FunctionLoweringInfo.h b/llvm/include/llvm/CodeGen/FunctionLoweringInfo.h index 7eb21b5c669..280481b25a3 100644 --- a/llvm/include/llvm/CodeGen/FunctionLoweringInfo.h +++ b/llvm/include/llvm/CodeGen/FunctionLoweringInfo.h @@ -220,6 +220,11 @@ void AddCatchInfo(const CallInst &I, void CopyCatchInfo(const BasicBlock *SuccBB, const BasicBlock *LPad, MachineModuleInfo *MMI, FunctionLoweringInfo &FLI); +/// AddLandingPadInfo - Extract the exception handling information from the +/// landingpad instruction and add them to the specified machine module info. +void AddLandingPadInfo(const LandingPadInst &I, MachineModuleInfo &MMI, + MachineBasicBlock *MBB); + } // end namespace llvm #endif diff --git a/llvm/lib/CodeGen/SelectionDAG/FunctionLoweringInfo.cpp b/llvm/lib/CodeGen/SelectionDAG/FunctionLoweringInfo.cpp index d5bf12055e0..1f41f043dba 100644 --- a/llvm/lib/CodeGen/SelectionDAG/FunctionLoweringInfo.cpp +++ b/llvm/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 --------- |