mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-11-01 15:11:24 +00:00
API change for {BinaryOperator|CmpInst|CastInst}::create*() --> Create. Legacy interfaces will be in place for some time. (Merge from use-diet branch.)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@51200 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
446efddfcd
commit
7cbd8a3e92
@ -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
|
||||
|
@ -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);
|
||||
|
@ -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...
|
||||
|
@ -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);
|
||||
|
@ -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) {
|
||||
|
@ -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);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
@ -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));
|
||||
}
|
||||
|
||||
//===--------------------------------------------------------------------===//
|
||||
|
@ -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);
|
||||
|
@ -2852,7 +2852,7 @@ InstVal : ArithmeticOps Types ValueRef ',' ValueRef {
|
||||
CHECK_FOR_ERROR
|
||||
Value* val2 = getVal(*$2, $5);
|
||||
CHECK_FOR_ERROR
|
||||
$$ = BinaryOperator::create($1, val1, val2);
|
||||
$$ = BinaryOperator::Create($1, val1, val2);
|
||||
if ($$ == 0)
|
||||
GEN_ERROR("binary operator returned null");
|
||||
delete $2;
|
||||
@ -2869,7 +2869,7 @@ InstVal : ArithmeticOps Types ValueRef ',' ValueRef {
|
||||
CHECK_FOR_ERROR
|
||||
Value* tmpVal2 = getVal(*$2, $5);
|
||||
CHECK_FOR_ERROR
|
||||
$$ = BinaryOperator::create($1, tmpVal1, tmpVal2);
|
||||
$$ = BinaryOperator::Create($1, tmpVal1, tmpVal2);
|
||||
if ($$ == 0)
|
||||
GEN_ERROR("binary operator returned null");
|
||||
delete $2;
|
||||
@ -2883,7 +2883,7 @@ InstVal : ArithmeticOps Types ValueRef ',' ValueRef {
|
||||
CHECK_FOR_ERROR
|
||||
Value* tmpVal2 = getVal(*$3, $6);
|
||||
CHECK_FOR_ERROR
|
||||
$$ = CmpInst::create($1, $2, tmpVal1, tmpVal2);
|
||||
$$ = CmpInst::Create($1, $2, tmpVal1, tmpVal2);
|
||||
if ($$ == 0)
|
||||
GEN_ERROR("icmp operator returned null");
|
||||
delete $3;
|
||||
@ -2897,7 +2897,7 @@ InstVal : ArithmeticOps Types ValueRef ',' ValueRef {
|
||||
CHECK_FOR_ERROR
|
||||
Value* tmpVal2 = getVal(*$3, $6);
|
||||
CHECK_FOR_ERROR
|
||||
$$ = CmpInst::create($1, $2, tmpVal1, tmpVal2);
|
||||
$$ = CmpInst::Create($1, $2, tmpVal1, tmpVal2);
|
||||
if ($$ == 0)
|
||||
GEN_ERROR("fcmp operator returned null");
|
||||
delete $3;
|
||||
@ -2911,7 +2911,7 @@ InstVal : ArithmeticOps Types ValueRef ',' ValueRef {
|
||||
CHECK_FOR_ERROR
|
||||
Value* tmpVal2 = getVal(*$3, $6);
|
||||
CHECK_FOR_ERROR
|
||||
$$ = CmpInst::create($1, $2, tmpVal1, tmpVal2);
|
||||
$$ = CmpInst::Create($1, $2, tmpVal1, tmpVal2);
|
||||
if ($$ == 0)
|
||||
GEN_ERROR("icmp operator returned null");
|
||||
delete $3;
|
||||
@ -2925,7 +2925,7 @@ InstVal : ArithmeticOps Types ValueRef ',' ValueRef {
|
||||
CHECK_FOR_ERROR
|
||||
Value* tmpVal2 = getVal(*$3, $6);
|
||||
CHECK_FOR_ERROR
|
||||
$$ = CmpInst::create($1, $2, tmpVal1, tmpVal2);
|
||||
$$ = CmpInst::Create($1, $2, tmpVal1, tmpVal2);
|
||||
if ($$ == 0)
|
||||
GEN_ERROR("fcmp operator returned null");
|
||||
delete $3;
|
||||
@ -2939,7 +2939,7 @@ InstVal : ArithmeticOps Types ValueRef ',' ValueRef {
|
||||
GEN_ERROR("invalid cast opcode for cast from '" +
|
||||
Val->getType()->getDescription() + "' to '" +
|
||||
DestTy->getDescription() + "'");
|
||||
$$ = CastInst::create($1, Val, DestTy);
|
||||
$$ = CastInst::Create($1, Val, DestTy);
|
||||
delete $4;
|
||||
}
|
||||
| SELECT ResolvedVal ',' ResolvedVal ',' ResolvedVal {
|
||||
|
@ -1266,7 +1266,7 @@ bool BitcodeReader::ParseFunctionBody(Function *F) {
|
||||
|
||||
int Opc = GetDecodedBinaryOpcode(Record[OpNum], LHS->getType());
|
||||
if (Opc == -1) return Error("Invalid BINOP record");
|
||||
I = BinaryOperator::create((Instruction::BinaryOps)Opc, LHS, RHS);
|
||||
I = BinaryOperator::Create((Instruction::BinaryOps)Opc, LHS, RHS);
|
||||
break;
|
||||
}
|
||||
case bitc::FUNC_CODE_INST_CAST: { // CAST: [opval, opty, destty, castopc]
|
||||
@ -1280,7 +1280,7 @@ bool BitcodeReader::ParseFunctionBody(Function *F) {
|
||||
int Opc = GetDecodedCastOpcode(Record[OpNum+1]);
|
||||
if (Opc == -1 || ResTy == 0)
|
||||
return Error("Invalid CAST record");
|
||||
I = CastInst::create((Instruction::CastOps)Opc, Op, ResTy);
|
||||
I = CastInst::Create((Instruction::CastOps)Opc, Op, ResTy);
|
||||
break;
|
||||
}
|
||||
case bitc::FUNC_CODE_INST_GEP: { // GEP: [n x operands]
|
||||
|
@ -173,76 +173,76 @@ static Value *LowerBSWAP(Value *V, Instruction *IP) {
|
||||
switch(BitSize) {
|
||||
default: assert(0 && "Unhandled type size of value to byteswap!");
|
||||
case 16: {
|
||||
Value *Tmp1 = BinaryOperator::createShl(V,
|
||||
Value *Tmp1 = BinaryOperator::CreateShl(V,
|
||||
ConstantInt::get(V->getType(),8),"bswap.2",IP);
|
||||
Value *Tmp2 = BinaryOperator::createLShr(V,
|
||||
Value *Tmp2 = BinaryOperator::CreateLShr(V,
|
||||
ConstantInt::get(V->getType(),8),"bswap.1",IP);
|
||||
V = BinaryOperator::createOr(Tmp1, Tmp2, "bswap.i16", IP);
|
||||
V = BinaryOperator::CreateOr(Tmp1, Tmp2, "bswap.i16", IP);
|
||||
break;
|
||||
}
|
||||
case 32: {
|
||||
Value *Tmp4 = BinaryOperator::createShl(V,
|
||||
Value *Tmp4 = BinaryOperator::CreateShl(V,
|
||||
ConstantInt::get(V->getType(),24),"bswap.4", IP);
|
||||
Value *Tmp3 = BinaryOperator::createShl(V,
|
||||
Value *Tmp3 = BinaryOperator::CreateShl(V,
|
||||
ConstantInt::get(V->getType(),8),"bswap.3",IP);
|
||||
Value *Tmp2 = BinaryOperator::createLShr(V,
|
||||
Value *Tmp2 = BinaryOperator::CreateLShr(V,
|
||||
ConstantInt::get(V->getType(),8),"bswap.2",IP);
|
||||
Value *Tmp1 = BinaryOperator::createLShr(V,
|
||||
Value *Tmp1 = BinaryOperator::CreateLShr(V,
|
||||
ConstantInt::get(V->getType(),24),"bswap.1", IP);
|
||||
Tmp3 = BinaryOperator::createAnd(Tmp3,
|
||||
Tmp3 = BinaryOperator::CreateAnd(Tmp3,
|
||||
ConstantInt::get(Type::Int32Ty, 0xFF0000),
|
||||
"bswap.and3", IP);
|
||||
Tmp2 = BinaryOperator::createAnd(Tmp2,
|
||||
Tmp2 = BinaryOperator::CreateAnd(Tmp2,
|
||||
ConstantInt::get(Type::Int32Ty, 0xFF00),
|
||||
"bswap.and2", IP);
|
||||
Tmp4 = BinaryOperator::createOr(Tmp4, Tmp3, "bswap.or1", IP);
|
||||
Tmp2 = BinaryOperator::createOr(Tmp2, Tmp1, "bswap.or2", IP);
|
||||
V = BinaryOperator::createOr(Tmp4, Tmp2, "bswap.i32", IP);
|
||||
Tmp4 = BinaryOperator::CreateOr(Tmp4, Tmp3, "bswap.or1", IP);
|
||||
Tmp2 = BinaryOperator::CreateOr(Tmp2, Tmp1, "bswap.or2", IP);
|
||||
V = BinaryOperator::CreateOr(Tmp4, Tmp2, "bswap.i32", IP);
|
||||
break;
|
||||
}
|
||||
case 64: {
|
||||
Value *Tmp8 = BinaryOperator::createShl(V,
|
||||
Value *Tmp8 = BinaryOperator::CreateShl(V,
|
||||
ConstantInt::get(V->getType(),56),"bswap.8", IP);
|
||||
Value *Tmp7 = BinaryOperator::createShl(V,
|
||||
Value *Tmp7 = BinaryOperator::CreateShl(V,
|
||||
ConstantInt::get(V->getType(),40),"bswap.7", IP);
|
||||
Value *Tmp6 = BinaryOperator::createShl(V,
|
||||
Value *Tmp6 = BinaryOperator::CreateShl(V,
|
||||
ConstantInt::get(V->getType(),24),"bswap.6", IP);
|
||||
Value *Tmp5 = BinaryOperator::createShl(V,
|
||||
Value *Tmp5 = BinaryOperator::CreateShl(V,
|
||||
ConstantInt::get(V->getType(),8),"bswap.5", IP);
|
||||
Value* Tmp4 = BinaryOperator::createLShr(V,
|
||||
Value* Tmp4 = BinaryOperator::CreateLShr(V,
|
||||
ConstantInt::get(V->getType(),8),"bswap.4", IP);
|
||||
Value* Tmp3 = BinaryOperator::createLShr(V,
|
||||
Value* Tmp3 = BinaryOperator::CreateLShr(V,
|
||||
ConstantInt::get(V->getType(),24),"bswap.3", IP);
|
||||
Value* Tmp2 = BinaryOperator::createLShr(V,
|
||||
Value* Tmp2 = BinaryOperator::CreateLShr(V,
|
||||
ConstantInt::get(V->getType(),40),"bswap.2", IP);
|
||||
Value* Tmp1 = BinaryOperator::createLShr(V,
|
||||
Value* Tmp1 = BinaryOperator::CreateLShr(V,
|
||||
ConstantInt::get(V->getType(),56),"bswap.1", IP);
|
||||
Tmp7 = BinaryOperator::createAnd(Tmp7,
|
||||
Tmp7 = BinaryOperator::CreateAnd(Tmp7,
|
||||
ConstantInt::get(Type::Int64Ty,
|
||||
0xFF000000000000ULL),
|
||||
"bswap.and7", IP);
|
||||
Tmp6 = BinaryOperator::createAnd(Tmp6,
|
||||
Tmp6 = BinaryOperator::CreateAnd(Tmp6,
|
||||
ConstantInt::get(Type::Int64Ty, 0xFF0000000000ULL),
|
||||
"bswap.and6", IP);
|
||||
Tmp5 = BinaryOperator::createAnd(Tmp5,
|
||||
Tmp5 = BinaryOperator::CreateAnd(Tmp5,
|
||||
ConstantInt::get(Type::Int64Ty, 0xFF00000000ULL),
|
||||
"bswap.and5", IP);
|
||||
Tmp4 = BinaryOperator::createAnd(Tmp4,
|
||||
Tmp4 = BinaryOperator::CreateAnd(Tmp4,
|
||||
ConstantInt::get(Type::Int64Ty, 0xFF000000ULL),
|
||||
"bswap.and4", IP);
|
||||
Tmp3 = BinaryOperator::createAnd(Tmp3,
|
||||
Tmp3 = BinaryOperator::CreateAnd(Tmp3,
|
||||
ConstantInt::get(Type::Int64Ty, 0xFF0000ULL),
|
||||
"bswap.and3", IP);
|
||||
Tmp2 = BinaryOperator::createAnd(Tmp2,
|
||||
Tmp2 = BinaryOperator::CreateAnd(Tmp2,
|
||||
ConstantInt::get(Type::Int64Ty, 0xFF00ULL),
|
||||
"bswap.and2", IP);
|
||||
Tmp8 = BinaryOperator::createOr(Tmp8, Tmp7, "bswap.or1", IP);
|
||||
Tmp6 = BinaryOperator::createOr(Tmp6, Tmp5, "bswap.or2", IP);
|
||||
Tmp4 = BinaryOperator::createOr(Tmp4, Tmp3, "bswap.or3", IP);
|
||||
Tmp2 = BinaryOperator::createOr(Tmp2, Tmp1, "bswap.or4", IP);
|
||||
Tmp8 = BinaryOperator::createOr(Tmp8, Tmp6, "bswap.or5", IP);
|
||||
Tmp4 = BinaryOperator::createOr(Tmp4, Tmp2, "bswap.or6", IP);
|
||||
V = BinaryOperator::createOr(Tmp8, Tmp4, "bswap.i64", IP);
|
||||
Tmp8 = BinaryOperator::CreateOr(Tmp8, Tmp7, "bswap.or1", IP);
|
||||
Tmp6 = BinaryOperator::CreateOr(Tmp6, Tmp5, "bswap.or2", IP);
|
||||
Tmp4 = BinaryOperator::CreateOr(Tmp4, Tmp3, "bswap.or3", IP);
|
||||
Tmp2 = BinaryOperator::CreateOr(Tmp2, Tmp1, "bswap.or4", IP);
|
||||
Tmp8 = BinaryOperator::CreateOr(Tmp8, Tmp6, "bswap.or5", IP);
|
||||
Tmp4 = BinaryOperator::CreateOr(Tmp4, Tmp2, "bswap.or6", IP);
|
||||
V = BinaryOperator::CreateOr(Tmp8, Tmp4, "bswap.i64", IP);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -269,16 +269,16 @@ static Value *LowerCTPOP(Value *V, Instruction *IP) {
|
||||
for (unsigned i = 1, ct = 0; i < (BitSize>64 ? 64 : BitSize);
|
||||
i <<= 1, ++ct) {
|
||||
Value *MaskCst = ConstantInt::get(V->getType(), MaskValues[ct]);
|
||||
Value *LHS = BinaryOperator::createAnd(
|
||||
Value *LHS = BinaryOperator::CreateAnd(
|
||||
PartValue, MaskCst, "cppop.and1", IP);
|
||||
Value *VShift = BinaryOperator::createLShr(PartValue,
|
||||
Value *VShift = BinaryOperator::CreateLShr(PartValue,
|
||||
ConstantInt::get(V->getType(), i), "ctpop.sh", IP);
|
||||
Value *RHS = BinaryOperator::createAnd(VShift, MaskCst, "cppop.and2", IP);
|
||||
PartValue = BinaryOperator::createAdd(LHS, RHS, "ctpop.step", IP);
|
||||
Value *RHS = BinaryOperator::CreateAnd(VShift, MaskCst, "cppop.and2", IP);
|
||||
PartValue = BinaryOperator::CreateAdd(LHS, RHS, "ctpop.step", IP);
|
||||
}
|
||||
Count = BinaryOperator::createAdd(PartValue, Count, "ctpop.part", IP);
|
||||
Count = BinaryOperator::CreateAdd(PartValue, Count, "ctpop.part", IP);
|
||||
if (BitSize > 64) {
|
||||
V = BinaryOperator::createLShr(V, ConstantInt::get(V->getType(), 64),
|
||||
V = BinaryOperator::CreateLShr(V, ConstantInt::get(V->getType(), 64),
|
||||
"ctpop.part.sh", IP);
|
||||
BitSize -= 64;
|
||||
}
|
||||
@ -294,11 +294,11 @@ static Value *LowerCTLZ(Value *V, Instruction *IP) {
|
||||
unsigned BitSize = V->getType()->getPrimitiveSizeInBits();
|
||||
for (unsigned i = 1; i < BitSize; i <<= 1) {
|
||||
Value *ShVal = ConstantInt::get(V->getType(), i);
|
||||
ShVal = BinaryOperator::createLShr(V, ShVal, "ctlz.sh", IP);
|
||||
V = BinaryOperator::createOr(V, ShVal, "ctlz.step", IP);
|
||||
ShVal = BinaryOperator::CreateLShr(V, ShVal, "ctlz.sh", IP);
|
||||
V = BinaryOperator::CreateOr(V, ShVal, "ctlz.step", IP);
|
||||
}
|
||||
|
||||
V = BinaryOperator::createNot(V, "", IP);
|
||||
V = BinaryOperator::CreateNot(V, "", IP);
|
||||
return LowerCTPOP(V, IP);
|
||||
}
|
||||
|
||||
@ -355,10 +355,10 @@ static Instruction *LowerPartSelect(CallInst *CI) {
|
||||
|
||||
// Cast Hi and Lo to the size of Val so the widths are all the same
|
||||
if (Hi->getType() != Val->getType())
|
||||
Hi = CastInst::createIntegerCast(Hi, Val->getType(), false,
|
||||
Hi = CastInst::CreateIntegerCast(Hi, Val->getType(), false,
|
||||
"tmp", CurBB);
|
||||
if (Lo->getType() != Val->getType())
|
||||
Lo = CastInst::createIntegerCast(Lo, Val->getType(), false,
|
||||
Lo = CastInst::CreateIntegerCast(Lo, Val->getType(), false,
|
||||
"tmp", CurBB);
|
||||
|
||||
// Compute a few things that both cases will need, up front.
|
||||
@ -373,12 +373,12 @@ static Instruction *LowerPartSelect(CallInst *CI) {
|
||||
|
||||
// First, copmute the number of bits in the forward case.
|
||||
Instruction* FBitSize =
|
||||
BinaryOperator::createSub(Hi, Lo,"fbits", FwdSize);
|
||||
BinaryOperator::CreateSub(Hi, Lo,"fbits", FwdSize);
|
||||
BranchInst::Create(Compute, FwdSize);
|
||||
|
||||
// Second, compute the number of bits in the reverse case.
|
||||
Instruction* RBitSize =
|
||||
BinaryOperator::createSub(Lo, Hi, "rbits", RevSize);
|
||||
BinaryOperator::CreateSub(Lo, Hi, "rbits", RevSize);
|
||||
BranchInst::Create(Compute, RevSize);
|
||||
|
||||
// Now, compute the bit range. Start by getting the bitsize and the shift
|
||||
@ -402,17 +402,17 @@ static Instruction *LowerPartSelect(CallInst *CI) {
|
||||
|
||||
// Increment the bit size
|
||||
Instruction *BitSizePlusOne =
|
||||
BinaryOperator::createAdd(BitSize, One, "bits", Compute);
|
||||
BinaryOperator::CreateAdd(BitSize, One, "bits", Compute);
|
||||
|
||||
// Create a Mask to zero out the high order bits.
|
||||
Instruction* Mask =
|
||||
BinaryOperator::createShl(AllOnes, BitSizePlusOne, "mask", Compute);
|
||||
Mask = BinaryOperator::createNot(Mask, "mask", Compute);
|
||||
BinaryOperator::CreateShl(AllOnes, BitSizePlusOne, "mask", Compute);
|
||||
Mask = BinaryOperator::CreateNot(Mask, "mask", Compute);
|
||||
|
||||
// Shift the bits down and apply the mask
|
||||
Instruction* FRes =
|
||||
BinaryOperator::createLShr(Val, ShiftAmt, "fres", Compute);
|
||||
FRes = BinaryOperator::createAnd(FRes, Mask, "fres", Compute);
|
||||
BinaryOperator::CreateLShr(Val, ShiftAmt, "fres", Compute);
|
||||
FRes = BinaryOperator::CreateAnd(FRes, Mask, "fres", Compute);
|
||||
BranchInst::Create(Reverse, RsltBlk, Cmp, Compute);
|
||||
|
||||
// In the Reverse block we have the mask already in FRes but we must reverse
|
||||
@ -435,22 +435,22 @@ static Instruction *LowerPartSelect(CallInst *CI) {
|
||||
RRes->addIncoming(Zero, Compute);
|
||||
|
||||
// Decrement the counter
|
||||
Instruction *Decr = BinaryOperator::createSub(Count, One, "decr", Reverse);
|
||||
Instruction *Decr = BinaryOperator::CreateSub(Count, One, "decr", Reverse);
|
||||
Count->addIncoming(Decr, Reverse);
|
||||
|
||||
// Compute the Bit that we want to move
|
||||
Instruction *Bit =
|
||||
BinaryOperator::createAnd(BitsToShift, One, "bit", Reverse);
|
||||
BinaryOperator::CreateAnd(BitsToShift, One, "bit", Reverse);
|
||||
|
||||
// Compute the new value for next iteration.
|
||||
Instruction *NewVal =
|
||||
BinaryOperator::createLShr(BitsToShift, One, "rshift", Reverse);
|
||||
BinaryOperator::CreateLShr(BitsToShift, One, "rshift", Reverse);
|
||||
BitsToShift->addIncoming(NewVal, Reverse);
|
||||
|
||||
// Shift the bit into the low bits of the result.
|
||||
Instruction *NewRes =
|
||||
BinaryOperator::createShl(RRes, One, "lshift", Reverse);
|
||||
NewRes = BinaryOperator::createOr(NewRes, Bit, "addbit", Reverse);
|
||||
BinaryOperator::CreateShl(RRes, One, "lshift", Reverse);
|
||||
NewRes = BinaryOperator::CreateOr(NewRes, Bit, "addbit", Reverse);
|
||||
RRes->addIncoming(NewRes, Reverse);
|
||||
|
||||
// Terminate loop if we've moved all the bits.
|
||||
@ -543,8 +543,8 @@ static Instruction *LowerPartSet(CallInst *CI) {
|
||||
new ICmpInst(ICmpInst::ICMP_ULT, Lo, Hi, "", entry);
|
||||
SelectInst* Hi_pn = SelectInst::Create(is_forward, Hi, Lo, "", entry);
|
||||
SelectInst* Lo_pn = SelectInst::Create(is_forward, Lo, Hi, "", entry);
|
||||
BinaryOperator* NumBits = BinaryOperator::createSub(Hi_pn, Lo_pn, "",entry);
|
||||
NumBits = BinaryOperator::createAdd(NumBits, One, "", entry);
|
||||
BinaryOperator* NumBits = BinaryOperator::CreateSub(Hi_pn, Lo_pn, "",entry);
|
||||
NumBits = BinaryOperator::CreateAdd(NumBits, One, "", entry);
|
||||
// Now, convert Lo and Hi to ValTy bit width
|
||||
if (ValBits > 32) {
|
||||
Lo = new ZExtInst(Lo_pn, ValTy, "", entry);
|
||||
@ -559,12 +559,12 @@ static Instruction *LowerPartSet(CallInst *CI) {
|
||||
|
||||
// BASIC BLOCK: large
|
||||
Instruction* MaskBits =
|
||||
BinaryOperator::createSub(RepBitWidth, NumBits, "", large);
|
||||
MaskBits = CastInst::createIntegerCast(MaskBits, RepMask->getType(),
|
||||
BinaryOperator::CreateSub(RepBitWidth, NumBits, "", large);
|
||||
MaskBits = CastInst::CreateIntegerCast(MaskBits, RepMask->getType(),
|
||||
false, "", large);
|
||||
BinaryOperator* Mask1 =
|
||||
BinaryOperator::createLShr(RepMask, MaskBits, "", large);
|
||||
BinaryOperator* Rep2 = BinaryOperator::createAnd(Mask1, Rep, "", large);
|
||||
BinaryOperator::CreateLShr(RepMask, MaskBits, "", large);
|
||||
BinaryOperator* Rep2 = BinaryOperator::CreateAnd(Mask1, Rep, "", large);
|
||||
BranchInst::Create(small, large);
|
||||
|
||||
// BASIC BLOCK: small
|
||||
@ -598,19 +598,19 @@ static Instruction *LowerPartSet(CallInst *CI) {
|
||||
RRes->addIncoming(ValZero, small);
|
||||
|
||||
// Decrement the loop counter by one
|
||||
Instruction *Decr = BinaryOperator::createSub(Count, One, "", reverse);
|
||||
Instruction *Decr = BinaryOperator::CreateSub(Count, One, "", reverse);
|
||||
Count->addIncoming(Decr, reverse);
|
||||
|
||||
// Get the bit that we want to move into the result
|
||||
Value *Bit = BinaryOperator::createAnd(BitsToShift, ValOne, "", reverse);
|
||||
Value *Bit = BinaryOperator::CreateAnd(BitsToShift, ValOne, "", reverse);
|
||||
|
||||
// Compute the new value of the bits to shift for the next iteration.
|
||||
Value *NewVal = BinaryOperator::createLShr(BitsToShift, ValOne,"", reverse);
|
||||
Value *NewVal = BinaryOperator::CreateLShr(BitsToShift, ValOne,"", reverse);
|
||||
BitsToShift->addIncoming(NewVal, reverse);
|
||||
|
||||
// Shift the bit we extracted into the low bit of the result.
|
||||
Instruction *NewRes = BinaryOperator::createShl(RRes, ValOne, "", reverse);
|
||||
NewRes = BinaryOperator::createOr(NewRes, Bit, "", reverse);
|
||||
Instruction *NewRes = BinaryOperator::CreateShl(RRes, ValOne, "", reverse);
|
||||
NewRes = BinaryOperator::CreateOr(NewRes, Bit, "", reverse);
|
||||
RRes->addIncoming(NewRes, reverse);
|
||||
|
||||
// Terminate loop if we've moved all the bits.
|
||||
@ -622,14 +622,14 @@ static Instruction *LowerPartSet(CallInst *CI) {
|
||||
Rplcmnt->reserveOperandSpace(2);
|
||||
Rplcmnt->addIncoming(NewRes, reverse);
|
||||
Rplcmnt->addIncoming(Rep4, small);
|
||||
Value* t0 = CastInst::createIntegerCast(NumBits,ValTy,false,"",result);
|
||||
Value* t1 = BinaryOperator::createShl(ValMask, Lo, "", result);
|
||||
Value* t2 = BinaryOperator::createNot(t1, "", result);
|
||||
Value* t3 = BinaryOperator::createShl(t1, t0, "", result);
|
||||
Value* t4 = BinaryOperator::createOr(t2, t3, "", result);
|
||||
Value* t5 = BinaryOperator::createAnd(t4, Val, "", result);
|
||||
Value* t6 = BinaryOperator::createShl(Rplcmnt, Lo, "", result);
|
||||
Value* Rslt = BinaryOperator::createOr(t5, t6, "part_set", result);
|
||||
Value* t0 = CastInst::CreateIntegerCast(NumBits,ValTy,false,"",result);
|
||||
Value* t1 = BinaryOperator::CreateShl(ValMask, Lo, "", result);
|
||||
Value* t2 = BinaryOperator::CreateNot(t1, "", result);
|
||||
Value* t3 = BinaryOperator::CreateShl(t1, t0, "", result);
|
||||
Value* t4 = BinaryOperator::CreateOr(t2, t3, "", result);
|
||||
Value* t5 = BinaryOperator::CreateAnd(t4, Val, "", result);
|
||||
Value* t6 = BinaryOperator::CreateShl(Rplcmnt, Lo, "", result);
|
||||
Value* Rslt = BinaryOperator::CreateOr(t5, t6, "part_set", result);
|
||||
ReturnInst::Create(Rslt, result);
|
||||
}
|
||||
|
||||
@ -704,10 +704,10 @@ void IntrinsicLowering::LowerIntrinsicCall(CallInst *CI) {
|
||||
case Intrinsic::cttz: {
|
||||
// cttz(x) -> ctpop(~X & (X-1))
|
||||
Value *Src = CI->getOperand(1);
|
||||
Value *NotSrc = BinaryOperator::createNot(Src, Src->getName()+".not", CI);
|
||||
Value *NotSrc = BinaryOperator::CreateNot(Src, Src->getName()+".not", CI);
|
||||
Value *SrcM1 = ConstantInt::get(Src->getType(), 1);
|
||||
SrcM1 = BinaryOperator::createSub(Src, SrcM1, "", CI);
|
||||
Src = LowerCTPOP(BinaryOperator::createAnd(NotSrc, SrcM1, "", CI), CI);
|
||||
SrcM1 = BinaryOperator::CreateSub(Src, SrcM1, "", CI);
|
||||
Src = LowerCTPOP(BinaryOperator::CreateAnd(NotSrc, SrcM1, "", CI), CI);
|
||||
CI->replaceAllUsesWith(Src);
|
||||
break;
|
||||
}
|
||||
|
@ -1155,7 +1155,7 @@ namespace {
|
||||
case Instruction::Shl:
|
||||
case Instruction::LShr:
|
||||
case Instruction::AShr:{
|
||||
Out << "BinaryOperator* " << iName << " = BinaryOperator::create(";
|
||||
Out << "BinaryOperator* " << iName << " = BinaryOperator::Create(";
|
||||
switch (I->getOpcode()) {
|
||||
case Instruction::Add: Out << "Instruction::Add"; break;
|
||||
case Instruction::Sub: Out << "Instruction::Sub"; break;
|
||||
|
@ -872,7 +872,7 @@ static GlobalVariable *OptimizeGlobalAddressOfMalloc(GlobalVariable *GV,
|
||||
case ICmpInst::ICMP_ULE:
|
||||
case ICmpInst::ICMP_SLE:
|
||||
case ICmpInst::ICMP_EQ:
|
||||
LV = BinaryOperator::createNot(LV, "notinit", CI);
|
||||
LV = BinaryOperator::CreateNot(LV, "notinit", CI);
|
||||
break;
|
||||
case ICmpInst::ICMP_NE:
|
||||
case ICmpInst::ICMP_UGE:
|
||||
@ -1193,7 +1193,7 @@ static GlobalVariable *PerformHeapAllocSRoA(GlobalVariable *GV, MallocInst *MI){
|
||||
if (!RunningOr)
|
||||
RunningOr = Cond; // First seteq
|
||||
else
|
||||
RunningOr = BinaryOperator::createOr(RunningOr, Cond, "tmp", MI);
|
||||
RunningOr = BinaryOperator::CreateOr(RunningOr, Cond, "tmp", MI);
|
||||
}
|
||||
|
||||
// Split the basic block at the old malloc.
|
||||
|
@ -72,7 +72,7 @@ bool IndMemRemPass::runOnModule(Module &M) {
|
||||
GlobalValue::LinkOnceLinkage,
|
||||
"malloc_llvm_bounce", &M);
|
||||
BasicBlock* bb = BasicBlock::Create("entry",FN);
|
||||
Instruction* c = CastInst::createIntegerCast(
|
||||
Instruction* c = CastInst::CreateIntegerCast(
|
||||
FN->arg_begin(), Type::Int32Ty, false, "c", bb);
|
||||
Instruction* a = new MallocInst(Type::Int8Ty, c, "m", bb);
|
||||
ReturnInst::Create(a, bb);
|
||||
|
@ -164,7 +164,7 @@ bool RaiseAllocations::runOnModule(Module &M) {
|
||||
// source size.
|
||||
if (Source->getType() != Type::Int32Ty)
|
||||
Source =
|
||||
CastInst::createIntegerCast(Source, Type::Int32Ty, false/*ZExt*/,
|
||||
CastInst::CreateIntegerCast(Source, Type::Int32Ty, false/*ZExt*/,
|
||||
"MallocAmtCast", I);
|
||||
|
||||
MallocInst *MI = new MallocInst(Type::Int8Ty, Source, "", I);
|
||||
|
@ -68,7 +68,7 @@ void llvm::InsertProfilingInitCall(Function *MainFn, const char *FnName,
|
||||
Instruction::CastOps opcode = CastInst::getCastOpcode(AI, false, ArgVTy,
|
||||
false);
|
||||
InitCall->setOperand(2,
|
||||
CastInst::create(opcode, AI, ArgVTy, "argv.cast", InitCall));
|
||||
CastInst::Create(opcode, AI, ArgVTy, "argv.cast", InitCall));
|
||||
} else {
|
||||
InitCall->setOperand(2, AI);
|
||||
}
|
||||
@ -83,11 +83,11 @@ void llvm::InsertProfilingInitCall(Function *MainFn, const char *FnName,
|
||||
if (!AI->use_empty()) {
|
||||
opcode = CastInst::getCastOpcode(InitCall, true, AI->getType(), true);
|
||||
AI->replaceAllUsesWith(
|
||||
CastInst::create(opcode, InitCall, AI->getType(), "", InsertPos));
|
||||
CastInst::Create(opcode, InitCall, AI->getType(), "", InsertPos));
|
||||
}
|
||||
opcode = CastInst::getCastOpcode(AI, true, Type::Int32Ty, true);
|
||||
InitCall->setOperand(1,
|
||||
CastInst::create(opcode, AI, Type::Int32Ty, "argc.cast", InitCall));
|
||||
CastInst::Create(opcode, AI, Type::Int32Ty, "argc.cast", InitCall));
|
||||
} else {
|
||||
AI->replaceAllUsesWith(InitCall);
|
||||
InitCall->setOperand(1, AI);
|
||||
@ -113,7 +113,7 @@ void llvm::IncrementCounterInBlock(BasicBlock *BB, unsigned CounterNum,
|
||||
|
||||
// Load, increment and store the value back.
|
||||
Value *OldVal = new LoadInst(ElementPtr, "OldFuncCounter", InsertPos);
|
||||
Value *NewVal = BinaryOperator::create(Instruction::Add, OldVal,
|
||||
Value *NewVal = BinaryOperator::Create(Instruction::Add, OldVal,
|
||||
ConstantInt::get(Type::Int32Ty, 1),
|
||||
"NewFuncCounter", InsertPos);
|
||||
new StoreInst(NewVal, ElementPtr, InsertPos);
|
||||
|
@ -215,7 +215,7 @@ void GlobalRandomCounter::ProcessChoicePoint(BasicBlock* bb) {
|
||||
ICmpInst* s = new ICmpInst(ICmpInst::ICMP_EQ, l, ConstantInt::get(T, 0),
|
||||
"countercc", t);
|
||||
|
||||
Value* nv = BinaryOperator::createSub(l, ConstantInt::get(T, 1),
|
||||
Value* nv = BinaryOperator::CreateSub(l, ConstantInt::get(T, 1),
|
||||
"counternew", t);
|
||||
new StoreInst(nv, Counter, t);
|
||||
t->setCondition(s);
|
||||
@ -290,7 +290,7 @@ void GlobalRandomCounterOpt::ProcessChoicePoint(BasicBlock* bb) {
|
||||
ICmpInst* s = new ICmpInst(ICmpInst::ICMP_EQ, l, ConstantInt::get(T, 0),
|
||||
"countercc", t);
|
||||
|
||||
Value* nv = BinaryOperator::createSub(l, ConstantInt::get(T, 1),
|
||||
Value* nv = BinaryOperator::CreateSub(l, ConstantInt::get(T, 1),
|
||||
"counternew", t);
|
||||
new StoreInst(nv, AI, t);
|
||||
t->setCondition(s);
|
||||
@ -319,7 +319,7 @@ void CycleCounter::ProcessChoicePoint(BasicBlock* bb) {
|
||||
|
||||
CallInst* c = CallInst::Create(F, "rdcc", t);
|
||||
BinaryOperator* b =
|
||||
BinaryOperator::createAnd(c, ConstantInt::get(Type::Int64Ty, rm),
|
||||
BinaryOperator::CreateAnd(c, ConstantInt::get(Type::Int64Ty, rm),
|
||||
"mrdcc", t);
|
||||
|
||||
ICmpInst *s = new ICmpInst(ICmpInst::ICMP_EQ, b,
|
||||
@ -357,7 +357,7 @@ void RSProfilers_std::IncrementCounterInBlock(BasicBlock *BB, unsigned CounterNu
|
||||
// Load, increment and store the value back.
|
||||
Value *OldVal = new LoadInst(ElementPtr, "OldCounter", InsertPos);
|
||||
profcode.insert(OldVal);
|
||||
Value *NewVal = BinaryOperator::createAdd(OldVal,
|
||||
Value *NewVal = BinaryOperator::CreateAdd(OldVal,
|
||||
ConstantInt::get(Type::Int32Ty, 1),
|
||||
"NewCounter", InsertPos);
|
||||
profcode.insert(NewVal);
|
||||
|
@ -389,7 +389,7 @@ static bool OptimizeNoopCopyExpression(CastInst *CI, const TargetLowering &TLI){
|
||||
while (isa<PHINode>(InsertPt)) ++InsertPt;
|
||||
|
||||
InsertedCast =
|
||||
CastInst::create(CI->getOpcode(), CI->getOperand(0), CI->getType(), "",
|
||||
CastInst::Create(CI->getOpcode(), CI->getOperand(0), CI->getType(), "",
|
||||
InsertPt);
|
||||
MadeChange = true;
|
||||
}
|
||||
@ -447,7 +447,7 @@ static bool OptimizeCmpExpression(CmpInst *CI){
|
||||
while (isa<PHINode>(InsertPt)) ++InsertPt;
|
||||
|
||||
InsertedCmp =
|
||||
CmpInst::create(CI->getOpcode(), CI->getPredicate(), CI->getOperand(0),
|
||||
CmpInst::Create(CI->getOpcode(), CI->getPredicate(), CI->getOperand(0),
|
||||
CI->getOperand(1), "", InsertPt);
|
||||
MadeChange = true;
|
||||
}
|
||||
@ -880,7 +880,7 @@ bool CodeGenPrepare::OptimizeLoadStoreInst(Instruction *LdStInst, Value *Addr,
|
||||
V = new SExtInst(V, IntPtrTy, "sunkaddr", InsertPt);
|
||||
}
|
||||
if (AddrMode.Scale != 1)
|
||||
V = BinaryOperator::createMul(V, ConstantInt::get(IntPtrTy,
|
||||
V = BinaryOperator::CreateMul(V, ConstantInt::get(IntPtrTy,
|
||||
AddrMode.Scale),
|
||||
"sunkaddr", InsertPt);
|
||||
Result = V;
|
||||
@ -892,7 +892,7 @@ bool CodeGenPrepare::OptimizeLoadStoreInst(Instruction *LdStInst, Value *Addr,
|
||||
if (V->getType() != IntPtrTy)
|
||||
V = new PtrToIntInst(V, IntPtrTy, "sunkaddr", InsertPt);
|
||||
if (Result)
|
||||
Result = BinaryOperator::createAdd(Result, V, "sunkaddr", InsertPt);
|
||||
Result = BinaryOperator::CreateAdd(Result, V, "sunkaddr", InsertPt);
|
||||
else
|
||||
Result = V;
|
||||
}
|
||||
@ -902,7 +902,7 @@ bool CodeGenPrepare::OptimizeLoadStoreInst(Instruction *LdStInst, Value *Addr,
|
||||
Value *V = new PtrToIntInst(AddrMode.BaseGV, IntPtrTy, "sunkaddr",
|
||||
InsertPt);
|
||||
if (Result)
|
||||
Result = BinaryOperator::createAdd(Result, V, "sunkaddr", InsertPt);
|
||||
Result = BinaryOperator::CreateAdd(Result, V, "sunkaddr", InsertPt);
|
||||
else
|
||||
Result = V;
|
||||
}
|
||||
@ -911,7 +911,7 @@ bool CodeGenPrepare::OptimizeLoadStoreInst(Instruction *LdStInst, Value *Addr,
|
||||
if (AddrMode.BaseOffs) {
|
||||
Value *V = ConstantInt::get(IntPtrTy, AddrMode.BaseOffs);
|
||||
if (Result)
|
||||
Result = BinaryOperator::createAdd(Result, V, "sunkaddr", InsertPt);
|
||||
Result = BinaryOperator::CreateAdd(Result, V, "sunkaddr", InsertPt);
|
||||
else
|
||||
Result = V;
|
||||
}
|
||||
|
@ -804,7 +804,7 @@ Value* GVNPRE::phi_translate(Value* V, BasicBlock* pred, BasicBlock* succ) {
|
||||
if (newOp1 != U->getOperand(0)) {
|
||||
Instruction* newVal = 0;
|
||||
if (CastInst* C = dyn_cast<CastInst>(U))
|
||||
newVal = CastInst::create(C->getOpcode(),
|
||||
newVal = CastInst::Create(C->getOpcode(),
|
||||
newOp1, C->getType(),
|
||||
C->getName()+".expr");
|
||||
|
||||
@ -847,11 +847,11 @@ Value* GVNPRE::phi_translate(Value* V, BasicBlock* pred, BasicBlock* succ) {
|
||||
if (newOp1 != U->getOperand(0) || newOp2 != U->getOperand(1)) {
|
||||
Instruction* newVal = 0;
|
||||
if (BinaryOperator* BO = dyn_cast<BinaryOperator>(U))
|
||||
newVal = BinaryOperator::create(BO->getOpcode(),
|
||||
newVal = BinaryOperator::Create(BO->getOpcode(),
|
||||
newOp1, newOp2,
|
||||
BO->getName()+".expr");
|
||||
else if (CmpInst* C = dyn_cast<CmpInst>(U))
|
||||
newVal = CmpInst::create(C->getOpcode(),
|
||||
newVal = CmpInst::Create(C->getOpcode(),
|
||||
C->getPredicate(),
|
||||
newOp1, newOp2,
|
||||
C->getName()+".expr");
|
||||
@ -1665,11 +1665,11 @@ void GVNPRE::insertion_pre(Value* e, BasicBlock* BB,
|
||||
|
||||
Value* newVal = 0;
|
||||
if (BinaryOperator* BO = dyn_cast<BinaryOperator>(U))
|
||||
newVal = BinaryOperator::create(BO->getOpcode(), s1, s2,
|
||||
newVal = BinaryOperator::Create(BO->getOpcode(), s1, s2,
|
||||
BO->getName()+".gvnpre",
|
||||
(*PI)->getTerminator());
|
||||
else if (CmpInst* C = dyn_cast<CmpInst>(U))
|
||||
newVal = CmpInst::create(C->getOpcode(), C->getPredicate(), s1, s2,
|
||||
newVal = CmpInst::Create(C->getOpcode(), C->getPredicate(), s1, s2,
|
||||
C->getName()+".gvnpre",
|
||||
(*PI)->getTerminator());
|
||||
else if (ShuffleVectorInst* S = dyn_cast<ShuffleVectorInst>(U))
|
||||
@ -1685,7 +1685,7 @@ void GVNPRE::insertion_pre(Value* e, BasicBlock* BB,
|
||||
newVal = SelectInst::Create(s1, s2, s3, S->getName()+".gvnpre",
|
||||
(*PI)->getTerminator());
|
||||
else if (CastInst* C = dyn_cast<CastInst>(U))
|
||||
newVal = CastInst::create(C->getOpcode(), s1, C->getType(),
|
||||
newVal = CastInst::Create(C->getOpcode(), s1, C->getType(),
|
||||
C->getName()+".gvnpre",
|
||||
(*PI)->getTerminator());
|
||||
else if (GetElementPtrInst* G = dyn_cast<GetElementPtrInst>(U))
|
||||
|
@ -151,7 +151,7 @@ void IndVarSimplify::EliminatePointerRecurrence(PHINode *PN,
|
||||
NewPhi->addIncoming(Constant::getNullValue(NewPhi->getType()), Preheader);
|
||||
|
||||
// Create the new add instruction.
|
||||
Value *NewAdd = BinaryOperator::createAdd(NewPhi, AddedVal,
|
||||
Value *NewAdd = BinaryOperator::CreateAdd(NewPhi, AddedVal,
|
||||
GEPI->getName()+".rec", GEPI);
|
||||
NewPhi->addIncoming(NewAdd, PN->getIncomingBlock(BackedgeIdx));
|
||||
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -581,7 +581,7 @@ bool LoopIndexSplit::processOneIterationLoop(SplitInfo &SD) {
|
||||
ICmpInst::ICMP_SLT : ICmpInst::ICMP_ULT,
|
||||
SD.SplitValue, ExitValue, "lisplit",
|
||||
Terminator);
|
||||
Instruction *NSplitCond = BinaryOperator::createAnd(C1, C2, "lisplit",
|
||||
Instruction *NSplitCond = BinaryOperator::CreateAnd(C1, C2, "lisplit",
|
||||
Terminator);
|
||||
SD.SplitCondition->replaceAllUsesWith(NSplitCond);
|
||||
SD.SplitCondition->eraseFromParent();
|
||||
@ -769,7 +769,7 @@ void LoopIndexSplit::updateLoopBounds(ICmpInst *CI) {
|
||||
//
|
||||
if (ExitCondition->getPredicate() == ICmpInst::ICMP_SLT
|
||||
|| ExitCondition->getPredicate() == ICmpInst::ICMP_ULT) {
|
||||
Value *A = BinaryOperator::createAdd(NV, ConstantInt::get(Ty, 1, Sign),
|
||||
Value *A = BinaryOperator::CreateAdd(NV, ConstantInt::get(Ty, 1, Sign),
|
||||
"lsplit.add", PHTerminator);
|
||||
Value *C = new ICmpInst(Sign ? ICmpInst::ICMP_SLT : ICmpInst::ICMP_ULT,
|
||||
A, UB,"lsplit,c", PHTerminator);
|
||||
@ -821,7 +821,7 @@ void LoopIndexSplit::updateLoopBounds(ICmpInst *CI) {
|
||||
//
|
||||
else if (ExitCondition->getPredicate() == ICmpInst::ICMP_SLE
|
||||
|| ExitCondition->getPredicate() == ICmpInst::ICMP_ULE) {
|
||||
Value *S = BinaryOperator::createSub(NV, ConstantInt::get(Ty, 1, Sign),
|
||||
Value *S = BinaryOperator::CreateSub(NV, ConstantInt::get(Ty, 1, Sign),
|
||||
"lsplit.add", PHTerminator);
|
||||
Value *C = new ICmpInst(Sign ? ICmpInst::ICMP_SLT : ICmpInst::ICMP_ULT,
|
||||
S, UB, "lsplit.c", PHTerminator);
|
||||
@ -857,7 +857,7 @@ void LoopIndexSplit::updateLoopBounds(ICmpInst *CI) {
|
||||
// LOOP_BODY
|
||||
//
|
||||
{
|
||||
Value *A = BinaryOperator::createAdd(NV, ConstantInt::get(Ty, 1, Sign),
|
||||
Value *A = BinaryOperator::CreateAdd(NV, ConstantInt::get(Ty, 1, Sign),
|
||||
"lsplit.add", PHTerminator);
|
||||
Value *C = new ICmpInst(Sign ? ICmpInst::ICMP_SLT : ICmpInst::ICMP_ULT,
|
||||
A, StartValue, "lsplit.c", PHTerminator);
|
||||
@ -1213,7 +1213,7 @@ void LoopIndexSplit::calculateLoopBounds(SplitInfo &SD) {
|
||||
// A;
|
||||
// for (i = max(LB, BSV); i < UB; ++i)
|
||||
// B;
|
||||
BSV = BinaryOperator::createAdd(SD.SplitValue,
|
||||
BSV = BinaryOperator::CreateAdd(SD.SplitValue,
|
||||
ConstantInt::get(Ty, 1, Sign),
|
||||
"lsplit.add", PHTerminator);
|
||||
AEV = BSV;
|
||||
@ -1244,7 +1244,7 @@ void LoopIndexSplit::calculateLoopBounds(SplitInfo &SD) {
|
||||
// B;
|
||||
// for (i = max(LB, BSV); i < UB; ++i)
|
||||
// A;
|
||||
BSV = BinaryOperator::createAdd(SD.SplitValue,
|
||||
BSV = BinaryOperator::CreateAdd(SD.SplitValue,
|
||||
ConstantInt::get(Ty, 1, Sign),
|
||||
"lsplit.add", PHTerminator);
|
||||
AEV = BSV;
|
||||
@ -1272,7 +1272,7 @@ void LoopIndexSplit::calculateLoopBounds(SplitInfo &SD) {
|
||||
// A;
|
||||
// for (i = max(LB, BSV); i <= UB; ++i)
|
||||
// B;
|
||||
AEV = BinaryOperator::createSub(SD.SplitValue,
|
||||
AEV = BinaryOperator::CreateSub(SD.SplitValue,
|
||||
ConstantInt::get(Ty, 1, Sign),
|
||||
"lsplit.sub", PHTerminator);
|
||||
break;
|
||||
@ -1288,7 +1288,7 @@ void LoopIndexSplit::calculateLoopBounds(SplitInfo &SD) {
|
||||
// A;
|
||||
// for (i = max(LB, BSV); i <= UB; ++i)
|
||||
// B;
|
||||
BSV = BinaryOperator::createAdd(SD.SplitValue,
|
||||
BSV = BinaryOperator::CreateAdd(SD.SplitValue,
|
||||
ConstantInt::get(Ty, 1, Sign),
|
||||
"lsplit.add", PHTerminator);
|
||||
break;
|
||||
@ -1304,7 +1304,7 @@ void LoopIndexSplit::calculateLoopBounds(SplitInfo &SD) {
|
||||
// B;
|
||||
// for (i = max(LB, BSV); i <= UB; ++i)
|
||||
// A;
|
||||
BSV = BinaryOperator::createAdd(SD.SplitValue,
|
||||
BSV = BinaryOperator::CreateAdd(SD.SplitValue,
|
||||
ConstantInt::get(Ty, 1, Sign),
|
||||
"lsplit.add", PHTerminator);
|
||||
break;
|
||||
@ -1321,7 +1321,7 @@ void LoopIndexSplit::calculateLoopBounds(SplitInfo &SD) {
|
||||
// B;
|
||||
// for (i = max(LB, BSV); i <= UB; ++i)
|
||||
// A;
|
||||
AEV = BinaryOperator::createSub(SD.SplitValue,
|
||||
AEV = BinaryOperator::CreateSub(SD.SplitValue,
|
||||
ConstantInt::get(Ty, 1, Sign),
|
||||
"lsplit.sub", PHTerminator);
|
||||
break;
|
||||
|
@ -583,7 +583,7 @@ bool MemCpyOpt::performCallSlotOptzn(MemCpyInst *cpy, CallInst *C) {
|
||||
for (unsigned i = 0; i < CS.arg_size(); ++i)
|
||||
if (CS.getArgument(i) == cpySrc) {
|
||||
if (cpySrc->getType() != cpyDest->getType())
|
||||
cpyDest = CastInst::createPointerCast(cpyDest, cpySrc->getType(),
|
||||
cpyDest = CastInst::CreatePointerCast(cpyDest, cpySrc->getType(),
|
||||
cpyDest->getName(), C);
|
||||
CS.setArgument(i, cpyDest);
|
||||
}
|
||||
|
@ -194,7 +194,7 @@ static BinaryOperator *isReassociableOp(Value *V, unsigned Opcode) {
|
||||
static Instruction *LowerNegateToMultiply(Instruction *Neg) {
|
||||
Constant *Cst = ConstantInt::getAllOnesValue(Neg->getType());
|
||||
|
||||
Instruction *Res = BinaryOperator::createMul(Neg->getOperand(1), Cst, "",Neg);
|
||||
Instruction *Res = BinaryOperator::CreateMul(Neg->getOperand(1), Cst, "",Neg);
|
||||
Res->takeName(Neg);
|
||||
Neg->replaceAllUsesWith(Res);
|
||||
Neg->eraseFromParent();
|
||||
@ -389,7 +389,7 @@ static Value *NegateValue(Value *V, Instruction *BI) {
|
||||
// Insert a 'neg' instruction that subtracts the value from zero to get the
|
||||
// negation.
|
||||
//
|
||||
return BinaryOperator::createNeg(V, V->getName() + ".neg", BI);
|
||||
return BinaryOperator::CreateNeg(V, V->getName() + ".neg", BI);
|
||||
}
|
||||
|
||||
/// ShouldBreakUpSubtract - Return true if we should break up this subtract of
|
||||
@ -427,7 +427,7 @@ static Instruction *BreakUpSubtract(Instruction *Sub) {
|
||||
//
|
||||
Value *NegVal = NegateValue(Sub->getOperand(1), Sub);
|
||||
Instruction *New =
|
||||
BinaryOperator::createAdd(Sub->getOperand(0), NegVal, "", Sub);
|
||||
BinaryOperator::CreateAdd(Sub->getOperand(0), NegVal, "", Sub);
|
||||
New->takeName(Sub);
|
||||
|
||||
// Everyone now refers to the add instruction.
|
||||
@ -451,7 +451,7 @@ static Instruction *ConvertShiftToMul(Instruction *Shl) {
|
||||
Constant *MulCst = ConstantInt::get(Shl->getType(), 1);
|
||||
MulCst = ConstantExpr::getShl(MulCst, cast<Constant>(Shl->getOperand(1)));
|
||||
|
||||
Instruction *Mul = BinaryOperator::createMul(Shl->getOperand(0), MulCst,
|
||||
Instruction *Mul = BinaryOperator::CreateMul(Shl->getOperand(0), MulCst,
|
||||
"", Shl);
|
||||
Mul->takeName(Shl);
|
||||
Shl->replaceAllUsesWith(Mul);
|
||||
@ -485,7 +485,7 @@ static Value *EmitAddTreeOfValues(Instruction *I, std::vector<Value*> &Ops) {
|
||||
Value *V1 = Ops.back();
|
||||
Ops.pop_back();
|
||||
Value *V2 = EmitAddTreeOfValues(I, Ops);
|
||||
return BinaryOperator::createAdd(V2, V1, "tmp", I);
|
||||
return BinaryOperator::CreateAdd(V2, V1, "tmp", I);
|
||||
}
|
||||
|
||||
/// RemoveFactorFromExpression - If V is an expression tree that is a
|
||||
@ -714,7 +714,7 @@ Value *Reassociate::OptimizeExpression(BinaryOperator *I,
|
||||
// this, we could otherwise run into situations where removing a factor
|
||||
// from an expression will drop a use of maxocc, and this can cause
|
||||
// RemoveFactorFromExpression on successive values to behave differently.
|
||||
Instruction *DummyInst = BinaryOperator::createAdd(MaxOccVal, MaxOccVal);
|
||||
Instruction *DummyInst = BinaryOperator::CreateAdd(MaxOccVal, MaxOccVal);
|
||||
std::vector<Value*> NewMulOps;
|
||||
for (unsigned i = 0, e = Ops.size(); i != e; ++i) {
|
||||
if (Value *V = RemoveFactorFromExpression(Ops[i].Op, MaxOccVal)) {
|
||||
@ -729,7 +729,7 @@ Value *Reassociate::OptimizeExpression(BinaryOperator *I,
|
||||
|
||||
unsigned NumAddedValues = NewMulOps.size();
|
||||
Value *V = EmitAddTreeOfValues(I, NewMulOps);
|
||||
Value *V2 = BinaryOperator::createMul(V, MaxOccVal, "tmp", I);
|
||||
Value *V2 = BinaryOperator::CreateMul(V, MaxOccVal, "tmp", I);
|
||||
|
||||
// Now that we have inserted V and its sole use, optimize it. This allows
|
||||
// us to handle cases that require multiple factoring steps, such as this:
|
||||
|
@ -67,7 +67,7 @@ namespace {
|
||||
while (isa<AllocaInst>(I)) ++I;
|
||||
|
||||
CastInst *AllocaInsertionPoint =
|
||||
CastInst::create(Instruction::BitCast,
|
||||
CastInst::Create(Instruction::BitCast,
|
||||
Constant::getNullValue(Type::Int32Ty), Type::Int32Ty,
|
||||
"reg2mem alloca point", I);
|
||||
|
||||
|
@ -1204,11 +1204,11 @@ Value *SROA::ConvertUsesOfLoadToScalar(LoadInst *LI, AllocaInst *NewAI,
|
||||
// We do this to support (f.e.) loads off the end of a structure where
|
||||
// only some bits are used.
|
||||
if (ShAmt > 0 && (unsigned)ShAmt < NTy->getBitWidth())
|
||||
NV = BinaryOperator::createLShr(NV,
|
||||
NV = BinaryOperator::CreateLShr(NV,
|
||||
ConstantInt::get(NV->getType(),ShAmt),
|
||||
LI->getName(), LI);
|
||||
else if (ShAmt < 0 && (unsigned)-ShAmt < NTy->getBitWidth())
|
||||
NV = BinaryOperator::createShl(NV,
|
||||
NV = BinaryOperator::CreateShl(NV,
|
||||
ConstantInt::get(NV->getType(),-ShAmt),
|
||||
LI->getName(), LI);
|
||||
|
||||
@ -1308,12 +1308,12 @@ Value *SROA::ConvertUsesOfStoreToScalar(StoreInst *SI, AllocaInst *NewAI,
|
||||
// only some bits in the structure are set.
|
||||
APInt Mask(APInt::getLowBitsSet(DestWidth, SrcWidth));
|
||||
if (ShAmt > 0 && (unsigned)ShAmt < DestWidth) {
|
||||
SV = BinaryOperator::createShl(SV,
|
||||
SV = BinaryOperator::CreateShl(SV,
|
||||
ConstantInt::get(SV->getType(), ShAmt),
|
||||
SV->getName(), SI);
|
||||
Mask <<= ShAmt;
|
||||
} else if (ShAmt < 0 && (unsigned)-ShAmt < DestWidth) {
|
||||
SV = BinaryOperator::createLShr(SV,
|
||||
SV = BinaryOperator::CreateLShr(SV,
|
||||
ConstantInt::get(SV->getType(),-ShAmt),
|
||||
SV->getName(), SI);
|
||||
Mask = Mask.lshr(ShAmt);
|
||||
@ -1323,9 +1323,9 @@ Value *SROA::ConvertUsesOfStoreToScalar(StoreInst *SI, AllocaInst *NewAI,
|
||||
// in the new bits.
|
||||
if (SrcWidth != DestWidth) {
|
||||
assert(DestWidth > SrcWidth);
|
||||
Old = BinaryOperator::createAnd(Old, ConstantInt::get(~Mask),
|
||||
Old = BinaryOperator::CreateAnd(Old, ConstantInt::get(~Mask),
|
||||
Old->getName()+".mask", SI);
|
||||
SV = BinaryOperator::createOr(Old, SV, SV->getName()+".ins", SI);
|
||||
SV = BinaryOperator::CreateOr(Old, SV, SV->getName()+".ins", SI);
|
||||
}
|
||||
}
|
||||
return SV;
|
||||
|
@ -131,11 +131,11 @@ bool LowerAllocations::runOnBasicBlock(BasicBlock &BB) {
|
||||
} else {
|
||||
Value *Scale = MI->getOperand(0);
|
||||
if (Scale->getType() != IntPtrTy)
|
||||
Scale = CastInst::createIntegerCast(Scale, IntPtrTy, false /*ZExt*/,
|
||||
Scale = CastInst::CreateIntegerCast(Scale, IntPtrTy, false /*ZExt*/,
|
||||
"", I);
|
||||
|
||||
// Multiply it by the array size if necessary...
|
||||
MallocArg = BinaryOperator::create(Instruction::Mul, Scale,
|
||||
MallocArg = BinaryOperator::Create(Instruction::Mul, Scale,
|
||||
MallocArg, "", I);
|
||||
}
|
||||
}
|
||||
|
@ -202,7 +202,7 @@ BasicBlock* LowerSwitch::newLeafBlock(CaseRange& Leaf, Value* Val,
|
||||
} else {
|
||||
// Emit V-Lo <=u Hi-Lo
|
||||
Constant* NegLo = ConstantExpr::getNeg(Leaf.Low);
|
||||
Instruction* Add = BinaryOperator::createAdd(Val, NegLo,
|
||||
Instruction* Add = BinaryOperator::CreateAdd(Val, NegLo,
|
||||
Val->getName()+".off",
|
||||
NewLeaf);
|
||||
Constant *UpperBound = ConstantExpr::getAdd(NegLo, Leaf.High);
|
||||
|
@ -1513,7 +1513,7 @@ bool llvm::SimplifyCFG(BasicBlock *BB) {
|
||||
// Invert the predecessors condition test (xor it with true),
|
||||
// which allows us to write this code once.
|
||||
Value *NewCond =
|
||||
BinaryOperator::createNot(PBI->getCondition(),
|
||||
BinaryOperator::CreateNot(PBI->getCondition(),
|
||||
PBI->getCondition()->getName()+".not", PBI);
|
||||
PBI->setCondition(NewCond);
|
||||
BasicBlock *OldTrue = PBI->getSuccessor(0);
|
||||
@ -1534,7 +1534,7 @@ bool llvm::SimplifyCFG(BasicBlock *BB) {
|
||||
PBI->getSuccessor(0) == TrueDest ?
|
||||
Instruction::Or : Instruction::And;
|
||||
Value *NewCond =
|
||||
BinaryOperator::create(Opcode, PBI->getCondition(),
|
||||
BinaryOperator::Create(Opcode, PBI->getCondition(),
|
||||
New, "bothcond", PBI);
|
||||
PBI->setCondition(NewCond);
|
||||
if (PBI->getSuccessor(0) == BB) {
|
||||
@ -1656,17 +1656,17 @@ bool llvm::SimplifyCFG(BasicBlock *BB) {
|
||||
// Make sure we get to CommonDest on True&True directions.
|
||||
Value *PBICond = PBI->getCondition();
|
||||
if (PBIOp)
|
||||
PBICond = BinaryOperator::createNot(PBICond,
|
||||
PBICond = BinaryOperator::CreateNot(PBICond,
|
||||
PBICond->getName()+".not",
|
||||
PBI);
|
||||
Value *BICond = BI->getCondition();
|
||||
if (BIOp)
|
||||
BICond = BinaryOperator::createNot(BICond,
|
||||
BICond = BinaryOperator::CreateNot(BICond,
|
||||
BICond->getName()+".not",
|
||||
PBI);
|
||||
// Merge the conditions.
|
||||
Value *Cond =
|
||||
BinaryOperator::createOr(PBICond, BICond, "brmerge", PBI);
|
||||
BinaryOperator::CreateOr(PBICond, BICond, "brmerge", PBI);
|
||||
|
||||
// Modify PBI to branch on the new condition to the new dests.
|
||||
PBI->setCondition(Cond);
|
||||
|
@ -272,7 +272,7 @@ void llvm::UpgradeIntrinsicCall(CallInst *CI, Function *NewFn) {
|
||||
bool DestSExt = F->getParamAttrs().paramHasAttr(0, ParamAttr::SExt);
|
||||
|
||||
// Construct an appropriate cast from the new return type to the old.
|
||||
CastInst *RetCast = CastInst::create(
|
||||
CastInst *RetCast = CastInst::Create(
|
||||
CastInst::getCastOpcode(NewCI, SrcSExt,
|
||||
F->getReturnType(),
|
||||
DestSExt),
|
||||
|
@ -1450,7 +1450,7 @@ void BinaryOperator::init(BinaryOps iType) {
|
||||
#endif
|
||||
}
|
||||
|
||||
BinaryOperator *BinaryOperator::create(BinaryOps Op, Value *S1, Value *S2,
|
||||
BinaryOperator *BinaryOperator::Create(BinaryOps Op, Value *S1, Value *S2,
|
||||
const std::string &Name,
|
||||
Instruction *InsertBefore) {
|
||||
assert(S1->getType() == S2->getType() &&
|
||||
@ -1458,15 +1458,15 @@ BinaryOperator *BinaryOperator::create(BinaryOps Op, Value *S1, Value *S2,
|
||||
return new BinaryOperator(Op, S1, S2, S1->getType(), Name, InsertBefore);
|
||||
}
|
||||
|
||||
BinaryOperator *BinaryOperator::create(BinaryOps Op, Value *S1, Value *S2,
|
||||
BinaryOperator *BinaryOperator::Create(BinaryOps Op, Value *S1, Value *S2,
|
||||
const std::string &Name,
|
||||
BasicBlock *InsertAtEnd) {
|
||||
BinaryOperator *Res = create(Op, S1, S2, Name);
|
||||
BinaryOperator *Res = Create(Op, S1, S2, Name);
|
||||
InsertAtEnd->getInstList().push_back(Res);
|
||||
return Res;
|
||||
}
|
||||
|
||||
BinaryOperator *BinaryOperator::createNeg(Value *Op, const std::string &Name,
|
||||
BinaryOperator *BinaryOperator::CreateNeg(Value *Op, const std::string &Name,
|
||||
Instruction *InsertBefore) {
|
||||
Value *zero = ConstantExpr::getZeroValueForNegationExpr(Op->getType());
|
||||
return new BinaryOperator(Instruction::Sub,
|
||||
@ -1474,7 +1474,7 @@ BinaryOperator *BinaryOperator::createNeg(Value *Op, const std::string &Name,
|
||||
Op->getType(), Name, InsertBefore);
|
||||
}
|
||||
|
||||
BinaryOperator *BinaryOperator::createNeg(Value *Op, const std::string &Name,
|
||||
BinaryOperator *BinaryOperator::CreateNeg(Value *Op, const std::string &Name,
|
||||
BasicBlock *InsertAtEnd) {
|
||||
Value *zero = ConstantExpr::getZeroValueForNegationExpr(Op->getType());
|
||||
return new BinaryOperator(Instruction::Sub,
|
||||
@ -1482,7 +1482,7 @@ BinaryOperator *BinaryOperator::createNeg(Value *Op, const std::string &Name,
|
||||
Op->getType(), Name, InsertAtEnd);
|
||||
}
|
||||
|
||||
BinaryOperator *BinaryOperator::createNot(Value *Op, const std::string &Name,
|
||||
BinaryOperator *BinaryOperator::CreateNot(Value *Op, const std::string &Name,
|
||||
Instruction *InsertBefore) {
|
||||
Constant *C;
|
||||
if (const VectorType *PTy = dyn_cast<VectorType>(Op->getType())) {
|
||||
@ -1496,7 +1496,7 @@ BinaryOperator *BinaryOperator::createNot(Value *Op, const std::string &Name,
|
||||
Op->getType(), Name, InsertBefore);
|
||||
}
|
||||
|
||||
BinaryOperator *BinaryOperator::createNot(Value *Op, const std::string &Name,
|
||||
BinaryOperator *BinaryOperator::CreateNot(Value *Op, const std::string &Name,
|
||||
BasicBlock *InsertAtEnd) {
|
||||
Constant *AllOnes;
|
||||
if (const VectorType *PTy = dyn_cast<VectorType>(Op->getType())) {
|
||||
@ -1801,7 +1801,7 @@ unsigned CastInst::isEliminableCastPair(
|
||||
return 0;
|
||||
}
|
||||
|
||||
CastInst *CastInst::create(Instruction::CastOps op, Value *S, const Type *Ty,
|
||||
CastInst *CastInst::Create(Instruction::CastOps op, Value *S, const Type *Ty,
|
||||
const std::string &Name, Instruction *InsertBefore) {
|
||||
// Construct and return the appropriate CastInst subclass
|
||||
switch (op) {
|
||||
@ -1823,7 +1823,7 @@ CastInst *CastInst::create(Instruction::CastOps op, Value *S, const Type *Ty,
|
||||
return 0;
|
||||
}
|
||||
|
||||
CastInst *CastInst::create(Instruction::CastOps op, Value *S, const Type *Ty,
|
||||
CastInst *CastInst::Create(Instruction::CastOps op, Value *S, const Type *Ty,
|
||||
const std::string &Name, BasicBlock *InsertAtEnd) {
|
||||
// Construct and return the appropriate CastInst subclass
|
||||
switch (op) {
|
||||
@ -1845,55 +1845,55 @@ CastInst *CastInst::create(Instruction::CastOps op, Value *S, const Type *Ty,
|
||||
return 0;
|
||||
}
|
||||
|
||||
CastInst *CastInst::createZExtOrBitCast(Value *S, const Type *Ty,
|
||||
CastInst *CastInst::CreateZExtOrBitCast(Value *S, const Type *Ty,
|
||||
const std::string &Name,
|
||||
Instruction *InsertBefore) {
|
||||
if (S->getType()->getPrimitiveSizeInBits() == Ty->getPrimitiveSizeInBits())
|
||||
return create(Instruction::BitCast, S, Ty, Name, InsertBefore);
|
||||
return create(Instruction::ZExt, S, Ty, Name, InsertBefore);
|
||||
return Create(Instruction::BitCast, S, Ty, Name, InsertBefore);
|
||||
return Create(Instruction::ZExt, S, Ty, Name, InsertBefore);
|
||||
}
|
||||
|
||||
CastInst *CastInst::createZExtOrBitCast(Value *S, const Type *Ty,
|
||||
CastInst *CastInst::CreateZExtOrBitCast(Value *S, const Type *Ty,
|
||||
const std::string &Name,
|
||||
BasicBlock *InsertAtEnd) {
|
||||
if (S->getType()->getPrimitiveSizeInBits() == Ty->getPrimitiveSizeInBits())
|
||||
return create(Instruction::BitCast, S, Ty, Name, InsertAtEnd);
|
||||
return create(Instruction::ZExt, S, Ty, Name, InsertAtEnd);
|
||||
return Create(Instruction::BitCast, S, Ty, Name, InsertAtEnd);
|
||||
return Create(Instruction::ZExt, S, Ty, Name, InsertAtEnd);
|
||||
}
|
||||
|
||||
CastInst *CastInst::createSExtOrBitCast(Value *S, const Type *Ty,
|
||||
CastInst *CastInst::CreateSExtOrBitCast(Value *S, const Type *Ty,
|
||||
const std::string &Name,
|
||||
Instruction *InsertBefore) {
|
||||
if (S->getType()->getPrimitiveSizeInBits() == Ty->getPrimitiveSizeInBits())
|
||||
return create(Instruction::BitCast, S, Ty, Name, InsertBefore);
|
||||
return create(Instruction::SExt, S, Ty, Name, InsertBefore);
|
||||
return Create(Instruction::BitCast, S, Ty, Name, InsertBefore);
|
||||
return Create(Instruction::SExt, S, Ty, Name, InsertBefore);
|
||||
}
|
||||
|
||||
CastInst *CastInst::createSExtOrBitCast(Value *S, const Type *Ty,
|
||||
CastInst *CastInst::CreateSExtOrBitCast(Value *S, const Type *Ty,
|
||||
const std::string &Name,
|
||||
BasicBlock *InsertAtEnd) {
|
||||
if (S->getType()->getPrimitiveSizeInBits() == Ty->getPrimitiveSizeInBits())
|
||||
return create(Instruction::BitCast, S, Ty, Name, InsertAtEnd);
|
||||
return create(Instruction::SExt, S, Ty, Name, InsertAtEnd);
|
||||
return Create(Instruction::BitCast, S, Ty, Name, InsertAtEnd);
|
||||
return Create(Instruction::SExt, S, Ty, Name, InsertAtEnd);
|
||||
}
|
||||
|
||||
CastInst *CastInst::createTruncOrBitCast(Value *S, const Type *Ty,
|
||||
CastInst *CastInst::CreateTruncOrBitCast(Value *S, const Type *Ty,
|
||||
const std::string &Name,
|
||||
Instruction *InsertBefore) {
|
||||
if (S->getType()->getPrimitiveSizeInBits() == Ty->getPrimitiveSizeInBits())
|
||||
return create(Instruction::BitCast, S, Ty, Name, InsertBefore);
|
||||
return create(Instruction::Trunc, S, Ty, Name, InsertBefore);
|
||||
return Create(Instruction::BitCast, S, Ty, Name, InsertBefore);
|
||||
return Create(Instruction::Trunc, S, Ty, Name, InsertBefore);
|
||||
}
|
||||
|
||||
CastInst *CastInst::createTruncOrBitCast(Value *S, const Type *Ty,
|
||||
CastInst *CastInst::CreateTruncOrBitCast(Value *S, const Type *Ty,
|
||||
const std::string &Name,
|
||||
BasicBlock *InsertAtEnd) {
|
||||
if (S->getType()->getPrimitiveSizeInBits() == Ty->getPrimitiveSizeInBits())
|
||||
return create(Instruction::BitCast, S, Ty, Name, InsertAtEnd);
|
||||
return create(Instruction::Trunc, S, Ty, Name, InsertAtEnd);
|
||||
return Create(Instruction::BitCast, S, Ty, Name, InsertAtEnd);
|
||||
return Create(Instruction::Trunc, S, Ty, Name, InsertAtEnd);
|
||||
}
|
||||
|
||||
CastInst *CastInst::createPointerCast(Value *S, const Type *Ty,
|
||||
CastInst *CastInst::CreatePointerCast(Value *S, const Type *Ty,
|
||||
const std::string &Name,
|
||||
BasicBlock *InsertAtEnd) {
|
||||
assert(isa<PointerType>(S->getType()) && "Invalid cast");
|
||||
@ -1901,12 +1901,12 @@ CastInst *CastInst::createPointerCast(Value *S, const Type *Ty,
|
||||
"Invalid cast");
|
||||
|
||||
if (Ty->isInteger())
|
||||
return create(Instruction::PtrToInt, S, Ty, Name, InsertAtEnd);
|
||||
return create(Instruction::BitCast, S, Ty, Name, InsertAtEnd);
|
||||
return Create(Instruction::PtrToInt, S, Ty, Name, InsertAtEnd);
|
||||
return Create(Instruction::BitCast, S, Ty, Name, InsertAtEnd);
|
||||
}
|
||||
|
||||
/// @brief Create a BitCast or a PtrToInt cast instruction
|
||||
CastInst *CastInst::createPointerCast(Value *S, const Type *Ty,
|
||||
CastInst *CastInst::CreatePointerCast(Value *S, const Type *Ty,
|
||||
const std::string &Name,
|
||||
Instruction *InsertBefore) {
|
||||
assert(isa<PointerType>(S->getType()) && "Invalid cast");
|
||||
@ -1914,11 +1914,11 @@ CastInst *CastInst::createPointerCast(Value *S, const Type *Ty,
|
||||
"Invalid cast");
|
||||
|
||||
if (Ty->isInteger())
|
||||
return create(Instruction::PtrToInt, S, Ty, Name, InsertBefore);
|
||||
return create(Instruction::BitCast, S, Ty, Name, InsertBefore);
|
||||
return Create(Instruction::PtrToInt, S, Ty, Name, InsertBefore);
|
||||
return Create(Instruction::BitCast, S, Ty, Name, InsertBefore);
|
||||
}
|
||||
|
||||
CastInst *CastInst::createIntegerCast(Value *C, const Type *Ty,
|
||||
CastInst *CastInst::CreateIntegerCast(Value *C, const Type *Ty,
|
||||
bool isSigned, const std::string &Name,
|
||||
Instruction *InsertBefore) {
|
||||
assert(C->getType()->isInteger() && Ty->isInteger() && "Invalid cast");
|
||||
@ -1928,10 +1928,10 @@ CastInst *CastInst::createIntegerCast(Value *C, const Type *Ty,
|
||||
(SrcBits == DstBits ? Instruction::BitCast :
|
||||
(SrcBits > DstBits ? Instruction::Trunc :
|
||||
(isSigned ? Instruction::SExt : Instruction::ZExt)));
|
||||
return create(opcode, C, Ty, Name, InsertBefore);
|
||||
return Create(opcode, C, Ty, Name, InsertBefore);
|
||||
}
|
||||
|
||||
CastInst *CastInst::createIntegerCast(Value *C, const Type *Ty,
|
||||
CastInst *CastInst::CreateIntegerCast(Value *C, const Type *Ty,
|
||||
bool isSigned, const std::string &Name,
|
||||
BasicBlock *InsertAtEnd) {
|
||||
assert(C->getType()->isInteger() && Ty->isInteger() && "Invalid cast");
|
||||
@ -1941,10 +1941,10 @@ CastInst *CastInst::createIntegerCast(Value *C, const Type *Ty,
|
||||
(SrcBits == DstBits ? Instruction::BitCast :
|
||||
(SrcBits > DstBits ? Instruction::Trunc :
|
||||
(isSigned ? Instruction::SExt : Instruction::ZExt)));
|
||||
return create(opcode, C, Ty, Name, InsertAtEnd);
|
||||
return Create(opcode, C, Ty, Name, InsertAtEnd);
|
||||
}
|
||||
|
||||
CastInst *CastInst::createFPCast(Value *C, const Type *Ty,
|
||||
CastInst *CastInst::CreateFPCast(Value *C, const Type *Ty,
|
||||
const std::string &Name,
|
||||
Instruction *InsertBefore) {
|
||||
assert(C->getType()->isFloatingPoint() && Ty->isFloatingPoint() &&
|
||||
@ -1954,10 +1954,10 @@ CastInst *CastInst::createFPCast(Value *C, const Type *Ty,
|
||||
Instruction::CastOps opcode =
|
||||
(SrcBits == DstBits ? Instruction::BitCast :
|
||||
(SrcBits > DstBits ? Instruction::FPTrunc : Instruction::FPExt));
|
||||
return create(opcode, C, Ty, Name, InsertBefore);
|
||||
return Create(opcode, C, Ty, Name, InsertBefore);
|
||||
}
|
||||
|
||||
CastInst *CastInst::createFPCast(Value *C, const Type *Ty,
|
||||
CastInst *CastInst::CreateFPCast(Value *C, const Type *Ty,
|
||||
const std::string &Name,
|
||||
BasicBlock *InsertAtEnd) {
|
||||
assert(C->getType()->isFloatingPoint() && Ty->isFloatingPoint() &&
|
||||
@ -1967,7 +1967,7 @@ CastInst *CastInst::createFPCast(Value *C, const Type *Ty,
|
||||
Instruction::CastOps opcode =
|
||||
(SrcBits == DstBits ? Instruction::BitCast :
|
||||
(SrcBits > DstBits ? Instruction::FPTrunc : Instruction::FPExt));
|
||||
return create(opcode, C, Ty, Name, InsertAtEnd);
|
||||
return Create(opcode, C, Ty, Name, InsertAtEnd);
|
||||
}
|
||||
|
||||
// Check whether it is valid to call getCastOpcode for these types.
|
||||
@ -2367,7 +2367,7 @@ CmpInst::CmpInst(const Type *ty, OtherOps op, unsigned short predicate,
|
||||
}
|
||||
|
||||
CmpInst *
|
||||
CmpInst::create(OtherOps Op, unsigned short predicate, Value *S1, Value *S2,
|
||||
CmpInst::Create(OtherOps Op, unsigned short predicate, Value *S1, Value *S2,
|
||||
const std::string &Name, Instruction *InsertBefore) {
|
||||
if (Op == Instruction::ICmp) {
|
||||
return new ICmpInst(CmpInst::Predicate(predicate), S1, S2, Name,
|
||||
@ -2386,7 +2386,7 @@ CmpInst::create(OtherOps Op, unsigned short predicate, Value *S1, Value *S2,
|
||||
}
|
||||
|
||||
CmpInst *
|
||||
CmpInst::create(OtherOps Op, unsigned short predicate, Value *S1, Value *S2,
|
||||
CmpInst::Create(OtherOps Op, unsigned short predicate, Value *S1, Value *S2,
|
||||
const std::string &Name, BasicBlock *InsertAtEnd) {
|
||||
if (Op == Instruction::ICmp) {
|
||||
return new ICmpInst(CmpInst::Predicate(predicate), S1, S2, Name,
|
||||
@ -2780,7 +2780,7 @@ GetElementPtrInst *GetElementPtrInst::clone() const {
|
||||
}
|
||||
|
||||
BinaryOperator *BinaryOperator::clone() const {
|
||||
return create(getOpcode(), Op<0>(), Op<1>());
|
||||
return Create(getOpcode(), Op<0>(), Op<1>());
|
||||
}
|
||||
|
||||
FCmpInst* FCmpInst::clone() const {
|
||||
|
Loading…
Reference in New Issue
Block a user