[llvm-branch-commits] [llvm-branch] r135985 - in /llvm/branches/exception-handling-rewrite: include/llvm/Instructions.h lib/VMCore/Instructions.cpp

Bill Wendling isanbard at gmail.com
Mon Jul 25 15:15:07 PDT 2011


Author: void
Date: Mon Jul 25 17:15:07 2011
New Revision: 135985

URL: http://llvm.org/viewvc/llvm-project?rev=135985&view=rev
Log:
Make sure to add the personality function while we're at it.

Modified:
    llvm/branches/exception-handling-rewrite/include/llvm/Instructions.h
    llvm/branches/exception-handling-rewrite/lib/VMCore/Instructions.cpp

Modified: llvm/branches/exception-handling-rewrite/include/llvm/Instructions.h
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/exception-handling-rewrite/include/llvm/Instructions.h?rev=135985&r1=135984&r2=135985&view=diff
==============================================================================
--- llvm/branches/exception-handling-rewrite/include/llvm/Instructions.h (original)
+++ llvm/branches/exception-handling-rewrite/include/llvm/Instructions.h Mon Jul 25 17:15:07 2011
@@ -1826,33 +1826,36 @@
     return User::operator new(s, 0);
   }
   void growOperands(unsigned Size);
+  void init(Value *PersFn, unsigned NumReservedValues, const Twine &NameStr);
 
-  explicit LandingPadInst(Type *RetTy, unsigned NumReservedValues,
-                          const Twine &NameStr, Instruction *InsertBefore)
-    : Instruction(RetTy, Instruction::LandingPad, 0, 0, InsertBefore),
-      ReservedSpace(NumReservedValues) {
-    setName(NameStr);
-    OperandList = allocHungoffUses(ReservedSpace);
-  }
-  explicit LandingPadInst(Type *RetTy, unsigned NumReservedValues,
-                          const Twine &NameStr, BasicBlock *InsertAtEnd)
-    : Instruction(RetTy, Instruction::LandingPad, 0, 0, InsertAtEnd),
-      ReservedSpace(NumReservedValues) {
-    setName(NameStr);
-    OperandList = allocHungoffUses(ReservedSpace);
+  explicit LandingPadInst(Type *RetTy, Value *PersonalityFn,
+                          unsigned NumReservedValues, const Twine &NameStr,
+                          Instruction *InsertBefore)
+    : Instruction(RetTy, Instruction::LandingPad, 0, 0, InsertBefore) {
+    init(PersonalityFn, 1 + NumReservedValues, NameStr);
+  }
+  explicit LandingPadInst(Type *RetTy, Value *PersonalityFn,
+                          unsigned NumReservedValues, const Twine &NameStr,
+                          BasicBlock *InsertAtEnd)
+    : Instruction(RetTy, Instruction::LandingPad, 0, 0, InsertAtEnd) {
+    init(PersonalityFn, 1 + NumReservedValues, NameStr);
   }
 protected:
   virtual LandingPadInst *clone_impl() const;
 public:
-  static LandingPadInst *Create(Type *RetTy, unsigned NumReservedValues,
+  static LandingPadInst *Create(Type *RetTy, Value *PersonalityFn,
+                                unsigned NumReservedValues,
                                 const Twine &NameStr = "",
                                 Instruction *InsertBefore = 0) {
-    return new LandingPadInst(RetTy, NumReservedValues, NameStr, InsertBefore);
+    return new LandingPadInst(RetTy, PersonalityFn, NumReservedValues, NameStr,
+                              InsertBefore);
   }
-  static LandingPadInst *Create(Type *RetTy, unsigned NumReservedValues,
+  static LandingPadInst *Create(Type *RetTy, Value *PersonalityFn,
+                                unsigned NumReservedValues,
                                 const Twine &NameStr = "",
                                 BasicBlock *InsertAtEnd = 0) {
-    return new LandingPadInst(RetTy, NumReservedValues, NameStr, InsertAtEnd);
+    return new LandingPadInst(RetTy, PersonalityFn, NumReservedValues, NameStr,
+                              InsertAtEnd);
   }
   ~LandingPadInst();
 

Modified: llvm/branches/exception-handling-rewrite/lib/VMCore/Instructions.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/exception-handling-rewrite/lib/VMCore/Instructions.cpp?rev=135985&r1=135984&r2=135985&view=diff
==============================================================================
--- llvm/branches/exception-handling-rewrite/lib/VMCore/Instructions.cpp (original)
+++ llvm/branches/exception-handling-rewrite/lib/VMCore/Instructions.cpp Mon Jul 25 17:15:07 2011
@@ -170,6 +170,17 @@
 //                       LandingPadInst Implementation
 //===----------------------------------------------------------------------===//
 
+void LandingPadInst::init(Value *PersFn, unsigned NumReservedValues,
+                          const Twine &NameStr) {
+  assert(NumReservedValues);
+  ReservedSpace = NumReservedValues;
+  NumOperands = 1;
+  OperandList = allocHungoffUses(ReservedSpace);
+
+  OperandList[0] = PersFn;
+  setName(NameStr);
+}
+
 LandingPadInst::LandingPadInst(const LandingPadInst &LP)
   : Instruction(LP.getType(), Instruction::LandingPad,
                 allocHungoffUses(LP.getNumOperands()), LP.getNumOperands()),





More information about the llvm-branch-commits mailing list