22 #ifndef LLVM_IR_NOFOLDER_H
23 #define LLVM_IR_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 {
216 Type *DestTy)
const {
223 bool isSigned)
const {
231 return CreateCast(Instruction::BitCast, C, DestTy);
234 return CreateCast(Instruction::IntToPtr, C, DestTy);
237 return CreateCast(Instruction::PtrToInt, C, DestTy);
void setHasNoSignedWrap(bool b=true)
Set or clear the nsw flag on this instruction, which must be an operator which supports this flag...
Instruction * CreateNUWMul(Constant *LHS, Constant *RHS) const
static BinaryOperator * CreateNot(Value *Op, const Twine &Name="", Instruction *InsertBefore=nullptr)
Instruction * CreateNUWSub(Constant *LHS, Constant *RHS) const
Instruction * CreateICmp(CmpInst::Predicate P, Constant *LHS, Constant *RHS) const
Instruction * CreateIntToPtr(Constant *C, Type *DestTy) const
Instruction * CreateSDiv(Constant *LHS, Constant *RHS, bool isExact=false) const
static Constant * getGetElementPtr(Type *Ty, Constant *C, ArrayRef< Constant * > IdxList, bool InBounds=false, Type *OnlyIfReducedTy=nullptr)
Getelementptr form.
ShuffleVectorInst - This instruction constructs a fixed permutation of two input vectors.
Instruction * CreateNSWSub(Constant *LHS, Constant *RHS) const
Instruction * CreateBitCast(Constant *C, Type *DestTy) const
static InsertElementInst * Create(Value *Vec, Value *NewElt, Value *Idx, const Twine &NameStr="", Instruction *InsertBefore=nullptr)
Instruction * CreateInBoundsGetElementPtr(Type *Ty, Constant *C, ArrayRef< Value * > IdxList) const
Constant * CreateGetElementPtr(Type *Ty, Constant *C, Constant *Idx) const
void setHasNoUnsignedWrap(bool b=true)
Set or clear the nsw flag on this instruction, which must be an operator which supports this flag...
Instruction * CreateInsertElement(Constant *Vec, Constant *NewElt, Constant *Idx) const
Instruction * CreateNSWNeg(Constant *C) const
Instruction * CreateFRem(Constant *LHS, Constant *RHS) const
static GetElementPtrInst * CreateInBounds(Value *Ptr, ArrayRef< Value * > IdxList, const Twine &NameStr="", Instruction *InsertBefore=nullptr)
Create an "inbounds" getelementptr.
Constant * CreateInBoundsGetElementPtr(Type *Ty, Constant *C, ArrayRef< Constant * > IdxList) const
static SelectInst * Create(Value *C, Value *S1, Value *S2, const Twine &NameStr="", Instruction *InsertBefore=nullptr)
Instruction * CreateCast(Instruction::CastOps Op, Constant *C, Type *DestTy) const
Instruction * CreateExactUDiv(Constant *LHS, Constant *RHS) const
This instruction compares its operands according to the predicate given to the constructor.
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory)...
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
static BinaryOperator * CreateAdd(Value *S1, Value *S2, const Twine &Name, Instruction *InsertBefore, Value *FlagsOp)
NoFolder - Create "constants" (actually, instructions) with no folding.
Instruction * CreateFPCast(Constant *C, Type *DestTy) const
Instruction * CreateNUWNeg(Constant *C) const
Instruction * CreateInsertValue(Constant *Agg, Constant *Val, ArrayRef< unsigned > IdxList) const
static BinaryOperator * CreateNSWNeg(Value *Op, const Twine &Name="", Instruction *InsertBefore=nullptr)
Instruction * CreateNSWMul(Constant *LHS, Constant *RHS) const
static Constant * getInBoundsGetElementPtr(Type *Ty, Constant *C, ArrayRef< Constant * > IdxList)
Create an "inbounds" getelementptr.
The instances of the Type class are immutable: once they are created, they are never changed...
Instruction * CreateNot(Constant *C) const
This is an important base class in LLVM.
This file contains the declarations for the subclasses of Constant, which represent the different fla...
Instruction * CreateOr(Constant *LHS, Constant *RHS) const
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
This instruction compares its operands according to the predicate given to the constructor.
Predicate
This enumeration lists the possible predicates for CmpInst subclasses.
static CastInst * CreatePointerCast(Value *S, Type *Ty, const Twine &Name, BasicBlock *InsertAtEnd)
Create a BitCast AddrSpaceCast, or a PtrToInt cast instruction.
NUW NUW NUW NUW Exact static Exact BinaryOperator * CreateNeg(Value *Op, const Twine &Name="", Instruction *InsertBefore=nullptr)
Helper functions to construct and inspect unary operations (NEG and NOT) via binary operators SUB and...
Instruction * CreateSRem(Constant *LHS, Constant *RHS) const
Instruction * CreateAdd(Constant *LHS, Constant *RHS, bool HasNUW=false, bool HasNSW=false) const
static CastInst * CreateZExtOrBitCast(Value *S, Type *Ty, const Twine &Name="", Instruction *InsertBefore=nullptr)
Create a ZExt or BitCast cast instruction.
static GetElementPtrInst * Create(Type *PointeeType, Value *Ptr, ArrayRef< Value * > IdxList, const Twine &NameStr="", Instruction *InsertBefore=nullptr)
static BinaryOperator * CreateNUWNeg(Value *Op, const Twine &Name="", Instruction *InsertBefore=nullptr)
static BinaryOperator * CreateFNeg(Value *Op, const Twine &Name="", Instruction *InsertBefore=nullptr)
Instruction * CreateTruncOrBitCast(Constant *C, Type *DestTy) const
static CastInst * CreateIntegerCast(Value *S, Type *Ty, bool isSigned, const Twine &Name="", Instruction *InsertBefore=nullptr)
Create a ZExt, BitCast, or Trunc for int -> int casts.
Instruction * CreateExactSDiv(Constant *LHS, Constant *RHS) const
Instruction * CreateUDiv(Constant *LHS, Constant *RHS, bool isExact=false) const
static CastInst * CreateFPCast(Value *S, Type *Ty, const Twine &Name="", Instruction *InsertBefore=nullptr)
Create an FPExt, BitCast, or FPTrunc for fp -> fp casts.
Instruction * CreatePtrToInt(Constant *C, Type *DestTy) const
Constant * CreateInBoundsGetElementPtr(Type *Ty, Constant *C, Constant *Idx) const
Instruction * CreateIntCast(Constant *C, Type *DestTy, bool isSigned) const
Instruction * CreateLShr(Constant *LHS, Constant *RHS, bool isExact=false) const
static BinaryOperator * Create(BinaryOps Op, Value *S1, Value *S2, const Twine &Name=Twine(), Instruction *InsertBefore=nullptr)
Construct a binary instruction, given the opcode and the two operands.
Instruction * CreateZExtOrBitCast(Constant *C, Type *DestTy) const
Instruction * CreateNUWAdd(Constant *LHS, Constant *RHS) const
Instruction * CreateFAdd(Constant *LHS, Constant *RHS) const
static CastInst * Create(Instruction::CastOps, Value *S, Type *Ty, const Twine &Name="", Instruction *InsertBefore=nullptr)
Provides a way to construct any of the CastInst subclasses using an opcode instead of the subclass's ...
Constant * CreateGetElementPtr(Type *Ty, Constant *C, ArrayRef< Constant * > IdxList) const
static CastInst * CreateTruncOrBitCast(Value *S, Type *Ty, const Twine &Name="", Instruction *InsertBefore=nullptr)
Create a Trunc or BitCast cast instruction.
Instruction * CreateBinOp(Instruction::BinaryOps Opc, Constant *LHS, Constant *RHS) const
Instruction * CreateFNeg(Constant *C) const
static InsertValueInst * Create(Value *Agg, Value *Val, ArrayRef< unsigned > Idxs, const Twine &NameStr="", Instruction *InsertBefore=nullptr)
Instruction * CreateGetElementPtr(Type *Ty, Constant *C, ArrayRef< Value * > IdxList) const
Instruction * CreateMul(Constant *LHS, Constant *RHS, bool HasNUW=false, bool HasNSW=false) const
Instruction * CreateXor(Constant *LHS, Constant *RHS) const
static CastInst * CreateSExtOrBitCast(Value *S, Type *Ty, const Twine &Name="", Instruction *InsertBefore=nullptr)
Create a SExt or BitCast cast instruction.
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
Instruction * CreateExtractValue(Constant *Agg, ArrayRef< unsigned > IdxList) const
Instruction * CreateFDiv(Constant *LHS, Constant *RHS) const
static BinaryOperator * CreateMul(Value *S1, Value *S2, const Twine &Name, Instruction *InsertBefore, Value *FlagsOp)
Instruction * CreateSelect(Constant *C, Constant *True, Constant *False) const
Instruction * CreateExtractElement(Constant *Vec, Constant *Idx) const