22 #ifndef LLVM_IR_NOFOLDER_H
23 #define LLVM_IR_NOFOLDER_H
43 bool HasNUW =
false,
bool HasNSW =
false)
const {
51 return BinaryOperator::CreateNSWAdd(LHS, RHS);
55 return BinaryOperator::CreateNUWAdd(LHS, RHS);
59 return BinaryOperator::CreateFAdd(LHS, RHS);
63 bool HasNUW =
false,
bool HasNSW =
false)
const {
71 return BinaryOperator::CreateNSWSub(LHS, RHS);
75 return BinaryOperator::CreateNUWSub(LHS, RHS);
79 return BinaryOperator::CreateFSub(LHS, RHS);
83 bool HasNUW =
false,
bool HasNSW =
false)
const {
91 return BinaryOperator::CreateNSWMul(LHS, RHS);
95 return BinaryOperator::CreateNUWMul(LHS, RHS);
99 return BinaryOperator::CreateFMul(LHS, RHS);
103 bool isExact =
false)
const {
105 return BinaryOperator::CreateUDiv(LHS, RHS);
106 return BinaryOperator::CreateExactUDiv(LHS, RHS);
110 return BinaryOperator::CreateExactUDiv(LHS, RHS);
114 bool isExact =
false)
const {
116 return BinaryOperator::CreateSDiv(LHS, RHS);
117 return BinaryOperator::CreateExactSDiv(LHS, RHS);
121 return BinaryOperator::CreateExactSDiv(LHS, RHS);
125 return BinaryOperator::CreateFDiv(LHS, RHS);
129 return BinaryOperator::CreateURem(LHS, RHS);
133 return BinaryOperator::CreateSRem(LHS, RHS);
137 return BinaryOperator::CreateFRem(LHS, RHS);
141 bool HasNSW =
false)
const {
149 bool isExact =
false)
const {
151 return BinaryOperator::CreateLShr(LHS, RHS);
152 return BinaryOperator::CreateExactLShr(LHS, RHS);
156 bool isExact =
false)
const {
158 return BinaryOperator::CreateAShr(LHS, RHS);
159 return BinaryOperator::CreateExactAShr(LHS, RHS);
163 return BinaryOperator::CreateAnd(LHS, RHS);
167 return BinaryOperator::CreateOr(LHS, RHS);
171 return BinaryOperator::CreateXor(LHS, RHS);
184 bool HasNUW =
false,
bool HasNSW =
false)
const {
251 Type *DestTy)
const {
260 bool isSigned)
const {
269 return CreateCast(Instruction::BitCast, C, DestTy);
273 return CreateCast(Instruction::IntToPtr, C, DestTy);
277 return CreateCast(Instruction::PtrToInt, C, DestTy);
342 #endif // LLVM_IR_NOFOLDER_H
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, Optional< unsigned > InRangeIndex=None, Type *OnlyIfReducedTy=nullptr)
Getelementptr form.
This instruction constructs a fixed permutation of two input vectors.
static SelectInst * Create(Value *C, Value *S1, Value *S2, const Twine &NameStr="", Instruction *InsertBefore=nullptr, Instruction *MDFrom=nullptr)
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
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
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)
void setHasNoSignedWrap(bool b=true)
Set or clear the nsw flag on this instruction, which must be an operator which supports this flag...
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
static GCRegistry::Add< ShadowStackGC > C("shadow-stack","Very portable GC for uncooperative code generators")
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
void setHasNoUnsignedWrap(bool b=true)
Set or clear the nsw flag on this instruction, which must be an operator which supports this flag...
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
std::underlying_type< E >::type Mask()
Get a bitmask with 1s in all places up to the high-order bit of E's largest value.
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