Go to the documentation of this file.
15 #ifndef LLVM_IR_INSTRTYPES_H
16 #define LLVM_IR_INSTRTYPES_H
69 void *
operator new(
size_t S) {
return User::operator
new(
S, 1); }
70 void operator delete(
void *
Ptr) { User::operator
delete(
Ptr); }
77 return I->isUnaryOp() ||
78 I->getOpcode() == Instruction::Alloca ||
80 I->getOpcode() == Instruction::VAArg ||
81 I->getOpcode() == Instruction::ExtractValue ||
82 (
I->getOpcode() >= CastOpsBegin &&
I->getOpcode() < CastOpsEnd);
85 return isa<Instruction>(V) &&
classof(cast<Instruction>(V));
136 #define HANDLE_UNARY_INST(N, OPC, CLASS) \
137 static UnaryOperator *Create##OPC(Value *V, const Twine &Name = "") {\
138 return Create(Instruction::OPC, V, Name);\
140 #include "llvm/IR/Instruction.def"
141 #define HANDLE_UNARY_INST(N, OPC, CLASS) \
142 static UnaryOperator *Create##OPC(Value *V, const Twine &Name, \
144 return Create(Instruction::OPC, V, Name, BB);\
146 #include "llvm/IR/Instruction.def"
147 #define HANDLE_UNARY_INST(N, OPC, CLASS) \
148 static UnaryOperator *Create##OPC(Value *V, const Twine &Name, \
150 return Create(Instruction::OPC, V, Name, I);\
152 #include "llvm/IR/Instruction.def"
154 static UnaryOperator *
166 return CreateWithCopiedFlags(Instruction::FNeg,
Op, FMFSource,
Name,
176 return I->isUnaryOp();
179 return isa<Instruction>(V) && classof(cast<Instruction>(V));
203 void *
operator new(
size_t S) {
return User::operator
new(
S, 2); }
204 void operator delete(
void *
Ptr) { User::operator
delete(
Ptr); }
228 #define HANDLE_BINARY_INST(N, OPC, CLASS) \
229 static BinaryOperator *Create##OPC(Value *V1, Value *V2, \
230 const Twine &Name = "") {\
231 return Create(Instruction::OPC, V1, V2, Name);\
233 #include "llvm/IR/Instruction.def"
234 #define HANDLE_BINARY_INST(N, OPC, CLASS) \
235 static BinaryOperator *Create##OPC(Value *V1, Value *V2, \
236 const Twine &Name, BasicBlock *BB) {\
237 return Create(Instruction::OPC, V1, V2, Name, BB);\
239 #include "llvm/IR/Instruction.def"
240 #define HANDLE_BINARY_INST(N, OPC, CLASS) \
241 static BinaryOperator *Create##OPC(Value *V1, Value *V2, \
242 const Twine &Name, Instruction *I) {\
243 return Create(Instruction::OPC, V1, V2, Name, I);\
245 #include "llvm/IR/Instruction.def"
339 #define DEFINE_HELPERS(OPC, NUWNSWEXACT) \
340 static BinaryOperator *Create##NUWNSWEXACT##OPC(Value *V1, Value *V2, \
341 const Twine &Name = "") { \
342 return Create##NUWNSWEXACT(Instruction::OPC, V1, V2, Name); \
344 static BinaryOperator *Create##NUWNSWEXACT##OPC( \
345 Value *V1, Value *V2, const Twine &Name, BasicBlock *BB) { \
346 return Create##NUWNSWEXACT(Instruction::OPC, V1, V2, Name, BB); \
348 static BinaryOperator *Create##NUWNSWEXACT##OPC( \
349 Value *V1, Value *V2, const Twine &Name, Instruction *I) { \
350 return Create##NUWNSWEXACT(Instruction::OPC, V1, V2, Name, I); \
367 #undef DEFINE_HELPERS
404 return I->isBinaryOp();
407 return isa<Instruction>(V) &&
classof(cast<Instruction>(V));
454 const Twine &Name =
"",
472 static CastInst *CreateZExtOrBitCast(
475 const Twine &Name =
"",
480 static CastInst *CreateZExtOrBitCast(
488 static CastInst *CreateSExtOrBitCast(
491 const Twine &Name =
"",
496 static CastInst *CreateSExtOrBitCast(
515 const Twine &Name =
"",
520 static CastInst *CreatePointerBitCastOrAddrSpaceCast(
528 static CastInst *CreatePointerBitCastOrAddrSpaceCast(
531 const Twine &Name =
"",
541 static CastInst *CreateBitOrPointerCast(
544 const Twine &Name =
"",
553 const Twine &Name =
"",
570 const Twine &Name =
"",
583 static CastInst *CreateTruncOrBitCast(
586 const Twine &Name =
"",
591 static CastInst *CreateTruncOrBitCast(
599 static bool isBitCastable(
609 static bool isBitOrNoopPointerCastable(
629 bool isIntegerCast()
const;
636 bool isLosslessCast()
const;
645 static bool isNoopCast(
663 static unsigned isEliminableCastPair(
690 return castIsValid(
op,
S->getType(), DstTy);
698 return isa<Instruction>(V) && classof(cast<Instruction>(V));
759 Predicate::LAST_FCMP_PREDICATE,
766 Predicate::LAST_ICMP_PREDICATE,
782 void *
operator new(
size_t S) {
return User::operator
new(
S, 2); }
783 void operator delete(
void *
Ptr) { User::operator
delete(
Ptr); }
815 "FIRST_FCMP_PREDICATE is required to be 0");
1046 return I->getOpcode() == Instruction::ICmp ||
1047 I->getOpcode() == Instruction::FCmp;
1050 return isa<Instruction>(V) &&
classof(cast<Instruction>(V));
1055 if (
VectorType* vt = dyn_cast<VectorType>(opnd_type)) {
1057 vt->getElementCount());
1065 void setValueSubclassData(
unsigned short D) {
1084 : Inputs(Inputs),
Tag(
Tag) {}
1089 if (isDeoptOperandBundle())
1090 if (A == Attribute::ReadOnly || A == Attribute::NoCapture)
1091 return Inputs[Idx]->getType()->isPointerTy();
1099 return Tag->getKey();
1108 return Tag->getValue();
1137 template <
typename InputTy>
class OperandBundleDefT {
1139 std::vector<InputTy> Inputs;
1192 Bitfield::areContiguous<CallInstReservedField, CallingConvField>(),
1193 "Bitfields must be contiguous");
1201 template <
class... ArgsTy>
1213 case Instruction::Invoke:
1215 case Instruction::CallBr:
1257 I->getOpcode() == Instruction::Invoke ||
1258 I->getOpcode() == Instruction::CallBr;
1261 return isa<Instruction>(V) &&
classof(cast<Instruction>(V));
1304 assert(
this == U->getUser() &&
1305 "Only valid to query with a use of this instruction!");
1372 assert(
this == U->getUser() &&
1373 "Only valid to query with a use of this instruction!");
1458 assert(cast<PointerType>(Fn->
getType())->isOpaqueOrPointeeTypeMatches(
FTy));
1466 return getSubclassData<CallingConvField>();
1470 setSubclassData<CallingConvField>(
CC);
1494 assert(Kind != Attribute::NoBuiltin &&
1495 "Use CallBase::isNoBuiltin() to check for Attribute::NoBuiltin");
1496 return hasFnAttrImpl(Kind);
1606 return hasRetAttrImpl(Kind);
1629 return getFnAttrOnCalledFunction(Kind);
1637 return getFnAttrOnCalledFunction(Kind);
1666 "Data operand index out of bounds!");
1676 "Must be either a call argument or an operand bundle!");
1747 return F->getAttributes().getRetAlignment();
1748 return std::nullopt;
1765 return F->getAttributes().getParamByValType(ArgNo);
1774 return F->getAttributes().getParamPreallocatedType(ArgNo);
1783 return F->getAttributes().getParamInAllocaType(ArgNo);
1792 return F->getAttributes().getParamStructRetType(ArgNo);
1850 return hasFnAttrImpl(Attribute::NoBuiltin) &&
1851 !hasFnAttrImpl(Attribute::Builtin);
1974 assert(
this == U->getUser() &&
1975 "Only valid to query with a use of this instruction!");
1991 assert(Begin <= End &&
"Should be!");
2036 return std::nullopt;
2052 return std::nullopt;
2085 return OBU.operandHasAttr(OpIdx - BOI.Begin, A);
2096 Other.bundle_op_info_begin());
2199 auto *NonConstThis =
const_cast<CallBase *
>(
this);
2216 auto *NonConstThis =
const_cast<CallBase *
>(
this);
2237 const unsigned BeginIndex);
2253 for (
const auto &
B : Bundles)
2263 bool hasFnAttrOnCalledFunction(
StringRef Kind)
const;
2265 template <
typename AttrKind>
bool hasFnAttrImpl(AttrKind Kind)
const {
2269 return hasFnAttrOnCalledFunction(Kind);
2271 template <
typename AK> Attribute getFnAttrOnCalledFunction(AK Kind)
const;
2275 template <
typename AttrKind>
bool hasRetAttrImpl(AttrKind Kind)
const {
2281 return F->getAttributes().hasRetAttr(Kind);
2321 unsigned arg_size()
const {
return getNumOperands() - 1; }
2332 Op<-1>() = ParentPad;
2351 return isa<Instruction>(V) && classof(cast<Instruction>(V));
2363 #endif // LLVM_IR_INSTRTYPES_H
AttributeList removeAttributeAtIndex(LLVMContext &C, unsigned Index, Attribute::AttrKind Kind) const
Remove the specified attribute at the specified index from this attribute list.
Value * getArgOperandWithAttribute(Attribute::AttrKind Kind) const
If one of the arguments has the specified attribute, returns its operand value.
const_bundle_op_iterator bundle_op_info_end() const
Return the end of the list of BundleOpInfo instances associated with this OperandBundleUser.
uint64_t getRetDereferenceableOrNullBytes() const
Get the number of dereferenceable_or_null bytes (or zero if unknown) of the return value.
Type * getParamInAllocaType(unsigned ArgNo) const
Return the inalloca type for the specified function parameter.
unsigned getNumOperandBundles() const
Return the number of operand bundles associated with this User.
@ FCMP_ULE
1 1 0 1 True if unordered, less than, or equal
bool hasStructRetAttr() const
Determine if the call returns a structure through first pointer argument.
uint64_t getRetDereferenceableBytes() const
Extract the number of dereferenceable bytes for a call or parameter (0=unknown).
auto enum_seq_inclusive(EnumT Begin, EnumT End)
Iterate over an enum type from Begin to End inclusive.
DECLARE_TRANSPARENT_OPERAND_ACCESSORS(Value)
Provide more efficient getOperand methods.
bool returnDoesNotAlias() const
Determine if the return value is marked with NoAlias attribute.
void addAttributeAtIndex(unsigned i, Attribute::AttrKind Kind)
adds the attribute to the list of attributes.
user_iterator_impl< const User > const_user_iterator
ArrayRef< InputTy > inputs() const
const_bundle_op_iterator bundle_op_info_begin() const
Return the start of the list of BundleOpInfo instances associated with this OperandBundleUser.
DECLARE_TRANSPARENT_OPERAND_ACCESSORS(Value)
Transparently provide more efficient getOperand methods.
OperandBundleUse getOperandBundleForOperand(unsigned OpIdx) const
Return the operand bundle for the operand at index OpIdx.
Predicate getSwappedPredicate() const
For example, EQ->EQ, SLE->SGE, ULT->UGT, OEQ->OEQ, ULE->UGE, OLT->OGT, etc.
void setOnlyAccessesInaccessibleMemory()
User::const_op_iterator arg_begin() const
This is an optimization pass for GlobalISel generic memory operations.
bool isNoBuiltin() const
Return true if the call should not be treated as a call to a builtin.
void getOperandBundlesAsDefs(SmallVectorImpl< OperandBundleDef > &Defs) const
Return the list of operand bundles attached to this instruction as a vector of OperandBundleDefs.
bool isValid() const
Return true if the attribute is any kind of attribute.
unsigned arg_size() const
arg_size - Return the number of funcletpad arguments.
AttributeList addDereferenceableParamAttr(LLVMContext &C, unsigned ArgNo, uint64_t Bytes) const
Add the dereferenceable attribute to the attribute set at the given arg index.
static IntegerType * getInt1Ty(LLVMContext &C)
DECLARE_TRANSPARENT_OPERAND_ACCESSORS(Value)
unsigned getBundleOperandsEndIndex() const
Return the index of the last bundle operand in the Use array.
iterator_range< T > make_range(T x, T y)
Convenience function for iterating over sub-ranges.
A parsed version of the target data layout string in and methods for querying it.
User::const_op_iterator arg_end() const
bool isBundleOperand(const Use *U) const
Returns true if the use is a bundle operand.
bool hasAttrSomewhere(Attribute::AttrKind Kind, unsigned *Index=nullptr) const
Return true if the specified attribute is set for at least one parameter or for the return value.
Predicate
This enumeration lists the possible predicates for CmpInst subclasses.
Predicate getUnsignedPredicate()
For example, SLT->ULT, SLE->ULE, SGT->UGT, SGE->UGE, ULT->Failed assert.
bool doesNotReturn() const
Determine if the call cannot return.
void removeFnAttr(Attribute::AttrKind Kind)
Removes the attribute from the function.
static CallBase * removeOperandBundle(CallBase *CB, uint32_t ID, Instruction *InsertPt=nullptr)
Create a clone of CB with operand bundle ID removed.
Use & getArgOperandUse(unsigned i)
bool hasInAllocaArgument() const
Determine if there are is an inalloca argument.
void swapOperands()
This is just a convenience that dispatches to the subclasses.
This currently compiles esp xmm0 movsd esp eax eax esp ret We should use not the dag combiner This is because dagcombine2 needs to be able to see through the X86ISD::Wrapper which DAGCombine can t really do The code for turning x load into a single vector load is target independent and should be moved to the dag combiner The code for turning x load into a vector load can only handle a direct load from a global or a direct load from the stack It should be generalized to handle any load from P
void mutateFunctionType(FunctionType *FTy)
static BinaryOperator * CreateWithCopiedFlags(BinaryOps Opc, Value *V1, Value *V2, Instruction *CopyO, const Twine &Name="", Instruction *InsertBefore=nullptr)
VariadicOperandTraits - determine the allocation regime of the Use array when it is a prefix to the U...
static BinaryOperator * CreateNot(Value *Op, const Twine &Name="", Instruction *InsertBefore=nullptr)
Use & getCalledOperandUse()
void removeParamAttrs(unsigned ArgNo, const AttributeMask &AttrsToRemove)
Removes the attributes from the given argument.
StringMapEntry< uint32_t > * Tag
The operand bundle tag, interned by LLVMContextImpl::getOrInsertBundleTag.
void setCalledFunction(Function *Fn)
Sets the function called, including updating the function type.
static BinaryOperator * CreateFRemFMF(Value *V1, Value *V2, Instruction *FMFSource, const Twine &Name="")
unsigned getNumTotalBundleOperands() const
Return the total number operands (not operand bundles) used by every operand bundle in this OperandBu...
Type * getParamPreallocatedType(unsigned ArgNo) const
Return the preallocated type for the specified function parameter.
DECLARE_TRANSPARENT_OPERAND_ACCESSORS(Value)
Transparently provide more efficient getOperand methods.
Predicate getFlippedSignednessPredicate()
For example, SLT->ULT, ULT->SLT, SLE->ULE, ULE->SLE, EQ->Failed assert.
static auto FCmpPredicates()
Returns the sequence of all FCmp predicates.
MemoryEffects getMemoryEffects() const
static BinaryOperator * CreateFDivFMF(Value *V1, Value *V2, Instruction *FMFSource, const Twine &Name="")
bool isInlineAsm() const
Check if this call is an inline asm statement.
@ FCMP_ONE
0 1 1 0 True if ordered and operands are unequal
AttributeList Attrs
parameter attributes for callable
static Type * makeCmpResultType(Type *opnd_type)
Create a result type for fcmp/icmp.
Predicate getInversePredicate() const
For example, EQ -> NE, UGT -> ULE, SLT -> SGE, OEQ -> UNE, UGT -> OLE, OLT -> UGE,...
Attribute getAttributeAtIndex(unsigned i, Attribute::AttrKind Kind) const
Get the attribute of a given kind at a position.
static auto ICmpPredicates()
Returns the sequence of all ICmp predicates.
static BinaryOperator * CreateNSW(BinaryOps Opc, Value *V1, Value *V2, const Twine &Name, BasicBlock *BB)
DEFINE_HELPERS(Add, NSW) DEFINE_HELPERS(Add
bool isCommutative() const
This is just a convenience that dispatches to the subclasses.
bool hasFnAttr(Attribute::AttrKind Kind) const
Determine whether this call has the given attribute.
const Use & getArgOperandUse(unsigned i) const
Wrappers for getting the Use of a call argument.
Type * getParamByValType(unsigned ArgNo) const
Return the byval type for the specified function parameter.
Predicate getFlippedStrictnessPredicate() const
For predicate of kind "is X or equal to 0" returns the predicate "is X".
static CallBase * addOperandBundle(CallBase *CB, uint32_t ID, OperandBundleDef OB, Instruction *InsertPt=nullptr)
Create a clone of CB with operand bundle OB added.
bool isStrictFP() const
Determine if the call requires strict floating point semantics.
@ ICMP_SGT
signed greater than
bool isInAllocaArgument(unsigned ArgNo) const
Determine whether this argument is passed in an alloca.
The instances of the Type class are immutable: once they are created, they are never changed.
AttributeList removeParamAttributes(LLVMContext &C, unsigned ArgNo, const AttributeMask &AttrsToRemove) const
Remove the specified attribute at the specified arg index from this attribute list.
bool isFalseWhenEqual() const
This is just a convenience.
bool isPassingUndefUB(unsigned ArgNo) const
Determine whether passing undef to this argument is undefined behavior.
AttributeList addDereferenceableRetAttr(LLVMContext &C, uint64_t Bytes) const
Add the dereferenceable attribute to the attribute set at the given index.
AttributeList getAttributes() const
Return the parameter attributes for this call.
#define DEFINE_TRANSPARENT_OPERAND_ACCESSORS(CLASS, VALUECLASS)
Macro for generating out-of-class operand accessor definitions.
bool isOperandBundleOfType(uint32_t ID, unsigned Idx) const
Return true if the operand at index Idx is a bundle operand that has tag ID ID.
A container for an operand bundle being viewed as a set of values rather than a set of uses.
FunctionType * getFunctionType() const
const_iterator begin(StringRef path, Style style=Style::native)
Get begin iterator over path.
bool isCallee(Value::const_user_iterator UI) const
Determine whether the passed iterator points to the callee operand's Use.
iterator_range< bundle_op_iterator > bundle_op_infos()
Return the range [bundle_op_info_begin, bundle_op_info_end).
bool hasArgument(const Value *V) const
Returns true if this CallSite passes the given Value* as an argument to the called function.
bool hasDescriptor() const
unsigned getDataOperandNo(const Use *U) const
Given a use for a data operand, get the data operand number that corresponds to it.
void addFnAttr(Attribute Attr)
Adds the attribute to the function.
bool isMustTailCall() const
Tests if this call site must be tail call optimized.
void setHasNoUnsignedWrap(bool b=true)
Set or clear the nuw flag on this instruction, which must be an operator which supports this flag.
static BinaryOperator * CreateNUW(BinaryOps Opc, Value *V1, Value *V2, const Twine &Name, BasicBlock *BB)
bool onlyWritesMemory() const
Determine if the call does not access or only writes memory.
CastInst(Type *Ty, unsigned iType, Value *S, const Twine &NameStr="", Instruction *InsertBefore=nullptr)
Constructor with insert-before-instruction semantics for subclasses.
static bool castIsValid(Instruction::CastOps op, Value *S, Type *DstTy)
OtherOps getOpcode() const
Get the opcode casted to the right type.
OperandBundleDefT(std::string Tag, std::vector< InputTy > Inputs)
@ ICMP_SLE
signed less or equal
bool isByValArgument(unsigned ArgNo) const
Determine whether this argument is passed by value.
User::op_iterator arg_begin()
Return the iterator pointing to the beginning of the argument list.
bool onlyAccessesInaccessibleMemOrArgMem() const
Determine if the function may only access memory that is either inaccessible from the IR or pointed t...
static StringRef getPredicateName(Predicate P)
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...
void setValueSubclassData(unsigned short D)
void addParamAttr(unsigned ArgNo, Attribute::AttrKind Kind)
Adds the attribute to the indicated argument.
void setIsExact(bool b=true)
Set or clear the exact flag on this instruction, which must be an operator which supports this flag.
op_range arg_operands()
arg_operands - iteration adapter for range-for loops.
@ FCMP_OGT
0 0 1 0 True if ordered and greater than
bool isCallee(const Use *U) const
Determine whether this Use is the callee operand's Use.
AttributeList removeFnAttributes(LLVMContext &C, const AttributeMask &AttrsToRemove) const
Remove the specified attribute at the function index from this attribute list.
Type * getDestTy() const
Return the destination type, as a convenience.
Attribute getFnAttr(Attribute::AttrKind Kind) const
Get the attribute of a given kind for the function.
unsigned getArgOperandNo(Value::const_user_iterator UI) const
Given a value use iterator, return the arg operand number corresponding to it.
LLVM Basic Block Representation.
bool hasIdenticalOperandBundleSchema(const CallBase &Other) const
Return true if Other has the same sequence of operand bundle tags with the same number of operands on...
bool doesNotAccessMemory() const
Determine if the call does not access memory.
MaybeAlign getParamStackAlign(unsigned ArgNo) const
uint64_t getParamDereferenceableBytes(unsigned Index) const
Get the number of dereferenceable bytes (or zero if unknown) of an arg.
@ FCMP_ULT
1 1 0 0 True if unordered or less than
Summary of how a function affects memory in the program.
static BinaryOperator * CreateNUW(BinaryOps Opc, Value *V1, Value *V2, const Twine &Name, Instruction *I)
const Use & getOperandUse(unsigned i) const
UnaryOps getOpcode() const
bool isDataOperand(Value::const_user_iterator UI) const
MaybeAlign getParamStackAlignment(unsigned ArgNo) const
Return the stack alignment for the specified function parameter.
bool swapOperands()
Exchange the two operands to this instruction.
Attribute getParamAttr(unsigned ArgNo, Attribute::AttrKind Kind) const
Get the attribute of a given kind from a given arg.
Value * getArgOperand(unsigned i) const
getArgOperand/setArgOperand - Return/set the i-th funcletpad argument.
void removeParamAttr(unsigned ArgNo, Attribute::AttrKind Kind)
Removes the attribute from the given argument.
unsigned getOpcode() const
Returns a member of one of the enums like Instruction::Add.
bool hasByValArgument() const
Determine if any call argument is an aggregate passed by value.
unsigned data_operands_size() const
Compile-time customization of User operands.
bool isFPPredicate() const
static bool classof(const Instruction *I)
Methods for support type inquiry through isa, cast, and dyn_cast:
AttributeList removeFnAttribute(LLVMContext &C, Attribute::AttrKind Kind) const
Remove the specified attribute at the function index from this attribute list.
bool isDeoptOperandBundle() const
Return true if this is a "deopt" operand bundle.
Predicate getNonStrictPredicate() const
For example, SGT -> SGE, SLT -> SLE, ULT -> ULE, UGT -> UGE.
void setHasNoSignedWrap(bool b=true)
Set or clear the nsw flag on this instruction, which must be an operator which supports this flag.
const Use & getCalledOperandUse() const
static bool isRelational(Predicate P)
Return true if the predicate is relational (not EQ or NE).
Predicate getSignedPredicate()
For example, ULT->SLT, ULE->SLE, UGT->SGT, UGE->SGE, SLT->Failed assert.
void removeFnAttrs(const AttributeMask &AttrsToRemove)
Removes the attributes from the function.
uint64_t getParamDereferenceableOrNullBytes(unsigned ArgNo) const
Get the number of dereferenceable_or_null bytes (or zero if unknown) of an arg.
@ ICMP_ULE
unsigned less or equal
BundleOpInfo & getBundleOpInfoForOperand(unsigned OpIdx)
Return the BundleOpInfo for the operand at index OpIdx.
Function * getCalledFunction() const
Returns the function called, or null if this is an indirect function invocation or the function signa...
typename std::vector< InputTy >::const_iterator input_iterator
void setAttributes(AttributeList A)
Set the parameter attributes for this call.
static BinaryOperator * CreateNSW(BinaryOps Opc, Value *V1, Value *V2, const Twine &Name="")
BinaryOperator(BinaryOps iType, Value *S1, Value *S2, Type *Ty, const Twine &Name, Instruction *InsertBefore)
void removeRetAttrs(const AttributeMask &AttrsToRemove)
Removes the attributes from the return value.
@ FCMP_UGE
1 0 1 1 True if unordered, greater than, or equal
static bool classof(const Value *V)
static bool classof(const Value *V)
static BinaryOperator * CreateExact(BinaryOps Opc, Value *V1, Value *V2, const Twine &Name="")
bool isConvergent() const
Determine if the invoke is convergent.
OperandBundleUse operandBundleFromBundleOpInfo(const BundleOpInfo &BOI) const
Simple helper function to map a BundleOpInfo to an OperandBundleUse.
This struct is a compact representation of a valid (power of two) or undefined (0) alignment.
static GCRegistry::Add< OcamlGC > B("ocaml", "ocaml 3.10-compatible GC")
Attribute getAttributeAtIndex(unsigned i, StringRef Kind) const
Get the attribute of a given kind at a position.
BinaryOps getOpcode() const
@ FCMP_UNO
1 0 0 0 True if unordered: isnan(X) | isnan(Y)
bool hasFnAttr(Attribute::AttrKind Kind) const
Return true if the attribute exists for the function.
ArrayRef< const uint8_t > getDescriptor() const
Returns the descriptor co-allocated with this User instance.
uint32_t Begin
The index in the Use& vector where operands for this operand bundle starts.
void addFnAttr(Attribute::AttrKind Kind)
Adds the attribute to the function.
MaybeAlign getRetAlignment() const
Return the alignment of the return value.
bool isArgOperand(Value::const_user_iterator UI) const
static UnaryOperator * CreateWithCopiedFlags(UnaryOps Opc, Value *V, Instruction *CopyO, const Twine &Name="", Instruction *InsertBefore=nullptr)
bundle_op_iterator bundle_op_info_begin()
Return the start of the list of BundleOpInfo instances associated with this OperandBundleUser.
Type * getParamByValType(unsigned ArgNo) const
Extract the byval type for a call or parameter.
User::const_op_iterator data_operands_begin() const
FunctionType * getFunctionType()
@ FCMP_OEQ
0 0 0 1 True if ordered and equal
Used to keep track of an operand bundle.
@ FCMP_OLT
0 1 0 0 True if ordered and less than
Type * getParamElementType(unsigned ArgNo) const
Return the elementtype type for the specified function parameter.
bool isDataOperand(const Use *U) const
User::op_iterator data_operands_end()
This struct is a compact representation of a valid (non-zero power of two) alignment.
uint64_t getParamDereferenceableBytes(unsigned i) const
Extract the number of dereferenceable bytes for a call or parameter (0=unknown).
Type * getSrcTy() const
Return the source type, as a convenience.
CallingConv::ID getCallingConv() const
static BinaryOperator * CreateExact(BinaryOps Opc, Value *V1, Value *V2, const Twine &Name, BasicBlock *BB)
UnaryInstruction(Type *Ty, unsigned iType, Value *V, BasicBlock *IAE)
AttributeList addParamAttribute(LLVMContext &C, unsigned ArgNo, Attribute::AttrKind Kind) const
Add an argument attribute to the list.
unsigned ID
LLVM IR allows to use arbitrary numbers as calling convention identifiers.
bool onlyReadsMemory(unsigned OpNo) const
Function * getCaller()
Helper to get the caller (the parent function).
uint32_t getTagID() const
Return the tag of this operand bundle as an integer.
static BinaryOperator * CreateNSW(BinaryOps Opc, Value *V1, Value *V2, const Twine &Name, Instruction *I)
bool isBundleOperand(Value::const_user_iterator UI) const
AttributeList removeRetAttributes(LLVMContext &C, const AttributeMask &AttrsToRemove) const
Remove the specified attribute at the return value index from this attribute list.
@ FCMP_FALSE
0 0 0 0 Always false (always folded)
bool isStrictPredicate() const
This class is the base class for the comparison instructions.
bool isFuncletOperandBundle() const
Return true if this is a "funclet" operand bundle.
static bool classof(const Value *V)
bool bundleOperandHasAttr(unsigned OpIdx, Attribute::AttrKind A) const
Return true if the bundle operand at index OpIdx has the attribute A.
Base class of all SIMD vector types.
uint64_t getParamDereferenceableOrNullBytes(unsigned i) const
Extract the number of dereferenceable_or_null bytes for a parameter (0=unknown).
Value(Type *Ty, unsigned scid)
Type * getParamElementType(unsigned ArgNo) const
Extract the elementtype type for a parameter.
void addDereferenceableRetAttr(uint64_t Bytes)
adds the dereferenceable attribute to the list of attributes.
unsigned getBundleOperandsStartIndex() const
Return the index of the first bundle operand in the Use array.
input_iterator input_end() const
void addRetAttr(Attribute Attr)
Adds the attribute to the return value.
void mutateType(Type *Ty)
Mutate the type of this Value to be of the specified type.
const Function * getCaller() const
bool isTailCall() const
Tests if this call site is marked as a tail call.
static UnaryOperator * CreateFNegFMF(Value *Op, Instruction *FMFSource, const Twine &Name="", Instruction *InsertBefore=nullptr)
bool doesNotAccessMemory(unsigned OpNo) const
OperandBundleDefT(std::string Tag, ArrayRef< InputTy > Inputs)
unsigned countOperandBundlesOfType(StringRef Name) const
Return the number of operand bundles with the tag Name attached to this instruction.
MaybeAlign getRetAlign() const
Extract the alignment of the return value.
iterator_range< const_bundle_op_iterator > bundle_op_infos() const
Return the range [bundle_op_info_begin, bundle_op_info_end).
static BinaryOperator * CreateFMulFMF(Value *V1, Value *V2, Instruction *FMFSource, const Twine &Name="")
static bool classof(const Value *V)
bool isCFGuardTargetOperandBundle() const
Return true if this is a "cfguardtarget" operand bundle.
static bool classof(const Instruction *I)
static GCRegistry::Add< StatepointGC > D("statepoint-example", "an example strategy for statepoint")
static bool isIntPredicate(Predicate P)
iterator_range< User::op_iterator > data_ops()
size_t input_size() const
uint64_t getRetDereferenceableBytes() const
Get the number of dereferenceable bytes (or zero if unknown) of the return value.
CmpInst(Type *ty, Instruction::OtherOps op, Predicate pred, Value *LHS, Value *RHS, const Twine &Name="", Instruction *InsertBefore=nullptr, Instruction *FlagsSource=nullptr)
AttributeList addRetAttribute(LLVMContext &C, Attribute::AttrKind Kind) const
Add a return value attribute to the list.
OperandBundleUse(StringMapEntry< uint32_t > *Tag, ArrayRef< Use > Inputs)
bool onlyAccessesArgMemory() const
Determine if the call can access memmory only using pointers based on its arguments.
unsigned getNumSubclassExtraOperands() const
AttrKind
This enumeration lists the attributes that can be associated with parameters, function results,...
iterator_range< User::const_op_iterator > data_ops() const
initializer< Ty > init(const Ty &Val)
MaybeAlign getParamAlignment(unsigned ArgNo) const
Return the alignment for the specified function parameter.
bool cannotMerge() const
Determine if the call cannot be tail merged.
bool is_contained(R &&Range, const E &Element)
Wrapper function around std::find to detect if an element exists in a container.
void addRetAttr(Attribute::AttrKind Kind)
Adds the attribute to the return value.
bool doesNotCapture(unsigned OpNo) const
Determine whether this data operand is not captured.
void addAttributeAtIndex(unsigned i, Attribute Attr)
adds the attribute to the list of attributes.
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
void setArgOperand(unsigned i, Value *v)
OutputIt move(R &&Range, OutputIt Out)
Provide wrappers to std::move which take ranges instead of having to pass begin/end explicitly.
bool hasOperandBundles() const
Return true if this User has any operand bundles.
@ FCMP_OGE
0 0 1 1 True if ordered and greater than or equal
@ ICMP_UGE
unsigned greater or equal
uint64_t getRetDereferenceableOrNullBytes() const
Extract the number of dereferenceable_or_null bytes for a call (0=unknown).
unsigned getNumSubclassExtraOperandsDynamic() const
Get the number of extra operands for instructions that don't have a fixed number of extra operands.
static bool classof(const Instruction *I)
Methods for support type inquiry through isa, cast, and dyn_cast:
static CallBase * Create(CallBase *CB, ArrayRef< OperandBundleDef > Bundles, Instruction *InsertPt=nullptr)
Create a clone of CB with a different set of operand bundles and insert it before InsertPt.
const BundleOpInfo & getBundleOpInfoForOperand(unsigned OpIdx) const
User::op_iterator arg_end()
Return the iterator pointing to the end of the argument list.
Type * getParamStructRetType(unsigned ArgNo) const
Extract the sret type for a call or parameter.
void setOperand(unsigned i, Value *Val)
static M68kRelType getType(unsigned Kind, MCSymbolRefExpr::VariantKind &Modifier, bool &IsPCRel)
@ ICMP_SLT
signed less than
bool isIntPredicate() const
void setOnlyReadsMemory()
Intrinsic::ID getIntrinsicID() const
Returns the intrinsic ID of the intrinsic called or Intrinsic::not_intrinsic if the called function i...
void addParamAttr(unsigned ArgNo, Attribute Attr)
Adds the attribute to the indicated argument.
UnaryInstruction(Type *Ty, unsigned iType, Value *V, Instruction *IB=nullptr)
Attribute getFnAttr(StringRef Kind) const
Get the attribute of a given kind for the function.
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory),...
static bool classof(const Instruction *I)
MaybeAlign getParamAlign(unsigned ArgNo) const
Extract the alignment for a call or parameter (0=unknown).
std::optional< OperandBundleUse > getOperandBundle(StringRef Name) const
Return an operand bundle by name, if present.
StringRef - Represent a constant reference to a string, i.e.
Type * getParamPreallocatedType(unsigned ArgNo) const
Extract the preallocated type for a call or parameter.
OperandBundleUse getOperandBundleAt(unsigned Index) const
Return the operand bundle at a specific index.
@ ICMP_ULT
unsigned less than
bool cannotDuplicate() const
Determine if the invoke cannot be duplicated.
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
Type * getType() const
All values are typed, get the type of this value.
bool onlyAccessesInaccessibleMemory() const
Determine if the function may only access memory that is inaccessible from the IR.
static constexpr unsigned NextBit
A lightweight accessor for an operand bundle meant to be passed around by value.
void append_range(Container &C, Range &&R)
Wrapper function to append a range to a container.
LLVMContext & getContext() const
All values hold a context through their type.
MachineBasicBlock MachineBasicBlock::iterator DebugLoc DL
static bool classof(const Instruction *I)
OperandBundleDefT< Value * > OperandBundleDef
add sub stmia L5 ldr r0 bl L_printf $stub Instead of a and a wouldn t it be better to do three moves *Return an aggregate type is even return S
@ MaxID
The highest possible ID. Must be some 2^k - 1.
This is the base class for all instructions that perform data casts.
uint32_t End
The index in the Use& vector where operands for this operand bundle ends.
bool hasFnAttr(StringRef Kind) const
Determine whether this call has the given attribute.
bool hasRetAttr(Attribute::AttrKind Kind) const
Determine whether the return value has the given attribute.
bool dataOperandHasImpliedAttr(unsigned i, Attribute::AttrKind Kind) const
Return true if the data operand at index i has the attribute A.
LLVMContext & getContext() const
Return the LLVMContext in which this type was uniqued.
bool paramHasAttr(unsigned ArgNo, Attribute::AttrKind Kind) const
Determine whether the argument or parameter has the given attribute.
void setArgOperand(unsigned i, Value *v)
std::optional< OperandBundleUse > getOperandBundle(uint32_t ID) const
Return an operand bundle by tag ID, if present.
bool onlyWritesMemory(unsigned OpNo) const
bool doesNotThrow() const
Determine if the call cannot unwind.
bool hasOperandBundlesOtherThan(ArrayRef< uint32_t > IDs) const
Return true if this operand bundle user contains operand bundles with tags other than those specified...
bool isRelational() const
Return true if the predicate is relational (not EQ or NE).
static bool isImpliedFalseByMatchingCmp(Predicate Pred1, Predicate Pred2)
Determine if Pred1 implies Pred2 is false when two compares have matching operands.
@ FCMP_UGT
1 0 1 0 True if unordered or greater than
static bool classof(const Instruction *I)
OperandBundleDefT(const OperandBundleUse &OBU)
Twine - A lightweight data structure for efficiently representing the concatenation of temporary valu...
unsigned countOperandBundlesOfType(uint32_t ID) const
Return the number of operand bundles with the tag ID attached to this instruction.
Instruction(const Instruction &)=delete
Attribute getParamAttr(unsigned ArgNo, StringRef Kind) const
Get the attribute of a given kind from a given arg.
static unsigned CountBundleInputs(ArrayRef< OperandBundleDef > Bundles)
Return the total number of values used in Bundles.
static bool isImpliedTrueByMatchingCmp(Predicate Pred1, Predicate Pred2)
Determine if Pred1 implies Pred2 is true when two compares have matching operands.
bool isBundleOperand(unsigned Idx) const
Return true if the operand at index Idx is a bundle operand.
void setCalledFunction(FunctionCallee Fn)
Sets the function called, including updating the function type.
CallBase(AttributeList const &A, FunctionType *FT, ArgsTy &&... Args)
unsigned getDataOperandNo(Value::const_user_iterator UI) const
Given a value use iterator, return the data operand corresponding to it.
void setOnlyWritesMemory()
bool isArgOperand(const Use *U) const
AttributeList addFnAttribute(LLVMContext &C, Attribute::AttrKind Kind) const
Add a function attribute to the list.
static BinaryOperator * CreateFAddFMF(Value *V1, Value *V2, Instruction *FMFSource, const Twine &Name="")
bool data_operands_empty() const
bool isNonStrictPredicate() const
void setMemoryEffects(MemoryEffects ME)
bundle_op_iterator bundle_op_info_end()
Return the end of the list of BundleOpInfo instances associated with this OperandBundleUser.
static BinaryOperator * CreateNUW(BinaryOps Opc, Value *V1, Value *V2, const Twine &Name="")
bool isNoInline() const
Return true if the call should not be inlined.
unsigned arg_size() const
Type * getParamStructRetType(unsigned ArgNo) const
Return the sret type for the specified function parameter.
User::const_op_iterator data_operands_end() const
bool isReturnNonNull() const
Return true if the return value is known to be not null.
input_iterator input_begin() const
static BinaryOperator * CreateNSWNeg(Value *Op, const Twine &Name="", Instruction *InsertBefore=nullptr)
bool operator==(const BundleOpInfo &Other) const
static bool classof(const Value *V)
static bool classof(const Value *V)
bool isIndirectCall() const
Return true if the callsite is an indirect call.
bool operandHasAttr(unsigned Idx, Attribute::AttrKind A) const
Return true if the operand at index Idx in this operand bundle has the attribute A.
void removeAttributeAtIndex(unsigned i, Attribute::AttrKind Kind)
removes the attribute from the list of attributes.
FunctionType * getFunctionType() const
Returns the FunctionType for me.
bool isEquality() const
Determine if this is an equals/not equals predicate.
Attribute getAttributeAtIndex(unsigned Index, Attribute::AttrKind Kind) const
Return the attribute object that exists at the given index.
unsigned getArgOperandNo(const Use *U) const
Given a use for a arg operand, get the arg operand number that corresponds to it.
Describes an element of a Bitfield.
@ ICMP_SGE
signed greater or equal
op_iterator populateBundleOperandInfos(ArrayRef< OperandBundleDef > Bundles, const unsigned BeginIndex)
Populate the BundleOpInfo instances and the Use& vector from Bundles.
void setPredicate(Predicate P)
Set the predicate for this instruction to the specified value.
Predicate getStrictPredicate() const
For example, SGE -> SGT, SLE -> SLT, ULE -> ULT, UGE -> UGT.
Value * getCalledOperand() const
AttributeList removeRetAttribute(LLVMContext &C, Attribute::AttrKind Kind) const
Remove the specified attribute at the return value index from this attribute list.
bool doesNoCfCheck() const
Determine if the call should not perform indirect branch tracking.
iterator_range< User::const_op_iterator > args() const
constexpr force_iteration_on_noniterable_enum_t force_iteration_on_noniterable_enum
bool isTrueWhenEqual() const
This is just a convenience.
void setCalledOperand(Value *V)
static CmpInst * Create(OtherOps Op, Predicate predicate, Value *S1, Value *S2, const Twine &Name="", Instruction *InsertBefore=nullptr)
Construct a compare instruction, given the opcode, the predicate and the two operands.
static Predicate getOrderedPredicate(Predicate Pred)
Returns the ordered variant of a floating point compare.
#define DECLARE_TRANSPARENT_OPERAND_ACCESSORS(VALUECLASS)
Macro for generating in-class operand accessor declarations.
static bool isFPPredicate(Predicate P)
static bool isSigned(unsigned int Opcode)
std::optional< std::vector< StOtherPiece > > Other
void removeAttributeAtIndex(unsigned i, StringRef Kind)
removes the attribute from the list of attributes.
StringRef getTagName() const
Return the tag of this operand bundle as a string.
bool hasRetAttr(StringRef Kind) const
Determine whether the return value has the given attribute.
@ ICMP_UGT
unsigned greater than
static bool classof(const Value *V)
@ FCMP_UNE
1 1 1 0 True if unordered or not equal
Value * getArgOperand(unsigned i) const
static constexpr int CalledOperandOpEndIdx
The last operand is the called operand.
Value * getReturnedArgOperand() const
If one of the arguments has the 'returned' attribute, returns its operand value.
Instruction::CastOps getOpcode() const
Return the opcode of this CastInst.
bool hasRetAttr(Attribute::AttrKind Kind) const
Return true if the attribute exists for the return value.
User::op_iterator data_operands_begin()
data_operands_begin/data_operands_end - Return iterators iterating over the call / invoke argument li...
Predicate getPredicate() const
Return the predicate for this instruction.
static BinaryOperator * CreateNUWNeg(Value *Op, const Twine &Name="", Instruction *InsertBefore=nullptr)
bool onlyReadsMemory() const
Determine if the call does not access or only reads memory.
BinaryOperator * cloneImpl() const
void setOnlyAccessesInaccessibleMemOrArgMem()
A range adaptor for a pair of iterators.
Predicate getOrderedPredicate() const
A handy container for a FunctionType+Callee-pointer pair, which can be passed around as a single enti...
FixedNumOperandTraits - determine the allocation regime of the Use array when it is a prefix to the U...
static bool isOrdered(Predicate predicate)
Determine if the predicate is an ordered operation.
bool hasClobberingOperandBundles() const
Return true if this operand bundle user has operand bundles that may write to the heap.
void copyIRFlags(const Value *V, bool IncludeWrapFlags=true)
Convenience method to copy supported exact, fast-math, and (optionally) wrapping flags from V to this...
AttributeList addAttributeAtIndex(LLVMContext &C, unsigned Index, Attribute::AttrKind Kind) const
Add an attribute to the attribute set at the given index.
@ FCMP_OLE
0 1 0 1 True if ordered and less than or equal
This class consists of common code factored out of the SmallVector class to reduce code duplication b...
void removeParamAttr(unsigned ArgNo, StringRef Kind)
Removes the attribute from the given argument.
void addDereferenceableParamAttr(unsigned i, uint64_t Bytes)
adds the dereferenceable attribute to the list of attributes.
Base class for all callable instructions (InvokeInst and CallInst) Holds everything related to callin...
static BinaryOperator * CreateExact(BinaryOps Opc, Value *V1, Value *V2, const Twine &Name, Instruction *I)
CastInst(Type *Ty, unsigned iType, Value *S, const Twine &NameStr, BasicBlock *InsertAtEnd)
Constructor with insert-at-end-of-block semantics for subclasses.
static bool isUnordered(Predicate predicate)
Determine if the predicate is an unordered operation.
bool isPassPointeeByValueArgument(unsigned ArgNo) const
Determine whether this argument is passed by value, in an alloca, or is preallocated.
void setCalledFunction(FunctionType *FTy, Value *Fn)
Sets the function called, including updating to the specified function type.
void removeRetAttr(Attribute::AttrKind Kind)
Removes the attribute from the return value.
Common register allocation spilling lr str ldr sxth r3 ldr mla r4 can lr mov lr str ldr sxth r3 mla r4 and then merge mul and lr str ldr sxth r3 mla r4 It also increase the likelihood the store may become dead bb27 Successors according to LLVM BB
void setOnlyAccessesArgMemory()
Type * getParamInAllocaType(unsigned ArgNo) const
Extract the inalloca type for a call or parameter.
constexpr char Args[]
Key for Kernel::Metadata::mArgs.
Value * getOperand(unsigned i) const
Value * getParentPad() const
Convenience accessors.
void setCannotDuplicate()
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.
@ FCMP_TRUE
1 1 1 1 Always true (always folded)
void setParentPad(Value *ParentPad)
Attribute getFnAttr(Attribute::AttrKind Kind) const
Return the attribute object that exists for the function.
Type * getReturnType() const
LLVM Value Representation.
const_op_range arg_operands() const
arg_operands - iteration adapter for range-for loops.
bool hasReadingOperandBundles() const
Return true if this operand bundle user has operand bundles that may read from the heap.
static VectorType * get(Type *ElementType, ElementCount EC)
This static method is the primary way to construct an VectorType.
Bitfield::Element< Predicate, 0, 6, LAST_ICMP_PREDICATE > PredicateField
Attribute getParamAttr(unsigned ArgNo, Attribute::AttrKind Kind) const
Return the attribute object that exists at the arg index.
void setDoesNotAccessMemory()
static bool classof(const Instruction *I)
static BinaryOperator * CreateFSubFMF(Value *V1, Value *V2, Instruction *FMFSource, const Twine &Name="")
friend class BasicBlock
Various leaf nodes.
@ FCMP_ORD
0 1 1 1 True if ordered (no nans)
iterator_range< User::op_iterator > args()
Iteration adapter for range-for loops.
@ FCMP_UEQ
1 0 0 1 True if unordered or equal
void setCallingConv(CallingConv::ID CC)
Class to represent function types.
A Use represents the edge between a Value definition and its users.
AttributeList removeParamAttribute(LLVMContext &C, unsigned ArgNo, Attribute::AttrKind Kind) const
Remove the specified attribute at the specified arg index from this attribute list.