22 #ifndef LLVM_SUPPORT_NOFOLDER_H
23 #define LLVM_SUPPORT_NOFOLDER_H
41 bool HasNUW =
false,
bool HasNSW =
false)
const {
48 return BinaryOperator::CreateNSWAdd(LHS, RHS);
51 return BinaryOperator::CreateNUWAdd(LHS, RHS);
54 return BinaryOperator::CreateFAdd(LHS, RHS);
57 bool HasNUW =
false,
bool HasNSW =
false)
const {
64 return BinaryOperator::CreateNSWSub(LHS, RHS);
67 return BinaryOperator::CreateNUWSub(LHS, RHS);
70 return BinaryOperator::CreateFSub(LHS, RHS);
73 bool HasNUW =
false,
bool HasNSW =
false)
const {
80 return BinaryOperator::CreateNSWMul(LHS, RHS);
83 return BinaryOperator::CreateNUWMul(LHS, RHS);
86 return BinaryOperator::CreateFMul(LHS, RHS);
89 bool isExact =
false)
const {
91 return BinaryOperator::CreateUDiv(LHS, RHS);
92 return BinaryOperator::CreateExactUDiv(LHS, RHS);
95 return BinaryOperator::CreateExactUDiv(LHS, RHS);
98 bool isExact =
false)
const {
100 return BinaryOperator::CreateSDiv(LHS, RHS);
101 return BinaryOperator::CreateExactSDiv(LHS, RHS);
104 return BinaryOperator::CreateExactSDiv(LHS, RHS);
107 return BinaryOperator::CreateFDiv(LHS, RHS);
110 return BinaryOperator::CreateURem(LHS, RHS);
113 return BinaryOperator::CreateSRem(LHS, RHS);
116 return BinaryOperator::CreateFRem(LHS, RHS);
119 bool HasNSW =
false)
const {
126 bool isExact =
false)
const {
128 return BinaryOperator::CreateLShr(LHS, RHS);
129 return BinaryOperator::CreateExactLShr(LHS, RHS);
132 bool isExact =
false)
const {
134 return BinaryOperator::CreateAShr(LHS, RHS);
135 return BinaryOperator::CreateExactAShr(LHS, RHS);
138 return BinaryOperator::CreateAnd(LHS, RHS);
141 return BinaryOperator::CreateOr(LHS, RHS);
144 return BinaryOperator::CreateXor(LHS, RHS);
157 bool HasNUW =
false,
bool HasNSW =
false)
const {
215 Type *DestTy)
const {
222 bool isSigned)
const {
230 return CreateCast(Instruction::BitCast, C, DestTy);
233 return CreateCast(Instruction::IntToPtr, C, DestTy);
236 return CreateCast(Instruction::PtrToInt, C, DestTy);
void setHasNoSignedWrap(bool b=true)
Instruction * CreateNUWMul(Constant *LHS, Constant *RHS) const
Constant * CreateGetElementPtr(Constant *C, ArrayRef< Constant * > IdxList) const
Instruction * CreateNUWSub(Constant *LHS, Constant *RHS) const
Instruction * CreateICmp(CmpInst::Predicate P, Constant *LHS, Constant *RHS) const
static SelectInst * Create(Value *C, Value *S1, Value *S2, const Twine &NameStr="", Instruction *InsertBefore=0)
static Constant * getGetElementPtr(Constant *C, ArrayRef< Constant * > IdxList, bool InBounds=false)
Constant * CreateGetElementPtr(Constant *C, Constant *Idx) const
Instruction * CreateIntToPtr(Constant *C, Type *DestTy) const
Instruction * CreateSDiv(Constant *LHS, Constant *RHS, bool isExact=false) const
Instruction * CreateNSWSub(Constant *LHS, Constant *RHS) const
Instruction * CreateBitCast(Constant *C, Type *DestTy) const
static BinaryOperator * CreateNUWNeg(Value *Op, const Twine &Name="", Instruction *InsertBefore=0)
void setHasNoUnsignedWrap(bool b=true)
static CastInst * CreateTruncOrBitCast(Value *S, Type *Ty, const Twine &Name="", Instruction *InsertBefore=0)
Create a Trunc or BitCast cast instruction.
Instruction * CreateInsertElement(Constant *Vec, Constant *NewElt, Constant *Idx) const
Instruction * CreateNSWNeg(Constant *C) const
Instruction * CreateFRem(Constant *LHS, Constant *RHS) const
Instruction * CreateCast(Instruction::CastOps Op, Constant *C, Type *DestTy) const
Instruction * CreateExactUDiv(Constant *LHS, Constant *RHS) const
Represents a floating point comparison operator.
Instruction * CreateAShr(Constant *LHS, Constant *RHS, bool isExact=false) const
Instruction * CreateFSub(Constant *LHS, Constant *RHS) const
Instruction * CreateFCmp(CmpInst::Predicate P, Constant *LHS, Constant *RHS) const
NoFolder - Create "constants" (actually, instructions) with no folding.
static CastInst * Create(Instruction::CastOps, Value *S, Type *Ty, const Twine &Name="", Instruction *InsertBefore=0)
Construct any of the CastInst subclasses.
Instruction * CreateFPCast(Constant *C, Type *DestTy) const
Instruction * CreateNUWNeg(Constant *C) const
Instruction * CreateInsertValue(Constant *Agg, Constant *Val, ArrayRef< unsigned > IdxList) const
Instruction * CreateNSWMul(Constant *LHS, Constant *RHS) const
static InsertElementInst * Create(Value *Vec, Value *NewElt, Value *Idx, const Twine &NameStr="", Instruction *InsertBefore=0)
Instruction * CreateNot(Constant *C) const
LLVM Constant Representation.
Instruction * CreateOr(Constant *LHS, Constant *RHS) const
static CastInst * CreateFPCast(Value *S, Type *Ty, const Twine &Name="", Instruction *InsertBefore=0)
Create an FPExt, BitCast, or FPTrunc for fp -> fp casts.
Instruction * CreateNSWAdd(Constant *LHS, Constant *RHS) const
Instruction * CreateAnd(Constant *LHS, Constant *RHS) const
Instruction * CreatePointerCast(Constant *C, Type *DestTy) const
Instruction * CreateShuffleVector(Constant *V1, Constant *V2, Constant *Mask) const
Represent an integer comparison operator.
NUW NUW NUW NUW Exact static Exact BinaryOperator * CreateNeg(Value *Op, const Twine &Name="", Instruction *InsertBefore=0)
static CastInst * CreatePointerCast(Value *S, Type *Ty, const Twine &Name, BasicBlock *InsertAtEnd)
Create a BitCast or a PtrToInt cast instruction.
Instruction * CreateGetElementPtr(Constant *C, ArrayRef< Value * > IdxList) const
Instruction * CreateSRem(Constant *LHS, Constant *RHS) const
static CastInst * CreateZExtOrBitCast(Value *S, Type *Ty, const Twine &Name="", Instruction *InsertBefore=0)
Create a ZExt or BitCast cast instruction.
Instruction * CreateAdd(Constant *LHS, Constant *RHS, bool HasNUW=false, bool HasNSW=false) const
static CastInst * CreateSExtOrBitCast(Value *S, Type *Ty, const Twine &Name="", Instruction *InsertBefore=0)
Create a SExt or BitCast cast instruction.
Instruction * CreateTruncOrBitCast(Constant *C, Type *DestTy) const
Instruction * CreateExactSDiv(Constant *LHS, Constant *RHS) const
Instruction * CreateUDiv(Constant *LHS, Constant *RHS, bool isExact=false) const
Instruction * CreatePtrToInt(Constant *C, Type *DestTy) const
Instruction * CreateIntCast(Constant *C, Type *DestTy, bool isSigned) const
static GetElementPtrInst * Create(Value *Ptr, ArrayRef< Value * > IdxList, const Twine &NameStr="", Instruction *InsertBefore=0)
Instruction * CreateLShr(Constant *LHS, Constant *RHS, bool isExact=false) const
Instruction * CreateZExtOrBitCast(Constant *C, Type *DestTy) const
static CastInst * CreateIntegerCast(Value *S, Type *Ty, bool isSigned, const Twine &Name="", Instruction *InsertBefore=0)
Create a ZExt, BitCast, or Trunc for int -> int casts.
Instruction * CreateNUWAdd(Constant *LHS, Constant *RHS) const
Instruction * CreateFAdd(Constant *LHS, Constant *RHS) const
Instruction * CreateInBoundsGetElementPtr(Constant *C, ArrayRef< Value * > IdxList) const
static InsertValueInst * Create(Value *Agg, Value *Val, ArrayRef< unsigned > Idxs, const Twine &NameStr="", Instruction *InsertBefore=0)
static Constant * getInBoundsGetElementPtr(Constant *C, ArrayRef< Constant * > IdxList)
Instruction * CreateBinOp(Instruction::BinaryOps Opc, Constant *LHS, Constant *RHS) const
Instruction * CreateFNeg(Constant *C) const
Instruction * CreateMul(Constant *LHS, Constant *RHS, bool HasNUW=false, bool HasNSW=false) const
static BinaryOperator * Create(BinaryOps Op, Value *S1, Value *S2, const Twine &Name=Twine(), Instruction *InsertBefore=0)
Instruction * CreateXor(Constant *LHS, Constant *RHS) const
Constant * CreateInBoundsGetElementPtr(Constant *C, Constant *Idx) const
Instruction * CreateNeg(Constant *C, bool HasNUW=false, bool HasNSW=false) const
Instruction * CreateURem(Constant *LHS, Constant *RHS) const
Instruction * CreateFMul(Constant *LHS, Constant *RHS) const
Instruction * CreateShl(Constant *LHS, Constant *RHS, bool HasNUW=false, bool HasNSW=false) const
Instruction * CreateSExtOrBitCast(Constant *C, Type *DestTy) const
Instruction * CreateSub(Constant *LHS, Constant *RHS, bool HasNUW=false, bool HasNSW=false) const
Constant * CreateInBoundsGetElementPtr(Constant *C, ArrayRef< Constant * > IdxList) const
Instruction * CreateExtractValue(Constant *Agg, ArrayRef< unsigned > IdxList) const
static BinaryOperator * CreateFNeg(Value *Op, const Twine &Name="", Instruction *InsertBefore=0)
Instruction * CreateFDiv(Constant *LHS, Constant *RHS) const
static GetElementPtrInst * CreateInBounds(Value *Ptr, ArrayRef< Value * > IdxList, const Twine &NameStr="", Instruction *InsertBefore=0)
static BinaryOperator * CreateNSWNeg(Value *Op, const Twine &Name="", Instruction *InsertBefore=0)
static BinaryOperator * CreateNot(Value *Op, const Twine &Name="", Instruction *InsertBefore=0)
Instruction * CreateSelect(Constant *C, Constant *True, Constant *False) const
Instruction * CreateExtractElement(Constant *Vec, Constant *Idx) const