16 #ifndef LLVM_IR_INSTRTYPES_H 17 #define LLVM_IR_INSTRTYPES_H 71 void *
operator new(
size_t s) {
72 return User::operator
new(s, 1);
80 return I->
getOpcode() == Instruction::Alloca ||
83 I->
getOpcode() == Instruction::ExtractValue ||
87 return isa<Instruction>(V) && classof(cast<Instruction>(V));
107 const Twine &
Name, Instruction *InsertBefore);
112 friend class Instruction;
118 void *
operator new(
size_t s) {
119 return User::operator
new(s, 2);
132 Instruction *InsertBefore =
nullptr);
144 #define HANDLE_BINARY_INST(N, OPC, CLASS) \ 145 static BinaryOperator *Create##OPC(Value *V1, Value *V2, \ 146 const Twine &Name = "") {\ 147 return Create(Instruction::OPC, V1, V2, Name);\ 149 #include "llvm/IR/Instruction.def" 150 #define HANDLE_BINARY_INST(N, OPC, CLASS) \ 151 static BinaryOperator *Create##OPC(Value *V1, Value *V2, \ 152 const Twine &Name, BasicBlock *BB) {\ 153 return Create(Instruction::OPC, V1, V2, Name, BB);\ 155 #include "llvm/IR/Instruction.def" 156 #define HANDLE_BINARY_INST(N, OPC, CLASS) \ 157 static BinaryOperator *Create##OPC(Value *V1, Value *V2, \ 158 const Twine &Name, Instruction *I) {\ 159 return Create(Instruction::OPC, V1, V2, Name, I);\ 161 #include "llvm/IR/Instruction.def" 166 const Twine &Name =
"") {
174 const Twine &Name =
"") {
175 return CreateWithCopiedFlags(Instruction::FAdd, V1, V2, FMFSource, Name);
179 const Twine &Name =
"") {
180 return CreateWithCopiedFlags(Instruction::FSub, V1, V2, FMFSource, Name);
184 const Twine &Name =
"") {
185 return CreateWithCopiedFlags(Instruction::FMul, V1, V2, FMFSource, Name);
189 const Twine &Name =
"") {
190 return CreateWithCopiedFlags(Instruction::FDiv, V1, V2, FMFSource, Name);
194 const Twine &Name =
"") {
195 return CreateWithCopiedFlags(Instruction::FRem, V1, V2, FMFSource, Name);
198 const Twine &Name =
"") {
200 return CreateWithCopiedFlags(Instruction::FSub, Zero, Op, FMFSource);
204 const Twine &Name =
"") {
216 const Twine &Name, Instruction *
I) {
223 const Twine &Name =
"") {
235 const Twine &Name, Instruction *
I) {
242 const Twine &Name =
"") {
254 const Twine &Name, Instruction *
I) {
260 #define DEFINE_HELPERS(OPC, NUWNSWEXACT) \ 261 static BinaryOperator *Create##NUWNSWEXACT##OPC(Value *V1, Value *V2, \ 262 const Twine &Name = "") { \ 263 return Create##NUWNSWEXACT(Instruction::OPC, V1, V2, Name); \ 265 static BinaryOperator *Create##NUWNSWEXACT##OPC( \ 266 Value *V1, Value *V2, const Twine &Name, BasicBlock *BB) { \ 267 return Create##NUWNSWEXACT(Instruction::OPC, V1, V2, Name, BB); \ 269 static BinaryOperator *Create##NUWNSWEXACT##OPC( \ 270 Value *V1, Value *V2, const Twine &Name, Instruction *I) { \ 271 return Create##NUWNSWEXACT(Instruction::OPC, V1, V2, Name, I); \ 288 #undef DEFINE_HELPERS 295 static BinaryOperator *
CreateNeg(Value *Op,
const Twine &Name =
"",
296 Instruction *InsertBefore =
nullptr);
297 static BinaryOperator *
CreateNeg(Value *Op,
const Twine &Name,
299 static BinaryOperator *CreateNSWNeg(Value *Op,
const Twine &Name =
"",
300 Instruction *InsertBefore =
nullptr);
301 static BinaryOperator *CreateNSWNeg(Value *Op,
const Twine &Name,
303 static BinaryOperator *CreateNUWNeg(Value *Op,
const Twine &Name =
"",
304 Instruction *InsertBefore =
nullptr);
305 static BinaryOperator *CreateNUWNeg(Value *Op,
const Twine &Name,
307 static BinaryOperator *CreateFNeg(Value *Op,
const Twine &Name =
"",
308 Instruction *InsertBefore =
nullptr);
309 static BinaryOperator *CreateFNeg(Value *Op,
const Twine &Name,
311 static BinaryOperator *CreateNot(Value *Op,
const Twine &Name =
"",
312 Instruction *InsertBefore =
nullptr);
313 static BinaryOperator *CreateNot(Value *Op,
const Twine &Name,
332 return isa<Instruction>(V) && classof(cast<Instruction>(V));
357 const Twine &NameStr =
"", Instruction *InsertBefore =
nullptr)
358 : UnaryInstruction(Ty, iType, S, InsertBefore) {
364 : UnaryInstruction(Ty, iType, S, InsertAtEnd) {
379 const Twine &Name =
"",
380 Instruction *InsertBefore =
nullptr 397 static CastInst *CreateZExtOrBitCast(
400 const Twine &Name =
"",
401 Instruction *InsertBefore =
nullptr 405 static CastInst *CreateZExtOrBitCast(
413 static CastInst *CreateSExtOrBitCast(
416 const Twine &Name =
"",
417 Instruction *InsertBefore =
nullptr 421 static CastInst *CreateSExtOrBitCast(
440 const Twine &Name =
"",
441 Instruction *InsertBefore =
nullptr 445 static CastInst *CreatePointerBitCastOrAddrSpaceCast(
453 static CastInst *CreatePointerBitCastOrAddrSpaceCast(
456 const Twine &Name =
"",
457 Instruction *InsertBefore =
nullptr 466 static CastInst *CreateBitOrPointerCast(
469 const Twine &Name =
"",
470 Instruction *InsertBefore =
nullptr 478 const Twine &Name =
"",
479 Instruction *InsertBefore =
nullptr 495 const Twine &Name =
"",
496 Instruction *InsertBefore =
nullptr 508 static CastInst *CreateTruncOrBitCast(
511 const Twine &Name =
"",
512 Instruction *InsertBefore =
nullptr 516 static CastInst *CreateTruncOrBitCast(
524 static bool isCastable(
530 static bool isBitCastable(
540 static bool isBitOrNoopPointerCastable(
560 bool isIntegerCast()
const;
567 bool isLosslessCast()
const;
576 static bool isNoopCast(
594 static unsigned isEliminableCastPair(
626 return isa<Instruction>(V) && classof(cast<Instruction>(V));
664 FIRST_FCMP_PREDICATE = FCMP_FALSE,
665 LAST_FCMP_PREDICATE = FCMP_TRUE,
666 BAD_FCMP_PREDICATE = FCMP_TRUE + 1,
677 FIRST_ICMP_PREDICATE = ICMP_EQ,
678 LAST_ICMP_PREDICATE = ICMP_SLE,
679 BAD_ICMP_PREDICATE = ICMP_SLE + 1
694 void *
operator new(
size_t s) {
695 return User::operator
new(s, 2);
722 return Predicate(getSubclassDataFromInstruction());
729 return P >= FIRST_FCMP_PREDICATE && P <= LAST_FCMP_PREDICATE;
733 return P >= FIRST_ICMP_PREDICATE && P <= LAST_ICMP_PREDICATE;
808 bool isCommutative()
const;
812 bool isEquality()
const;
853 static bool isUnsigned(
Predicate predicate);
857 static bool isSigned(
Predicate predicate);
863 static bool isUnordered(
Predicate predicate);
869 static bool isFalseWhenEqual(
Predicate predicate);
881 return I->
getOpcode() == Instruction::ICmp ||
885 return isa<Instruction>(V) && classof(cast<Instruction>(V));
890 if (
VectorType* vt = dyn_cast<VectorType>(opnd_type)) {
892 vt->getNumElements());
900 void setValueSubclassData(
unsigned short D) {
919 : Inputs(Inputs), Tag(Tag) {}
924 if (isDeoptOperandBundle())
926 return Inputs[Idx]->getType()->isPointerTy();
934 return Tag->getKey();
943 return Tag->getValue();
969 std::vector<InputTy> Inputs;
973 : Tag(
std::move(Tag)), Inputs(
std::move(Inputs)) {}
975 : Tag(
std::move(Tag)), Inputs(Inputs) {}
979 Inputs.insert(Inputs.end(), OBU.
Inputs.begin(), OBU.
Inputs.end());
1017 static constexpr
int CalledOperandOpEndIdx = -1;
1022 template <
class... ArgsTy>
1034 case Instruction::Invoke:
1048 return isa<Instruction>(V) && classof(cast<Instruction>(V));
1067 return const_cast<CallBase *
>(
this)->data_operands_begin();
1072 return op_end() - getNumSubclassExtraOperands() - 1;
1075 return const_cast<CallBase *
>(
this)->data_operands_end();
1078 return make_range(data_operands_begin(), data_operands_end());
1081 return make_range(data_operands_begin(), data_operands_end());
1084 return data_operands_end() == data_operands_begin();
1087 return std::distance(data_operands_begin(), data_operands_end());
1091 assert(
this == U->getUser() &&
1092 "Only valid to query with a use of this instruction!");
1093 return data_operands_begin() <= U && U < data_operands_end();
1096 return isDataOperand(&UI.getUse());
1102 return const_cast<CallBase *
>(
this)->arg_begin();
1109 return data_operands_end() - getNumTotalBundleOperands();
1112 return const_cast<CallBase *
>(
this)->arg_end();
1123 unsigned arg_size()
const {
return arg_end() - arg_begin(); }
1136 assert(i < getNumArgOperands() &&
"Out of bounds!");
1137 return getOperand(i);
1141 assert(i < getNumArgOperands() &&
"Out of bounds!");
1147 assert(i < getNumArgOperands() &&
"Out of bounds!");
1151 assert(i < getNumArgOperands() &&
"Out of bounds!");
1156 assert(
this == U->getUser() &&
1157 "Only valid to query with a use of this instruction!");
1158 return arg_begin() <= U && U < arg_end();
1161 return isArgOperand(&UI.getUse());
1182 return dyn_cast_or_null<Function>(getCalledOperand());
1186 bool isIndirectCall()
const;
1190 return isCallee(&UI.getUse());
1194 bool isCallee(
const Use *U)
const {
return &getCalledOperandUse() == U; }
1199 return const_cast<CallBase *
>(
this)->getCaller();
1212 cast<FunctionType>(cast<PointerType>(Fn->
getType())->getElementType()),
1220 assert(FTy == cast<FunctionType>(
1221 cast<PointerType>(Fn->
getType())->getElementType()));
1222 setCalledOperand(Fn);
1226 return static_cast<CallingConv::ID>(getSubclassDataFromInstruction() >> 2);
1230 auto ID =
static_cast<unsigned>(CC);
1232 setInstructionSubclassData((getSubclassDataFromInstruction() & 3) |
1253 "Use CallBase::isNoBuiltin() to check for Attribute::NoBuiltin");
1254 return hasFnAttrImpl(Kind);
1276 assert(ArgNo < getNumArgOperands() &&
"Out of bounds");
1284 assert(ArgNo < getNumArgOperands() &&
"Out of bounds");
1306 assert(ArgNo < getNumArgOperands() &&
"Out of bounds");
1314 assert(ArgNo < getNumArgOperands() &&
"Out of bounds");
1353 assert(ArgNo < getNumArgOperands() &&
"Out of bounds");
1359 assert(ArgNo < getNumArgOperands() &&
"Out of bounds");
1378 assert(i < (getNumArgOperands() + getNumTotalBundleOperands() + 1) &&
1379 "Data operand index out of bounds!");
1386 return hasRetAttr(Kind);
1390 if (i < (getNumArgOperands() + 1))
1391 return paramHasAttr(i - 1, Kind);
1393 assert(hasOperandBundles() && i >= (getBundleOperandsStartIndex() + 1) &&
1394 "Must be either a call argument or an operand bundle!");
1395 return bundleOperandHasAttr(i - 1, Kind);
1479 Value *getReturnedArgOperand()
const;
1578 if (getNumArgOperands() == 0)
1601 return std::distance(bundle_op_info_begin(), bundle_op_info_end());
1609 assert(hasOperandBundles() &&
"Don't call otherwise!");
1610 return bundle_op_info_begin()->Begin;
1615 assert(hasOperandBundles() &&
"Don't call otherwise!");
1616 return bundle_op_info_end()[-1].End;
1621 return hasOperandBundles() && Idx >= getBundleOperandsStartIndex() &&
1622 Idx < getBundleOperandsEndIndex();
1627 assert(
this == U->getUser() &&
1628 "Only valid to query with a use of this instruction!");
1629 return hasOperandBundles() && isBundleOperand(U - op_begin());
1632 return isBundleOperand(&UI.getUse());
1638 if (!hasOperandBundles())
1641 unsigned Begin = getBundleOperandsStartIndex();
1642 unsigned End = getBundleOperandsEndIndex();
1644 assert(Begin <= End &&
"Should be!");
1650 assert(Index < getNumOperandBundles() &&
"Index out of bounds!");
1651 return operandBundleFromBundleOpInfo(*(bundle_op_info_begin() + Index));
1658 for (
unsigned i = 0, e = getNumOperandBundles(); i != e; ++i)
1659 if (getOperandBundleAt(i).getTagName() == Name)
1669 for (
unsigned i = 0, e = getNumOperandBundles(); i != e; ++i)
1670 if (getOperandBundleAt(i).getTagID() == ID)
1681 assert(countOperandBundlesOfType(Name) < 2 &&
"Precondition violated!");
1683 for (
unsigned i = 0, e = getNumOperandBundles(); i != e; ++i) {
1697 assert(countOperandBundlesOfType(ID) < 2 &&
"Precondition violated!");
1699 for (
unsigned i = 0, e = getNumOperandBundles(); i != e; ++i) {
1716 for (
unsigned i = 0, e = getNumOperandBundles(); i != e; ++i)
1725 return operandBundleFromBundleOpInfo(getBundleOpInfoForOperand(OpIdx));
1734 return hasOperandBundles();
1740 for (
auto &BOI : bundle_op_infos()) {
1756 auto &BOI = getBundleOpInfoForOperand(OpIdx);
1757 auto OBU = operandBundleFromBundleOpInfo(BOI);
1758 return OBU.operandHasAttr(OpIdx - BOI.Begin, A);
1768 return std::equal(bundle_op_info_begin(), bundle_op_info_end(),
1775 for (
unsigned i = 0, e = getNumOperandBundles(); i != e; ++i) {
1776 uint32_t ID = getOperandBundleAt(i).getTagID();
1799 return hasReadingOperandBundles();
1802 return hasReadingOperandBundles();
1805 return hasReadingOperandBundles();
1808 return hasReadingOperandBundles();
1811 return hasClobberingOperandBundles();
1833 return Tag == Other.
Tag && Begin == Other.
Begin && End == Other.
End;
1841 auto begin = op_begin();
1896 if (!hasDescriptor())
1899 uint8_t *BytesBegin = getDescriptor().begin();
1906 auto *NonConstThis =
const_cast<CallBase *
>(
this);
1913 if (!hasDescriptor())
1916 uint8_t *BytesEnd = getDescriptor().end();
1923 auto *NonConstThis =
const_cast<CallBase *
>(
this);
1929 return make_range(bundle_op_info_begin(), bundle_op_info_end());
1934 return make_range(bundle_op_info_begin(), bundle_op_info_end());
1944 const unsigned BeginIndex);
1951 for (
auto &BOI : bundle_op_infos())
1952 if (BOI.Begin <= OpIdx && OpIdx < BOI.End)
1962 for (
auto &
B : Bundles)
1963 Total +=
B.input_size();
1972 bool hasFnAttrOnCalledFunction(
StringRef Kind)
const;
1974 template <
typename AttrKind>
bool hasFnAttrImpl(AttrKind Kind)
const {
1980 if (isFnAttrDisallowedByOpBundle(Kind))
1983 return hasFnAttrOnCalledFunction(Kind);
2033 Op<-1>() = ParentPad;
2052 return isa<Instruction>(V) && classof(cast<Instruction>(V));
2064 #endif // LLVM_IR_INSTRTYPES_H bool isFPPredicate() const
void setArgOperand(unsigned i, Value *v)
static BinaryOperator * CreateFMulFMF(Value *V1, Value *V2, BinaryOperator *FMFSource, const Twine &Name="")
bool hasOperandBundles() const
Return true if this User has any operand bundles.
iterator_range< User::op_iterator > data_ops()
bool hasReadingOperandBundles() const
Return true if this operand bundle user has operand bundles that may read from the heap...
Predicate getNonStrictPredicate() const
For example, SGT -> SGE, SLT -> SLE, ULT -> ULE, UGT -> UGE.
bool hasClobberingOperandBundles() const
Return true if this operand bundle user has operand bundles that may write to the heap...
User::op_iterator data_operands_end()
A parsed version of the target data layout string in and methods for querying it. ...
bool data_operands_empty() const
Attribute getParamAttr(unsigned ArgNo, Attribute::AttrKind Kind) const
Return the attribute object that exists at the arg index.
bool cannotDuplicate() const
Determine if the invoke cannot be duplicated.
This class is the base class for the comparison instructions.
Type * getSrcTy() const
Return the source type, as a convenience.
static IntegerType * getInt1Ty(LLVMContext &C)
bool doesNotAccessMemory(unsigned OpNo) const
const_iterator begin(StringRef path, Style style=Style::native)
Get begin iterator over path.
OperandBundleDefT(std::string Tag, ArrayRef< InputTy > Inputs)
static Type * makeCmpResultType(Type *opnd_type)
Create a result type for fcmp/icmp.
bool isFuncletPad() const
static BinaryOperator * CreateNUW(BinaryOps Opc, Value *V1, Value *V2, const Twine &Name, Instruction *I)
This class represents lattice values for constants.
BinaryOps getOpcode() const
static BinaryOperator * CreateExact(BinaryOps Opc, Value *V1, Value *V2, const Twine &Name="")
static BinaryOperator * CreateNSW(BinaryOps Opc, Value *V1, Value *V2, const Twine &Name, BasicBlock *BB)
bool isConvergent() const
Determine if the invoke is convergent.
UnaryInstruction(Type *Ty, unsigned iType, Value *V, BasicBlock *IAE)
This provides a very simple, boring adaptor for a begin and end iterator into a range type...
unsigned getBundleOperandsStartIndex() const
Return the index of the first bundle operand in the Use array.
bool isArgOperand(const Use *U) const
unsigned getNumSubclassExtraOperands() const
void setDoesNotAccessMemory()
LLVMContext & getContext() const
All values hold a context through their type.
const Use & getOperandUse(unsigned i) const
void addParamAttr(unsigned ArgNo, Attribute Attr)
Adds the attribute to the indicated argument.
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.
void setArgOperand(unsigned i, Value *v)
Base class for all callable instructions (InvokeInst and CallInst) Holds everything related to callin...
User::op_iterator arg_end()
Return the iterator pointing to the end of the argument list.
unsigned getRetAlignment() const
Return the alignment of the return value.
typename std::vector< InputTy >::const_iterator input_iterator
Attribute getParamAttr(unsigned ArgNo, StringRef Kind) const
Get the attribute of a given kind from a given arg.
OperandBundleUse getOperandBundleAt(unsigned Index) const
Return the operand bundle at a specific index.
User::op_iterator data_operands_begin()
data_operands_begin/data_operands_end - Return iterators iterating over the call / invoke argument li...
void addAttribute(unsigned i, Attribute::AttrKind Kind)
adds the attribute to the list of attributes.
ArrayRef< InputTy > inputs() const
bool isTrueWhenEqual(CondCode Cond)
Return true if the specified condition returns true if the two operands to the condition are equal...
void copyIRFlags(const Value *V, bool IncludeWrapFlags=true)
Convenience method to copy supported exact, fast-math, and (optionally) wrapping flags from V to this...
void setCalledFunction(FunctionType *FTy, Value *Fn)
Sets the function called, including updating to the specified function type.
unsigned getParamAlignment(unsigned ArgNo) const
Extract the alignment for a call or parameter (0=unknown).
UnaryInstruction(Type *Ty, unsigned iType, Value *V, Instruction *IB=nullptr)
static BinaryOperator * CreateFSubFMF(Value *V1, Value *V2, BinaryOperator *FMFSource, const Twine &Name="")
static bool classof(const Instruction *I)
void addDereferenceableOrNullAttr(unsigned i, uint64_t Bytes)
adds the dereferenceable_or_null attribute to the list of attributes.
CallBase(AttributeList const &A, FunctionType *FT, ArgsTy &&... Args)
bool hasAttribute(unsigned Index, Attribute::AttrKind Kind) const
Return true if the attribute exists at the given index.
static BinaryOperator * CreateNSW(BinaryOps Opc, Value *V1, Value *V2, const Twine &Name, Instruction *I)
LLVMContext & getContext() const
Return the LLVMContext in which this type was uniqued.
Predicate getSignedPredicate()
For example, ULT->SLT, ULE->SLE, UGT->SGT, UGE->SGE, SLT->Failed assert.
bool isBundleOperand(unsigned Idx) const
Return true if the operand at index Idx is a bundle operand.
Value * getArgOperand(unsigned i) const
static BinaryOperator * CreateNSW(BinaryOps Opc, Value *V1, Value *V2, const Twine &Name="")
iterator_range< User::const_op_iterator > arg_operands() const
void removeParamAttr(unsigned ArgNo, StringRef Kind)
Removes the attribute from the given argument.
bool doesNotCapture(unsigned OpNo) const
Determine whether this data operand is not captured.
amdgpu Simplify well known AMD library false Value Value const Twine & Name
size_t input_size() const
unsigned countOperandBundlesOfType(StringRef Name) const
Return the number of operand bundles with the tag Name attached to this instruction.
bool onlyAccessesInaccessibleMemory() const
Determine if the function may only access memory that is inaccessible from the IR.
Used to keep track of an operand bundle.
Predicate getInversePredicate() const
For example, EQ -> NE, UGT -> ULE, SLT -> SGE, OEQ -> UNE, UGT -> OLE, OLT -> UGE, etc.
Twine - A lightweight data structure for efficiently representing the concatenation of temporary valu...
bool onlyAccessesArgMemory() const
Determine if the call can access memmory only using pointers based on its arguments.
uint64_t getDereferenceableBytes(unsigned Index) const
Get the number of dereferenceable bytes (or zero if unknown).
This is the base class for all instructions that perform data casts.
static Constant * getNegativeZero(Type *Ty)
bool doesNotReadMemory() const
Determine if the call does not access or only writes memory.
bundle_op_iterator bundle_op_info_end()
Return the end of the list of BundleOpInfo instances associated with this OperandBundleUser.
CastInst(Type *Ty, unsigned iType, Value *S, const Twine &NameStr, BasicBlock *InsertAtEnd)
Constructor with insert-at-end-of-block semantics for subclasses.
A Use represents the edge between a Value definition and its users.
static Optional< unsigned > getOpcode(ArrayRef< VPValue *> Values)
Returns the opcode of Values or ~0 if they do not all agree.
This class consists of common code factored out of the SmallVector class to reduce code duplication b...
uint32_t getTagID() const
Return the tag of this operand bundle as an integer.
static bool classof(const Value *V)
void setCalledFunction(Value *Fn)
Sets the function called, including updating the function type.
This file contains the simple types necessary to represent the attributes associated with functions a...
void removeAttribute(unsigned i, StringRef Kind)
removes the attribute from the list of attributes.
bool operator==(const BundleOpInfo &Other) const
The highest possible calling convention ID. Must be some 2^k - 1.
static bool isOrdered(const Instruction *I)
bool isBundleOperand(const Use *U) const
Returns true if the use is a bundle operand.
static BinaryOperator * CreateFRemFMF(Value *V1, Value *V2, BinaryOperator *FMFSource, const Twine &Name="")
AttributeList getAttributes(LLVMContext &C, ID id)
Return the attributes for an intrinsic.
static unsigned CountBundleInputs(ArrayRef< OperandBundleDef > Bundles)
Return the total number of values used in Bundles.
OtherOps getOpcode() const
Get the opcode casted to the right type.
bool doesNotThrow() const
Determine if the call cannot unwind.
#define DEFINE_TRANSPARENT_OPERAND_ACCESSORS(CLASS, VALUECLASS)
Macro for generating out-of-class operand accessor definitions.
Class to represent function types.
static BinaryOperator * CreateFAddFMF(Value *V1, Value *V2, BinaryOperator *FMFSource, const Twine &Name="")
void setIsExact(bool b=true)
Set or clear the exact flag on this instruction, which must be an operator which supports this flag...
Instruction::CastOps getOpcode() const
Return the opcode of this CastInst.
bool hasOperandBundlesOtherThan(ArrayRef< uint32_t > IDs) const
Return true if this operand bundle user contains operand bundles with tags other than those specified...
const BundleOpInfo & getBundleOpInfoForOperand(unsigned OpIdx) const
Return the BundleOpInfo for the operand at index OpIdx.
Type * getType() const
All values are typed, get the type of this value.
User::const_op_iterator data_operands_end() const
bool isFuncletOperandBundle() const
Return true if this is a "funclet" operand bundle.
unsigned getRetAlignment() const
Extract the alignment of the return value.
void setOnlyReadsMemory()
Value * getCalledOperand() const
void setParentPad(Value *ParentPad)
const_op_range arg_operands() const
arg_operands - iteration adapter for range-for loops.
void setCalledOperand(Value *V)
uint64_t getDereferenceableOrNullBytes(unsigned Index) const
Get the number of dereferenceable_or_null bytes (or zero if unknown).
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory)...
OperandBundleUse getOperandBundleForOperand(unsigned OpIdx) const
Return the operand bundle for the operand at index OpIdx.
unsigned getOpcode() const
Returns a member of one of the enums like Instruction::Add.
iterator_range< User::op_iterator > arg_operands()
OperandBundleUse(StringMapEntry< uint32_t > *Tag, ArrayRef< Use > Inputs)
bool doesNoCfCheck() const
Determine if the call should not perform indirect branch tracking.
unsigned getNumOperandBundles() const
Return the number of operand bundles associated with this User.
constexpr char Attrs[]
Key for Kernel::Metadata::mAttrs.
uint32_t Begin
The index in the Use& vector where operands for this operand bundle starts.
void setOnlyAccessesInaccessibleMemOrArgMem()
Optional< OperandBundleUse > getOperandBundle(StringRef Name) const
Return an operand bundle by name, if present.
bool hasFnAttr(StringRef Kind) const
Determine whether this call has the given attribute.
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...
static bool classof(const Instruction *I)
Methods for support type inquiry through isa, cast, and dyn_cast:
initializer< Ty > init(const Ty &Val)
uint64_t getDereferenceableOrNullBytes(unsigned i) const
Extract the number of dereferenceable_or_null bytes for a call or parameter (0=unknown).
static bool isIntPredicate(Predicate P)
static GCRegistry::Add< OcamlGC > B("ocaml", "ocaml 3.10-compatible GC")
LLVM_NODISCARD AttributeList addDereferenceableOrNullAttr(LLVMContext &C, unsigned Index, uint64_t Bytes) const
Add the dereferenceable_or_null attribute to the attribute set at the given index.
bool isNoInline() const
Return true if the call should not be inlined.
unsigned arg_size() const
Value * getCalledValue() const
LLVM Basic Block Representation.
void setCannotDuplicate()
LLVM_NODISCARD AttributeList addParamAttribute(LLVMContext &C, unsigned ArgNo, Attribute::AttrKind Kind) const
Add an argument attribute to the list.
The instances of the Type class are immutable: once they are created, they are never changed...
bool isNoBuiltin() const
Return true if the call should not be treated as a call to a builtin.
unsigned countOperandBundlesOfType(uint32_t ID) const
Return the number of operand bundles with the tag ID attached to this instruction.
This file contains the declarations for the subclasses of Constant, which represent the different fla...
bool hasInAllocaArgument() const
Determine if there are is an inalloca argument.
static BinaryOperator * CreateNUW(BinaryOps Opc, Value *V1, Value *V2, const Twine &Name="")
FunctionType * getFunctionType() const
void mutateFunctionType(FunctionType *FTy)
unsigned getNumTotalBundleOperands() const
Return the total number operands (not operand bundles) used by every operand bundle in this OperandBu...
iterator_range< User::const_op_iterator > args() const
static BinaryOperator * CreateNUW(BinaryOps Opc, Value *V1, Value *V2, const Twine &Name, BasicBlock *BB)
bool any_of(R &&range, UnaryPredicate P)
Provide wrappers to std::any_of which take ranges instead of having to pass begin/end explicitly...
static BinaryOperator * CreateExact(BinaryOps Opc, Value *V1, Value *V2, const Twine &Name, BasicBlock *BB)
void setCallingConv(CallingConv::ID CC)
static bool classof(const Value *V)
bool isDeoptOperandBundle() const
Return true if this is a "deopt" operand bundle.
unsigned getBundleOperandsEndIndex() const
Return the index of the last bundle operand in the Use array.
bool hasDescriptor() const
bool onlyAccessesInaccessibleMemOrArgMem() const
Determine if the function may only access memory that is either inaccessible from the IR or pointed t...
bool isFnAttrDisallowedByOpBundle(Attribute::AttrKind A) const
Is the function attribute A disallowed by some operand bundle on this operand bundle user...
static bool classof(const Instruction *I)
uint64_t getDereferenceableBytes(unsigned i) const
Extract the number of dereferenceable bytes for a call or parameter (0=unknown).
const_bundle_op_iterator bundle_op_info_begin() const
Return the start of the list of BundleOpInfo instances associated with this OperandBundleUser.
bool isByValOrInAllocaArgument(unsigned ArgNo) const
Determine whether this argument is passed by value or in an alloca.
#define DECLARE_TRANSPARENT_OPERAND_ACCESSORS(VALUECLASS)
Macro for generating in-class operand accessor declarations.
Attribute getAttribute(unsigned Index, Attribute::AttrKind Kind) const
Return the attribute object that exists at the given index.
bool hasFnAttr(Attribute::AttrKind Kind) const
Determine whether this call has the given attribute.
bool onlyReadsMemory() const
Determine if the call does not access or only reads memory.
iterator_range< User::op_iterator > args()
Iteration adapter for range-for loops.
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
const_bundle_op_iterator bundle_op_info_end() const
Return the end of the list of BundleOpInfo instances associated with this OperandBundleUser.
bool isByValArgument(unsigned ArgNo) const
Determine whether this argument is passed by value.
User::const_op_iterator arg_begin() const
Value * getParentPad() const
Convenience accessors.
iterator_range< T > make_range(T x, T y)
Convenience function for iterating over sub-ranges.
bool operandHasAttr(unsigned Idx, Attribute::AttrKind A) const
Return true if the operand at index Idx in this operand bundle has the attribute A.
LLVM_NODISCARD AttributeList removeParamAttribute(LLVMContext &C, unsigned ArgNo, Attribute::AttrKind Kind) const
Remove the specified attribute at the specified arg index from this attribute list.
void setHasNoSignedWrap(bool b=true)
Set or clear the nsw flag on this instruction, which must be an operator which supports this flag...
void addParamAttr(unsigned ArgNo, Attribute::AttrKind Kind)
Adds the attribute to the indicated argument.
Predicate getPredicate(unsigned Condition, unsigned Hint)
Return predicate consisting of specified condition and hint bits.
bool doesNotReturn() const
Determine if the call cannot return.
bool returnDoesNotAlias() const
Determine if the return value is marked with NoAlias attribute.
OperandBundleUse operandBundleFromBundleOpInfo(const BundleOpInfo &BOI) const
Simple helper function to map a BundleOpInfo to an OperandBundleUse.
bool isCallee(Value::const_user_iterator UI) const
Determine whether the passed iterator points to the callee operand's Use.
static unsigned getIntrinsicID(const SDNode *N)
void setOnlyAccessesInaccessibleMemory()
OperandBundleDefT(std::string Tag, std::vector< InputTy > Inputs)
bool isInAllocaArgument(unsigned ArgNo) const
Determine whether this argument is passed in an alloca.
FunctionType * getType(LLVMContext &Context, ID id, ArrayRef< Type *> Tys=None)
Return the function type for an intrinsic.
CastInst(Type *Ty, unsigned iType, Value *S, const Twine &NameStr="", Instruction *InsertBefore=nullptr)
Constructor with insert-before-instruction semantics for subclasses.
Predicate
Predicate - These are "(BI << 5) | BO" for various predicates.
void setDoesNotReadMemory()
User::const_op_iterator arg_end() const
Type * getReturnType() const
#define DEFINE_HELPERS(OPC, NUWNSWEXACT)
bool hasByValArgument() const
Determine if any call argument is an aggregate passed by value.
void getOperandBundlesAsDefs(SmallVectorImpl< OperandBundleDef > &Defs) const
Return the list of operand bundles attached to this instruction as a vector of OperandBundleDefs.
static GCRegistry::Add< StatepointGC > D("statepoint-example", "an example strategy for statepoint")
StringMapEntry< uint32_t > * Tag
The operand bundle tag, interned by LLVMContextImpl::getOrInsertBundleTag.
Type * getDestTy() const
Return the destination type, as a convenience.
Use & getArgOperandUse(unsigned i)
AttributeList getAttributes() const
Return the parameter attributes for this call.
unsigned getNumArgOperands() const
getNumArgOperands - Return the number of funcletpad arguments.
static BinaryOperator * CreateFDivFMF(Value *V1, Value *V2, BinaryOperator *FMFSource, const Twine &Name="")
void setValueSubclassData(unsigned short D)
void setPredicate(Predicate P)
Set the predicate for this instruction to the specified value.
Predicate getFlippedStrictnessPredicate() const
For predicate of kind "is X or equal to 0" returns the predicate "is X".
bool isIntPredicate() const
bool isTrueWhenEqual() const
This is just a convenience.
A range adaptor for a pair of iterators.
Class to represent vector types.
bool isFalseWhenEqual() const
This is just a convenience.
static bool isFPPredicate(Predicate P)
A lightweight accessor for an operand bundle meant to be passed around by value.
Attribute getAttribute(unsigned i, StringRef Kind) const
Get the attribute of a given kind at a position.
bool doesNotAccessMemory() const
Determine if the call does not access memory.
Use & getCalledOperandUse()
static BinaryOperator * CreateExact(BinaryOps Opc, Value *V1, Value *V2, const Twine &Name, Instruction *I)
bool isFnAttrDisallowedByOpBundle(StringRef S) const
Is the function attribute S disallowed by some operand bundle on this operand bundle user...
Attribute getAttribute(unsigned i, Attribute::AttrKind Kind) const
Get the attribute of a given kind at a position.
user_iterator_impl< const User > const_user_iterator
amdgpu Simplify well known AMD library false Value Value * Arg
bool hasStructRetAttr() const
Determine if the call returns a structure through first pointer argument.
User::op_iterator arg_begin()
Return the iterator pointing to the beginning of the argument list.
void addDereferenceableAttr(unsigned i, uint64_t Bytes)
adds the dereferenceable attribute to the list of attributes.
OperandBundleDefT(const OperandBundleUse &OBU)
Predicate getPredicate() const
Return the predicate for this instruction.
static BinaryOperator * CreateWithCopiedFlags(BinaryOps Opc, Value *V1, Value *V2, BinaryOperator *CopyBO, const Twine &Name="")
unsigned getParamAlignment(unsigned ArgNo) const
Return the alignment for the specified function parameter.
bool isBundleOperand(Value::const_user_iterator UI) const
LLVM_NODISCARD AttributeList addAttribute(LLVMContext &C, unsigned Index, Attribute::AttrKind Kind) const
Add an attribute to the attribute set at the given index.
unsigned getNumArgOperands() const
Optional< OperandBundleUse > getOperandBundle(uint32_t ID) const
Return an operand bundle by tag ID, if present.
LLVM_NODISCARD AttributeList addDereferenceableAttr(LLVMContext &C, unsigned Index, uint64_t Bytes) const
Add the dereferenceable attribute to the attribute set at the given index.
void emplace_back(ArgTypes &&... Args)
bool isArgOperand(Value::const_user_iterator UI) const
AttributeList Attrs
parameter attributes for callable
iterator_range< const_bundle_op_iterator > bundle_op_infos() const
Return the range [bundle_op_info_begin, bundle_op_info_end).
CallingConv::ID getCallingConv() const
input_iterator input_begin() const
LLVM_NODISCARD AttributeList removeAttribute(LLVMContext &C, unsigned Index, Attribute::AttrKind Kind) const
Remove the specified attribute at the specified index from this attribute list.
Function * getCalledFunction() const
Returns the function called, or null if this is an indirect function invocation.
bool isDataOperand(const Use *U) const
bool onlyReadsMemory(unsigned OpNo) const
input_iterator input_end() const
StringRef getTagName() const
Return the tag of this operand bundle as a string.
unsigned data_operands_size() const
uint32_t End
The index in the Use& vector where operands for this operand bundle ends.
const Use & getArgOperandUse(unsigned i) const
Wrappers for getting the Use of a call argument.
Compile-time customization of User operands.
void setAttributes(AttributeList A)
Set the parameter attributes for this call.
void removeParamAttr(unsigned ArgNo, Attribute::AttrKind Kind)
Removes the attribute from the given argument.
static BinaryOperator * CreateFNegFMF(Value *Op, BinaryOperator *FMFSource, const Twine &Name="")
static BinaryOperator * CreateNeg(Value *S1, const Twine &Name, Instruction *InsertBefore, Value *FlagsOp)
bool doesNotReadMemory(unsigned OpNo) const
static bool isReturnNonNull(Function *F, const SCCNodeSet &SCCNodes, bool &Speculative)
Tests whether this function is known to not return null.
bool isStrictFP() const
Determine if the call requires strict floating point semantics.
void mutateType(Type *Ty)
Mutate the type of this Value to be of the specified type.
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...
Instruction(const Instruction &)=delete
static bool classof(const Value *V)
void setHasNoUnsignedWrap(bool b=true)
Set or clear the nuw flag on this instruction, which must be an operator which supports this flag...
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
op_range arg_operands()
arg_operands - iteration adapter for range-for loops.
bool hasArgument(const Value *V) const
Returns true if this CallSite passes the given Value* as an argument to the called function...
bool isDataOperand(Value::const_user_iterator UI) const
const Function * getCaller() const
LLVM Value Representation.
void setOnlyAccessesArgMemory()
static bool classof(const Value *V)
static VectorType * get(Type *ElementType, unsigned NumElements)
This static method is the primary way to construct an VectorType.
A container for an operand bundle being viewed as a set of values rather than a set of uses...
bundle_op_iterator bundle_op_info_begin()
Return the start of the list of BundleOpInfo instances associated with this OperandBundleUser.
StringRef - Represent a constant reference to a string, i.e.
Predicate getSwappedPredicate() const
For example, EQ->EQ, SLE->SGE, ULT->UGT, OEQ->OEQ, ULE->UGE, OLT->OGT, etc.
iterator_range< bundle_op_iterator > bundle_op_infos()
Return the range [bundle_op_info_begin, bundle_op_info_end).
FixedNumOperandTraits - determine the allocation regime of the Use array when it is a prefix to the U...
Value * getArgOperand(unsigned i) const
getArgOperand/setArgOperand - Return/set the i-th funcletpad argument.
Attribute getParamAttr(unsigned ArgNo, Attribute::AttrKind Kind) const
Get the attribute of a given kind from a given arg.
static bool classof(const Instruction *I)
VariadicOperandTraits - determine the allocation regime of the Use array when it is a prefix to the U...
const Use & getCalledOperandUse() const
static bool classof(const Instruction *I)
bool dataOperandHasImpliedAttr(unsigned i, Attribute::AttrKind Kind) const
Return true if the data operand at index i has the attribute A.
static bool classof(const Instruction *I)
Methods for support type inquiry through isa, cast, and dyn_cast:
constexpr char Args[]
Key for Kernel::Metadata::mArgs.
User::const_op_iterator data_operands_begin() const
static bool classof(const Value *V)
void removeAttribute(unsigned i, Attribute::AttrKind Kind)
removes the attribute from the list of attributes.
void addAttribute(unsigned i, Attribute Attr)
adds the attribute to the list of attributes.
bool isCallee(const Use *U) const
Determine whether this Use is the callee operand's Use.
AttrKind
This enumeration lists the attributes that can be associated with parameters, function results...
iterator_range< User::const_op_iterator > data_ops() const
bool is_contained(R &&Range, const E &Element)
Wrapper function around std::find to detect if an element exists in a container.
Predicate getSwappedPredicate(Predicate Opcode)
Assume the condition register is set by MI(a,b), return the predicate if we modify the instructions s...