diff options
31 files changed, 617 insertions, 524 deletions
diff --git a/examples/Fibonacci/fibonacci.cpp b/examples/Fibonacci/fibonacci.cpp index f5ef0d02a8..73dff11031 100644 --- a/examples/Fibonacci/fibonacci.cpp +++ b/examples/Fibonacci/fibonacci.cpp @@ -66,18 +66,18 @@ static Function *CreateFibFunction(Module *M) { ReturnInst::Create(One, RetBB); // create fib(x-1) - Value *Sub = BinaryOperator::createSub(ArgX, One, "arg", RecurseBB); + Value *Sub = BinaryOperator::CreateSub(ArgX, One, "arg", RecurseBB); CallInst *CallFibX1 = CallInst::Create(FibF, Sub, "fibx1", RecurseBB); CallFibX1->setTailCall(); // create fib(x-2) - Sub = BinaryOperator::createSub(ArgX, Two, "arg", RecurseBB); + Sub = BinaryOperator::CreateSub(ArgX, Two, "arg", RecurseBB); CallInst *CallFibX2 = CallInst::Create(FibF, Sub, "fibx2", RecurseBB); CallFibX2->setTailCall(); // fib(x-1)+fib(x-2) - Value *Sum = BinaryOperator::createAdd(CallFibX1, CallFibX2, + Value *Sum = BinaryOperator::CreateAdd(CallFibX1, CallFibX2, "addresult", RecurseBB); // Create the return instruction and add it to the basic block diff --git a/examples/HowToUseJIT/HowToUseJIT.cpp b/examples/HowToUseJIT/HowToUseJIT.cpp index 2aba8e1128..5fa4237179 100644 --- a/examples/HowToUseJIT/HowToUseJIT.cpp +++ b/examples/HowToUseJIT/HowToUseJIT.cpp @@ -69,7 +69,7 @@ int main() { ArgX->setName("AnArg"); // Give it a nice symbolic name for fun. // Create the add instruction, inserting it into the end of BB. - Instruction *Add = BinaryOperator::createAdd(One, ArgX, "addresult", BB); + Instruction *Add = BinaryOperator::CreateAdd(One, ArgX, "addresult", BB); // Create the return instruction and add it to the basic block ReturnInst::Create(Add, BB); diff --git a/examples/ModuleMaker/ModuleMaker.cpp b/examples/ModuleMaker/ModuleMaker.cpp index 40d2fa99f4..154e24065c 100644 --- a/examples/ModuleMaker/ModuleMaker.cpp +++ b/examples/ModuleMaker/ModuleMaker.cpp @@ -43,7 +43,7 @@ int main() { Value *Three = ConstantInt::get(Type::Int32Ty, 3); // Create the add instruction... does not insert... - Instruction *Add = BinaryOperator::create(Instruction::Add, Two, Three, + Instruction *Add = BinaryOperator::Create(Instruction::Add, Two, Three, "addresult"); // explicitly insert it into the basic block... diff --git a/examples/ParallelJIT/ParallelJIT.cpp b/examples/ParallelJIT/ParallelJIT.cpp index 634bffa126..e812d84eaf 100644 --- a/examples/ParallelJIT/ParallelJIT.cpp +++ b/examples/ParallelJIT/ParallelJIT.cpp @@ -50,7 +50,7 @@ static Function* createAdd1(Module *M) { ArgX->setName("AnArg"); // Give it a nice symbolic name for fun. // Create the add instruction, inserting it into the end of BB. - Instruction *Add = BinaryOperator::createAdd(One, ArgX, "addresult", BB); + Instruction *Add = BinaryOperator::CreateAdd(One, ArgX, "addresult", BB); // Create the return instruction and add it to the basic block ReturnInst::Create(Add, BB); @@ -90,16 +90,16 @@ static Function *CreateFibFunction(Module *M) { ReturnInst::Create(One, RetBB); // create fib(x-1) - Value *Sub = BinaryOperator::createSub(ArgX, One, "arg", RecurseBB); + Value *Sub = BinaryOperator::CreateSub(ArgX, One, "arg", RecurseBB); Value *CallFibX1 = CallInst::Create(FibF, Sub, "fibx1", RecurseBB); // create fib(x-2) - Sub = BinaryOperator::createSub(ArgX, Two, "arg", RecurseBB); + Sub = BinaryOperator::CreateSub(ArgX, Two, "arg", RecurseBB); Value *CallFibX2 = CallInst::Create(FibF, Sub, "fibx2", RecurseBB); // fib(x-1)+fib(x-2) Value *Sum = - BinaryOperator::createAdd(CallFibX1, CallFibX2, "addresult", RecurseBB); + BinaryOperator::CreateAdd(CallFibX1, CallFibX2, "addresult", RecurseBB); // Create the return instruction and add it to the basic block ReturnInst::Create(Sum, RecurseBB); diff --git a/include/llvm/Analysis/ScalarEvolutionExpander.h b/include/llvm/Analysis/ScalarEvolutionExpander.h index 584e488f64..ed520f5dc2 100644 --- a/include/llvm/Analysis/ScalarEvolutionExpander.h +++ b/include/llvm/Analysis/ScalarEvolutionExpander.h @@ -101,17 +101,17 @@ namespace llvm { Value *visitTruncateExpr(SCEVTruncateExpr *S) { Value *V = expand(S->getOperand()); - return CastInst::createTruncOrBitCast(V, S->getType(), "tmp.", InsertPt); + return CastInst::CreateTruncOrBitCast(V, S->getType(), "tmp.", InsertPt); } Value *visitZeroExtendExpr(SCEVZeroExtendExpr *S) { Value *V = expand(S->getOperand()); - return CastInst::createZExtOrBitCast(V, S->getType(), "tmp.", InsertPt); + return CastInst::CreateZExtOrBitCast(V, S->getType(), "tmp.", InsertPt); } Value *visitSignExtendExpr(SCEVSignExtendExpr *S) { Value *V = expand(S->getOperand()); - return CastInst::createSExtOrBitCast(V, S->getType(), "tmp.", InsertPt); + return CastInst::CreateSExtOrBitCast(V, S->getType(), "tmp.", InsertPt); } Value *visitAddExpr(SCEVAddExpr *S) { diff --git a/include/llvm/InstrTypes.h b/include/llvm/InstrTypes.h index a320ad00e4..3748b0c9a5 100644 --- a/include/llvm/InstrTypes.h +++ b/include/llvm/InstrTypes.h @@ -152,42 +152,42 @@ public: /// Transparently provide more efficient getOperand methods. DECLARE_TRANSPARENT_OPERAND_ACCESSORS(Value); - /// create() - Construct a binary instruction, given the opcode and the two + /// Create() - Construct a binary instruction, given the opcode and the two /// operands. Optionally (if InstBefore is specified) insert the instruction /// into a BasicBlock right before the specified instruction. The specified /// Instruction is allowed to be a dereferenced end iterator. /// - static BinaryOperator *create(BinaryOps Op, Value *S1, Value *S2, + static BinaryOperator *Create(BinaryOps Op, Value *S1, Value *S2, const std::string &Name = "", Instruction *InsertBefore = 0); - /// create() - Construct a binary instruction, given the opcode and the two + /// Create() - Construct a binary instruction, given the opcode and the two /// operands. Also automatically insert this instruction to the end of the /// BasicBlock specified. /// - static BinaryOperator *create(BinaryOps Op, Value *S1, Value *S2, + static BinaryOperator *Create(BinaryOps Op, Value *S1, Value *S2, const std::string &Name, BasicBlock *InsertAtEnd); - /// create* - These methods just forward to create, and are useful when you + /// Create* - These methods just forward to create, and are useful when you /// statically know what type of instruction you're going to create. These /// helpers just save some typing. #define HANDLE_BINARY_INST(N, OPC, CLASS) \ - static BinaryOperator *create##OPC(Value *V1, Value *V2, \ + static BinaryOperator *Create##OPC(Value *V1, Value *V2, \ const std::string &Name = "") {\ - return create(Instruction::OPC, V1, V2, Name);\ + return Create(Instruction::OPC, V1, V2, Name);\ } #include "llvm/Instruction.def" #define HANDLE_BINARY_INST(N, OPC, CLASS) \ - static BinaryOperator *create##OPC(Value *V1, Value *V2, \ + static BinaryOperator *Create##OPC(Value *V1, Value *V2, \ const std::string &Name, BasicBlock *BB) {\ - return create(Instruction::OPC, V1, V2, Name, BB);\ + return Create(Instruction::OPC, V1, V2, Name, BB);\ } #include "llvm/Instruction.def" #define HANDLE_BINARY_INST(N, OPC, CLASS) \ - static BinaryOperator *create##OPC(Value *V1, Value *V2, \ + static BinaryOperator *Create##OPC(Value *V1, Value *V2, \ const std::string &Name, Instruction *I) {\ - return create(Instruction::OPC, V1, V2, Name, I);\ + return Create(Instruction::OPC, V1, V2, Name, I);\ } #include "llvm/Instruction.def" @@ -195,16 +195,16 @@ public: /// Helper functions to construct and inspect unary operations (NEG and NOT) /// via binary operators SUB and XOR: /// - /// createNeg, createNot - Create the NEG and NOT + /// CreateNeg, CreateNot - Create the NEG and NOT /// instructions out of SUB and XOR instructions. /// - static BinaryOperator *createNeg(Value *Op, const std::string &Name = "", + static BinaryOperator *CreateNeg(Value *Op, const std::string &Name = "", Instruction *InsertBefore = 0); - static BinaryOperator *createNeg(Value *Op, const std::string &Name, + static BinaryOperator *CreateNeg(Value *Op, const std::string &Name, BasicBlock *InsertAtEnd); - static BinaryOperator *createNot(Value *Op, const std::string &Name = "", + static BinaryOperator *CreateNot(Value *Op, const std::string &Name = "", Instruction *InsertBefore = 0); - static BinaryOperator *createNot(Value *Op, const std::string &Name, + static BinaryOperator *CreateNot(Value *Op, const std::string &Name, BasicBlock *InsertAtEnd); /// isNeg, isNot - Check if the given Value is a NEG or NOT instruction. @@ -241,6 +241,53 @@ public: static inline bool classof(const Value *V) { return isa<Instruction>(V) && classof(cast<Instruction>(V)); } + + /// Backward-compatible interfaces + /// @deprecated in 2.4, do not use, will disappear soon + static BinaryOperator *create(BinaryOps Op, Value *S1, Value *S2, + const std::string &Name = "", + Instruction *InsertBefore = 0) { + return Create(Op, S1, S2, Name, InsertBefore); + } + static BinaryOperator *create(BinaryOps Op, Value *S1, Value *S2, + const std::string &Name, + BasicBlock *InsertAtEnd) { + return Create(Op, S1, S2, Name, InsertAtEnd); + } +#define HANDLE_BINARY_INST(N, OPC, CLASS) \ + static BinaryOperator *create##OPC(Value *V1, Value *V2, \ + const std::string &Name = "") {\ + return Create(Instruction::OPC, V1, V2, Name);\ + } +#include "llvm/Instruction.def" +#define HANDLE_BINARY_INST(N, OPC, CLASS) \ + static BinaryOperator *create##OPC(Value *V1, Value *V2, \ + const std::string &Name, BasicBlock *BB) {\ + return Create(Instruction::OPC, V1, V2, Name, BB);\ + } +#include "llvm/Instruction.def" +#define HANDLE_BINARY_INST(N, OPC, CLASS) \ + static BinaryOperator *create##OPC(Value *V1, Value *V2, \ + const std::string &Name, Instruction *I) {\ + return Create(Instruction::OPC, V1, V2, Name, I);\ + } +#include "llvm/Instruction.def" + static BinaryOperator *createNeg(Value *Op, const std::string &Name = "", + Instruction *InsertBefore = 0) { + return CreateNeg(Op, Name, InsertBefore); + } + static BinaryOperator *createNeg(Value *Op, const std::string &Name, + BasicBlock *InsertAtEnd) { + return CreateNeg(Op, Name, InsertAtEnd); + } + static BinaryOperator *createNot(Value *Op, const std::string &Name = "", + Instruction *InsertBefore = 0) { + return CreateNot(Op, Name, InsertBefore); + } + static BinaryOperator *createNot(Value *Op, const std::string &Name, + BasicBlock *InsertAtEnd) { + return CreateNot(Op, Name, InsertAtEnd); + } }; template <> @@ -286,7 +333,7 @@ public: /// constructor has insert-before-instruction semantics to automatically /// insert the new CastInst before InsertBefore (if it is non-null). /// @brief Construct any of the CastInst subclasses - static CastInst *create( + static CastInst *Create( Instruction::CastOps, ///< The opcode of the cast instruction Value *S, ///< The value to be casted (operand 0) const Type *Ty, ///< The type to which cast should be made @@ -299,7 +346,7 @@ public: /// to automatically insert the new CastInst at the end of InsertAtEnd (if /// its non-null). /// @brief Construct any of the CastInst subclasses - static CastInst *create( + static CastInst *Create( Instruction::CastOps, ///< The opcode for the cast instruction Value *S, ///< The value to be casted (operand 0) const Type *Ty, ///< The type to which operand is casted @@ -308,7 +355,7 @@ public: ); /// @brief Create a ZExt or BitCast cast instruction - static CastInst *createZExtOrBitCast( + static CastInst *CreateZExtOrBitCast( Value *S, ///< The value to be casted (operand 0) const Type *Ty, ///< The type to which cast should be made const std::string &Name = "", ///< Name for the instruction @@ -316,7 +363,7 @@ public: ); /// @brief Create a ZExt or BitCast cast instruction - static CastInst *createZExtOrBitCast( + static CastInst *CreateZExtOrBitCast( Value *S, ///< The value to be casted (operand 0) const Type *Ty, ///< The type to which operand is casted const std::string &Name, ///< The name for the instruction @@ -324,15 +371,23 @@ public: ); /// @brief Create a SExt or BitCast cast instruction - static CastInst *createSExtOrBitCast( + static CastInst *CreateSExtOrBitCast( Value *S, ///< The value to be casted (operand 0) const Type *Ty, ///< The type to which cast should be made const std::string &Name = "", ///< Name for the instruction Instruction *InsertBefore = 0 ///< Place to insert the instruction ); + /// @brief Create a SExt or BitCast cast instruction + static CastInst *CreateSExtOrBitCast( + Value *S, ///< The value to be casted (operand 0) + const Type *Ty, ///< The type to which operand is casted + const std::string &Name, ///< The name for the instruction + BasicBlock *InsertAtEnd ///< The block to insert the instruction into + ); + /// @brief Create a BitCast or a PtrToInt cast instruction - static CastInst *createPointerCast( + static CastInst *CreatePointerCast( Value *S, ///< The pointer value to be casted (operand 0) const Type *Ty, ///< The type to which operand is casted const std::string &Name, ///< The name for the instruction @@ -340,7 +395,7 @@ public: ); /// @brief Create a BitCast or a PtrToInt cast instruction - static CastInst *createPointerCast( + static CastInst *CreatePointerCast( Value *S, ///< The pointer value to be casted (operand 0) const Type *Ty, ///< The type to which cast should be made const std::string &Name = "", ///< Name for the instruction @@ -348,7 +403,7 @@ public: ); /// @brief Create a ZExt, BitCast, or Trunc for int -> int casts. - static CastInst *createIntegerCast( + static CastInst *CreateIntegerCast( Value *S, ///< The pointer value to be casted (operand 0) const Type *Ty, ///< The type to which cast should be made bool isSigned, ///< Whether to regard S as signed or not @@ -357,7 +412,7 @@ public: ); /// @brief Create a ZExt, BitCast, or Trunc for int -> int casts. - static CastInst *createIntegerCast( + static CastInst *CreateIntegerCast( Value *S, ///< The integer value to be casted (operand 0) const Type *Ty, ///< The integer type to which operand is casted bool isSigned, ///< Whether to regard S as signed or not @@ -366,7 +421,7 @@ public: ); /// @brief Create an FPExt, BitCast, or FPTrunc for fp -> fp casts - static CastInst *createFPCast( + static CastInst *CreateFPCast( Value *S, ///< The floating point value to be casted const Type *Ty, ///< The floating point type to cast to const std::string &Name = "", ///< Name for the instruction @@ -374,23 +429,15 @@ public: ); /// @brief Create an FPExt, BitCast, or FPTrunc for fp -> fp casts - static CastInst *createFPCast( + static CastInst *CreateFPCast( Value *S, ///< The floating point value to be casted const Type *Ty, ///< The floating point type to cast to const std::string &Name, ///< The name for the instruction BasicBlock *InsertAtEnd ///< The block to insert the instruction into ); - /// @brief Create a SExt or BitCast cast instruction - static CastInst *createSExtOrBitCast( - Value *S, ///< The value to be casted (operand 0) - const Type *Ty, ///< The type to which operand is casted - const std::string &Name, ///< The name for the instruction - BasicBlock *InsertAtEnd ///< The block to insert the instruction into - ); - /// @brief Create a Trunc or BitCast cast instruction - static CastInst *createTruncOrBitCast( + static CastInst *CreateTruncOrBitCast( Value *S, ///< The value to be casted (operand 0) const Type *Ty, ///< The type to which cast should be made const std::string &Name = "", ///< Name for the instruction @@ -398,7 +445,7 @@ public: ); /// @brief Create a Trunc or BitCast cast instruction - static CastInst *createTruncOrBitCast( + static CastInst *CreateTruncOrBitCast( Value *S, ///< The value to be casted (operand 0) const Type *Ty, ///< The type to which operand is casted const std::string &Name, ///< The name for the instruction @@ -487,6 +534,40 @@ public: static inline bool classof(const Value *V) { return isa<Instruction>(V) && classof(cast<Instruction>(V)); } + /// Backward-compatible interfaces + /// @deprecated in 2.4, do not use, will disappear soon + static CastInst *create(Instruction::CastOps Op,Value *S,const Type *Ty, + const std::string &Name = "",Instruction *InsertBefore = 0) { + return Create(Op,S,Ty,Name,InsertBefore); + } + static CastInst *create(Instruction::CastOps Op,Value *S,const Type *Ty, + const std::string &Name,BasicBlock *InsertAtEnd) { + return Create(Op,S,Ty,Name,InsertAtEnd); + } + +#define DEFINE_CASTINST_DEPRECATED(OP) \ + static CastInst *create ## OP ## Cast(Value *S, const Type *Ty, \ + const std::string &Name = "", Instruction *InsertBefore = 0) { \ + return Create ## OP ## Cast(S, Ty, Name, InsertBefore); \ + } \ + static CastInst *create ## OP ## Cast(Value *S, const Type *Ty, \ + const std::string &Name, BasicBlock *InsertAtEnd) { \ + return Create ## OP ## Cast(S, Ty, Name, InsertAtEnd); \ + } + DEFINE_CASTINST_DEPRECATED(ZExtOrBit) + DEFINE_CASTINST_DEPRECATED(SExtOrBit) + DEFINE_CASTINST_DEPRECATED(Pointer) + DEFINE_CASTINST_DEPRECATED(FP) + DEFINE_CASTINST_DEPRECATED(TruncOrBit) +#undef DEFINE_CASTINST_DEPRECATED + static CastInst *createIntegerCast(Value *S, const Type *Ty, bool isSigned, + const std::string &Name = "", Instruction *InsertBefore = 0) { + return CreateIntegerCast(S, Ty, isSigned, Name, InsertBefore); + } + static CastInst *createIntegerCast(Value *S, const Type *Ty, bool isSigned, + const std::string &Name, BasicBlock *InsertAtEnd) { + return CreateIntegerCast(S, Ty, isSigned, Name, InsertAtEnd); + } }; //===----------------------------------------------------------------------===// @@ -558,7 +639,7 @@ public: /// instruction into a BasicBlock right before the specified instruction. /// The specified Instruction is allowed to be a dereferenced end iterator. /// @brief Create a CmpInst - static CmpInst *create(OtherOps Op, unsigned short predicate, Value *S1, + static CmpInst *Create(OtherOps Op, unsigned short predicate, Value *S1, Value *S2, const std::string &Name = "", Instruction *InsertBefore = 0); @@ -566,7 +647,7 @@ public: /// two operands. Also automatically insert this instruction to the end of /// the BasicBlock specified. /// @brief Create a CmpInst - static CmpInst *create(OtherOps Op, unsigned short predicate, Value *S1, + static CmpInst *Create(OtherOps Op, unsigned short predicate, Value *S1, Value *S2, const std::string &Name, BasicBlock *InsertAtEnd); @@ -627,6 +708,18 @@ public: static inline bool classof(const Value *V) { return isa<Instruction>(V) && classof(cast<Instruction>(V)); } + /// Backward-compatible interfaces + /// @deprecated in 2.4, do not use, will disappear soon + static CmpInst *create(OtherOps Op, unsigned short predicate, Value *S1, + Value *S2, const std::string &Name = "", + Instruction *InsertBefore = 0) { + return Create(Op, predicate, S1, S2, Name, InsertBefore); + } + static CmpInst *create(OtherOps Op, unsigned short predicate, Value *S1, + Value *S2, const std::string &Name, + BasicBlock *InsertAtEnd) { + return Create(Op, predicate, S1, S2, Name, InsertAtEnd); + } }; diff --git a/include/llvm/Support/IRBuilder.h b/include/llvm/Support/IRBuilder.h index e2610ea08c..65236b2c39 100644 --- a/include/llvm/Support/IRBuilder.h +++ b/include/llvm/Support/IRBuilder.h @@ -149,103 +149,103 @@ public: if (Constant *LC = dyn_cast<Constant>(LHS)) if (Constant *RC = dyn_cast<Constant>(RHS)) return ConstantExpr::getAdd(LC, RC); - return Insert(BinaryOperator::createAdd(LHS, RHS, Name)); + return Insert(BinaryOperator::CreateAdd(LHS, RHS, Name)); } Value *CreateSub(Value *LHS, Value *RHS, const char *Name = "") { if (Constant *LC = dyn_cast<Constant>(LHS)) if (Constant *RC = dyn_cast<Constant>(RHS)) return ConstantExpr::getSub(LC, RC); - return Insert(BinaryOperator::createSub(LHS, RHS, Name)); + return Insert(BinaryOperator::CreateSub(LHS, RHS, Name)); } Value *CreateMul(Value *LHS, Value *RHS, const char *Name = "") { if (Constant *LC = dyn_cast<Constant>(LHS)) if (Constant *RC = dyn_cast<Constant>(RHS)) return ConstantExpr::getMul(LC, RC); - return Insert(BinaryOperator::createMul(LHS, RHS, Name)); + return Insert(BinaryOperator::CreateMul(LHS, RHS, Name)); } Value *CreateUDiv(Value *LHS, Value *RHS, const char *Name = "") { if (Constant *LC = dyn_cast<Constant>(LHS)) if (Constant *RC = dyn_cast<Constant>(RHS)) return ConstantExpr::getUDiv(LC, RC); - return Insert(BinaryOperator::createUDiv(LHS, RHS, Name)); + return Insert(BinaryOperator::CreateUDiv(LHS, RHS, Name)); } Value *CreateSDiv(Value *LHS, Value *RHS, const char *Name = "") { if (Constant *LC = dyn_cast<Constant>(LHS)) if (Constant *RC = dyn_cast<Constant>(RHS)) return ConstantExpr::getSDiv(LC, RC); - return Insert(BinaryOperator::createSDiv(LHS, RHS, Name)); + return Insert(BinaryOperator::CreateSDiv(LHS, RHS, Name)); } Value *CreateFDiv(Value *LHS, Value *RHS, const char *Name = "") { if (Constant *LC = dyn_cast<Constant>(LHS)) if (Constant *RC = dyn_cast<Constant>(RHS)) return ConstantExpr::getFDiv(LC, RC); - return Insert(BinaryOperator::createFDiv(LHS, RHS, Name)); + return Insert(BinaryOperator::CreateFDiv(LHS, RHS, Name)); } Value *CreateURem(Value *LHS, Value *RHS, const char *Name = "") { if (Constant *LC = dyn_cast<Constant>(LHS)) if (Constant *RC = dyn_cast<Constant>(RHS)) return ConstantExpr::getURem(LC, RC); - return Insert(BinaryOperator::createURem(LHS, RHS, Name)); + return Insert(BinaryOperator::CreateURem(LHS, RHS, Name)); } Value *CreateSRem(Value *LHS, Value *RHS, const char *Name = "") { if (Constant *LC = dyn_cast<Constant>(LHS)) if (Constant *RC = dyn_cast<Constant>(RHS)) return ConstantExpr::getSRem(LC, RC); - return Insert(BinaryOperator::createSRem(LHS, RHS, Name)); + return Insert(BinaryOperator::CreateSRem(LHS, RHS, Name)); } Value *CreateFRem(Value *LHS, Value *RHS, const char *Name = "") { if (Constant *LC = dyn_cast<Constant>(LHS)) if (Constant *RC = dyn_cast<Constant>(RHS)) return ConstantExpr::getFRem(LC, RC); - return Insert(BinaryOperator::createFRem(LHS, RHS, Name)); + return Insert(BinaryOperator::CreateFRem(LHS, RHS, Name)); } Value *CreateShl(Value *LHS, Value *RHS, const char *Name = "") { if (Constant *LC = dyn_cast<Constant>(LHS)) if (Constant *RC = dyn_cast<Constant>(RHS)) return ConstantExpr::getShl(LC, RC); - return Insert(BinaryOperator::createShl(LHS, RHS, Name)); + return Insert(BinaryOperator::CreateShl(LHS, RHS, Name)); } Value *CreateLShr(Value *LHS, Value *RHS, const char *Name = "") { if (Constant *LC = dyn_cast<Constant>(LHS)) if (Constant *RC = dyn_cast<Constant>(RHS)) return ConstantExpr::getLShr(LC, RC); - return Insert(BinaryOperator::createLShr(LHS, RHS, Name)); + return Insert(BinaryOperator::CreateLShr(LHS, RHS, Name)); } Value *CreateAShr(Value *LHS, Value *RHS, const char *Name = "") { if (Constant *LC = dyn_cast<Constant>(LHS)) if (Constant *RC = dyn_cast<Constant>(RHS)) return ConstantExpr::getAShr(LC, RC); - return Insert(BinaryOperator::createAShr(LHS, RHS, Name)); + return Insert(BinaryOperator::CreateAShr(LHS, RHS, Name)); } Value *CreateAnd(Value *LHS, Value *RHS, const char *Name = "") { if (Constant *LC = dyn_cast<Constant>(LHS)) if (Constant *RC = dyn_cast<Constant>(RHS)) return ConstantExpr::getAnd(LC, RC); - return Insert(BinaryOperator::createAnd(LHS, RHS, Name)); + return Insert(BinaryOperator::CreateAnd(LHS, RHS, Name)); } Value *CreateOr(Value *LHS, Value *RHS, const char *Name = "") { if (Constant *LC = dyn_cast<Constant>(LHS)) if (Constant *RC = dyn_cast<Constant>(RHS)) return ConstantExpr::getOr(LC, RC); - return Insert(BinaryOperator::createOr(LHS, RHS, Name)); + return Insert(BinaryOperator::CreateOr(LHS, RHS, Name)); } Value *CreateXor(Value *LHS, Value *RHS, const char *Name = "") { if (Constant *LC = dyn_cast<Constant>(LHS)) if (Constant *RC = dyn_cast<Constant>(RHS)) return ConstantExpr::getXor(LC, RC); - return Insert(BinaryOperator::createXor(LHS, RHS, Name)); + return Insert(BinaryOperator::CreateXor(LHS, RHS, Name)); } BinaryOperator *CreateBinOp(Instruction::BinaryOps Opc, Value *LHS, Value *RHS, const char *Name = "") { - return Insert(BinaryOperator::create(Opc, LHS, RHS, Name)); + return Insert(BinaryOperator::Create(Opc, LHS, RHS, Name)); } BinaryOperator *CreateNeg(Value *V, const char *Name = "") { - return Insert(BinaryOperator::createNeg(V, Name)); + return Insert(BinaryOperator::CreateNeg(V, Name)); } BinaryOperator *CreateNot(Value *V, const char *Name = "") { - return Insert(BinaryOperator::createNot(V, Name)); + return Insert(BinaryOperator::CreateNot(V, Name)); } //===--------------------------------------------------------------------===// @@ -357,7 +357,7 @@ public: return V; if (Constant *VC = dyn_cast<Constant>(V)) return ConstantExpr::getCast(Op, VC, DestTy); - return Insert(CastInst::create(Op, V, DestTy, Name)); + return Insert(CastInst::Create(Op, V, DestTy, Name)); } Value *CreateIntCast(Value *V, const Type *DestTy, bool isSigned, const char *Name = "") { @@ -365,7 +365,7 @@ public: return V; if (Constant *VC = dyn_cast<Constant>(V)) return ConstantExpr::getIntegerCast(VC, DestTy, isSigned); - return Insert(CastInst::createIntegerCast(V, DestTy, isSigned, Name)); + return Insert(CastInst::CreateIntegerCast(V, DestTy, isSigned, Name)); } //===--------------------------------------------------------------------===// diff --git a/lib/Analysis/ScalarEvolutionExpander.cpp b/lib/Analysis/ScalarEvolutionExpander.cpp index 7ef1948b6a..e249421a1f 100644 --- a/lib/Analysis/ScalarEvolutionExpander.cpp +++ b/lib/Analysis/ScalarEvolutionExpander.cpp @@ -40,7 +40,7 @@ Value *SCEVExpander::InsertCastOfTo(Instruction::CastOps opcode, Value *V, return CI; } } - return CastInst::create(opcode, V, Ty, V->getName(), + return CastInst::Create(opcode, V, Ty, V->getName(), A->getParent()->getEntryBlock().begin()); } @@ -67,7 +67,7 @@ Value *SCEVExpander::InsertCastOfTo(Instruction::CastOps opcode, Value *V, if (InvokeInst *II = dyn_cast<InvokeInst>(I)) IP = II->getNormalDest()->begin(); while (isa<PHINode>(IP)) ++IP; - return CastInst::create(opcode, V, Ty, V->getName(), IP); + return CastInst::Create(opcode, V, Ty, V->getName(), IP); } /// InsertBinop - Insert the specified binary operator, doing a small amount @@ -96,7 +96,7 @@ Value *SCEVExpander::InsertBinop(Instruction::BinaryOps Opcode, Value *LHS, } // If we don't have - return BinaryOperator::create(Opcode, LHS, RHS, "tmp", InsertPt); + return BinaryOperator::Create(Opcode, LHS, RHS, "tmp", InsertPt); } Value *SCEVExpander::visitMulExpr(SCEVMulExpr *S) { @@ -155,7 +155,7 @@ Value *SCEVExpander::visitAddRecExpr(SCEVAddRecExpr *S) { // Insert a unit add instruction right before the terminator corresponding // to the back-edge. Constant *One = ConstantInt::get(Ty, 1); - Instruction *Add = BinaryOperator::createAdd(PN, One, "indvar.next", + Instruction *Add = BinaryOperator::CreateAdd(PN, One, "indvar.next", (*HPI)->getTerminator()); pred_iterator PI = pred_begin(Header); diff --git a/lib/AsmParser/llvmAsmParser.y b/lib/AsmParser/llvmAsmParser.y index 90fe540b8d..8c8a3c64ac 100644 --- a/lib/AsmParser/llvmAsmParser.y +++ b/ |