16 #ifndef LLVM_IR_INSTRUCTIONS_H 17 #define LLVM_IR_INSTRUCTIONS_H 71 Value *ArraySize =
nullptr,
148 return (I->
getOpcode() == Instruction::Alloca);
151 return isa<Instruction>(V) &&
classof(cast<Instruction>(V));
157 void setInstructionSubclassData(
unsigned short D) {
191 NameStr, isVolatile, Align, InsertBefore) {}
200 NameStr, isVolatile, Align, Order, SSID, InsertBefore) {}
211 bool isVolatile =
false,
Instruction *InsertBefore =
nullptr);
213 bool isVolatile =
false,
216 NameStr, isVolatile, InsertBefore) {}
245 ((
unsigned)Ordering << 7));
262 setOrdering(Ordering);
263 setSyncScopeID(SSID);
281 return getPointerOperandType()->getPointerAddressSpace();
289 return isa<Instruction>(V) &&
classof(cast<Instruction>(V));
295 void setInstructionSubclassData(
unsigned short D) {
338 void *
operator new(
size_t s) {
339 return User::operator
new(s, 2);
370 ((
unsigned)Ordering << 7));
387 setOrdering(Ordering);
388 setSyncScopeID(SSID);
409 return getPointerOperandType()->getPointerAddressSpace();
417 return isa<Instruction>(V) &&
classof(cast<Instruction>(V));
423 void setInstructionSubclassData(
unsigned short D) {
449 friend class Instruction;
458 Instruction *InsertBefore =
nullptr);
463 void *
operator new(
size_t s) {
464 return User::operator
new(s, 0);
476 ((
unsigned)Ordering << 1));
491 return I->
getOpcode() == Instruction::Fence;
494 return isa<Instruction>(V) &&
classof(cast<Instruction>(V));
500 void setInstructionSubclassData(
unsigned short D) {
540 void *
operator new(
size_t s) {
541 return User::operator
new(s, 3);
579 "CmpXchg instructions can only be atomic.");
581 ((
unsigned)Ordering << 2));
592 "CmpXchg instructions can only be atomic.");
594 ((
unsigned)Ordering << 5));
631 switch (SuccessOrdering) {
647 return I->
getOpcode() == Instruction::AtomicCmpXchg;
650 return isa<Instruction>(V) &&
classof(cast<Instruction>(V));
656 void setInstructionSubclassData(
unsigned short D) {
730 void *
operator new(
size_t s) {
731 return User::operator
new(s, 2);
740 setInstructionSubclassData((SubclassData & 31) |
768 "atomicrmw instructions can only be atomic.");
770 ((
unsigned)Ordering << 2));
797 return I->
getOpcode() == Instruction::AtomicRMW;
800 return isa<Instruction>(V) &&
classof(cast<Instruction>(V));
809 void setInstructionSubclassData(
unsigned short D) {
834 assert(Ty &&
"Invalid GetElementPtrInst indices for type!");
842 Type *SourceElementType;
843 Type *ResultElementType;
869 const Twine &NameStr =
"",
880 NameStr, InsertBefore);
885 const Twine &NameStr,
896 NameStr, InsertAtEnd);
903 const Twine &NameStr =
"",
905 return CreateInBounds(
nullptr, Ptr, IdxList, NameStr, InsertBefore);
910 const Twine &NameStr =
"",
913 Create(PointeeType, Ptr, IdxList, NameStr, InsertBefore);
920 const Twine &NameStr,
922 return CreateInBounds(
nullptr, Ptr, IdxList, NameStr, InsertAtEnd);
927 const Twine &NameStr,
930 Create(PointeeType, Ptr, IdxList, NameStr, InsertAtEnd);
944 assert(ResultElementType ==
945 cast<PointerType>(
getType()->getScalarType())->getElementType());
946 return ResultElementType;
953 return getPointerAddressSpace();
997 return getPointerOperandType()->getPointerAddressSpace();
1003 return getGEPReturnType(
1017 if (
Index->getType()->isVectorTy()) {
1018 unsigned NumElem =
Index->getType()->getVectorNumElements();
1036 bool hasAllZeroIndices()
const;
1041 bool hasAllConstantIndices()
const;
1045 void setIsInBounds(
bool b =
true);
1048 bool isInBounds()
const;
1062 return (I->
getOpcode() == Instruction::GetElementPtr);
1065 return isa<Instruction>(V) &&
classof(cast<Instruction>(V));
1074 GetElementPtrInst::GetElementPtrInst(
Type *PointeeType,
Value *Ptr,
1076 const Twine &NameStr,
1078 :
Instruction(getGEPReturnType(PointeeType, Ptr, IdxList), GetElementPtr,
1080 Values, InsertBefore),
1081 SourceElementType(PointeeType),
1082 ResultElementType(getIndexedType(PointeeType, IdxList)) {
1083 assert(ResultElementType ==
1084 cast<PointerType>(
getType()->getScalarType())->getElementType());
1085 init(Ptr, IdxList, NameStr);
1088 GetElementPtrInst::GetElementPtrInst(
Type *PointeeType,
Value *Ptr,
1090 const Twine &NameStr,
1092 :
Instruction(getGEPReturnType(PointeeType, Ptr, IdxList), GetElementPtr,
1094 Values, InsertAtEnd),
1095 SourceElementType(PointeeType),
1096 ResultElementType(getIndexedType(PointeeType, IdxList)) {
1097 assert(ResultElementType ==
1098 cast<PointerType>(
getType()->getScalarType())->getElementType());
1099 init(Ptr, IdxList, NameStr);
1114 assert(isIntPredicate() &&
1115 "Invalid ICmp predicate value");
1117 "Both operands to ICmp instruction are not of the same type!");
1121 "Invalid operand types for ICmp instruction");
1138 const Twine &NameStr =
"" 1153 const Twine &NameStr =
"" 1167 const Twine &NameStr =
"" 1202 return P == ICMP_EQ || P == ICMP_NE;
1218 return !isEquality();
1224 return !isEquality(P);
1234 Op<0>().
swap(Op<1>());
1239 return I->
getOpcode() == Instruction::ICmp;
1242 return isa<Instruction>(V) &&
classof(cast<Instruction>(V));
1256 assert(isFPPredicate() &&
"Invalid FCmp predicate value");
1258 "Both operands to FCmp instruction are not of the same type!");
1261 "Invalid operand types for FCmp instruction");
1278 const Twine &NameStr =
"" 1291 const Twine &NameStr =
"" 1303 const Twine &NameStr =
"" 1312 return Pred == FCMP_OEQ || Pred == FCMP_ONE || Pred == FCMP_UEQ ||
1323 return isEquality() ||
1341 Op<0>().
swap(Op<1>());
1346 return I->
getOpcode() == Instruction::FCmp;
1349 return isa<Instruction>(V) &&
classof(cast<Instruction>(V));
1365 template <
class InstTy>
1373 template <
class... ArgsTy>
1378 using BaseInstTy::BaseInstTy;
1395 "CallBase is not meant to be used as part of the classof hierarchy");
1417 return getNumOperands() - getNumTotalBundleOperands() - InstTy::ArgOffset;
1423 assert(i < getNumArgOperands() &&
"Out of bounds!");
1427 assert(i < getNumArgOperands() &&
"Out of bounds!");
1437 return op_end() - getNumTotalBundleOperands() - InstTy::ArgOffset;
1451 return op_end() - getNumTotalBundleOperands() - InstTy::ArgOffset;
1461 assert(i < getNumArgOperands() &&
"Out of bounds!");
1465 assert(i < getNumArgOperands() &&
"Out of bounds!");
1477 if (
F->getAttributes().hasAttrSomewhere(Attribute::Returned, &Index) &&
1500 "getOperand() out of range!");
1502 const_cast<CallBase *>(
this))[i_nocapture]
1508 "setOperand() out of range!");
1515 template <
int Idx_nocapture>
Use &
Op() {
1516 return User::OpFrom<Idx_nocapture>(
this);
1518 template <
int Idx_nocapture>
const Use &
Op()
const {
1519 return User::OpFrom<Idx_nocapture>(
this);
1531 assert(Kind != Attribute::NoBuiltin &&
1532 "Use CallBase::isNoBuiltin() to check for Attribute::NoBuiltin");
1533 return hasFnAttrImpl(Kind);
1545 auto ID =
static_cast<unsigned>(CC);
1568 assert(ArgNo < getNumArgOperands() &&
"Out of bounds");
1576 assert(ArgNo < getNumArgOperands() &&
"Out of bounds");
1598 assert(ArgNo < getNumArgOperands() &&
"Out of bounds");
1606 assert(ArgNo < getNumArgOperands() &&
"Out of bounds");
1640 assert(ArgNo < getNumArgOperands() &&
"Param index out of bounds!");
1645 return F->getAttributes().hasParamAttribute(ArgNo, Kind);
1661 assert(ArgNo < getNumArgOperands() &&
"Out of bounds");
1667 assert(ArgNo < getNumArgOperands() &&
"Out of bounds");
1687 "Data operand index out of bounds!");
1694 return hasRetAttr(Kind);
1698 if (i < (getNumArgOperands() + 1))
1699 return paramHasAttr(i - 1, Kind);
1701 assert(hasOperandBundles() && i >= (getBundleOperandsStartIndex() + 1) &&
1702 "Must be either a call argument or an operand bundle!");
1703 return bundleOperandHasAttr(i - 1, Kind);
1734 return hasFnAttrImpl(Attribute::NoBuiltin) &&
1735 !hasFnAttrImpl(Attribute::Builtin);
1739 bool isStrictFP()
const {
return hasFnAttr(Attribute::StrictFP); }
1742 bool isNoInline()
const {
return hasFnAttr(Attribute::NoInline); }
1748 return hasFnAttr(Attribute::ReadNone);
1756 return doesNotAccessMemory() || hasFnAttr(Attribute::ReadOnly);
1764 return doesNotAccessMemory() || hasFnAttr(Attribute::WriteOnly);
1773 return hasFnAttr(Attribute::ArgMemOnly);
1782 return hasFnAttr(Attribute::InaccessibleMemOnly);
1791 return hasFnAttr(Attribute::InaccessibleMemOrArgMemOnly);
1829 if (getNumArgOperands() == 0)
1833 return paramHasAttr(0, Attribute::StructRet);
1848 cast<FunctionType>(cast<PointerType>(Fn->
getType())->getElementType()),
1853 assert(FTy == cast<FunctionType>(
1854 cast<PointerType>(Fn->
getType())->getElementType()));
1855 Op<-InstTy::ArgOffset>() = Fn;
1865 if (isFnAttrDisallowedByOpBundle(Kind))
1888 inline CallInst(FunctionType *Ty, Value *Func, ArrayRef<Value *> Args,
1889 ArrayRef<OperandBundleDef> Bundles, const Twine &NameStr,
1890 Instruction *InsertBefore);
1893 ArrayRef<OperandBundleDef> Bundles, const Twine &NameStr,
1894 Instruction *InsertBefore)
1896 cast<PointerType>(Func->getType())->getElementType()),
1897 Func,
Args, Bundles, NameStr, InsertBefore) {}
1901 : CallInst(Func, Args,
None, NameStr, InsertBefore) {}
1915 init(cast<FunctionType>(
1916 cast<PointerType>(Func->
getType())->getElementType()),
1917 Func, Args, Bundles, NameStr);
1930 static constexpr
int ArgOffset = 1;
1934 const Twine &NameStr =
"",
1936 return Create(cast<FunctionType>(
1937 cast<PointerType>(Func->
getType())->getElementType()),
1938 Func, Args, Bundles, NameStr, InsertBefore);
1942 const Twine &NameStr,
1944 return Create(cast<FunctionType>(
1945 cast<PointerType>(Func->
getType())->getElementType()),
1946 Func, Args,
None, NameStr, InsertBefore);
1950 const Twine &NameStr,
1953 CallInst(Ty, Func, Args,
None, NameStr, InsertBefore);
1958 const Twine &NameStr =
"",
1960 const unsigned TotalOps =
1961 unsigned(Args.
size()) + CountBundleInputs(Bundles) + 1;
1962 const unsigned DescriptorBytes = Bundles.
size() *
sizeof(BundleOpInfo);
1964 return new (TotalOps, DescriptorBytes)
1965 CallInst(Ty, Func, Args, Bundles, NameStr, InsertBefore);
1971 const unsigned TotalOps =
1972 unsigned(Args.
size()) + CountBundleInputs(Bundles) + 1;
1973 const unsigned DescriptorBytes = Bundles.
size() *
sizeof(BundleOpInfo);
1975 return new (TotalOps, DescriptorBytes)
1976 CallInst(Func, Args, Bundles, NameStr, InsertAtEnd);
1982 CallInst(Func, Args,
None, NameStr, InsertAtEnd);
1987 return new (1) CallInst(F, NameStr, InsertBefore);
1992 return new (1) CallInst(F, NameStr, InsertAtEnd);
2012 Value *ArraySize =
nullptr,
2017 Value *ArraySize =
nullptr,
2022 Value *ArraySize =
nullptr,
2028 Value *ArraySize =
nullptr,
2055 return Kind == TCK_Tail || Kind == TCK_MustTail;
2068 unsigned(isTC ? TCK_Tail : TCK_None));
2090 return isa<Instruction>(V) &&
classof(cast<Instruction>(V));
2096 void setInstructionSubclassData(
unsigned short D) {
2110 cast<PointerType>(Func->
getType())->getElementType())
2114 (Args.
size() + CountBundleInputs(Bundles) + 1),
2115 unsigned(Args.
size() + CountBundleInputs(Bundles) + 1), InsertAtEnd) {
2116 init(Func, Args, Bundles, NameStr);
2124 (Args.
size() + CountBundleInputs(Bundles) + 1),
2125 unsigned(Args.
size() + CountBundleInputs(Bundles) + 1),
2127 init(Ty, Func, Args, Bundles, NameStr);
2140 &Op<0>(), 3, InsertBefore) {
2148 &Op<0>(), 3, InsertAtEnd) {
2154 assert(!areInvalidOperands(C, S1, S2) &&
"Invalid operands for select");
2168 const Twine &NameStr =
"",
2178 const Twine &NameStr,
2180 return new(3)
SelectInst(C, S1, S2, NameStr, InsertAtEnd);
2196 static const char *areInvalidOperands(
Value *Cond,
Value *True,
Value *False);
2210 return isa<Instruction>(V) &&
classof(cast<Instruction>(V));
2256 return isa<Instruction>(V) &&
classof(cast<Instruction>(V));
2281 const Twine &NameStr =
"",
2287 const Twine &NameStr,
2294 static bool isValidOperands(
const Value *Vec,
const Value *Idx);
2302 return cast<VectorType>(getVectorOperand()->getType());
2310 return I->
getOpcode() == Instruction::ExtractElement;
2313 return isa<Instruction>(V) &&
classof(cast<Instruction>(V));
2333 const Twine &NameStr =
"",
2346 const Twine &NameStr =
"",
2352 const Twine &NameStr,
2359 static bool isValidOperands(
const Value *Vec,
const Value *NewElt,
2373 return I->
getOpcode() == Instruction::InsertElement;
2376 return isa<Instruction>(V) &&
classof(cast<Instruction>(V));
2403 const Twine &NameStr =
"",
2409 void *
operator new(
size_t s) {
2410 return User::operator
new(s, 3);
2415 static bool isValidOperands(
const Value *V1,
const Value *
V2,
2433 static int getMaskValue(
const Constant *Mask,
unsigned Elt);
2438 return getMaskValue(getMask(), Elt);
2443 static void getShuffleMask(
const Constant *Mask,
2449 return getShuffleMask(getMask(), Result);
2454 getShuffleMask(Mask);
2463 unsigned NumMaskElts = getMask()->getType()->getVectorNumElements();
2464 return NumSourceElts != NumMaskElts;
2475 getShuffleMask(Mask, MaskAsInts);
2476 return isSingleSourceMask(MaskAsInts);
2484 return !changesLength() && isSingleSourceMask(getMask());
2496 getShuffleMask(Mask, MaskAsInts);
2497 return isIdentityMask(MaskAsInts);
2506 return !changesLength() && isIdentityMask(getShuffleMask());
2521 getShuffleMask(Mask, MaskAsInts);
2522 return isSelectMask(MaskAsInts);
2534 return !changesLength() && isSelectMask(getMask());
2545 getShuffleMask(Mask, MaskAsInts);
2565 getShuffleMask(Mask, MaskAsInts);
2566 return isZeroEltSplatMask(MaskAsInts);
2576 return !changesLength() && isZeroEltSplatMask(getMask());
2615 getShuffleMask(Mask, MaskAsInts);
2616 return isTransposeMask(MaskAsInts);
2625 return !changesLength() && isTransposeMask(getMask());
2631 unsigned InVecNumElts) {
2632 for (
int &Idx : Mask) {
2635 Idx = Idx < (int)InVecNumElts ? Idx + InVecNumElts : Idx - InVecNumElts;
2636 assert(Idx >= 0 && Idx < (
int)InVecNumElts * 2 &&
2637 "shufflevector mask index out of range");
2643 return I->
getOpcode() == Instruction::ShuffleVector;
2646 return isa<Instruction>(V) &&
classof(cast<Instruction>(V));
2675 const Twine &NameStr,
2692 const Twine &NameStr =
"",
2700 const Twine &NameStr,
2734 return (
unsigned)Indices.
size();
2743 return I->
getOpcode() == Instruction::ExtractValue;
2746 return isa<Instruction>(V) &&
classof(cast<Instruction>(V));
2750 ExtractValueInst::ExtractValueInst(
Value *Agg,
2752 const Twine &NameStr,
2755 ExtractValue, Agg, InsertBefore) {
2756 init(Idxs, NameStr);
2759 ExtractValueInst::ExtractValueInst(
Value *Agg,
2761 const Twine &NameStr,
2764 ExtractValue, Agg, InsertAtEnd) {
2765 init(Idxs, NameStr);
2786 const Twine &NameStr,
2795 const Twine &NameStr =
"",
2801 const Twine &NameStr);
2811 void *
operator new(
size_t s) {
2812 return User::operator
new(s, 2);
2817 const Twine &NameStr =
"",
2824 const Twine &NameStr,
2865 return (
unsigned)Indices.
size();
2874 return I->
getOpcode() == Instruction::InsertValue;
2877 return isa<Instruction>(V) &&
classof(cast<Instruction>(V));
2886 InsertValueInst::InsertValueInst(
Value *Agg,
2889 const Twine &NameStr,
2894 init(Agg, Val, Idxs, NameStr);
2897 InsertValueInst::InsertValueInst(
Value *Agg,
2900 const Twine &NameStr,
2905 init(Agg, Val, Idxs, NameStr);
2921 unsigned ReservedSpace;
2925 explicit PHINode(
Type *Ty,
unsigned NumReservedValues,
2926 const Twine &NameStr =
"",
2928 :
Instruction(Ty, Instruction::PHI,
nullptr, 0, InsertBefore),
2929 ReservedSpace(NumReservedValues) {
2936 :
Instruction(Ty, Instruction::PHI,
nullptr, 0, InsertAtEnd),
2937 ReservedSpace(NumReservedValues) {
2959 const Twine &NameStr =
"",
2961 return new PHINode(Ty, NumReservedValues, NameStr, InsertBefore);
2966 return new PHINode(Ty, NumReservedValues, NameStr, InsertAtEnd);
2999 return make_range(block_begin(), block_end());
3003 return make_range(block_begin(), block_end());
3020 assert(V &&
"PHI node got a null value!");
3022 "All operands to PHI node must be the same type as the PHI node!");
3037 return block_begin()[i];
3044 assert(
this == U.
getUser() &&
"Iterator doesn't point to PHI's Uses?");
3045 return getIncomingBlock(
unsigned(&U -
op_begin()));
3052 return getIncomingBlock(I.getUse());
3056 assert(BB &&
"PHI node got a null basic block!");
3057 block_begin()[i] = BB;
3079 Value *removeIncomingValue(
unsigned Idx,
bool DeletePHIIfEmpty =
true);
3082 int Idx = getBasicBlockIndex(BB);
3083 assert(Idx >= 0 &&
"Invalid basic block argument to remove!");
3084 return removeIncomingValue(Idx, DeletePHIIfEmpty);
3092 if (block_begin()[i] == BB)
3098 int Idx = getBasicBlockIndex(BB);
3099 assert(Idx >= 0 &&
"Invalid basic block argument!");
3100 return getIncomingValue(Idx);
3105 Value *hasConstantValue()
const;
3110 bool hasConstantOrUndefValue()
const;
3114 return I->
getOpcode() == Instruction::PHI;
3117 return isa<Instruction>(V) &&
classof(cast<Instruction>(V));
3121 void growOperands();
3145 unsigned ReservedSpace;
3159 void *
operator new(
size_t s) {
3160 return User::operator
new(s);
3163 void growOperands(
unsigned Size);
3164 void init(
unsigned NumReservedValues,
const Twine &NameStr);
3176 const Twine &NameStr =
"",
3196 void addClause(
Constant *ClauseVal);
3223 return I->
getOpcode() == Instruction::LandingPad;
3226 return isa<Instruction>(V) &&
classof(cast<Instruction>(V));
3273 return new(!!retVal)
ReturnInst(C, retVal, InsertBefore);
3278 return new(!!retVal)
ReturnInst(C, retVal, InsertAtEnd);
3300 return isa<Instruction>(V) &&
classof(cast<Instruction>(V));
3306 BasicBlock *getSuccessor(
unsigned idx)
const {
3359 return new(1)
BranchInst(IfTrue, InsertBefore);
3364 return new(3)
BranchInst(IfTrue, IfFalse, Cond, InsertBefore);
3368 return new(1)
BranchInst(IfTrue, InsertAtEnd);
3373 return new(3)
BranchInst(IfTrue, IfFalse, Cond, InsertAtEnd);
3383 assert(isConditional() &&
"Cannot get condition of an uncond branch!");
3388 assert(isConditional() &&
"Cannot set condition of unconditional branch!");
3395 assert(i < getNumSuccessors() &&
"Successor # out of range for Branch!");
3396 return cast_or_null<BasicBlock>((&
Op<-1>() - i)->get());
3400 assert(idx < getNumSuccessors() &&
"Successor # out of range for Branch!");
3401 *(&
Op<-1>() - idx) = NewSucc;
3409 void swapSuccessors();
3413 return (I->
getOpcode() == Instruction::Br);
3416 return isa<Instruction>(V) &&
classof(cast<Instruction>(V));
3434 unsigned ReservedSpace;
3457 void *
operator new(
size_t s) {
3458 return User::operator
new(s);
3461 void init(Value *Value,
BasicBlock *Default,
unsigned NumReserved);
3462 void growOperands();
3472 static const unsigned DefaultPseudoIndex =
static_cast<unsigned>(~0L-1);
3481 template <
typename SwitchInstT,
typename ConstantIntT,
typename BasicBlockT>
3500 assert((
unsigned)Index < SI->getNumCases() &&
3501 "Index out the number of cases.");
3502 return reinterpret_cast<ConstantIntT *
>(SI->getOperand(2 + Index * 2));
3507 assert(((
unsigned)Index < SI->getNumCases() ||
3508 (
unsigned)Index == DefaultPseudoIndex) &&
3509 "Index out the number of cases.");
3510 return SI->getSuccessor(getSuccessorIndex());
3518 assert(((
unsigned)Index == DefaultPseudoIndex ||
3519 (
unsigned)Index < SI->getNumCases()) &&
3520 "Index out the number of cases.");
3521 return (
unsigned)Index != DefaultPseudoIndex ? Index + 1 : 0;
3525 assert(SI == RHS.
SI &&
"Incompatible operators.");
3526 return Index == RHS.
Index;
3542 assert((
unsigned)Index < SI->getNumCases() &&
3543 "Index out the number of cases.");
3553 template <
typename CaseHandleT>
3556 std::random_access_iterator_tag,
3558 using SwitchInstT =
typename CaseHandleT::SwitchInstType;
3574 unsigned SuccessorIndex) {
3575 assert(SuccessorIndex < SI->getNumSuccessors() &&
3576 "Successor index # out of range!");
3590 assert(Case.Index + N >= 0 &&
3591 (
unsigned)(Case.Index + N) <= Case.SI->getNumCases() &&
3592 "Case.Index out the number of cases.");
3599 assert(Case.Index - N >= 0 &&
3600 (
unsigned)(Case.Index - N) <= Case.SI->getNumCases() &&
3601 "Case.Index out the number of cases.");
3606 assert(Case.SI == RHS.Case.SI &&
"Incompatible operators.");
3607 return Case.Index - RHS.Case.Index;
3610 return Case == RHS.Case;
3613 assert(Case.SI == RHS.Case.SI &&
"Incompatible operators.");
3614 return Case.Index < RHS.Case.Index;
3626 return new SwitchInst(Value, Default, NumCases, InsertBefore);
3630 unsigned NumCases,
BasicBlock *InsertAtEnd) {
3631 return new SwitchInst(Value, Default, NumCases, InsertAtEnd);
3646 setOperand(1, reinterpret_cast<Value*>(DefaultCase));
3670 return CaseIt(
this, getNumCases());
3695 return CaseIt(
this, DefaultPseudoIndex);
3708 if (I != case_end())
3711 return case_default();
3717 if (I != case_end())
3720 return case_default();
3726 if (BB == getDefaultDest())
3730 for (
auto Case : cases()) {
3731 if (Case.getCaseSuccessor() != BB)
3737 CI = Case.getCaseValue();
3760 assert(idx < getNumSuccessors() &&
"Successor idx out of range for switch!");
3761 return cast<BasicBlock>(
getOperand(idx*2+1));
3764 assert(idx < getNumSuccessors() &&
"Successor # out of range for switch!");
3770 return I->
getOpcode() == Instruction::Switch;
3773 return isa<Instruction>(V) &&
classof(cast<Instruction>(V));
3791 unsigned ReservedSpace;
3810 void *
operator new(
size_t s) {
3811 return User::operator
new(s);
3814 void init(Value *Address,
unsigned NumDests);
3815 void growOperands();
3856 void removeDestination(
unsigned i);
3868 return I->
getOpcode() == Instruction::IndirectBr;
3871 return isa<Instruction>(V) &&
classof(cast<Instruction>(V));
3896 inline InvokeInst(Value *Func, BasicBlock *IfNormal, BasicBlock *IfException,
3897 ArrayRef<Value *> Args, ArrayRef<OperandBundleDef> Bundles,
3898 unsigned Values, const Twine &NameStr,
3899 Instruction *InsertBefore)
3901 cast<PointerType>(Func->getType())->getElementType()),
3902 Func, IfNormal, IfException, Args, Bundles, Values, NameStr,
3914 unsigned Values,
const Twine &NameStr,
3920 const Twine &NameStr) {
3921 init(cast<FunctionType>(
3922 cast<PointerType>(Func->
getType())->getElementType()),
3923 Func, IfNormal, IfException, Args, Bundles, NameStr);
3937 static constexpr
int ArgOffset = 3;
3940 const Twine &NameStr,
3942 return Create(cast<FunctionType>(
3943 cast<PointerType>(Func->
getType())->getElementType()),
3944 Func, IfNormal, IfException, Args,
None, NameStr,
3951 const Twine &NameStr =
"",
3953 return Create(cast<FunctionType>(
3954 cast<PointerType>(Func->
getType())->getElementType()),
3955 Func, IfNormal, IfException, Args, Bundles, NameStr,
3961 const Twine &NameStr,
3964 return new (Values)
InvokeInst(Ty, Func, IfNormal, IfException, Args,
None,
3965 Values, NameStr, InsertBefore);
3971 const Twine &NameStr =
"",
3973 unsigned Values =
unsigned(Args.
size()) + CountBundleInputs(Bundles) + 3;
3974 unsigned DescriptorBytes = Bundles.
size() *
sizeof(BundleOpInfo);
3976 return new (Values, DescriptorBytes)
3977 InvokeInst(Ty, Func, IfNormal, IfException, Args, Bundles, Values,
3978 NameStr, InsertBefore);
3986 return new (Values)
InvokeInst(Func, IfNormal, IfException, Args,
None,
3987 Values, NameStr, InsertAtEnd);
3994 unsigned Values =
unsigned(Args.
size()) + CountBundleInputs(Bundles) + 3;
3995 unsigned DescriptorBytes = Bundles.
size() *
sizeof(BundleOpInfo);
3997 return new (Values, DescriptorBytes)
3998 InvokeInst(Func, IfNormal, IfException, Args, Bundles, Values, NameStr,
4035 cast<FunctionType>(cast<PointerType>(Fn->
getType())->getElementType()),
4040 assert(FTy == cast<FunctionType>(
4041 cast<PointerType>(Fn->
getType())->getElementType()));
4047 return cast<BasicBlock>(
Op<-2>());
4050 return cast<BasicBlock>(
Op<-1>());
4053 Op<-2>() = reinterpret_cast<Value*>(B);
4056 Op<-1>() = reinterpret_cast<Value*>(B);
4061 LandingPadInst *getLandingPadInst()
const;
4064 assert(i < 2 &&
"Successor # out of range for invoke!");
4065 return i == 0 ? getNormalDest() : getUnwindDest();
4069 assert(idx < 2 &&
"Successor # out of range for invoke!");
4070 *(&
Op<-2>() + idx) =
reinterpret_cast<Value*
>(NewSucc);
4077 return (I->
getOpcode() == Instruction::Invoke);
4080 return isa<Instruction>(V) &&
classof(cast<Instruction>(V));
4087 void setInstructionSubclassData(
unsigned short D) {
4103 Values, InsertBefore) {
4104 init(Ty, Func, IfNormal, IfException, Args, Bundles, NameStr);
4107 InvokeInst::InvokeInst(Value *Func,
BasicBlock *IfNormal,
4113 cast<PointerType>(Func->
getType())->getElementType())
4115 Instruction::Invoke,
4118 init(Func, IfNormal, IfException, Args, Bundles, NameStr);
4160 return I->
getOpcode() == Instruction::Resume;
4163 return isa<Instruction>(V) &&
classof(cast<Instruction>(V));
4169 BasicBlock *getSuccessor(
unsigned idx)
const {
4173 void setSuccessor(
unsigned idx,
BasicBlock *NewSucc) {
4191 unsigned ReservedSpace;
4203 unsigned NumHandlers,
const Twine &NameStr,
4211 unsigned NumHandlers,
const Twine &NameStr,
4215 void *
operator new(
size_t s) {
return User::operator
new(s); }
4217 void init(Value *ParentPad,
BasicBlock *UnwindDest,
unsigned NumReserved);
4218 void growOperands(
unsigned Size);
4228 unsigned NumHandlers,
4229 const Twine &NameStr =
"",
4231 return new CatchSwitchInst(ParentPad, UnwindDest, NumHandlers, NameStr,
4236 unsigned NumHandlers,
const Twine &NameStr,
4238 return new CatchSwitchInst(ParentPad, UnwindDest, NumHandlers, NameStr,
4253 if (hasUnwindDest())
4266 if (hasUnwindDest())
4272 static BasicBlock *handler_helper(Value *V) {
return cast<BasicBlock>(V); }
4273 static const BasicBlock *handler_helper(
const Value *V) {
4274 return cast<BasicBlock>(V);
4289 if (hasUnwindDest())
4298 if (hasUnwindDest())
4300 return const_handler_iterator(It,
ConstDerefFnTy(handler_helper));
4317 return make_range(handler_begin(), handler_end());
4322 return make_range(handler_begin(), handler_end());
4335 assert(Idx < getNumSuccessors() &&
4336 "Successor # out of range for catchswitch!");
4337 return cast<BasicBlock>(
getOperand(Idx + 1));
4340 assert(Idx < getNumSuccessors() &&
4341 "Successor # out of range for catchswitch!");
4347 return I->
getOpcode() == Instruction::CatchSwitch;
4350 return isa<Instruction>(V) &&
classof(cast<Instruction>(V));
4365 unsigned Values,
const Twine &NameStr,
4367 :
FuncletPadInst(Instruction::CleanupPad, ParentPad, Args, Values,
4368 NameStr, InsertBefore) {}
4370 unsigned Values,
const Twine &NameStr,
4372 :
FuncletPadInst(Instruction::CleanupPad, ParentPad, Args, Values,
4373 NameStr, InsertAtEnd) {}
4377 const Twine &NameStr =
"",
4379 unsigned Values = 1 + Args.
size();
4386 unsigned Values = 1 + Args.
size();
4393 return I->
getOpcode() == Instruction::CleanupPad;
4396 return isa<Instruction>(V) &&
classof(cast<Instruction>(V));
4406 unsigned Values,
const Twine &NameStr,
4408 :
FuncletPadInst(Instruction::CatchPad, CatchSwitch, Args, Values,
4409 NameStr, InsertBefore) {}
4411 unsigned Values,
const Twine &NameStr,
4413 :
FuncletPadInst(Instruction::CatchPad, CatchSwitch, Args, Values,
4414 NameStr, InsertAtEnd) {}
4418 const Twine &NameStr =
"",
4420 unsigned Values = 1 + Args.
size();
4422 CatchPadInst(CatchSwitch, Args, Values, NameStr, InsertBefore);
4427 unsigned Values = 1 + Args.
size();
4429 CatchPadInst(CatchSwitch, Args, Values, NameStr, InsertAtEnd);
4434 return cast<CatchSwitchInst>(
Op<-1>());
4438 Op<-1>() = CatchSwitch;
4443 return I->
getOpcode() == Instruction::CatchPad;
4446 return isa<Instruction>(V) &&
classof(cast<Instruction>(V));
4502 return getCatchPad()->getCatchSwitch()->getParentPad();
4507 return (I->
getOpcode() == Instruction::CatchRet);
4510 return isa<Instruction>(V) &&
classof(cast<Instruction>(V));
4516 BasicBlock *getSuccessor(
unsigned Idx)
const {
4517 assert(Idx < getNumSuccessors() &&
"Successor # out of range for catchret!");
4518 return getSuccessor();
4521 void setSuccessor(
unsigned Idx,
BasicBlock *B) {
4522 assert(Idx < getNumSuccessors() &&
"Successor # out of range for catchret!");
4558 unsigned Values = 1;
4568 unsigned Values = 1;
4583 return cast<CleanupPadInst>(Op<0>());
4587 Op<0>() = CleanupPad;
4593 return hasUnwindDest() ? cast<BasicBlock>(Op<1>()) :
nullptr;
4603 return (I->
getOpcode() == Instruction::CleanupRet);
4606 return isa<Instruction>(V) &&
classof(cast<Instruction>(V));
4612 BasicBlock *getSuccessor(
unsigned Idx)
const {
4614 return getUnwindDest();
4617 void setSuccessor(
unsigned Idx,
BasicBlock *B) {
4624 void setInstructionSubclassData(
unsigned short D) {
4656 void *
operator new(
size_t s) {
4657 return User::operator
new(s, 0);
4664 return I->
getOpcode() == Instruction::Unreachable;
4667 return isa<Instruction>(V) &&
classof(cast<Instruction>(V));
4673 BasicBlock *getSuccessor(
unsigned idx)
const {
4677 void setSuccessor(
unsigned idx,
BasicBlock *B) {
4700 const Twine &NameStr =
"",
4708 const Twine &NameStr,
4717 return isa<Instruction>(V) &&
classof(cast<Instruction>(V));
4739 const Twine &NameStr =
"",
4747 const Twine &NameStr,
4756 return isa<Instruction>(V) &&
classof(cast<Instruction>(V));
4778 const Twine &NameStr =
"",
4786 const Twine &NameStr,
4795 return isa<Instruction>(V) &&
classof(cast<Instruction>(V));
4817 const Twine &NameStr =
"",
4825 const Twine &NameStr,
4834 return isa<Instruction>(V) &&
classof(cast<Instruction>(V));
4856 const Twine &NameStr =
"",
4864 const Twine &NameStr,
4873 return isa<Instruction>(V) &&
classof(cast<Instruction>(V));
4895 const Twine &NameStr =
"",
4903 const Twine &NameStr,
4912 return isa<Instruction>(V) &&
classof(cast<Instruction>(V));
4934 const Twine &NameStr =
"",
4942 const Twine &NameStr,
4951 return isa<Instruction>(V) &&
classof(cast<Instruction>(V));
4973 const Twine &NameStr =
"",
4981 const Twine &NameStr,
4990 return isa<Instruction>(V) &&
classof(cast<Instruction>(V));
5012 const Twine &NameStr =
"",
5020 const Twine &NameStr,
5029 return isa<Instruction>(V) &&
classof(cast<Instruction>(V));
5047 const Twine &NameStr =
"",
5055 const Twine &NameStr,
5072 return isa<Instruction>(V) &&
classof(cast<Instruction>(V));
5094 const Twine &NameStr =
"",
5102 const Twine &NameStr,
5123 return isa<Instruction>(V) &&
classof(cast<Instruction>(V));
5145 const Twine &NameStr =
"",
5153 const Twine &NameStr,
5162 return isa<Instruction>(V) &&
classof(cast<Instruction>(V));
5185 const Twine &NameStr =
"",
5193 const Twine &NameStr,
5202 return isa<Instruction>(V) &&
classof(cast<Instruction>(V));
5234 if (
auto *
Load = dyn_cast<LoadInst>(V))
5235 return Load->getPointerOperand();
5236 if (
auto *
Store = dyn_cast<StoreInst>(V))
5237 return Store->getPointerOperand();
5246 if (
auto *Gep = dyn_cast<GetElementPtrInst>(V))
5247 return Gep->getPointerOperand();
5253 #endif // LLVM_IR_INSTRUCTIONS_H static unsigned getInsertedValueOperandIndex()
static GetElementPtrInst * Create(Type *PointeeType, Value *Ptr, ArrayRef< Value *> IdxList, const Twine &NameStr, BasicBlock *InsertAtEnd)
Return a value (possibly void), from a function.
Value * getValueOperand()
unsigned getNumCases() const
Return the number of 'cases' in this switch instruction, excluding the default case.
static bool isEquality(Predicate Pred)
A parsed version of the target data layout string in and methods for querying it. ...
constexpr char Align[]
Key for Kernel::Arg::Metadata::mAlign.
Attribute getParamAttr(unsigned ArgNo, Attribute::AttrKind Kind) const
Return the attribute object that exists at the arg index.
Function * getCalledFunction() const
Return the function called, or null if this is an indirect function invocation.
Value * getPointerOperand()
static bool classof(const Instruction *I)
CaseIt case_end()
Returns a read/write iterator that points one past the last in the SwitchInst.
This class is the base class for the comparison instructions.
unsigned getSrcAddressSpace() const
Returns the address space of the pointer operand.
static bool classof(const Instruction *I)
Methods for support type inquiry through isa, cast, and dyn_cast:
idx_iterator idx_end() const
static CallInst * Create(FunctionType *Ty, Value *Func, ArrayRef< Value *> Args, ArrayRef< OperandBundleDef > Bundles=None, const Twine &NameStr="", Instruction *InsertBefore=nullptr)
bool hasStructRetAttr() const
Determine if the call returns a structure through first pointer argument.
void setUnwindDest(BasicBlock *UnwindDest)
CleanupPadInst * getCleanupPad() const
Convenience accessor.
void addIncoming(Value *V, BasicBlock *BB)
Add an incoming value to the end of the PHI list.
Value * getPointerOperand(Value *V)
A helper function that returns the pointer operand of a load, store or GEP instruction.
*p = old <signed v ? old : v
iterator_range< CaseIt > cases()
Iteration adapter for range-for loops.
const_block_iterator block_begin() const
ConstCaseIt case_begin() const
Returns a read-only iterator that points to the first case in the SwitchInst.
Value * getAggregateOperand()
static bool classof(const Instruction *I)
static bool classof(const Instruction *I)
static bool classof(const Instruction *I)
static bool classof(const Instruction *I)
Function * getCalledFunction() const
Return the function called, or null if this is an indirect function invocation.
Atomic ordering constants.
const CaseHandleT & operator*() const
static bool classof(const Value *V)
void addAttribute(unsigned i, Attribute::AttrKind Kind)
adds the attribute to the list of attributes.
bool onlyAccessesInaccessibleMemory() const
Determine if the function may only access memory that is inaccessible from the IR.
Compute iterated dominance frontiers using a linear time algorithm.
unsigned getSubclassDataFromInstruction() const
bool isAtomic() const
Return true if this instruction has an AtomicOrdering of unordered or higher.
bool isNoInline() const
Return true if the call should not be inlined.
void setCalledFunction(Value *Fn)
Set the function called.
void allocHungoffUses(unsigned N)
static PHINode * Create(Type *Ty, unsigned NumReservedValues, const Twine &NameStr, BasicBlock *InsertAtEnd)
The highest possible calling convention ID. Must be some 2^k - 1.
unsigned getNumIndices() const
static ResumeInst * Create(Value *Exn, Instruction *InsertBefore=nullptr)
void setOnlyAccessesArgMemory()
void setOrdering(AtomicOrdering Ordering)
Sets the ordering constraint of this rmw instruction.
static bool classof(const Instruction *I)
void setAlignment(unsigned Align)
An instruction for ordering other memory operations.
an instruction that atomically checks whether a specified value is in a memory location, and, if it is, stores a new value there.
BasicBlock *const * const_block_iterator
static CallInst * Create(FunctionType *Ty, Value *Func, ArrayRef< Value *> Args, const Twine &NameStr, Instruction *InsertBefore=nullptr)
This class represents zero extension of integer types.
This provides a very simple, boring adaptor for a begin and end iterator into a range type...
AllocaInst(Type *Ty, unsigned AddrSpace, Value *ArraySize=nullptr, const Twine &Name="", Instruction *InsertBefore=nullptr)
static GetElementPtrInst * Create(Type *PointeeType, Value *Ptr, ArrayRef< Value *> IdxList, const Twine &NameStr="", Instruction *InsertBefore=nullptr)
static CallInst * Create(Value *Func, ArrayRef< Value *> Args, const Twine &NameStr, Instruction *InsertBefore=nullptr)
Value * getPointerOperand()
Gets the pointer operand.
const_handler_range handlers() const
iteration adapter for range-for loops.
This class represents a function call, abstracting a target machine's calling convention.
CaseHandleImpl(SwitchInstT *SI, ptrdiff_t Index)
static bool classof(const Value *V)
const_handler_iterator handler_begin() const
Returns an iterator that points to the first handler in the CatchSwitchInst.
void setOrdering(AtomicOrdering Ordering)
Sets the ordering constraint of this load instruction.
void setOnlyReadsMemory()
static unsigned getPointerOperandIndex()
Gets the operand index of the pointer operand.
Value * getCondition() const
static bool classof(const Value *V)
static PointerType * get(Type *ElementType, unsigned AddressSpace)
This constructs a pointer to an object of the specified type in a numbered address space...
SyncScope::ID getSyncScopeID() const
Returns the synchronization scope ID of this store instruction.
const Value * getTrueValue() const
CaseIt case_begin()
Returns a read/write iterator that points to the first case in the SwitchInst.
The two locations do not alias at all.
User::op_iterator arg_begin()
Return the iterator pointing to the beginning of the argument list.
*p = old <unsigned v ? old : v
bool isReverse() const
Return true if this shuffle swaps the order of elements from exactly one source vector.
void setAllocatedType(Type *Ty)
for use only in special circumstances that need to generically transform a whole instruction (eg: IR ...
void setVolatile(bool V)
Specify whether this is a volatile cmpxchg.
bool isSwiftError() const
Return true if this alloca is used as a swifterror argument to a call.
AtomicOrdering getOrdering() const
Returns the ordering constraint of this load instruction.
ConstantIntT * getCaseValue() const
Resolves case value for current case.
*p = old >unsigned v ? old : v
This instruction constructs a fixed permutation of two input vectors.
static SelectInst * Create(Value *C, Value *S1, Value *S2, const Twine &NameStr="", Instruction *InsertBefore=nullptr, Instruction *MDFrom=nullptr)
static bool classof(const Value *V)
static bool classof(const Value *V)
LLVMContext & getContext() const
All values hold a context through their type.
iterator_range< const_block_iterator > blocks() const
Attribute getAttribute(unsigned i, StringRef Kind) const
Get the attribute of a given kind at a position.
const Use & getOperandUse(unsigned i) const
Type * getPointerOperandType() const
BasicBlock * getSuccessor(unsigned i) const
static bool classof(const Instruction *I)
static bool isEquality(Predicate P)
Return true if this predicate is either EQ or NE.
void setSuccessor(unsigned i, BasicBlock *NewSucc)
void setSuccessor(BasicBlock *NewSucc)
Value * getNewValOperand()
bool onlyAccessesInaccessibleMemOrArgMem() const
Determine if the function may only access memory that is either inaccessible from the IR or pointed t...
Base class for all callable instructions (InvokeInst and CallInst) Holds everything related to callin...
static CallInst * Create(Value *Func, ArrayRef< Value *> Args, ArrayRef< OperandBundleDef > Bundles=None, const Twine &NameStr="", Instruction *InsertBefore=nullptr)
AttributeList Attrs
parameter attributes for callable
This class represents a sign extension of integer types.
unsigned getPointerAddressSpace() const
Get the address space of this pointer or pointer vector type.
unsigned getRetAlignment() const
Return the alignment of the return value.
An instruction for reading from memory.
static bool classof(const Value *V)
static bool classof(const Value *V)
static bool classof(const Instruction *I)
Methods for support type inquiry through isa, cast, and dyn_cast:
static bool classof(const Instruction *I)
Methods for support type inquiry through isa, cast, and dyn_cast:
an instruction that atomically reads a memory location, combines it with another value, and then stores the result back.
void setAddress(Value *V)
Value * getCondition() const
CallBase(AttributeList const &A, FunctionType *FT, ArgsTy &&... Args)
BasicBlock * getUnwindDest() const
void removeParamAttr(unsigned ArgNo, Attribute::AttrKind Kind)
Removes the attribute from the given argument.
static CleanupReturnInst * Create(Value *CleanupPad, BasicBlock *UnwindBB, BasicBlock *InsertAtEnd)
LoadInst(Value *Ptr, const char *NameStr=nullptr, bool isVolatile=false, Instruction *InsertBefore=nullptr)
bool isVectorTy() const
True if this is an instance of VectorType.
CallingConv::ID getCallingConv() const
getCallingConv/setCallingConv - Get or set the calling convention of this function call...
static bool classof(const Value *V)
Constant * getClause(unsigned Idx) const
Get the value of the clause at index Idx.
BasicBlock * getSuccessor() const
This defines the Use class.
handler_iterator handler_begin()
Returns an iterator that points to the first handler in CatchSwitchInst.
static bool classof(const Instruction *I)
bool isMustTailCall() const
static bool isSelectMask(const Constant *Mask)
void setAtomic(AtomicOrdering Ordering, SyncScope::ID SSID=SyncScope::System)
Sets the ordering constraint and the synchronization scope ID of this store instruction.
static bool classof(const Instruction *I)
void addParamAttr(unsigned ArgNo, Attribute::AttrKind Kind)
Adds the attribute to the indicated argument.
void setSyncScopeID(SyncScope::ID SSID)
Sets the synchronization scope ID of this rmw instruction.
*p = old >signed v ? old : v
User::const_op_iterator op_end() const
ConstCaseIt findCaseValue(const ConstantInt *C) const
UnaryInstruction(Type *Ty, unsigned iType, Value *V, Instruction *IB=nullptr)
static InvokeInst * Create(Value *Func, BasicBlock *IfNormal, BasicBlock *IfException, ArrayRef< Value *> Args, const Twine &NameStr, BasicBlock *InsertAtEnd)
uint64_t getDereferenceableBytes(unsigned i) const
Extract the number of dereferenceable bytes for a call or parameter (0=unknown).
unsigned getPointerAddressSpace() const
Returns the address space of the pointer operand.
static bool classof(const Instruction *I)
BasicBlock * getIncomingBlock(const Use &U) const
Return incoming basic block corresponding to an operand of the PHI.
Value * removeIncomingValue(const BasicBlock *BB, bool DeletePHIIfEmpty=true)
bool hasAttribute(unsigned Index, Attribute::AttrKind Kind) const
Return true if the attribute exists at the given index.
ConstantInt * findCaseDest(BasicBlock *BB)
Finds the unique case value for a given successor.
uint64_t getDereferenceableOrNullBytes(unsigned i) const
Extract the number of dereferenceable_or_null bytes for a call or parameter (0=unknown).
bool isSingleSource() const
Return true if this shuffle chooses elements from exactly one source vector without changing the leng...
static SwitchInst * Create(Value *Value, BasicBlock *Default, unsigned NumCases, BasicBlock *InsertAtEnd)
unsigned getNumDestinations() const
return the number of possible destinations in this indirectbr instruction.
BasicBlock * getSuccessor(unsigned i) const
bool onlyReadsMemory() const
Determine if the call does not access or only reads memory.
CaseIteratorImpl(SwitchInstT *SI, unsigned CaseNum)
Initializes case iterator for given SwitchInst and for given case number.
static BranchInst * Create(BasicBlock *IfTrue, BasicBlock *IfFalse, Value *Cond, BasicBlock *InsertAtEnd)
void setVolatile(bool V)
Specify whether this is a volatile RMW or not.
block_iterator block_end()
AtomicOrdering getFailureOrdering() const
Returns the failure ordering constraint of this cmpxchg instruction.
static bool classof(const Instruction *I)
bool doesNoCfCheck() const
Determine if the call should not perform indirect branch tracking.
static ReturnInst * Create(LLVMContext &C, Value *retVal=nullptr, Instruction *InsertBefore=nullptr)
static InsertValueInst * Create(Value *Agg, Value *Val, ArrayRef< unsigned > Idxs, const Twine &NameStr, BasicBlock *InsertAtEnd)
AllocaInst * cloneImpl() const
static bool classof(const Instruction *I)
void setAtomic(AtomicOrdering Ordering, SyncScope::ID SSID=SyncScope::System)
Sets the ordering constraint and the synchronization scope ID of this load instruction.
bool hasUnwindDest() const
static unsigned getOperandNumForIncomingValue(unsigned i)
static bool isRelational(Predicate P)
Return true if the predicate is relational (not EQ or NE).
Constant * getMask() const
static InsertElementInst * Create(Value *Vec, Value *NewElt, Value *Idx, const Twine &NameStr="", Instruction *InsertBefore=nullptr)
iterator_range< const_op_iterator > indices() const
bool isVolatile() const
Return true if this is a load from a volatile memory location.
This class represents a conversion between pointers from one address space to another.
BasicBlock *(*)(Value *) DerefFnTy
BasicBlock * getSuccessor(unsigned Idx) const
bool isRelational() const
This class represents the LLVM 'select' instruction.
static bool classof(const Value *V)
int getBasicBlockIndex(const BasicBlock *BB) const
Return the first index of the specified basic block in the value list for this PHI.
void addAttribute(unsigned i, Attribute Attr)
adds the attribute to the list of attributes.
FunctionType * getFunctionType() const
Twine - A lightweight data structure for efficiently representing the concatenation of temporary valu...
unsigned getAlignment() const
Return the alignment of the memory that is being allocated by the instruction.
OtherOps getOpcode() const
uint64_t getDereferenceableBytes(unsigned Index) const
Get the number of dereferenceable bytes (or zero if unknown).
void setCleanupPad(CleanupPadInst *CleanupPad)
This is the base class for all instructions that perform data casts.
PointerType * getType() const
Overload to return most specific pointer type.
unsigned getNumSuccessors() const
AttributeList addParamAttribute(LLVMContext &C, unsigned ArgNo, Attribute::AttrKind Kind) const
Add an argument attribute to the list.
static bool classof(const Instruction *I)
TailCallKind getTailCallKind() const
static bool classof(const Value *V)
unsigned getNumSuccessors() const
A Use represents the edge between a Value definition and its users.
static bool classof(const Value *V)
const Value * getPointerOperand() const
void setOrdering(AtomicOrdering Ordering)
Sets the ordering constraint of this fence instruction.
BinOp getOperation() const
const Value * getValueOperand() const
void setIsInBounds(bool b=true)
Set or clear the inbounds flag on this GEP instruction.
bool isWeak() const
Return true if this cmpxchg may spuriously fail.
const Value * getNewValOperand() const
unsigned getNumSuccessors() const
This file contains the simple types necessary to represent the attributes associated with functions a...
unsigned getNumSuccessors() const
unsigned getNumHandlers() const
return the number of 'handlers' in this catchswitch instruction, except the default handler ...
iterator_range< ConstCaseIt > cases() const
Constant iteration adapter for range-for loops.
static bool classof(const Value *V)
unsigned getPointerAddressSpace() const
Returns the address space of the pointer operand.
static bool classof(const Instruction *I)
Methods for support type inquiry through isa, cast, and dyn_cast:
void setName(const Twine &Name)
Change the name of the value.
BasicBlock * getIncomingBlock(Value::const_user_iterator I) const
Return incoming basic block corresponding to value use iterator.
bool isVolatile() const
Return true if this is a cmpxchg from a volatile memory location.
Value * getPointerOperand()
static bool isZeroEltSplatMask(const Constant *Mask)
Type * getSourceElementType() const
block_iterator block_begin()
unsigned getNumClauses() const
Get the number of clauses for this landing pad.
BasicBlock * getDestination(unsigned i)
Return the specified destination.
static bool classof(const Instruction *I)
bool operator==(const CaseHandleImpl &RHS) const
This class represents a cast from a pointer to an integer.
unsigned getPointerAddressSpace() const
Returns the address space of the pointer operand.
AtomicOrdering
Atomic ordering for LLVM's memory model.
bool isCommutative() const
static CaseIteratorImpl fromSuccessorIndex(SwitchInstT *SI, unsigned SuccessorIndex)
Initializes case iterator for given SwitchInst and for given TerminatorInst's successor index...
bool doesNotThrow() const
Determine if the call cannot unwind.
AttributeList getAttributes(LLVMContext &C, ID id)
Return the attributes for an intrinsic.
unsigned getNumIndices() const
void setUnwindDest(BasicBlock *B)
Value * getPointerOperand()
void getShuffleMask(SmallVectorImpl< int > &Result) const
Return the mask for this instruction as a vector of integers.
unsigned getPointerAddressSpace() const
Returns the address space of the pointer operand.
#define DEFINE_TRANSPARENT_OPERAND_ACCESSORS(CLASS, VALUECLASS)
Macro for generating out-of-class operand accessor definitions.
User * getUser() const LLVM_READONLY
Returns the User that contains this Use.
Class to represent function types.
static CatchSwitchInst * Create(Value *ParentPad, BasicBlock *UnwindDest, unsigned NumHandlers, const Twine &NameStr, BasicBlock *InsertAtEnd)
void setCleanup(bool V)
Indicate that this landingpad instruction is a cleanup.
Type * getType() const
All values are typed, get the type of this value.
static bool classof(const Instruction *I)
static bool classof(const Value *V)
static bool classof(const Instruction *I)
ptrdiff_t operator-(const CaseIteratorImpl &RHS) const
BinOp
This enumeration lists the possible modifications atomicrmw can make.
unsigned getCaseIndex() const
Returns number of current case.
void setNormalDest(BasicBlock *B)
AtomicOrdering getSuccessOrdering() const
Returns the success ordering constraint of this cmpxchg instruction.
unsigned getNumSuccessors() const
static BranchInst * Create(BasicBlock *IfTrue, BasicBlock *IfFalse, Value *Cond, Instruction *InsertBefore=nullptr)
bool isNoBuiltin() const
Return true if the call should not be treated as a call to a builtin.
bool isUsedWithInAlloca() const
Return true if this alloca is used as an inalloca argument to a call.
const_op_iterator idx_begin() const
void setAttributes(AttributeList A)
Set the parameter attributes for this call.
This instruction compares its operands according to the predicate given to the constructor.
bool cannotDuplicate() const
Determine if the invoke cannot be duplicated.
bool operator==(const CaseIteratorImpl &RHS) const
static bool classof(const Value *V)
static bool classof(const Value *V)
This class represents a no-op cast from one type to another.
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)...
Value * getInsertedValueOperand()
unsigned getOpcode() const
Returns a member of one of the enums like Instruction::Add.
static bool isReverseMask(const Constant *Mask)
static bool classof(const Value *V)
Value * getLoadStorePointerOperand(Value *V)
A helper function that returns the pointer operand of a load or store instruction.
void setInstructionSubclassData(unsigned short D)
An instruction for storing to memory.
This class represents a cast from floating point to signed integer.
BasicBlock * getSuccessor(unsigned idx) const
bool isSelect() const
Return true if this shuffle chooses elements from its source vectors without lane crossings and all o...
const_op_range incoming_values() const
Value * getParentPad() const
constexpr char Attrs[]
Key for Kernel::Metadata::mAttrs.
AttributeList getAttributes() const
Return the parameter attributes for this call.
static bool classof(const Value *V)
bool operator<(const CaseIteratorImpl &RHS) const
bool hasFnAttrImpl(AttrKind Kind) const
handler_range handlers()
iteration adapter for range-for loops.
CRTP base class which implements the entire standard iterator facade in terms of a minimal subset of ...
ICmpInst(BasicBlock &InsertAtEnd, Predicate pred, Value *LHS, Value *RHS, const Twine &NameStr="")
Constructor with insert-at-end semantics.
static bool classof(const Value *V)
VectorType * getType() const
Overload to return most specific vector type.
This class represents a truncation of integer types.
static unsigned getPointerOperandIndex()
Gets the operand index of the pointer operand.
void setCannotDuplicate()
std::enable_if<!is_simple_type< Y >::value, typename cast_retty< X, const Y >::ret_type >::type cast(const Y &Val)
Value * getOperand(unsigned i) const
Class to represent pointers.
unsigned getNumSuccessors() const
bool isRelational() const
Return true if the predicate is relational (not EQ or NE).
unsigned getAddressSpace() const
Returns the address space of this instruction's pointer type.
bool doesNotAccessMemory() const
Determine if the call does not access memory.
Type * getScalarType() const
If this is a vector type, return the element type, otherwise return 'this'.
Value * getOperand(unsigned i_nocapture) const
void setUnwindDest(BasicBlock *NewDest)
User::op_iterator op_end()
CaseHandle(SwitchInst *SI, ptrdiff_t Index)
an instruction for type-safe pointer arithmetic to access elements of arrays and structs ...
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...
unsigned getNumSuccessors() const
static InvokeInst * Create(Value *Func, BasicBlock *IfNormal, BasicBlock *IfException, ArrayRef< Value *> Args, ArrayRef< OperandBundleDef > Bundles, const Twine &NameStr, BasicBlock *InsertAtEnd)
static bool classof(const Instruction *I)
bool doesNotThrow() const
Determine if the call cannot unwind.
static bool classof(const Value *V)
static unsigned getPointerOperandIndex()
void addParamAttr(unsigned ArgNo, Attribute Attr)
Adds the attribute to the indicated argument.
initializer< Ty > init(const Ty &Val)
void setDoesNotAccessMemory()
unsigned getNumOperands() const
This instruction inserts a single (scalar) element into a VectorType value.
void setParentPad(Value *ParentPad)
const Use * getOperandList() const
The landingpad instruction holds all of the information necessary to generate correct exception handl...
VAArgInst(Value *List, Type *Ty, const Twine &NameStr, BasicBlock *InsertAtEnd)
static GCRegistry::Add< OcamlGC > B("ocaml", "ocaml 3.10-compatible GC")
bool hasFnAttr(Attribute::AttrKind Kind) const
Determine whether this call has the given attribute.
Subclasses of this class are all able to terminate a basic block.
AttributeList addDereferenceableOrNullAttr(LLVMContext &C, unsigned Index, uint64_t Bytes) const
Add the dereferenceable_or_null attribute to the attribute set at the given index.
SyncScope::ID getSyncScopeID() const
Returns the synchronization scope ID of this rmw instruction.
MutableArrayRef - Represent a mutable reference to an array (0 or more elements consecutively in memo...
static unsigned getAggregateOperandIndex()
LLVM Basic Block Representation.
PointerIntPair - This class implements a pair of a pointer and small integer.
The instances of the Type class are immutable: once they are created, they are never changed...
static unsigned getPointerOperandIndex()
This is an important class for using LLVM in a threaded context.
Conditional or Unconditional Branch instruction.
PowerPC Reduce CR logical Operation
void mutateFunctionType(FunctionType *FTy)
void setSyncScopeID(SyncScope::ID SSID)
Sets the synchronization scope ID of this store instruction.
size_t size() const
size - Get the array size.
This function has undefined behavior.
This is an important base class in LLVM.
Attribute getAttribute(unsigned i, Attribute::AttrKind Kind) const
Get the attribute of a given kind at a position.
Resume the propagation of an exception.
LLVM_ATTRIBUTE_ALWAYS_INLINE iterator begin()
Value * getCompareOperand()
void setFailureOrdering(AtomicOrdering Ordering)
Sets the failure ordering constraint of this cmpxchg instruction.
Value * getIncomingValueForBlock(const BasicBlock *BB) const
bool isIdentity() const
Return true if this shuffle mask chooses elements from exactly one source vector without lane crossin...
void setUsedWithInAlloca(bool V)
Specify whether this alloca is used to represent the arguments to a call.
static BranchInst * Create(BasicBlock *IfTrue, BasicBlock *InsertAtEnd)
void setCalledFunction(FunctionType *FTy, Value *Fn)
Indirect Branch Instruction.
static bool isReverseMask(ArrayRef< int > M, EVT VT)
unsigned getPointerAddressSpace() const
Returns the address space of the pointer operand.
BasicBlock * getDefaultDest() const
User::op_iterator op_begin()
const Value * getCompareOperand() const
static bool classof(const Value *V)
const Value * getPointerOperand() const
const_op_iterator idx_end() const
static SelectInst * Create(Value *C, Value *S1, Value *S2, const Twine &NameStr, BasicBlock *InsertAtEnd)
static unsigned getPointerOperandIndex()
static bool classof(const Value *V)
void setCalledFunction(Value *Fn)
Set the function called.
This instruction compares its operands according to the predicate given to the constructor.
User::const_op_iterator arg_begin() const
Return the iterator pointing to the beginning of the argument list.
static GetElementPtrInst * CreateInBounds(Type *PointeeType, Value *Ptr, ArrayRef< Value *> IdxList, const Twine &NameStr, BasicBlock *InsertAtEnd)
void setArgOperand(unsigned i, Value *v)
Value * getPointerOperand()
static bool classof(const Value *V)
CaseIteratorImpl & operator+=(ptrdiff_t N)
const Value * getInsertedValueOperand() const
iterator_range< block_iterator > blocks()
unsigned getAddressSpace() const
Returns the address space of this instruction's pointer type.
static bool classof(const Value *V)
const Value * getPointerOperand() const
Gets the pointer operand.
auto find_if(R &&Range, UnaryPredicate P) -> decltype(adl_begin(Range))
Provide wrappers to std::find_if which take ranges instead of having to pass begin/end explicitly...
void setTailCallKind(TailCallKind TCK)
void setSourceElementType(Type *Ty)
void setOnlyAccessesInaccessibleMemOrArgMem()
This class represents a cast from an integer to a pointer.
const Value * getCondition() const
Type * getPointerOperandType() const
Method to return the pointer operand as a PointerType.
static bool classof(const Value *V)
void setTailCall(bool isTC=true)
This class represents the va_arg llvm instruction, which returns an argument of the specified type gi...
SyncScope::ID getSyncScopeID() const
Returns the synchronization scope ID of this cmpxchg instruction.
Attribute getAttribute(unsigned Index, Attribute::AttrKind Kind) const
Return the attribute object that exists at the given index.
iterator_range< User::op_iterator > arg_operands()
Iteration adapter for range-for loops.
BasicBlock * getSuccessor(unsigned i) const
void swapOperands()
Exchange the two operands to this instruction in such a way that it does not modify the semantics of ...
const Value * getArraySize() const
Get the number of elements allocated.
static CatchReturnInst * Create(Value *CatchPad, BasicBlock *BB, BasicBlock *InsertAtEnd)
static unsigned getIncomingValueNumForOperand(unsigned i)
Value * getIncomingValue(unsigned i) const
Return incoming value number x.
const Value * getPointerOperand() const
const Value * getPointerOperand() const
Gets the pointer operand.
void setSuccessor(unsigned Idx, BasicBlock *NewSucc)
AtomicOrdering getOrdering() const
Returns the ordering constraint of this rmw instruction.
int getMaskValue(unsigned Elt) const
Return the shuffle mask value of this instruction for the given element index.
bool hasRetAttr(Attribute::AttrKind Kind) const
Determine whether the return value has the given attribute.
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
const Value * getAggregateOperand() const
static IndirectBrInst * Create(Value *Address, unsigned NumDests, Instruction *InsertBefore=nullptr)
static InvokeInst * Create(Value *Func, BasicBlock *IfNormal, BasicBlock *IfException, ArrayRef< Value *> Args, const Twine &NameStr, Instruction *InsertBefore=nullptr)
CaseIteratorImpl & operator-=(ptrdiff_t N)
Type * getAllocatedType() const
Return the type that is being allocated by the instruction.
bool isFilter(unsigned Idx) const
Return 'true' if the clause and index Idx is a filter clause.
DECLARE_TRANSPARENT_OPERAND_ACCESSORS(Value)
Transparently provide more efficient getOperand methods.
void setSyncScopeID(SyncScope::ID SSID)
Sets the synchronization scope ID of this load instruction.
static bool classof(const Instruction *I)
void setSuccessor(unsigned idx, BasicBlock *NewSucc)
void setCallingConv(CallingConv::ID CC)
void setDoesNotReadMemory()
Optional< uint64_t > getAllocationSizeInBits(const DataLayout &DL) const
Get allocation size in bits.
static bool classof(const Value *V)
idx_iterator idx_begin() const
FCmpInst(Predicate pred, Value *LHS, Value *RHS, const Twine &NameStr="")
Constructor with no-insertion semantics.
static AtomicOrdering getStrongestFailureOrdering(AtomicOrdering SuccessOrdering)
Returns the strongest permitted ordering on failure, given the desired ordering on success...
static InsertElementInst * Create(Value *Vec, Value *NewElt, Value *Idx, const Twine &NameStr, BasicBlock *InsertAtEnd)
iterator_range< T > make_range(T x, T y)
Convenience function for iterating over sub-ranges.
LoadInst(Value *Ptr, const Twine &NameStr, bool isVolatile=false, Instruction *InsertBefore=nullptr)
BasicBlock * getNormalDest() const
bool unwindsToCaller() const
static bool classof(const Instruction *I)
Methods for support type inquiry through isa, cast, and dyn_cast:
static bool classof(const Value *V)
unsigned getDestAddressSpace() const
Returns the address space of the result.
const Value * getPointerOperand() const
static bool classof(const Instruction *I)
Predicate getPredicate(unsigned Condition, unsigned Hint)
Return predicate consisting of specified condition and hint bits.
bool doesNotReturn() const
Determine if the call cannot return.
static bool classof(const Value *V)
unsigned getNumOperands() const
bool hasParamAttribute(unsigned ArgNo, Attribute::AttrKind Kind) const
Equivalent to hasAttribute(ArgNo + FirstArgIndex, Kind).
Use & getArgOperandUse(unsigned i)
This is the shared class of boolean and integer constants.
bool doesNotReadMemory() const
Determine if the call does not access or only writes memory.
static bool classof(const Instruction *I)
void setIncomingBlock(unsigned i, BasicBlock *BB)
static CleanupPadInst * Create(Value *ParentPad, ArrayRef< Value *> Args=None, const Twine &NameStr="", Instruction *InsertBefore=nullptr)
bool paramHasAttr(unsigned ArgNo, Attribute::AttrKind Kind) const
Determine whether the argument or parameter has the given attribute.
static CatchSwitchInst * Create(Value *ParentPad, BasicBlock *UnwindDest, unsigned NumHandlers, const Twine &NameStr="", Instruction *InsertBefore=nullptr)
static bool classof(const Instruction *I)
static bool isSingleSourceMask(const Constant *Mask)
static bool classof(const Instruction *I)
bool hasUnwindDest() const
static SwitchInst * Create(Value *Value, BasicBlock *Default, unsigned NumCases, Instruction *InsertBefore=nullptr)
static InvokeInst * Create(Value *Func, BasicBlock *IfNormal, BasicBlock *IfException, ArrayRef< Value *> Args, ArrayRef< OperandBundleDef > Bundles=None, const Twine &NameStr="", Instruction *InsertBefore=nullptr)
Type * checkGEPType(Type *Ty)
void addDereferenceableOrNullAttr(unsigned i, uint64_t Bytes)
adds the dereferenceable_or_null attribute to the list of attributes.
static bool classof(const Instruction *I)
const Use & getArgOperandUse(unsigned i) const
Wrappers for getting the Use of a call argument.
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small...
typename CallBaseParent< CallInst >::type BaseInstTy
static bool classof(const Instruction *I)
Methods for support type inquiry through isa, cast, and dyn_cast:
BasicBlock * getUnwindDest() const
Type * getReturnType() const
This class represents a cast from floating point to unsigned integer.
static bool classof(const Instruction *I)
Methods for support type inquiry through isa, cast, and dyn_cast:
const Value * getPointerOperand() const
static GCRegistry::Add< StatepointGC > D("statepoint-example", "an example strategy for statepoint")
static BranchInst * Create(BasicBlock *IfTrue, Instruction *InsertBefore=nullptr)
static bool classof(const Instruction *I)
Methods for support type inquiry through isa, cast, and dyn_cast:
bool isConditional() const
Predicate getSignedPredicate() const
For example, EQ->EQ, SLE->SLE, UGT->SGT, etc.
static bool classof(const Instruction *I)
iterator_range< idx_iterator > indices() const
bool changesLength() const
Return true if this shuffle returns a vector with a different number of elements than its source elem...
static PHINode * Create(Type *Ty, unsigned NumReservedValues, const Twine &NameStr="", Instruction *InsertBefore=nullptr)
Constructors - NumReservedValues is a hint for the number of incoming edges that this phi node will h...
static CallInst * Create(Value *Func, ArrayRef< Value *> Args, const Twine &NameStr, BasicBlock *InsertAtEnd)
unsigned getNumIncomingValues() const
Return the number of incoming edges.
static const Function * getCalledFunction(const Value *V, bool LookThroughBitCast, bool &IsNoBuiltin)
CaseIt findCaseValue(const ConstantInt *C)
Search all of the case values for the specified constant.
void setSuccessor(unsigned idx, BasicBlock *NewSucc)
static bool classof(const Instruction *I)
FCmpInst(BasicBlock &InsertAtEnd, Predicate pred, Value *LHS, Value *RHS, const Twine &NameStr="")
Constructor with insert-at-end semantics.
void setOperand(unsigned i, Value *Val)
void swap(llvm::BitVector &LHS, llvm::BitVector &RHS)
Implement std::swap in terms of BitVector swap.
unsigned getVectorNumElements() const
void setOperand(unsigned i_nocapture, Value *Val_nocapture)
A range adaptor for a pair of iterators.
bool isZeroEltSplat() const
Return true if all elements of this shuffle are the same value as the first element of exactly one so...
Class to represent vector types.
void setVolatile(bool V)
Specify whether this is a volatile store or not.
unsigned getNumSuccessors() const
Class for arbitrary precision integers.
static bool classof(const Instruction *I)
static bool classof(const Value *V)
static bool classof(const Value *V)
static CleanupPadInst * Create(Value *ParentPad, ArrayRef< Value *> Args, const Twine &NameStr, BasicBlock *InsertAtEnd)
VAArgInst(Value *List, Type *Ty, const Twine &NameStr="", Instruction *InsertBefore=nullptr)
bool isCleanup() const
Return 'true' if this landingpad instruction is a cleanup.
User::const_op_iterator op_begin() const
void setWeak(bool IsWeak)
void removeAttribute(unsigned i, StringRef Kind)
removes the attribute from the list of attributes.
void setResultElementType(Type *Ty)
unsigned getSuccessorIndex() const
Returns TerminatorInst's successor index for current case successor.
static bool classof(const Value *V)
static ReturnInst * Create(LLVMContext &C, BasicBlock *InsertAtEnd)
FCmpInst(Instruction *InsertBefore, Predicate pred, Value *LHS, Value *RHS, const Twine &NameStr="")
Constructor with insert-before-instruction semantics.
static ResumeInst * Create(Value *Exn, BasicBlock *InsertAtEnd)
const Value * getFalseValue() const
void setCondition(Value *V)
static CallInst * Create(Value *F, const Twine &NameStr="", Instruction *InsertBefore=nullptr)
static CatchPadInst * Create(Value *CatchSwitch, ArrayRef< Value *> Args, const Twine &NameStr="", Instruction *InsertBefore=nullptr)
void setSwiftError(bool V)
Specify whether this alloca is used to represent a swifterror.
user_iterator_impl< const User > const_user_iterator
bool isConvergent() const
Determine if the invoke is convergent.
unsigned getParamAlignment(unsigned ArgNo) const
Extract the alignment for a call or parameter (0=unknown).
void removeParamAttr(unsigned ArgNo, StringRef Kind)
Removes the attribute from the given argument.
bool isStrictFP() const
Determine if the call requires strict floating point semantics.
static bool classof(const Value *V)
iterator_range< op_iterator > indices()
bool isTranspose() const
Return true if this shuffle transposes the elements of its inputs without changing the length of the ...
void setOrdering(AtomicOrdering Ordering)
Sets the ordering constraint of this store instruction.
ConstCaseIt case_default() const
bool dataOperandHasImpliedAttr(unsigned i, Attribute::AttrKind Kind) const
Return true if the data operand at index i has the attribute A.
unsigned getParamAlignment(unsigned ArgNo) const
Return the alignment for the specified function parameter.
LLVM_ATTRIBUTE_ALWAYS_INLINE iterator end()
AttributeList addAttribute(LLVMContext &C, unsigned Index, Attribute::AttrKind Kind) const
Add an attribute to the attribute set at the given index.
SyncScope::ID getSyncScopeID() const
Returns the synchronization scope ID of this fence instruction.
bool isVolatile() const
Return true if this is a store to a volatile memory location.
iterator_range< User::const_op_iterator > arg_operands() const
Iteration adapter for range-for loops.
Value * getPointerOperand()
Gets the pointer operand.
bool isInlineAsm() const
Check if this call is an inline asm statement.
void setTrueValue(Value *V)
static CallInst * Create(Value *Func, ArrayRef< Value *> Args, ArrayRef< OperandBundleDef > Bundles, const Twine &NameStr, BasicBlock *InsertAtEnd)
bool unwindsToCaller() const
bool doesNoCfCheck() const
Determine if the call should not perform indirect branch tracking.
Type * getPointerOperandType() const
AttributeList addDereferenceableAttr(LLVMContext &C, unsigned Index, uint64_t Bytes) const
Add the dereferenceable attribute to the attribute set at the given index.
unsigned getAlignment() const
Return the alignment of the access that is being performed.
static bool classof(const Instruction *I)
Methods for support type inquiry through isa, cast, and dyn_cast:
void setCondition(Value *V)
unsigned getNumArgOperands() const
Return the number of call arguments.
AtomicOrdering getOrdering() const
Returns the ordering constraint of this store instruction.
const BasicBlock * getDestination(unsigned i) const
static InvokeInst * Create(FunctionType *Ty, Value *Func, BasicBlock *IfNormal, BasicBlock *IfException, ArrayRef< Value *> Args, const Twine &NameStr, Instruction *InsertBefore=nullptr)
bool returnDoesNotAlias() const
Determine if the return value is marked with NoAlias attribute.
bool hasDescriptor() const
void setOperation(BinOp Operation)
Value * getPointerOperand()
void setSyncScopeID(SyncScope::ID SSID)
Sets the synchronization scope ID of this fence instruction.
static bool classof(const Instruction *I)
Methods for support type inquiry through isa, cast, and dyn_cast:
static InsertValueInst * Create(Value *Agg, Value *Val, ArrayRef< unsigned > Idxs, const Twine &NameStr="", Instruction *InsertBefore=nullptr)
void removeAttribute(unsigned i, Attribute::AttrKind Kind)
removes the attribute from the list of attributes.
BasicBlock * getIncomingBlock(unsigned i) const
Return incoming basic block number i.
AttributeList removeAttribute(LLVMContext &C, unsigned Index, Attribute::AttrKind Kind) const
Remove the specified attribute at the specified index from this attribute list.
static bool classof(const Instruction *I)
Methods for support type inquiry through isa, cast, and dyn_cast:
static bool classof(const Value *V)
void setValue(ConstantInt *V)
Sets the new value for current case.
SyncScope::ID getSyncScopeID() const
Returns the synchronization scope ID of this load instruction.
bool isEquality() const
Return true if this predicate is either EQ or NE.
static ReturnInst * Create(LLVMContext &C, Value *retVal, BasicBlock *InsertAtEnd)
Value * getValue() const
Convenience accessor.
const Value * getAddress() const
bool isCatch(unsigned Idx) const
Return 'true' if the clause and index Idx is a catch clause.
void setSuccessor(unsigned idx, BasicBlock *NewSucc)
static bool classof(const Value *V)
This class represents a cast unsigned integer to floating point.
static bool classof(const Value *V)
Type * getResultElementType() const
static bool classof(const Value *V)
BasicBlockT * getCaseSuccessor() const
Resolves successor for current case.
Compile-time customization of User operands.
static bool classof(const Instruction *I)
Methods for support type inquiry through isa, cast, and dyn_cast:
void setSyncScopeID(SyncScope::ID SSID)
Sets the synchronization scope ID of this cmpxchg instruction.
LLVM_NODISCARD std::enable_if<!is_simple_type< Y >::value, typename cast_retty< X, const Y >::ret_type >::type dyn_cast(const Y &Val)
static bool classof(const Value *V)
void setFalseValue(Value *V)
User::const_op_iterator arg_end() const
Return the iterator pointing to the end of the argument list.
Value * getCatchSwitchParentPad() const
Get the parentPad of this catchret's catchpad's catchswitch.
static bool isTransposeMask(const Constant *Mask)
static unsigned getPointerOperandIndex()
const BasicBlock *(*)(const Value *) ConstDerefFnTy
Value * getReturnValue() const
Convenience accessor. Returns null if there is no return value.
CaseIt case_default()
Returns an iterator that points to the default case.
const Value * getPointerOperand() const
bool isUnconditional() const
ICmpInst(Predicate pred, Value *LHS, Value *RHS, const Twine &NameStr="")
Constructor with no-insertion semantics.
unsigned getAlignment() const
Return the alignment of the access that is being performed.
void mutateType(Type *Ty)
Mutate the type of this Value to be of the specified type.
static bool classof(const Instruction *I)
Methods for support type inquiry through isa, cast, and dyn_cast:
void setCatchSwitch(Value *CatchSwitch)
CatchPadInst * getCatchPad() const
Convenience accessors.
static CallInst * Create(Value *F, const Twine &NameStr, BasicBlock *InsertAtEnd)
ConstCaseIt case_end() const
Returns a read-only iterator that points one past the last in the SwitchInst.
void reserveClauses(unsigned Size)
Grow the size of the operand list to accommodate the new number of clauses.
static bool classof(const Value *V)
static bool classof(const Value *V)
void setCalledFunction(FunctionType *FTy, Value *Fn)
void setCondition(Value *V)
unsigned getPointerAddressSpace() const
Returns the address space of the pointer operand.
Synchronized with respect to all concurrently executing threads.
static unsigned getPointerOperandIndex()
This class represents a cast from signed integer to floating point.
static GetElementPtrInst * CreateInBounds(Value *Ptr, ArrayRef< Value *> IdxList, const Twine &NameStr="", Instruction *InsertBefore=nullptr)
Create an "inbounds" getelementptr.
const Value * getCalledValue() const
Get a pointer to the function that is invoked by this instruction.
void swapOperands()
Exchange the two operands to this instruction in such a way that it does not modify the semantics of ...
static Type * getGEPReturnType(Value *Ptr, ArrayRef< Value *> IdxList)
Returns the pointer type returned by the GEP instruction, which may be a vector of pointers...
bool isArrayAllocation() const
Return true if there is an allocation size parameter to the allocation instruction that is not 1...
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
handler_iterator handler_end()
Returns a read-only iterator that points one past the last handler in the CatchSwitchInst.
void addDereferenceableAttr(unsigned i, uint64_t Bytes)
adds the dereferenceable attribute to the list of attributes.
User::op_iterator arg_end()
Return the iterator pointing to the end of the argument list.
SmallVector< int, 16 > getShuffleMask() const
Value * getArgOperand(unsigned i) const
getArgOperand/setArgOperand - Return/set the i-th call argument.
unsigned getNumSuccessors() const
bool hasFnAttr(StringRef Kind) const
Determine whether this call has the given attribute.
const_block_iterator block_end() const
This class represents a truncation of floating point types.
BasicBlock * getUnwindDest() const
static CatchReturnInst * Create(Value *CatchPad, BasicBlock *BB, Instruction *InsertBefore=nullptr)
void setSuccessOrdering(AtomicOrdering Ordering)
Sets the success ordering constraint of this cmpxchg instruction.
ArrayRef< unsigned > getIndices() const
LLVM Value Representation.
static GetElementPtrInst * CreateInBounds(Value *Ptr, ArrayRef< Value *> IdxList, const Twine &NameStr, BasicBlock *InsertAtEnd)
bool canReturnTwice() const
Return true if the call can return twice.
void setDefaultDest(BasicBlock *DefaultCase)
unsigned getNumSuccessors() const
constexpr char Size[]
Key for Kernel::Arg::Metadata::mSize.
HungoffOperandTraits - determine the allocation regime of the Use array when it is not a prefix to th...
void copyMetadata(const Instruction &SrcInst, ArrayRef< unsigned > WL=ArrayRef< unsigned >())
Copy metadata from SrcInst to this instruction.
static VectorType * get(Type *ElementType, unsigned NumElements)
This static method is the primary way to construct an VectorType.
void allocHungoffUses(unsigned N, bool IsPhi=false)
Allocate the array of Uses, followed by a pointer (with bottom bit set) to the User.
static CleanupReturnInst * Create(Value *CleanupPad, BasicBlock *UnwindBB=nullptr, Instruction *InsertBefore=nullptr)
std::underlying_type< E >::type Mask()
Get a bitmask with 1s in all places up to the high-order bit of E's largest value.
bool onlyAccessesArgMemory() const
Determine if the call can access memmory only using pointers based on its arguments.
const Value * getCalledValue() const
Get a pointer to the function that is invoked by this instruction.
static CatchPadInst * Create(Value *CatchSwitch, ArrayRef< Value *> Args, const Twine &NameStr, BasicBlock *InsertAtEnd)
static bool classof(const Instruction *I)
void setSuccessor(BasicBlock *S)
Sets the new successor for current case.
A handle to a particular switch case.
bool isNoTailCall() const
StringRef - Represent a constant reference to a string, i.e.
FixedNumOperandTraits - determine the allocation regime of the Use array when it is a prefix to the U...
ICmpInst(Instruction *InsertBefore, Predicate pred, Value *LHS, Value *RHS, const Twine &NameStr="")
Constructor with insert-before-instruction semantics.
AtomicOrdering getOrdering() const
Returns the ordering constraint of this fence instruction.
static bool classof(const Value *V)
CaseHandleT & operator*()
static bool isVolatile(Instruction *Inst)
bool isStaticAlloca() const
Return true if this alloca is in the entry block of the function and is a constant size...
VariadicOperandTraits - determine the allocation regime of the Use array when it is a prefix to the U...
void setNumHungOffUseOperands(unsigned NumOps)
Subclasses with hung off uses need to manage the operand count themselves.
AttributeList removeParamAttribute(LLVMContext &C, unsigned ArgNo, Attribute::AttrKind Kind) const
Remove the specified attribute at the specified arg index from this attribute list.
void setIncomingValue(unsigned i, Value *V)
static GetElementPtrInst * CreateInBounds(Type *PointeeType, Value *Ptr, ArrayRef< Value *> IdxList, const Twine &NameStr="", Instruction *InsertBefore=nullptr)
static bool classof(const Value *V)
static bool isIdentityMask(const Constant *Mask)
Attribute getParamAttr(unsigned ArgNo, Attribute::AttrKind Kind) const
Get the attribute of a given kind from a given arg.
op_range incoming_values()
This class represents an extension of floating point types.
LoadInst(Value *Ptr, const Twine &NameStr, bool isVolatile, unsigned Align, AtomicOrdering Order, SyncScope::ID SSID=SyncScope::System, Instruction *InsertBefore=nullptr)
Attribute getParamAttr(unsigned ArgNo, StringRef Kind) const
Get the attribute of a given kind from a given arg.
void setVolatile(bool V)
Specify whether this is a volatile load or not.
Predicate getUnsignedPredicate() const
For example, EQ->EQ, SLE->ULE, UGT->UGT, etc.
const Value * getValOperand() const
VectorType * getType() const
Overload to return most specific vector type.
Value * getPointerOperand()
static Type * getGEPReturnType(Type *ElTy, Value *Ptr, ArrayRef< Value *> IdxList)
Value * getReturnedArgOperand() const
If one of the arguments has the 'returned' attribute, return its operand value.
unsigned getRetAlignment() const
Extract the alignment of the return value.
static bool classof(const Value *V)
static bool classof(const Instruction *I)
constexpr char Args[]
Key for Kernel::Metadata::mArgs.
static unsigned getPointerOperandIndex()
A mixin to add operand bundle functionality to llvm instruction classes.
static InvokeInst * Create(FunctionType *Ty, Value *Func, BasicBlock *IfNormal, BasicBlock *IfException, ArrayRef< Value *> Args, ArrayRef< OperandBundleDef > Bundles=None, const Twine &NameStr="", Instruction *InsertBefore=nullptr)
static void commuteShuffleMask(MutableArrayRef< int > Mask, unsigned InVecNumElts)
Change values in a shuffle permute mask assuming the two vector operands of length InVecNumElts have ...
bool isVolatile() const
Return true if this is a RMW on a volatile memory location.
bool hasByValArgument() const
Determine if any call argument is an aggregate passed by value.
static bool classof(const Value *V)
static IndirectBrInst * Create(Value *Address, unsigned NumDests, BasicBlock *InsertAtEnd)
an instruction to allocate memory on the stack
static bool classof(const Instruction *I)
This instruction inserts a struct field of array element value into an aggregate value.
AttrKind
This enumeration lists the attributes that can be associated with parameters, function results...
void setCatchPad(CatchPadInst *CatchPad)
bool isCommutative() const
static bool classof(const Instruction *I)
CatchSwitchInst * getCatchSwitch() const
Convenience accessors.
const_handler_iterator handler_end() const
Returns an iterator that points one past the last handler in the CatchSwitchInst. ...
void setOnlyAccessesInaccessibleMemory()
LoadInst(Value *Ptr, const Twine &NameStr, bool isVolatile, unsigned Align, Instruction *InsertBefore=nullptr)
Predicate getSwappedPredicate(Predicate Opcode)
Assume the condition register is set by MI(a,b), return the predicate if we modify the instructions s...