[llvm-branch-commits] [llvm-branch] r107654 - in /llvm/branches/wendling/eh: include/llvm/Instructions.h lib/VMCore/Instructions.cpp

Bill Wendling isanbard at gmail.com
Tue Jul 6 05:21:48 PDT 2010


Author: void
Date: Tue Jul  6 07:21:48 2010
New Revision: 107654

URL: http://llvm.org/viewvc/llvm-project?rev=107654&view=rev
Log:
The catch-all stuff needs to record that it's using the type and dest BB.

Modified:
    llvm/branches/wendling/eh/include/llvm/Instructions.h
    llvm/branches/wendling/eh/lib/VMCore/Instructions.cpp

Modified: llvm/branches/wendling/eh/include/llvm/Instructions.h
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/wendling/eh/include/llvm/Instructions.h?rev=107654&r1=107653&r2=107654&view=diff
==============================================================================
--- llvm/branches/wendling/eh/include/llvm/Instructions.h (original)
+++ llvm/branches/wendling/eh/include/llvm/Instructions.h Tue Jul  6 07:21:48 2010
@@ -2378,12 +2378,10 @@
 class InvokeInst : public TerminatorInst {
   /// CatchList - This is a pointer to the array of catches.
   Use *CatchList;
+  Use *CatchAllList;
   unsigned ReservedSpace;
   unsigned NumCatches;
 
-  Value *CatchAllType;
-  BasicBlock *CatchAllDest;
-
   AttrListPtr AttributeList;
   InvokeInst(const InvokeInst &BI);
   void init(Value *Fn, BasicBlock *IfNormal, BasicBlock *IfException,
@@ -2592,17 +2590,12 @@
   void setPersonalityFn(Value *V) {
     Op<-1>() = V;
   }
+
   Value *getCatchAllType() const {
-    return CatchAllType;
-  }
-  void setCatchAllType(Value *V) {
-    CatchAllType = V;
+    return CatchAllList[0];
   }
   BasicBlock *getCatchAllDest() const {
-    return CatchAllDest;
-  }
-  void setCatchAllDest(BasicBlock *B) {
-    CatchAllDest = B;
+    return cast<BasicBlock>(CatchAllList[1]);
   }
 
   /// getNumCatches - Return the number of catch blocks for this invoke
@@ -2644,10 +2637,10 @@
     if (i == 1)
       return getUnwindDest();
 
-    if (CatchAllDest != 0 && i == 2)
+    if (CatchAllList != 0 && i == 2)
       return getCatchAllDest();
 
-    return getCatchDest(i - (CatchAllDest != 0 ? 3 : 2));
+    return getCatchDest(i - (CatchAllList != 0 ? 3 : 2));
   }
 
   void setSuccessor(unsigned idx, BasicBlock *NewSucc) {
@@ -2656,7 +2649,7 @@
   }
 
   unsigned getNumSuccessors() const {
-    return (CatchAllDest != 0 ? 3 : 2) + getNumCatches();
+    return (CatchAllList != 0 ? 3 : 2) + getNumCatches();
   }
 
   // Methods for support type inquiry through isa, cast, and dyn_cast:

Modified: llvm/branches/wendling/eh/lib/VMCore/Instructions.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/wendling/eh/lib/VMCore/Instructions.cpp?rev=107654&r1=107653&r2=107654&view=diff
==============================================================================
--- llvm/branches/wendling/eh/lib/VMCore/Instructions.cpp (original)
+++ llvm/branches/wendling/eh/lib/VMCore/Instructions.cpp Tue Jul  6 07:21:48 2010
@@ -559,14 +559,19 @@
           (FTy->isVarArg() && NumArgs > FTy->getNumParams())) &&
          "Invoking a function with bad signature");
 
-  CatchAllType = CatchAllTy;
-  CatchAllDest = CatchAll;
-
   // Allocate space for the catches.
   ReservedSpace = NumCatches * 2;
   this->NumCatches = 0;
   CatchList = allocHungoffUses(ReservedSpace);
 
+  if (CatchAllTy && CatchAll) {
+    CatchAllList = allocHungoffUses(2);
+    CatchAllList[0] = CatchAllTy;
+    CatchAllList[1] = CatchAll;
+  } else {
+    CatchAllList = 0;
+  }
+
   Use *OL = OperandList;
   for (unsigned i = 0, e = NumArgs; i != e; i++) {
     assert((i >= FTy->getNumParams() || 
@@ -592,6 +597,7 @@
 
 InvokeInst::~InvokeInst() {
   dropHungoffUses(CatchList);
+  if (CatchAllList) dropHungoffUses(CatchAllList);
 }
 
 BasicBlock *InvokeInst::getSuccessorV(unsigned idx) const {





More information about the llvm-branch-commits mailing list