[llvm-branch-commits] [llvm-branch] r105258 - in /llvm/branches/wendling/eh: include/llvm-c/ include/llvm/ include/llvm/Support/ lib/AsmParser/ lib/Bitcode/Reader/ lib/CodeGen/ lib/Transforms/IPO/ lib/Transforms/InstCombine/ lib/Transforms/Utils/ lib/VMCore/

Bill Wendling isanbard at gmail.com
Mon May 31 15:39:19 PDT 2010


Author: void
Date: Mon May 31 17:39:18 2010
New Revision: 105258

URL: http://llvm.org/viewvc/llvm-project?rev=105258&view=rev
Log:
Add more infrastructure. This time to support adding the "catches" clause of the
new invoke.

Modified:
    llvm/branches/wendling/eh/include/llvm-c/Core.h
    llvm/branches/wendling/eh/include/llvm/Instructions.h
    llvm/branches/wendling/eh/include/llvm/Support/IRBuilder.h
    llvm/branches/wendling/eh/lib/AsmParser/LLParser.cpp
    llvm/branches/wendling/eh/lib/Bitcode/Reader/BitcodeReader.cpp
    llvm/branches/wendling/eh/lib/CodeGen/ShadowStackGC.cpp
    llvm/branches/wendling/eh/lib/Transforms/IPO/ArgumentPromotion.cpp
    llvm/branches/wendling/eh/lib/Transforms/IPO/DeadArgumentElimination.cpp
    llvm/branches/wendling/eh/lib/Transforms/IPO/LowerSetJmp.cpp
    llvm/branches/wendling/eh/lib/Transforms/IPO/PartialSpecialization.cpp
    llvm/branches/wendling/eh/lib/Transforms/IPO/StructRetPromotion.cpp
    llvm/branches/wendling/eh/lib/Transforms/InstCombine/InstCombineCalls.cpp
    llvm/branches/wendling/eh/lib/Transforms/Utils/InlineFunction.cpp
    llvm/branches/wendling/eh/lib/VMCore/Core.cpp
    llvm/branches/wendling/eh/lib/VMCore/Instructions.cpp

Modified: llvm/branches/wendling/eh/include/llvm-c/Core.h
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/wendling/eh/include/llvm-c/Core.h?rev=105258&r1=105257&r2=105258&view=diff
==============================================================================
--- llvm/branches/wendling/eh/include/llvm-c/Core.h (original)
+++ llvm/branches/wendling/eh/include/llvm-c/Core.h Mon May 31 17:39:18 2010
@@ -812,9 +812,11 @@
                              LLVMBasicBlockRef Else, unsigned NumCases);
 LLVMValueRef LLVMBuildIndirectBr(LLVMBuilderRef B, LLVMValueRef Addr,
                                  unsigned NumDests);
-LLVMValueRef LLVMBuildInvoke(LLVMBuilderRef, LLVMValueRef Fn,
+LLVMValueRef LLVMBuildInvoke(LLVMBuilderRef B, LLVMValueRef Fn,
                              LLVMValueRef *Args, unsigned NumArgs,
                              LLVMBasicBlockRef Then, LLVMBasicBlockRef Catch,
+                             LLVMValueRef PersFn, LLVMValueRef CatchAllTy,
+                             LLVMBasicBlockRef CatchAll, unsigned NumCatches,
                              const char *Name);
 LLVMValueRef LLVMBuildUnwind(LLVMBuilderRef);
 LLVMValueRef LLVMBuildUnreachable(LLVMBuilderRef);

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=105258&r1=105257&r2=105258&view=diff
==============================================================================
--- llvm/branches/wendling/eh/include/llvm/Instructions.h (original)
+++ llvm/branches/wendling/eh/include/llvm/Instructions.h Mon May 31 17:39:18 2010
@@ -2361,16 +2361,20 @@
 /// calling convention of the call.
 ///
 class InvokeInst : public TerminatorInst {
+  /// CatchList - This is a pointer to the array of catches.
+  Use *CatchList;
+  unsigned NumCatches;
+
   AttrListPtr AttributeList;
   InvokeInst(const InvokeInst &BI);
   void init(Value *Fn, BasicBlock *IfNormal, BasicBlock *IfException,
             Value *PersFn, Value *CatchAllTy, BasicBlock *CatchAll,
-            Value* const *Args, unsigned NumArgs);
+            unsigned NumCatches, Value * const *Args, unsigned NumArgs);
 
   template<typename InputIterator>
   void init(Value *Func, BasicBlock *IfNormal, BasicBlock *IfException,
             Value *PersFn, Value *CatchAllTy, BasicBlock *CatchAll,
-            InputIterator ArgBegin, InputIterator ArgEnd,
+            unsigned NumCatches, InputIterator ArgBegin, InputIterator ArgEnd,
             const Twine &NameStr,
             // This argument ensures that we have an iterator we can
             // do arithmetic on in constant time
@@ -2379,7 +2383,7 @@
 
     // This requires that the iterator points to contiguous memory.
     init(Func, IfNormal, IfException, PersFn, CatchAllTy, CatchAll,
-         NumArgs ? &*ArgBegin : 0, NumArgs);
+         NumCatches, NumArgs ? &*ArgBegin : 0, NumArgs);
     setName(NameStr);
   }
 
@@ -2393,8 +2397,8 @@
   template<typename InputIterator>
   inline InvokeInst(Value *Func, BasicBlock *IfNormal, BasicBlock *IfException,
                     Value *PersFn, Value *CatchAllTy, BasicBlock *CatchAll,
-                    InputIterator ArgBegin, InputIterator ArgEnd,
-                    unsigned Values,
+                    unsigned NumCatches, InputIterator ArgBegin,
+                    InputIterator ArgEnd, unsigned Values,
                     const Twine &NameStr, Instruction *InsertBefore);
 
   /// Construct an InvokeInst given a range of arguments.
@@ -2407,23 +2411,24 @@
   template<typename InputIterator>
   inline InvokeInst(Value *Func, BasicBlock *IfNormal, BasicBlock *IfException,
                     Value *PersFn, Value *CatchAllTy, BasicBlock *CatchAll,
-                    InputIterator ArgBegin, InputIterator ArgEnd,
-                    unsigned Values,
-                    const Twine &NameStr, BasicBlock *InsertAtEnd);
+                    unsigned NumCatches, InputIterator ArgBegin,
+                    InputIterator ArgEnd, unsigned Values, const Twine &NameStr,
+                    BasicBlock *InsertAtEnd);
 protected:
   virtual InvokeInst *clone_impl() const;
 public:
+  ~InvokeInst();
   template<typename InputIterator>
   static InvokeInst *Create(Value *Func,
                             BasicBlock *IfNormal, BasicBlock *IfException,
                             Value *PersFn, Value *CatchAllTy,
-                            BasicBlock *CatchAll,
+                            BasicBlock *CatchAll, unsigned NumCatches,
                             InputIterator ArgBegin, InputIterator ArgEnd,
                             const Twine &NameStr = "",
                             Instruction *InsertBefore = 0) {
     unsigned Values(ArgEnd - ArgBegin + 6);
     return new(Values) InvokeInst(Func, IfNormal, IfException, PersFn,
-                                  CatchAllTy, CatchAll,
+                                  CatchAllTy, CatchAll, NumCatches,
                                   ArgBegin, ArgEnd,
                                   Values, NameStr, InsertBefore);
   }
@@ -2431,13 +2436,13 @@
   static InvokeInst *Create(Value *Func,
                             BasicBlock *IfNormal, BasicBlock *IfException,
                             Value *PersFn, Value *CatchAllTy,
-                            BasicBlock *CatchAll,
+                            BasicBlock *CatchAll, unsigned NumCatches,
                             InputIterator ArgBegin, InputIterator ArgEnd,
                             const Twine &NameStr,
                             BasicBlock *InsertAtEnd) {
     unsigned Values(ArgEnd - ArgBegin + 6);
     return new(Values) InvokeInst(Func, IfNormal, IfException, PersFn,
-                                  CatchAllTy, CatchAll,
+                                  CatchAllTy, CatchAll, NumCatches,
                                   ArgBegin, ArgEnd,
                                   Values, NameStr, InsertAtEnd);
   }
@@ -2581,6 +2586,13 @@
     Op<-1>() = reinterpret_cast<Value*>(B);
   }
 
+  unsigned getNumCatches() const {
+    return NumCatches;          // EH-FIXME: Correct value?
+  }
+
+  /// addCatch - Add a catch to the invoke instruction.
+  void addCatch(ConstantInt *, BasicBlock *) {} // EH-FIXME: Implement.
+
   // Successor accessors.
   BasicBlock *getSuccessor(unsigned i) const {
     assert(i < 2 && "Successor # out of range for invoke!");
@@ -2623,8 +2635,8 @@
 InvokeInst::InvokeInst(Value *Func,
                        BasicBlock *IfNormal, BasicBlock *IfException,
                        Value *PersFn, Value *CatchAllTy, BasicBlock *CatchAll,
-                       InputIterator ArgBegin, InputIterator ArgEnd,
-                       unsigned Values,
+                       unsigned NumCatches, InputIterator ArgBegin,
+                       InputIterator ArgEnd, unsigned Values,
                        const Twine &NameStr, Instruction *InsertBefore)
   : TerminatorInst(cast<FunctionType>(cast<PointerType>(Func->getType())
                                       ->getElementType())->getReturnType(),
@@ -2632,15 +2644,15 @@
                    OperandTraits<InvokeInst>::op_end(this) - Values,
                    Values, InsertBefore) {
   init(Func, IfNormal, IfException, PersFn, CatchAllTy, CatchAll,
-       ArgBegin, ArgEnd, NameStr,
+       NumCatches, ArgBegin, ArgEnd, NameStr,
        typename std::iterator_traits<InputIterator>::iterator_category());
 }
 template<typename InputIterator>
 InvokeInst::InvokeInst(Value *Func,
                        BasicBlock *IfNormal, BasicBlock *IfException,
                        Value *PersFn, Value *CatchAllTy, BasicBlock *CatchAll,
-                       InputIterator ArgBegin, InputIterator ArgEnd,
-                       unsigned Values,
+                       unsigned NumCatches, InputIterator ArgBegin,
+                       InputIterator ArgEnd, unsigned Values,
                        const Twine &NameStr, BasicBlock *InsertAtEnd)
   : TerminatorInst(cast<FunctionType>(cast<PointerType>(Func->getType())
                                       ->getElementType())->getReturnType(),
@@ -2648,7 +2660,7 @@
                    OperandTraits<InvokeInst>::op_end(this) - Values,
                    Values, InsertAtEnd) {
   init(Func, IfNormal, IfException, PersFn, CatchAllTy, CatchAll,
-       ArgBegin, ArgEnd, NameStr,
+       NumCatches, ArgBegin, ArgEnd, NameStr,
        typename std::iterator_traits<InputIterator>::iterator_category());
 }
 

Modified: llvm/branches/wendling/eh/include/llvm/Support/IRBuilder.h
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/wendling/eh/include/llvm/Support/IRBuilder.h?rev=105258&r1=105257&r2=105258&view=diff
==============================================================================
--- llvm/branches/wendling/eh/include/llvm/Support/IRBuilder.h (original)
+++ llvm/branches/wendling/eh/include/llvm/Support/IRBuilder.h Mon May 31 17:39:18 2010
@@ -279,41 +279,42 @@
   InvokeInst *CreateInvoke(Value *Callee, BasicBlock *NormalDest,
                            BasicBlock *UnwindDest, Value *PersonalityFn,
                            Value *CatchAllTy, BasicBlock *CatchAll,
-                           const Twine &Name = "") {
+                           unsigned NumCatches, const Twine &Name = "") {
     Value *Args[] = { 0 };
     return Insert(InvokeInst::Create(Callee, NormalDest, UnwindDest,
                                      PersonalityFn, CatchAllTy, CatchAll,
-                                     Args, Args), Name);
+                                     NumCatches, Args, Args), Name);
   }
   InvokeInst *CreateInvoke(Value *Callee, BasicBlock *NormalDest,
                            BasicBlock *UnwindDest, Value *PersonalityFn,
                            Value *CatchAllTy, BasicBlock *CatchAll,
-                           Value *Arg1, const Twine &Name = "") {
+                           unsigned NumCatches, Value *Arg1,
+                           const Twine &Name = "") {
     Value *Args[] = { Arg1 };
     return Insert(InvokeInst::Create(Callee, NormalDest, UnwindDest,
                                      PersonalityFn, CatchAllTy, CatchAll,
-                                     Args, Args+1), Name);
+                                     NumCatches, Args, Args+1), Name);
   }
   InvokeInst *CreateInvoke3(Value *Callee, BasicBlock *NormalDest,
                             BasicBlock *UnwindDest, Value *PersonalityFn,
                             Value *CatchAllTy, BasicBlock *CatchAll,
-                            Value *Arg1, Value *Arg2, Value *Arg3,
-                            const Twine &Name = "") {
+                            unsigned NumCatches, Value *Arg1, Value *Arg2,
+                            Value *Arg3, const Twine &Name = "") {
     Value *Args[] = { Arg1, Arg2, Arg3 };
     return Insert(InvokeInst::Create(Callee, NormalDest, UnwindDest,
                                      PersonalityFn, CatchAllTy, CatchAll,
-                                     Args, Args+3), Name);
+                                     NumCatches, Args, Args+3), Name);
   }
   /// CreateInvoke - Create an invoke instruction.
   template<typename InputIterator>
   InvokeInst *CreateInvoke(Value *Callee, BasicBlock *NormalDest,
                            BasicBlock *UnwindDest, Value *PersonalityFn,
                             Value *CatchAllTy, BasicBlock *CatchAll,
-                           InputIterator ArgBegin, InputIterator ArgEnd,
-                           const Twine &Name = "") {
+                           unsigned NumCatches, InputIterator ArgBegin,
+                           InputIterator ArgEnd, const Twine &Name = "") {
     return Insert(InvokeInst::Create(Callee, NormalDest, UnwindDest,
                                      PersonalityFn, CatchAllTy, CatchAll,
-                                     ArgBegin, ArgEnd), Name);
+                                     NumCatches, ArgBegin, ArgEnd), Name);
   }
 
   UnwindInst *CreateUnwind() {

Modified: llvm/branches/wendling/eh/lib/AsmParser/LLParser.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/wendling/eh/lib/AsmParser/LLParser.cpp?rev=105258&r1=105257&r2=105258&view=diff
==============================================================================
--- llvm/branches/wendling/eh/lib/AsmParser/LLParser.cpp (original)
+++ llvm/branches/wendling/eh/lib/AsmParser/LLParser.cpp Mon May 31 17:39:18 2010
@@ -3487,7 +3487,7 @@
   AttrListPtr PAL = AttrListPtr::get(Attrs.begin(), Attrs.end());
 
   InvokeInst *II = InvokeInst::Create(Callee, NormalBB, UnwindBB, PersFn,
-                                      CatchAllVal, CatchAllBB,
+                                      CatchAllVal, CatchAllBB, Catches.size(),
                                       Args.begin(), Args.end());
   II->setCallingConv(CC);
   II->setAttributes(PAL);

Modified: llvm/branches/wendling/eh/lib/Bitcode/Reader/BitcodeReader.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/wendling/eh/lib/Bitcode/Reader/BitcodeReader.cpp?rev=105258&r1=105257&r2=105258&view=diff
==============================================================================
--- llvm/branches/wendling/eh/lib/Bitcode/Reader/BitcodeReader.cpp (original)
+++ llvm/branches/wendling/eh/lib/Bitcode/Reader/BitcodeReader.cpp Mon May 31 17:39:18 2010
@@ -2114,7 +2114,7 @@
       }
 
       I = InvokeInst::Create(Callee, NormalBB, UnwindBB,
-                             0, 0, 0, // EH-FIXME!
+                             0, 0, 0, 0, // EH-FIXME!
                              Ops.begin(), Ops.end());
       InstructionList.push_back(I);
       cast<InvokeInst>(I)->setCallingConv(

Modified: llvm/branches/wendling/eh/lib/CodeGen/ShadowStackGC.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/wendling/eh/lib/CodeGen/ShadowStackGC.cpp?rev=105258&r1=105257&r2=105258&view=diff
==============================================================================
--- llvm/branches/wendling/eh/lib/CodeGen/ShadowStackGC.cpp (original)
+++ llvm/branches/wendling/eh/lib/CodeGen/ShadowStackGC.cpp Mon May 31 17:39:18 2010
@@ -162,7 +162,7 @@
 
           InvokeInst *II = InvokeInst::Create(CI->getCalledValue(),
                                               NewBB, CleanupBB,
-                                              0, 0, 0, // EH-FIXME!
+                                              0, 0, 0, 0, // EH-FIXME!
                                               Args.begin(), Args.end(),
                                               CI->getName(), CallBB);
           II->setCallingConv(CI->getCallingConv());

Modified: llvm/branches/wendling/eh/lib/Transforms/IPO/ArgumentPromotion.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/wendling/eh/lib/Transforms/IPO/ArgumentPromotion.cpp?rev=105258&r1=105257&r2=105258&view=diff
==============================================================================
--- llvm/branches/wendling/eh/lib/Transforms/IPO/ArgumentPromotion.cpp (original)
+++ llvm/branches/wendling/eh/lib/Transforms/IPO/ArgumentPromotion.cpp Mon May 31 17:39:18 2010
@@ -715,8 +715,9 @@
     if (InvokeInst *II = dyn_cast<InvokeInst>(Call)) {
       New = InvokeInst::Create(NF, II->getNormalDest(), II->getUnwindDest(),
                                II->getPersonalityFn(), II->getCatchAllType(),
-                               II->getCatchAllDest(),
+                               II->getCatchAllDest(), II->getNumCatches(),
                                Args.begin(), Args.end(), "", Call);
+      // EH-FIXME: Add catches.
       cast<InvokeInst>(New)->setCallingConv(CS.getCallingConv());
       cast<InvokeInst>(New)->setAttributes(AttrListPtr::get(AttributesVec.begin(),
                                                           AttributesVec.end()));

Modified: llvm/branches/wendling/eh/lib/Transforms/IPO/DeadArgumentElimination.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/wendling/eh/lib/Transforms/IPO/DeadArgumentElimination.cpp?rev=105258&r1=105257&r2=105258&view=diff
==============================================================================
--- llvm/branches/wendling/eh/lib/Transforms/IPO/DeadArgumentElimination.cpp (original)
+++ llvm/branches/wendling/eh/lib/Transforms/IPO/DeadArgumentElimination.cpp Mon May 31 17:39:18 2010
@@ -234,8 +234,9 @@
     if (InvokeInst *II = dyn_cast<InvokeInst>(Call)) {
       New = InvokeInst::Create(NF, II->getNormalDest(), II->getUnwindDest(),
                                II->getPersonalityFn(), II->getCatchAllType(),
-                               II->getCatchAllDest(),
+                               II->getCatchAllDest(), II->getNumCatches(),
                                Args.begin(), Args.end(), "", Call);
+      // EH-FIXME: Add catches.
       cast<InvokeInst>(New)->setCallingConv(CS.getCallingConv());
       cast<InvokeInst>(New)->setAttributes(PAL);
     } else {
@@ -766,8 +767,9 @@
     if (InvokeInst *II = dyn_cast<InvokeInst>(Call)) {
       New = InvokeInst::Create(NF, II->getNormalDest(), II->getUnwindDest(),
                                II->getPersonalityFn(), II->getCatchAllType(),
-                               II->getCatchAllDest(),
+                               II->getCatchAllDest(), II->getNumCatches(),
                                Args.begin(), Args.end(), "", Call);
+      // EH-FIXME: Add catches.
       cast<InvokeInst>(New)->setCallingConv(CS.getCallingConv());
       cast<InvokeInst>(New)->setAttributes(NewCallPAL);
     } else {

Modified: llvm/branches/wendling/eh/lib/Transforms/IPO/LowerSetJmp.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/wendling/eh/lib/Transforms/IPO/LowerSetJmp.cpp?rev=105258&r1=105257&r2=105258&view=diff
==============================================================================
--- llvm/branches/wendling/eh/lib/Transforms/IPO/LowerSetJmp.cpp (original)
+++ llvm/branches/wendling/eh/lib/Transforms/IPO/LowerSetJmp.cpp Mon May 31 17:39:18 2010
@@ -476,7 +476,7 @@
   std::vector<Value*> Params(CI.op_begin() + 1, CI.op_end());
   InvokeInst* II =
     InvokeInst::Create(CI.getCalledValue(), NewBB, PrelimBBMap[Func],
-                       0, 0, 0, // EH-FIXME!
+                       0, 0, 0, 0, // EH-FIXME!
                        Params.begin(), Params.end(), CI.getName(), Term);
   II->setCallingConv(CI.getCallingConv());
   II->setAttributes(CI.getAttributes());

Modified: llvm/branches/wendling/eh/lib/Transforms/IPO/PartialSpecialization.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/wendling/eh/lib/Transforms/IPO/PartialSpecialization.cpp?rev=105258&r1=105257&r2=105258&view=diff
==============================================================================
--- llvm/branches/wendling/eh/lib/Transforms/IPO/PartialSpecialization.cpp (original)
+++ llvm/branches/wendling/eh/lib/Transforms/IPO/PartialSpecialization.cpp Mon May 31 17:39:18 2010
@@ -96,8 +96,10 @@
                                      II->getPersonalityFn(),
                                      II->getCatchAllType(),
                                      II->getCatchAllDest(),
+                                     II->getNumCatches(),
                                      args.begin(), args.end(), 
                                      II->getName(), II);
+          // EH-FIXME: Add catches.
           cast<InvokeInst>(NCall)->setCallingConv(II->getCallingConv());
         }
         CS.getInstruction()->replaceAllUsesWith(NCall);

Modified: llvm/branches/wendling/eh/lib/Transforms/IPO/StructRetPromotion.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/wendling/eh/lib/Transforms/IPO/StructRetPromotion.cpp?rev=105258&r1=105257&r2=105258&view=diff
==============================================================================
--- llvm/branches/wendling/eh/lib/Transforms/IPO/StructRetPromotion.cpp (original)
+++ llvm/branches/wendling/eh/lib/Transforms/IPO/StructRetPromotion.cpp Mon May 31 17:39:18 2010
@@ -305,8 +305,9 @@
     if (InvokeInst *II = dyn_cast<InvokeInst>(Call)) {
       New = InvokeInst::Create(NF, II->getNormalDest(), II->getUnwindDest(),
                                II->getPersonalityFn(), II->getCatchAllType(),
-                               II->getCatchAllDest(),
+                               II->getCatchAllDest(), II->getNumCatches(),
                                Args.begin(), Args.end(), "", Call);
+      // EH-FIXME: Add catches.
       cast<InvokeInst>(New)->setCallingConv(CS.getCallingConv());
       cast<InvokeInst>(New)->setAttributes(NewPAL);
     } else {

Modified: llvm/branches/wendling/eh/lib/Transforms/InstCombine/InstCombineCalls.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/wendling/eh/lib/Transforms/InstCombine/InstCombineCalls.cpp?rev=105258&r1=105257&r2=105258&view=diff
==============================================================================
--- llvm/branches/wendling/eh/lib/Transforms/InstCombine/InstCombineCalls.cpp (original)
+++ llvm/branches/wendling/eh/lib/Transforms/InstCombine/InstCombineCalls.cpp Mon May 31 17:39:18 2010
@@ -1081,9 +1081,10 @@
   if (InvokeInst *II = dyn_cast<InvokeInst>(Caller)) {
     NC = InvokeInst::Create(Callee, II->getNormalDest(), II->getUnwindDest(),
                             II->getPersonalityFn(), II->getCatchAllType(),
-                            II->getCatchAllDest(),
+                            II->getCatchAllDest(), II->getNumCatches(),
                             Args.begin(), Args.end(),
                             Caller->getName(), Caller);
+    // EH-FIXME: Add catches.
     cast<InvokeInst>(NC)->setCallingConv(II->getCallingConv());
     cast<InvokeInst>(NC)->setAttributes(NewCallerPAL);
   } else {
@@ -1256,8 +1257,10 @@
                                        II->getPersonalityFn(),
                                        II->getCatchAllType(),
                                        II->getCatchAllDest(),
+                                       II->getNumCatches(),
                                        NewArgs.begin(), NewArgs.end(),
                                        Caller->getName(), Caller);
+        // EH-FIXME: Add catches.
         cast<InvokeInst>(NewCaller)->setCallingConv(II->getCallingConv());
         cast<InvokeInst>(NewCaller)->setAttributes(NewPAL);
       } else {

Modified: llvm/branches/wendling/eh/lib/Transforms/Utils/InlineFunction.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/wendling/eh/lib/Transforms/Utils/InlineFunction.cpp?rev=105258&r1=105257&r2=105258&view=diff
==============================================================================
--- llvm/branches/wendling/eh/lib/Transforms/Utils/InlineFunction.cpp (original)
+++ llvm/branches/wendling/eh/lib/Transforms/Utils/InlineFunction.cpp Mon May 31 17:39:18 2010
@@ -66,7 +66,7 @@
     SmallVector<Value*, 8> InvokeArgs(CI->op_begin()+1, CI->op_end());
     InvokeInst *II =
       InvokeInst::Create(CI->getCalledValue(), Split, InvokeDest,
-                         0, 0, 0, // EH-FIXME!
+                         0, 0, 0, 0, // EH-FIXME!
                          InvokeArgs.begin(), InvokeArgs.end(),
                          CI->getName(), BB->getTerminator());
     II->setCallingConv(CI->getCallingConv());

Modified: llvm/branches/wendling/eh/lib/VMCore/Core.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/wendling/eh/lib/VMCore/Core.cpp?rev=105258&r1=105257&r2=105258&view=diff
==============================================================================
--- llvm/branches/wendling/eh/lib/VMCore/Core.cpp (original)
+++ llvm/branches/wendling/eh/lib/VMCore/Core.cpp Mon May 31 17:39:18 2010
@@ -1726,11 +1726,13 @@
                              LLVMValueRef *Args, unsigned NumArgs,
                              LLVMBasicBlockRef Then, LLVMBasicBlockRef Catch,
                              LLVMValueRef PersFn, LLVMValueRef CatchAllTy,
-                             LLVMBasicBlockRef CatchAll, const char *Name) {
+                             LLVMBasicBlockRef CatchAll, unsigned NumCatches,
+                             const char *Name) {
   return wrap(unwrap(B)->CreateInvoke(unwrap(Fn), unwrap(Then), unwrap(Catch),
                                       unwrap(PersFn), unwrap(CatchAllTy),
-                                      unwrap(CatchAll), unwrap(Args),
-                                      unwrap(Args) + NumArgs, Name));
+                                      unwrap(CatchAll), NumCatches,
+                                      unwrap(Args), unwrap(Args) + NumArgs,
+                                      Name));
 }
 
 LLVMValueRef LLVMBuildUnwind(LLVMBuilderRef B) {

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=105258&r1=105257&r2=105258&view=diff
==============================================================================
--- llvm/branches/wendling/eh/lib/VMCore/Instructions.cpp (original)
+++ llvm/branches/wendling/eh/lib/VMCore/Instructions.cpp Mon May 31 17:39:18 2010
@@ -546,8 +546,9 @@
 
 void InvokeInst::init(Value *Fn, BasicBlock *IfNormal, BasicBlock *IfException,
                       Value *PersFn, Value *CatchAllTy, BasicBlock *CatchAll,
-                      Value* const *Args, unsigned NumArgs) {
-  assert(NumOperands == 3+NumArgs && "NumOperands not set up?");
+                      unsigned NumCatches, Value * const *Args,
+                      unsigned NumArgs) {
+  assert(NumOperands == 6 + NumArgs && "NumOperands not set up?");
   Op<-6>() = Fn;
   Op<-5>() = IfNormal;
   Op<-4>() = IfException;
@@ -556,7 +557,7 @@
   Op<-1>() = CatchAll;
   const FunctionType *FTy =
     cast<FunctionType>(cast<PointerType>(Fn->getType())->getElementType());
-  FTy = FTy;  // silence warning.
+  FTy = FTy;  // Silence warning.
 
   assert(((NumArgs == FTy->getNumParams()) ||
           (FTy->isVarArg() && NumArgs > FTy->getNumParams())) &&
@@ -585,6 +586,10 @@
   SubclassOptionalData = II.SubclassOptionalData;
 }
 
+InvokeInst::~InvokeInst() {
+  dropHungoffUses(CatchList);
+}
+
 BasicBlock *InvokeInst::getSuccessorV(unsigned idx) const {
   return getSuccessor(idx);
 }





More information about the llvm-branch-commits mailing list