[llvm-branch-commits] [llvm-branch] r100561 - in /llvm/branches/ggreif/CallInst-operands/lib/CodeGen: SelectionDAG/FunctionLoweringInfo.cpp ShadowStackGC.cpp SjLjEHPrepare.cpp

Gabor Greif ggreif at gmail.com
Tue Apr 6 14:33:43 PDT 2010


Author: ggreif
Date: Tue Apr  6 16:33:43 2010
New Revision: 100561

URL: http://llvm.org/viewvc/llvm-project?rev=100561&view=rev
Log:
shift operands for various EH-related intrinsics

Modified:
    llvm/branches/ggreif/CallInst-operands/lib/CodeGen/SelectionDAG/FunctionLoweringInfo.cpp
    llvm/branches/ggreif/CallInst-operands/lib/CodeGen/ShadowStackGC.cpp
    llvm/branches/ggreif/CallInst-operands/lib/CodeGen/SjLjEHPrepare.cpp

Modified: llvm/branches/ggreif/CallInst-operands/lib/CodeGen/SelectionDAG/FunctionLoweringInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/ggreif/CallInst-operands/lib/CodeGen/SelectionDAG/FunctionLoweringInfo.cpp?rev=100561&r1=100560&r2=100561&view=diff
==============================================================================
--- llvm/branches/ggreif/CallInst-operands/lib/CodeGen/SelectionDAG/FunctionLoweringInfo.cpp (original)
+++ llvm/branches/ggreif/CallInst-operands/lib/CodeGen/SelectionDAG/FunctionLoweringInfo.cpp Tue Apr  6 16:33:43 2010
@@ -31,7 +31,6 @@
 #include "llvm/Target/TargetData.h"
 #include "llvm/Target/TargetFrameInfo.h"
 #include "llvm/Target/TargetInstrInfo.h"
-#include "llvm/Target/TargetIntrinsicInfo.h"
 #include "llvm/Target/TargetLowering.h"
 #include "llvm/Target/TargetOptions.h"
 #include "llvm/Support/Compiler.h"
@@ -309,9 +308,9 @@
   // Gather all the type infos for this landing pad and pass them along to
   // MachineModuleInfo.
   std::vector<GlobalVariable *> TyInfo;
-  unsigned N = I.getNumOperands();
+  unsigned N = I.getNumOperands() - 1;
 
-  for (unsigned i = N - 2; i > 1; --i) {
+  for (unsigned i = N - 1; i > 1; --i) {
     if (ConstantInt *CI = dyn_cast<ConstantInt>(I.getOperand(i))) {
       unsigned FilterLength = CI->getZExtValue();
       unsigned FirstCatch = i + FilterLength + !FilterLength;
@@ -341,8 +340,8 @@
     }
   }
 
-  if (N > 3) {
-    TyInfo.reserve(N - 3);
+  if (N > 2) {
+    TyInfo.reserve(N - 2);
     for (unsigned j = 2; j < N - 1; ++j)
       TyInfo.push_back(ExtractTypeInfo(I.getOperand(j)));
     MMI->addCatchTypeInfo(MBB, TyInfo);

Modified: llvm/branches/ggreif/CallInst-operands/lib/CodeGen/ShadowStackGC.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/ggreif/CallInst-operands/lib/CodeGen/ShadowStackGC.cpp?rev=100561&r1=100560&r2=100561&view=diff
==============================================================================
--- llvm/branches/ggreif/CallInst-operands/lib/CodeGen/ShadowStackGC.cpp (original)
+++ llvm/branches/ggreif/CallInst-operands/lib/CodeGen/ShadowStackGC.cpp Tue Apr  6 16:33:43 2010
@@ -158,9 +158,9 @@
 
           // Create a new invoke instruction.
           Args.clear();
-          Args.append(CI->op_begin() + 1, CI->op_end());
+          Args.append(CI->op_begin(), CI->op_end() - 1);
 
-          InvokeInst *II = InvokeInst::Create(CI->getOperand(0),
+          InvokeInst *II = InvokeInst::Create(CI->getCalledValue(),
                                               NewBB, CleanupBB,
                                               Args.begin(), Args.end(),
                                               CI->getName(), CallBB);
@@ -194,7 +194,7 @@
   unsigned NumMeta = 0;
   SmallVector<Constant*,16> Metadata;
   for (unsigned I = 0; I != Roots.size(); ++I) {
-    Constant *C = cast<Constant>(Roots[I].first->getOperand(2));
+    Constant *C = cast<Constant>(Roots[I].first->getOperand(1));
     if (!C->isNullValue())
       NumMeta = I + 1;
     Metadata.push_back(ConstantExpr::getBitCast(C, VoidPtr));
@@ -322,16 +322,16 @@
 
   assert(Roots.empty() && "Not cleaned up?");
 
-  SmallVector<std::pair<CallInst*,AllocaInst*>,16> MetaRoots;
+  SmallVector<std::pair<CallInst*, AllocaInst*>,16> MetaRoots;
 
   for (Function::iterator BB = F.begin(), E = F.end(); BB != E; ++BB)
     for (BasicBlock::iterator II = BB->begin(), E = BB->end(); II != E;)
       if (IntrinsicInst *CI = dyn_cast<IntrinsicInst>(II++))
         if (Function *F = CI->getCalledFunction())
           if (F->getIntrinsicID() == Intrinsic::gcroot) {
-            std::pair<CallInst*,AllocaInst*> Pair = std::make_pair(
-              CI, cast<AllocaInst>(CI->getOperand(1)->stripPointerCasts()));
-            if (IsNullValue(CI->getOperand(2)))
+            std::pair<CallInst*, AllocaInst*> Pair = std::make_pair(
+              CI, cast<AllocaInst>(CI->getOperand(0)->stripPointerCasts()));
+            if (IsNullValue(CI->getOperand(1)))
               Roots.push_back(Pair);
             else
               MetaRoots.push_back(Pair);

Modified: llvm/branches/ggreif/CallInst-operands/lib/CodeGen/SjLjEHPrepare.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/ggreif/CallInst-operands/lib/CodeGen/SjLjEHPrepare.cpp?rev=100561&r1=100560&r2=100561&view=diff
==============================================================================
--- llvm/branches/ggreif/CallInst-operands/lib/CodeGen/SjLjEHPrepare.cpp (original)
+++ llvm/branches/ggreif/CallInst-operands/lib/CodeGen/SjLjEHPrepare.cpp Tue Apr  6 16:33:43 2010
@@ -305,7 +305,7 @@
     for (BasicBlock::iterator I = BB->begin(), E = BB->end(); I != E; ++I) {
       if (CallInst *CI = dyn_cast<CallInst>(I)) {
         if (CI->getCalledFunction() == SelectorFn) {
-          if (!PersonalityFn) PersonalityFn = CI->getOperand(2);
+          if (!PersonalityFn) PersonalityFn = CI->getOperand(1);
           EH_Selectors.push_back(CI);
         } else if (CI->getCalledFunction() == ExceptionFn) {
           EH_Exceptions.push_back(CI);





More information about the llvm-branch-commits mailing list