[llvm-commits] [llvm] r136392 - in /llvm/trunk: include/llvm/Instructions.h include/llvm/Support/IRBuilder.h lib/AsmParser/LLParser.cpp lib/Bitcode/Reader/BitcodeReader.cpp lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp lib/VMCore/Core.cpp lib/VMCore/Instructions.cpp

Bill Wendling isanbard at gmail.com
Thu Jul 28 14:14:13 PDT 2011


Author: void
Date: Thu Jul 28 16:14:13 2011
New Revision: 136392

URL: http://llvm.org/viewvc/llvm-project?rev=136392&view=rev
Log:
The personality function should be a Function* and not just a Value*.

Modified:
    llvm/trunk/include/llvm/Instructions.h
    llvm/trunk/include/llvm/Support/IRBuilder.h
    llvm/trunk/lib/AsmParser/LLParser.cpp
    llvm/trunk/lib/Bitcode/Reader/BitcodeReader.cpp
    llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
    llvm/trunk/lib/VMCore/Core.cpp
    llvm/trunk/lib/VMCore/Instructions.cpp

Modified: llvm/trunk/include/llvm/Instructions.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Instructions.h?rev=136392&r1=136391&r2=136392&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Instructions.h (original)
+++ llvm/trunk/include/llvm/Instructions.h Thu Jul 28 16:14:13 2011
@@ -1806,16 +1806,16 @@
     return User::operator new(s, 0);
   }
   void growOperands();
-  void init(Value *PersFn, unsigned NumReservedValues, const Twine &NameStr);
+  void init(Function *PersFn, unsigned NumReservedValues, const Twine &NameStr);
 
-  explicit LandingPadInst(Type *RetTy, Value *PersonalityFn,
+  explicit LandingPadInst(Type *RetTy, Function *PersonalityFn,
                           unsigned NumReservedValues, const Twine &NameStr,
                           Instruction *InsertBefore)
     : Instruction(RetTy, Instruction::LandingPad, 0, 0, InsertBefore),
       IsCleanup(false) {
     init(PersonalityFn, 1 + NumReservedValues, NameStr);
   }
-  explicit LandingPadInst(Type *RetTy, Value *PersonalityFn,
+  explicit LandingPadInst(Type *RetTy, Function *PersonalityFn,
                           unsigned NumReservedValues, const Twine &NameStr,
                           BasicBlock *InsertAtEnd)
     : Instruction(RetTy, Instruction::LandingPad, 0, 0, InsertAtEnd),
@@ -1825,14 +1825,14 @@
 protected:
   virtual LandingPadInst *clone_impl() const;
 public:
-  static LandingPadInst *Create(Type *RetTy, Value *PersonalityFn,
+  static LandingPadInst *Create(Type *RetTy, Function *PersonalityFn,
                                 unsigned NumReservedValues,
                                 const Twine &NameStr = "",
                                 Instruction *InsertBefore = 0) {
     return new LandingPadInst(RetTy, PersonalityFn, NumReservedValues, NameStr,
                               InsertBefore);
   }
-  static LandingPadInst *Create(Type *RetTy, Value *PersonalityFn,
+  static LandingPadInst *Create(Type *RetTy, Function *PersonalityFn,
                                 unsigned NumReservedValues,
                                 const Twine &NameStr, BasicBlock *InsertAtEnd) {
     return new LandingPadInst(RetTy, PersonalityFn, NumReservedValues, NameStr,
@@ -1845,7 +1845,9 @@
 
   /// getPersonalityFn - Get the personality function associated with this
   /// landing pad.
-  const Value *getPersonalityFn() const { return getOperand(0); }
+  const Function *getPersonalityFn() const {
+    return cast<Function>(getOperand(0));
+  }
 
   // Simple accessors.
   bool isCleanup() const { return IsCleanup; }

Modified: llvm/trunk/include/llvm/Support/IRBuilder.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/IRBuilder.h?rev=136392&r1=136391&r2=136392&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Support/IRBuilder.h (original)
+++ llvm/trunk/include/llvm/Support/IRBuilder.h Thu Jul 28 16:14:13 2011
@@ -1198,7 +1198,7 @@
     return Insert(InsertValueInst::Create(Agg, Val, Idxs), Name);
   }
 
-  Value *CreateLandingPad(Type *Ty, Value *PersFn, unsigned NumClauses,
+  Value *CreateLandingPad(Type *Ty, Function *PersFn, unsigned NumClauses,
                           const Twine &Name = "") {
     return Insert(LandingPadInst::Create(Ty, PersFn, NumClauses, Name));
   }

Modified: llvm/trunk/lib/AsmParser/LLParser.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/AsmParser/LLParser.cpp?rev=136392&r1=136391&r2=136392&view=diff
==============================================================================
--- llvm/trunk/lib/AsmParser/LLParser.cpp (original)
+++ llvm/trunk/lib/AsmParser/LLParser.cpp Thu Jul 28 16:14:13 2011
@@ -3547,7 +3547,8 @@
     } while (EatIfPresent(lltok::comma));
   }
 
-  LandingPadInst *LP = LandingPadInst::Create(Ty, PersFn, Clauses.size());
+  LandingPadInst *LP = LandingPadInst::Create(Ty, cast<Function>(PersFn),
+                                              Clauses.size());
   LP->setCleanup(IsCleanup);
 
   for (SmallVectorImpl<std::pair<LandingPadInst::ClauseType,

Modified: llvm/trunk/lib/Bitcode/Reader/BitcodeReader.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Bitcode/Reader/BitcodeReader.cpp?rev=136392&r1=136391&r2=136392&view=diff
==============================================================================
--- llvm/trunk/lib/Bitcode/Reader/BitcodeReader.cpp (original)
+++ llvm/trunk/lib/Bitcode/Reader/BitcodeReader.cpp Thu Jul 28 16:14:13 2011
@@ -2539,7 +2539,8 @@
 
       bool IsCleanup = !!Record[Idx++];
       unsigned NumClauses = Record[Idx++];
-      LandingPadInst *LP = LandingPadInst::Create(Ty, PersFn, NumClauses);
+      LandingPadInst *LP = LandingPadInst::Create(Ty, cast<Function>(PersFn),
+                                                  NumClauses);
       LP->setCleanup(IsCleanup);
       for (unsigned J = 0; J != NumClauses; ++J) {
         LandingPadInst::ClauseType CT =

Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp?rev=136392&r1=136391&r2=136392&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp (original)
+++ llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp Thu Jul 28 16:14:13 2011
@@ -914,10 +914,6 @@
   llvm_unreachable("SelectionDAGBuilder shouldn't visit PHI nodes!");
 }
 
-void SelectionDAGBuilder::visitLandingPad(const LandingPadInst &) {
-  // FIXME: Handle this
-}
-
 void SelectionDAGBuilder::visit(unsigned Opcode, const User &I) {
   // Note: this doesn't use InstVisitor, because it has to work with
   // ConstantExpr's in addition to instructions.
@@ -1813,7 +1809,13 @@
 }
 
 void SelectionDAGBuilder::visitResume(const ResumeInst &RI) {
+  llvm_unreachable("SelectionDAGBuilder shouldn't visit resume instructions!");
+}
+
+void SelectionDAGBuilder::visitLandingPad(const LandingPadInst &) {
   // FIXME: Handle this
+  assert(FuncInfo.MBB->isLandingPad() &&
+         "Call to landingpad not in landing pad!");
 }
 
 /// handleSmallSwitchCaseRange - Emit a series of specific tests (suitable for

Modified: llvm/trunk/lib/VMCore/Core.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/Core.cpp?rev=136392&r1=136391&r2=136392&view=diff
==============================================================================
--- llvm/trunk/lib/VMCore/Core.cpp (original)
+++ llvm/trunk/lib/VMCore/Core.cpp Thu Jul 28 16:14:13 2011
@@ -1686,7 +1686,8 @@
 LLVMValueRef LLVMBuildLandingPad(LLVMBuilderRef B, LLVMTypeRef Ty,
                                  LLVMValueRef PersFn, unsigned NumClauses,
                                  const char *Name) {
-  return wrap(unwrap(B)->CreateLandingPad(unwrap(Ty), unwrap(PersFn),
+  return wrap(unwrap(B)->CreateLandingPad(unwrap(Ty),
+                                          cast<Function>(unwrap(PersFn)),
                                           NumClauses, Name));
 }
 

Modified: llvm/trunk/lib/VMCore/Instructions.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/Instructions.cpp?rev=136392&r1=136391&r2=136392&view=diff
==============================================================================
--- llvm/trunk/lib/VMCore/Instructions.cpp (original)
+++ llvm/trunk/lib/VMCore/Instructions.cpp Thu Jul 28 16:14:13 2011
@@ -170,12 +170,12 @@
 //                       LandingPadInst Implementation
 //===----------------------------------------------------------------------===//
 
-void LandingPadInst::init(Value *PersFn, unsigned NumReservedValues,
+void LandingPadInst::init(Function *PersFn, unsigned NumReservedValues,
                           const Twine &NameStr) {
   ReservedSpace = NumReservedValues;
   NumOperands = 1;
   OperandList = allocHungoffUses(ReservedSpace);
-  OperandList[0] = PersFn;
+  OperandList[0] = (Value*)PersFn;
   setName(NameStr);
 }
 





More information about the llvm-commits mailing list