[llvm-branch-commits] [llvm-branch] r83036 - in /llvm/branches/eh-experiment: include/llvm/Intrinsics.td lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp

Eric Christopher echristo at apple.com
Mon Sep 28 18:06:37 PDT 2009


Author: echristo
Date: Mon Sep 28 20:06:36 2009
New Revision: 83036

URL: http://llvm.org/viewvc/llvm-project?rev=83036&view=rev
Log:
Rework catch information for eh.personality. 

Modified:
    llvm/branches/eh-experiment/include/llvm/Intrinsics.td
    llvm/branches/eh-experiment/lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp

Modified: llvm/branches/eh-experiment/include/llvm/Intrinsics.td
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/eh-experiment/include/llvm/Intrinsics.td?rev=83036&r1=83035&r2=83036&view=diff

==============================================================================
--- llvm/branches/eh-experiment/include/llvm/Intrinsics.td (original)
+++ llvm/branches/eh-experiment/include/llvm/Intrinsics.td Mon Sep 28 20:06:36 2009
@@ -300,8 +300,11 @@
 // recover this data. However, that falls apart very quickly. This way is robust
 // for all transformations.
 
-def int_eh_personality_i32 : Intrinsic<[llvm_i32_ty], [llvm_ptr_ty]>;
-def int_eh_personality_i64 : Intrinsic<[llvm_i64_ty], [llvm_ptr_ty]>;
+// Args: Exception, Personality Routine, Catch-All Type
+def int_eh_personality_i32 : Intrinsic<[llvm_i32_ty],
+				       [llvm_ptr_ty, llvm_ptr_ty, llvm_ptr_ty]>;
+def int_eh_personality_i64 : Intrinsic<[llvm_i64_ty],
+				       [llvm_ptr_ty, llvm_ptr_ty, llvm_ptr_ty]>;
 
 def int_eh_exception    : Intrinsic<[llvm_ptr_ty]>;
 

Modified: llvm/branches/eh-experiment/lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/eh-experiment/lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp?rev=83036&r1=83035&r2=83036&view=diff

==============================================================================
--- llvm/branches/eh-experiment/lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp (original)
+++ llvm/branches/eh-experiment/lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp Mon Sep 28 20:06:36 2009
@@ -2976,48 +2976,13 @@
          "Personality should be a function");
   MMI->addPersonality(MBB, cast<Function>(CE->getOperand(0)));
 
-  // Gather all the type infos for this landing pad and pass them along to
-  // MachineModuleInfo.
-  std::vector<GlobalVariable *> TyInfo;
-  unsigned N = I.getNumOperands();
-
-  for (unsigned i = N - 1; i > 2; --i) {
-    if (ConstantInt *CI = dyn_cast<ConstantInt>(I.getOperand(i))) {
-      unsigned FilterLength = CI->getZExtValue();
-      unsigned FirstCatch = i + FilterLength + !FilterLength;
-      assert (FirstCatch <= N && "Invalid filter length");
-
-      if (FirstCatch < N) {
-        TyInfo.reserve(N - FirstCatch);
-        for (unsigned j = FirstCatch; j < N; ++j)
-          TyInfo.push_back(ExtractTypeInfo(I.getOperand(j)));
-        MMI->addCatchTypeInfo(MBB, TyInfo);
-        TyInfo.clear();
-      }
-
-      if (!FilterLength) {
-        // Cleanup.
-        MMI->addCleanup(MBB);
-      } else {
-        // Filter.
-        TyInfo.reserve(FilterLength - 1);
-        for (unsigned j = i + 1; j < FirstCatch; ++j)
-          TyInfo.push_back(ExtractTypeInfo(I.getOperand(j)));
-        MMI->addFilterTypeInfo(MBB, TyInfo);
-        TyInfo.clear();
-      }
 
-      N = i;
-    }
-  }
+  // TODO: Do we need to do anything about cleanups here?
+  std::vector<GlobalVariable *> TyInfo;
+  TyInfo.push_back(ExtractTypeInfo(I.getOperand(3)));
 
-  if (N > 3) {
-    TyInfo.reserve(N - 3);
-    for (unsigned j = 3; j < N; ++j)
-      TyInfo.push_back(ExtractTypeInfo(I.getOperand(j)));
     MMI->addCatchTypeInfo(MBB, TyInfo);
   }
-}
 
 }
 
@@ -4035,6 +4000,10 @@
 
   case Intrinsic::eh_personality_i32:
   case Intrinsic::eh_personality_i64: {
+    MachineModuleInfo *MMI = DAG.getMachineModuleInfo();
+
+    AddCatchInfo(I, MMI, CurMBB);
+
     // FIXME: Mark exception selector register as live in.  Hack for PR1508.
     unsigned Reg = TLI.getExceptionSelectorRegister();
     if (Reg) CurMBB->addLiveIn(Reg);





More information about the llvm-branch-commits mailing list