16 #ifndef LLVM_IR_INSTRTYPES_H 17 #define LLVM_IR_INSTRTYPES_H 58 Use *Ops,
unsigned NumOps,
60 :
Instruction(Ty, iType, Ops, NumOps, InsertBefore) {}
64 :
Instruction(Ty, iType, Ops, NumOps, InsertAtEnd) {}
81 return isa<Instruction>(V) &&
classof(cast<Instruction>(V));
87 case Instruction::CatchSwitch:
88 case Instruction::CatchRet:
89 case Instruction::CleanupRet:
90 case Instruction::Invoke:
91 case Instruction::Resume:
102 template <
class Term,
class BB>
103 class SuccIterator :
public std::iterator<std::random_access_iterator_tag, BB,
106 std::iterator<std::random_access_iterator_tag, BB, int, BB *, BB *>;
117 inline bool index_is_valid(
unsigned idx) {
118 return idx < TermInst->getNumSuccessors();
122 class SuccessorProxy {
126 explicit SuccessorProxy(
const Self &it) : it(it) {}
128 SuccessorProxy(
const SuccessorProxy &) =
default;
130 SuccessorProxy &
operator=(SuccessorProxy r) {
136 it.TermInst->setSuccessor(it.idx, r);
140 operator reference()
const {
return *it; }
149 idx = TermInst->getNumSuccessors();
164 inline bool operator==(
const Self &x)
const {
return idx == x.idx; }
192 assert(TermInst == x.TermInst &&
193 "Cannot compare iterators of different blocks!");
198 assert(TermInst == x.TermInst &&
199 "Cannot compare iterators of different blocks!");
203 assert(TermInst == x.TermInst &&
204 "Cannot compare iterators of different blocks!");
209 assert(TermInst == x.TermInst &&
210 "Cannot compare iterators of different blocks!");
215 unsigned new_idx = idx +
Right;
216 assert(index_is_valid(new_idx) &&
"Iterator index out of bound");
232 assert(TermInst == x.TermInst &&
233 "Cannot work on iterators of different blocks!");
234 int distance = idx - x.idx;
241 return SuccessorProxy(tmp);
246 assert(TermInst &&
"Source not available, if basic block was malformed");
247 return TermInst->getParent();
294 void *
operator new(
size_t s) {
295 return User::operator
new(s, 1);
303 return I->
getOpcode() == Instruction::Alloca ||
306 I->
getOpcode() == Instruction::ExtractValue ||
310 return isa<Instruction>(V) &&
classof(cast<Instruction>(V));
330 const Twine &
Name, Instruction *InsertBefore);
335 friend class Instruction;
341 void *
operator new(
size_t s) {
342 return User::operator
new(s, 2);
355 Instruction *InsertBefore =
nullptr);
367 #define HANDLE_BINARY_INST(N, OPC, CLASS) \ 368 static BinaryOperator *Create##OPC(Value *V1, Value *V2, \ 369 const Twine &Name = "") {\ 370 return Create(Instruction::OPC, V1, V2, Name);\ 372 #include "llvm/IR/Instruction.def" 373 #define HANDLE_BINARY_INST(N, OPC, CLASS) \ 374 static BinaryOperator *Create##OPC(Value *V1, Value *V2, \ 375 const Twine &Name, BasicBlock *BB) {\ 376 return Create(Instruction::OPC, V1, V2, Name, BB);\ 378 #include "llvm/IR/Instruction.def" 379 #define HANDLE_BINARY_INST(N, OPC, CLASS) \ 380 static BinaryOperator *Create##OPC(Value *V1, Value *V2, \ 381 const Twine &Name, Instruction *I) {\ 382 return Create(Instruction::OPC, V1, V2, Name, I);\ 384 #include "llvm/IR/Instruction.def" 389 const Twine &Name =
"") {
397 const Twine &Name =
"") {
398 return CreateWithCopiedFlags(Instruction::FAdd, V1, V2, FMFSource, Name);
402 const Twine &Name =
"") {
403 return CreateWithCopiedFlags(Instruction::FSub, V1, V2, FMFSource, Name);
407 const Twine &Name =
"") {
408 return CreateWithCopiedFlags(Instruction::FMul, V1, V2, FMFSource, Name);
412 const Twine &Name =
"") {
413 return CreateWithCopiedFlags(Instruction::FDiv, V1, V2, FMFSource, Name);
417 const Twine &Name =
"") {
418 return CreateWithCopiedFlags(Instruction::FRem, V1, V2, FMFSource, Name);
421 const Twine &Name =
"") {
423 return CreateWithCopiedFlags(Instruction::FSub, Zero, Op, FMFSource);
427 const Twine &Name =
"") {
439 const Twine &Name, Instruction *
I) {
446 const Twine &Name =
"") {
458 const Twine &Name, Instruction *
I) {
465 const Twine &Name =
"") {
477 const Twine &Name, Instruction *
I) {
483 #define DEFINE_HELPERS(OPC, NUWNSWEXACT) \ 484 static BinaryOperator *Create##NUWNSWEXACT##OPC(Value *V1, Value *V2, \ 485 const Twine &Name = "") { \ 486 return Create##NUWNSWEXACT(Instruction::OPC, V1, V2, Name); \ 488 static BinaryOperator *Create##NUWNSWEXACT##OPC( \ 489 Value *V1, Value *V2, const Twine &Name, BasicBlock *BB) { \ 490 return Create##NUWNSWEXACT(Instruction::OPC, V1, V2, Name, BB); \ 492 static BinaryOperator *Create##NUWNSWEXACT##OPC( \ 493 Value *V1, Value *V2, const Twine &Name, Instruction *I) { \ 494 return Create##NUWNSWEXACT(Instruction::OPC, V1, V2, Name, I); \ 511 #undef DEFINE_HELPERS 518 static BinaryOperator *
CreateNeg(
Value *Op,
const Twine &Name =
"",
519 Instruction *InsertBefore =
nullptr);
522 static BinaryOperator *CreateNSWNeg(
Value *Op,
const Twine &Name =
"",
523 Instruction *InsertBefore =
nullptr);
524 static BinaryOperator *CreateNSWNeg(
Value *Op,
const Twine &Name,
526 static BinaryOperator *CreateNUWNeg(
Value *Op,
const Twine &Name =
"",
527 Instruction *InsertBefore =
nullptr);
528 static BinaryOperator *CreateNUWNeg(
Value *Op,
const Twine &Name,
530 static BinaryOperator *CreateFNeg(
Value *Op,
const Twine &Name =
"",
531 Instruction *InsertBefore =
nullptr);
532 static BinaryOperator *CreateFNeg(
Value *Op,
const Twine &Name,
534 static BinaryOperator *CreateNot(
Value *Op,
const Twine &Name =
"",
535 Instruction *InsertBefore =
nullptr);
536 static BinaryOperator *CreateNot(
Value *Op,
const Twine &Name,
541 static bool isNeg(
const Value *V);
542 static bool isFNeg(
const Value *V,
bool IgnoreZeroSign=
false);
543 static bool isNot(
const Value *V);
548 static const Value *getNegArgument(
const Value *BinOp);
550 static const Value *getFNegArgument(
const Value *BinOp);
552 static const Value *getNotArgument(
const Value *BinOp);
571 return isa<Instruction>(V) &&
classof(cast<Instruction>(V));
596 const Twine &NameStr =
"", Instruction *InsertBefore =
nullptr)
597 : UnaryInstruction(Ty, iType, S, InsertBefore) {
603 : UnaryInstruction(Ty, iType, S, InsertAtEnd) {
618 const Twine &Name =
"",
619 Instruction *InsertBefore =
nullptr 636 static CastInst *CreateZExtOrBitCast(
639 const Twine &Name =
"",
640 Instruction *InsertBefore =
nullptr 644 static CastInst *CreateZExtOrBitCast(
652 static CastInst *CreateSExtOrBitCast(
655 const Twine &Name =
"",
656 Instruction *InsertBefore =
nullptr 660 static CastInst *CreateSExtOrBitCast(
679 const Twine &Name =
"",
680 Instruction *InsertBefore =
nullptr 684 static CastInst *CreatePointerBitCastOrAddrSpaceCast(
692 static CastInst *CreatePointerBitCastOrAddrSpaceCast(
695 const Twine &Name =
"",
696 Instruction *InsertBefore =
nullptr 705 static CastInst *CreateBitOrPointerCast(
708 const Twine &Name =
"",
709 Instruction *InsertBefore =
nullptr 717 const Twine &Name =
"",
718 Instruction *InsertBefore =
nullptr 734 const Twine &Name =
"",
735 Instruction *InsertBefore =
nullptr 747 static CastInst *CreateTruncOrBitCast(
750 const Twine &Name =
"",
751 Instruction *InsertBefore =
nullptr 755 static CastInst *CreateTruncOrBitCast(
763 static bool isCastable(
769 static bool isBitCastable(
779 static bool isBitOrNoopPointerCastable(
799 bool isIntegerCast()
const;
806 bool isLosslessCast()
const;
815 static bool isNoopCast(
833 static unsigned isEliminableCastPair(
865 return isa<Instruction>(V) &&
classof(cast<Instruction>(V));
903 FIRST_FCMP_PREDICATE = FCMP_FALSE,
904 LAST_FCMP_PREDICATE = FCMP_TRUE,
905 BAD_FCMP_PREDICATE = FCMP_TRUE + 1,
916 FIRST_ICMP_PREDICATE = ICMP_EQ,
917 LAST_ICMP_PREDICATE = ICMP_SLE,
918 BAD_ICMP_PREDICATE = ICMP_SLE + 1
932 void *
operator new(
size_t s) {
933 return User::operator
new(s, 2);
967 return P >= FIRST_FCMP_PREDICATE && P <= LAST_FCMP_PREDICATE;
971 return P >= FIRST_ICMP_PREDICATE && P <= LAST_ICMP_PREDICATE;
1042 void swapOperands();
1050 bool isEquality()
const;
1091 static bool isUnsigned(
Predicate predicate);
1101 static bool isUnordered(
Predicate predicate);
1107 static bool isFalseWhenEqual(
Predicate predicate);
1119 return I->
getOpcode() == Instruction::ICmp ||
1123 return isa<Instruction>(V) &&
classof(cast<Instruction>(V));
1128 if (
VectorType* vt = dyn_cast<VectorType>(opnd_type)) {
1130 vt->getNumElements());
1138 void setValueSubclassData(
unsigned short D) {
1191 Op<-1>() = ParentPad;
1210 return isa<Instruction>(V) &&
classof(cast<Instruction>(V));
1227 : Inputs(Inputs), Tag(Tag) {}
1232 if (isDeoptOperandBundle())
1233 if (A == Attribute::ReadOnly || A == Attribute::NoCapture)
1234 return Inputs[Idx]->getType()->isPointerTy();
1242 return Tag->getKey();
1251 return Tag->getValue();
1277 std::vector<InputTy> Inputs;
1281 : Tag(
std::move(Tag)), Inputs(
std::move(Inputs)) {}
1283 : Tag(
std::move(Tag)), Inputs(Inputs) {}
1287 Inputs.insert(Inputs.end(), OBU.
Inputs.begin(), OBU.
Inputs.end());
1354 return std::distance(bundle_op_info_begin(), bundle_op_info_end());
1362 assert(hasOperandBundles() &&
"Don't call otherwise!");
1363 return bundle_op_info_begin()->Begin;
1368 assert(hasOperandBundles() &&
"Don't call otherwise!");
1369 return bundle_op_info_end()[-1].End;
1374 return hasOperandBundles() && Idx >= getBundleOperandsStartIndex() &&
1375 Idx < getBundleOperandsEndIndex();
1381 if (!hasOperandBundles())
1384 unsigned Begin = getBundleOperandsStartIndex();
1385 unsigned End = getBundleOperandsEndIndex();
1387 assert(Begin <= End &&
"Should be!");
1393 assert(Index < getNumOperandBundles() &&
"Index out of bounds!");
1394 return operandBundleFromBundleOpInfo(*(bundle_op_info_begin() + Index));
1401 for (
unsigned i = 0, e = getNumOperandBundles(); i != e; ++i)
1402 if (getOperandBundleAt(i).getTagName() == Name)
1412 for (
unsigned i = 0, e = getNumOperandBundles(); i != e; ++i)
1413 if (getOperandBundleAt(i).getTagID() == ID)
1424 assert(countOperandBundlesOfType(Name) < 2 &&
"Precondition violated!");
1426 for (
unsigned i = 0, e = getNumOperandBundles(); i != e; ++i) {
1440 assert(countOperandBundlesOfType(ID) < 2 &&
"Precondition violated!");
1442 for (
unsigned i = 0, e = getNumOperandBundles(); i != e; ++i) {
1459 for (
unsigned i = 0, e = getNumOperandBundles(); i != e; ++i)
1468 return operandBundleFromBundleOpInfo(getBundleOpInfoForOperand(OpIdx));
1477 return hasOperandBundles();
1483 for (
auto &BOI : bundle_op_infos()) {
1499 auto &BOI = getBundleOpInfoForOperand(OpIdx);
1500 auto OBU = operandBundleFromBundleOpInfo(BOI);
1501 return OBU.operandHasAttr(OpIdx - BOI.Begin, A);
1512 return std::equal(bundle_op_info_begin(), bundle_op_info_end(),
1519 for (
unsigned i = 0, e = getNumOperandBundles(); i != e; ++i) {
1520 uint32_t ID = getOperandBundleAt(i).getTagID();
1543 case Attribute::InaccessibleMemOrArgMemOnly:
1544 return hasReadingOperandBundles();
1546 case Attribute::InaccessibleMemOnly:
1547 return hasReadingOperandBundles();
1549 case Attribute::ArgMemOnly:
1550 return hasReadingOperandBundles();
1552 case Attribute::ReadNone:
1553 return hasReadingOperandBundles();
1555 case Attribute::ReadOnly:
1556 return hasClobberingOperandBundles();
1578 return Tag == Other.
Tag && Begin == Other.
Begin && End == Other.
End;
1597 if (!static_cast<InstrTy *>(
this)->hasDescriptor())
1600 uint8_t *BytesBegin =
static_cast<InstrTy *
>(
this)->
getDescriptor().begin();
1607 auto *NonConstThis =
1615 if (!static_cast<InstrTy *>(
this)->hasDescriptor())
1618 uint8_t *BytesEnd =
static_cast<InstrTy *
>(
this)->
getDescriptor().end();
1625 auto *NonConstThis =
1632 return make_range(bundle_op_info_begin(), bundle_op_info_end());
1637 return make_range(bundle_op_info_begin(), bundle_op_info_end());
1647 const unsigned BeginIndex) {
1648 auto It =
static_cast<InstrTy *
>(
this)->
op_begin() + BeginIndex;
1649 for (
auto &
B : Bundles)
1650 It =
std::copy(
B.input_begin(),
B.input_end(), It);
1653 auto BI = Bundles.begin();
1654 unsigned CurrentIndex = BeginIndex;
1656 for (
auto &BOI : bundle_op_infos()) {
1657 assert(BI != Bundles.end() &&
"Incorrect allocation?");
1659 BOI.Tag = ContextImpl->getOrInsertBundleTag(BI->getTag());
1660 BOI.Begin = CurrentIndex;
1661 BOI.End = CurrentIndex + BI->input_size();
1662 CurrentIndex = BOI.End;
1666 assert(BI == Bundles.end() &&
"Incorrect allocation?");
1676 for (
auto &BOI : bundle_op_infos())
1677 if (BOI.Begin <= OpIdx && OpIdx < BOI.End)
1686 for (
auto &
B : Bundles)
1687 Total +=
B.input_size();
1694 #endif // LLVM_IR_INSTRTYPES_H TerminatorInst(Type *Ty, Instruction::TermOps iType, Use *Ops, unsigned NumOps, Instruction *InsertBefore=nullptr)
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.
Predicate getNonStrictPredicate() const
For example, SGT -> SGE, SLT -> SLE, ULT -> ULE, UGT -> UGE.
A parsed version of the target data layout string in and methods for querying it. ...
This class is the base class for the comparison instructions.
Self operator+(int Right) const
static bool classof(const Instruction *I)
Type * getSrcTy() const
Return the source type, as a convenience.
static IntegerType * getInt1Ty(LLVMContext &C)
unsigned getSuccessorIndex() const
This is used to interface between code that wants to operate on terminator instructions directly...
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)
Self operator-(int Right) const
Compute iterated dominance frontiers using a linear time algorithm.
BinaryOps getOpcode() const
unsigned getSubclassDataFromInstruction() const
unsigned countOperandBundlesOfType(StringRef Name) const
Return the number of operand bundles with the tag Name attached to this instruction.
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)
BasicBlock * getSuccessor(unsigned idx) const
Return the specified successor.
Self & operator+=(int Right)
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...
static unsigned CountBundleInputs(ArrayRef< OperandBundleDef > Bundles)
Return the total number of values used in Bundles.
unsigned getNumOperandBundles() const
Return the number of operand bundles associated with this User.
uint32_t Begin
The index in the Use& vector where operands for this operand bundle starts.
bool operator==(const BundleOpInfo &Other) const
unsigned getNumTotalBundleOperands() const
Return the total number operands (not operand bundles) used by every operand bundle in this OperandBu...
iterator_range< op_iterator > op_range
OperandBundleUse getOperandBundleAt(unsigned Index) const
Return the operand bundle at a specific index.
LLVMContext & getContext() const
All values hold a context through their type.
bool isTerminator() const
static bool classof(const Value *V)
typename std::vector< InputTy >::const_iterator input_iterator
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...
bool hasOperandBundlesOtherThan(ArrayRef< uint32_t > IDs) const
Return true if this operand bundle user contains operand bundles with tags other than those specified...
void copyIRFlags(const Value *V, bool IncludeWrapFlags=true)
Convenience method to copy supported exact, fast-math, and (optionally) wrapping flags from V to this...
UnaryInstruction(Type *Ty, unsigned iType, Value *V, Instruction *IB=nullptr)
static BinaryOperator * CreateFSubFMF(Value *V1, Value *V2, BinaryOperator *FMFSource, const Twine &Name="")
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.
static BinaryOperator * CreateNSW(BinaryOps Opc, Value *V1, Value *V2, const Twine &Name="")
bool operator>(const Self &x) const
size_t input_size() const
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...
This is the base class for all instructions that perform data casts.
static Constant * getNegativeZero(Type *Ty)
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.
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.
bool hasClobberingOperandBundles() const
Return true if this operand bundle user has operand bundles that may write to the heap...
This file contains the simple types necessary to represent the attributes associated with functions a...
bundle_op_iterator bundle_op_info_begin()
Return the start of the list of BundleOpInfo instances associated with this OperandBundleUser.
typename super::pointer pointer
void setName(const Twine &Name)
Change the name of the value.
BundleOpInfo * bundle_op_iterator
static bool isOrdered(const Instruction *I)
iterator_range< const_op_iterator > const_op_range
Interval::succ_iterator succ_begin(Interval *I)
succ_begin/succ_end - define methods so that Intervals may be used just like BasicBlocks can with the...
static BinaryOperator * CreateFRemFMF(Value *V1, Value *V2, BinaryOperator *FMFSource, const Twine &Name="")
bool operator>=(const Self &x) const
OtherOps getOpcode() const
Get the opcode casted to the right type.
#define DEFINE_TRANSPARENT_OPERAND_ACCESSORS(CLASS, VALUECLASS)
Macro for generating out-of-class operand accessor definitions.
static BinaryOperator * CreateFAddFMF(Value *V1, Value *V2, BinaryOperator *FMFSource, const Twine &Name="")
BB * getSource()
Get the source BB of this iterator.
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.
Type * getType() const
All values are typed, get the type of this value.
bool operator!=(const Self &x) const
bool isFuncletOperandBundle() const
Return true if this is a "funclet" operand bundle.
void setParentPad(Value *ParentPad)
pointer operator->() const
const_op_range arg_operands() const
arg_operands - iteration adapter for range-for loops.
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory)...
Used to keep track of an operand bundle.
unsigned getOpcode() const
Returns a member of one of the enums like Instruction::Add.
void setInstructionSubclassData(unsigned short D)
OperandBundleUse(StringMapEntry< uint32_t > *Tag, ArrayRef< Use > Inputs)
Value * getOperand(unsigned i) const
Interval::succ_iterator succ_end(Interval *I)
static bool classof(const Instruction *I)
Methods for support type inquiry through isa, cast, and dyn_cast:
initializer< Ty > init(const Ty &Val)
bool isFnAttrDisallowedByOpBundle(Attribute::AttrKind A) const
Is the function attribute A disallowed by some operand bundle on this operand bundle user...
static bool isIntPredicate(Predicate P)
static GCRegistry::Add< OcamlGC > B("ocaml", "ocaml 3.10-compatible GC")
Subclasses of this class are all able to terminate a basic block.
succ_const_range successors() const
void setSuccessor(unsigned idx, BasicBlock *B)
Update the specified successor to point at the provided block.
unsigned getBundleOperandsStartIndex() const
Return the index of the first bundle operand in the Use array.
LLVM Basic Block Representation.
The instances of the Type class are immutable: once they are created, they are never changed...
SuccIterator< const TerminatorInst *, const BasicBlock > succ_const_iterator
This file contains the declarations for the subclasses of Constant, which represent the different fla...
static BinaryOperator * CreateNUW(BinaryOps Opc, Value *V1, Value *V2, const Twine &Name="")
Optional< OperandBundleUse > getOperandBundle(uint32_t ID) const
Return an operand bundle by tag ID, if present.
iterator_range< const_bundle_op_iterator > bundle_op_infos() const
Return the range [bundle_op_info_begin, bundle_op_info_end).
static BinaryOperator * CreateNUW(BinaryOps Opc, Value *V1, Value *V2, const Twine &Name, BasicBlock *BB)
static BinaryOperator * CreateExact(BinaryOps Opc, Value *V1, Value *V2, const Twine &Name, BasicBlock *BB)
ArrayRef< const uint8_t > getDescriptor() const
Returns the descriptor co-allocated with this User instance.
iterator_range< succ_iterator > succ_range
static bool classof(const Value *V)
bool isDeoptOperandBundle() const
Return true if this is a "deopt" operand bundle.
static bool classof(const Instruction *I)
Self & operator-=(int Right)
#define DECLARE_TRANSPARENT_OPERAND_ACCESSORS(VALUECLASS)
Macro for generating in-class operand accessor declarations.
Value(Type *Ty, unsigned scid)
unsigned countOperandBundlesOfType(uint32_t ID) const
Return the number of operand bundles with the tag ID attached to this instruction.
bool hasIdenticalOperandBundleSchema(const OperandBundleUser< InstrTy, OpIteratorTy > &Other) const
Return true if Other has the same sequence of operand bundle tags with the same number of operands on...
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
OpIteratorTy populateBundleOperandInfos(ArrayRef< OperandBundleDef > Bundles, const unsigned BeginIndex)
Populate the BundleOpInfo instances and the Use& vector from Bundles.
LLVMContextImpl *const pImpl
bool isBundleOperand(unsigned Idx) const
Return true if the operand at index Idx is a bundle operand.
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.
bool bundleOperandHasAttr(unsigned OpIdx, Attribute::AttrKind A) const
Return true if the bundle operand at index OpIdx has the attribute A.
void setHasNoSignedWrap(bool b=true)
Set or clear the nsw flag on this instruction, which must be an operator which supports this flag...
Predicate getPredicate(unsigned Condition, unsigned Hint)
Return predicate consisting of specified condition and hint bits.
unsigned getNumOperands() const
TerminatorInst(Type *Ty, Instruction::TermOps iType, Use *Ops, unsigned NumOps, BasicBlock *InsertAtEnd)
OperandBundleDefT(std::string Tag, std::vector< InputTy > Inputs)
bool isExceptional() const
const BundleOpInfo & getBundleOpInfoForOperand(unsigned OpIdx) const
Return the BundleOpInfo for the operand at index OpIdx.
bool operator==(const Self &x) const
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.
bool isFnAttrDisallowedByOpBundle(StringRef S) const
Is the function attribute S disallowed by some operand bundle on this operand bundle user...
bundle_op_iterator bundle_op_info_end()
Return the end of the list of BundleOpInfo instances associated with this OperandBundleUser.
#define DEFINE_HELPERS(OPC, NUWNSWEXACT)
static GCRegistry::Add< StatepointGC > D("statepoint-example", "an example strategy for statepoint")
OperandBundleUse operandBundleFromBundleOpInfo(const BundleOpInfo &BOI) const
Simple helper function to map a BundleOpInfo to an OperandBundleUse.
Type * getDestTy() const
Return the destination type, as a convenience.
unsigned getNumArgOperands() const
getNumArgOperands - Return the number of funcletpad arguments.
static BinaryOperator * CreateFDivFMF(Value *V1, Value *V2, BinaryOperator *FMFSource, const Twine &Name="")
bool isCommutative() const
Return true if the instruction is commutative:
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".
void setOperand(unsigned i, Value *Val)
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.
unsigned getBundleOperandsEndIndex() const
Return the index of the last bundle operand in the Use array.
uint32_t End
The index in the Use& vector where operands for this operand bundle ends.
static BinaryOperator * CreateExact(BinaryOps Opc, Value *V1, Value *V2, const Twine &Name, Instruction *I)
StringMapEntry< uint32_t > * Tag
The operand bundle tag, interned by LLVMContextImpl::getOrInsertBundleTag.
reference operator*() const
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="")
bool operator<=(const Self &x) const
void emplace_back(ArgTypes &&... Args)
static bool classof(const Value *V)
Optional< OperandBundleUse > getOperandBundle(StringRef Name) const
Return an operand bundle by name, if present.
input_iterator input_begin() const
static bool isSigned(Value *V)
Can the given value generate sign bits.
SuccIterator(Term T, bool)
input_iterator input_end() const
StringRef getTagName() const
Return the tag of this operand bundle as a string.
Compile-time customization of User operands.
static BinaryOperator * CreateFNegFMF(Value *Op, BinaryOperator *FMFSource, const Twine &Name="")
SuccessorProxy operator[](int offset)
static BinaryOperator * CreateNeg(Value *S1, const Twine &Name, Instruction *InsertBefore, Value *FlagsOp)
Instruction & operator=(const Instruction &)=delete
const_bundle_op_iterator bundle_op_info_begin() const
Return the start of the list of BundleOpInfo instances associated with this OperandBundleUser.
OperandBundleUse getOperandBundleForOperand(unsigned OpIdx) const
Return the operand bundle for the operand at index OpIdx.
const BundleOpInfo * const_bundle_op_iterator
void getOperandBundlesAsDefs(SmallVectorImpl< OperandBundleDef > &Defs) const
Return the list of operand bundles attached to this instruction as a vector of OperandBundleDefs.
SuccIterator< TerminatorInst *, BasicBlock > succ_iterator
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.
unsigned getNumSuccessors() const
Return the number of successors that this terminator has.
const_bundle_op_iterator bundle_op_info_end() const
Return the end of the list of BundleOpInfo instances associated with this OperandBundleUser.
LLVM Value Representation.
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...
iterator_range< succ_const_iterator > succ_const_range
iterator_range< bundle_op_iterator > bundle_op_infos()
Return the range [bundle_op_info_begin, bundle_op_info_end).
bool operator<(const Self &x) const
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.
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.
static bool classof(const Instruction *I)
VariadicOperandTraits - determine the allocation regime of the Use array when it is a prefix to the U...
typename super::reference reference
OutputIt copy(R &&Range, OutputIt Out)
static bool classof(const Instruction *I)
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.
bool hasReadingOperandBundles() const
Return true if this operand bundle user has operand bundles that may read from the heap...
static bool classof(const Value *V)
A mixin to add operand bundle functionality to llvm instruction classes.
AttrKind
This enumeration lists the attributes that can be associated with parameters, function results...
int operator-(const Self &x) 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...