[llvm-commits] [llvm] r136429 - in /llvm/trunk: include/llvm/CodeGen/FunctionLoweringInfo.h lib/CodeGen/SelectionDAG/FunctionLoweringInfo.cpp

Bill Wendling isanbard at gmail.com
Thu Jul 28 16:42:57 PDT 2011


Author: void
Date: Thu Jul 28 18:42:57 2011
New Revision: 136429

URL: http://llvm.org/viewvc/llvm-project?rev=136429&view=rev
Log:
Add the AddLandingPadInfo function.

AddLandingPadInfo takes a landingpad instruction and grabs all of the
information from it that it needs for EH table generation.

Modified:
    llvm/trunk/include/llvm/CodeGen/FunctionLoweringInfo.h
    llvm/trunk/lib/CodeGen/SelectionDAG/FunctionLoweringInfo.cpp

Modified: llvm/trunk/include/llvm/CodeGen/FunctionLoweringInfo.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/FunctionLoweringInfo.h?rev=136429&r1=136428&r2=136429&view=diff
==============================================================================
--- llvm/trunk/include/llvm/CodeGen/FunctionLoweringInfo.h (original)
+++ llvm/trunk/include/llvm/CodeGen/FunctionLoweringInfo.h Thu Jul 28 18:42:57 2011
@@ -220,6 +220,11 @@
 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

Modified: llvm/trunk/lib/CodeGen/SelectionDAG/FunctionLoweringInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/FunctionLoweringInfo.cpp?rev=136429&r1=136428&r2=136429&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/SelectionDAG/FunctionLoweringInfo.cpp (original)
+++ llvm/trunk/lib/CodeGen/SelectionDAG/FunctionLoweringInfo.cpp Thu Jul 28 18:42:57 2011
@@ -454,3 +454,37 @@
       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   ---------





More information about the llvm-commits mailing list