15 #ifndef LLVM_IR_INSTRUCTIONS_H 16 #define LLVM_IR_INSTRUCTIONS_H 70 Value *ArraySize =
nullptr,
149 return (I->
getOpcode() == Instruction::Alloca);
152 return isa<Instruction>(V) &&
classof(cast<Instruction>(V));
158 void setInstructionSubclassData(
unsigned short D) {
209 isVolatile, InsertBefore) {}
213 isVolatile, InsertAtEnd) {}
217 isVolatile, Align, InsertBefore) {}
221 isVolatile, Align, InsertAtEnd) {}
226 isVolatile, Align, Order, SSID, InsertBefore) {}
230 isVolatile, Align, Order, SSID, InsertAtEnd) {}
266 ((
unsigned)Ordering << 7));
283 setOrdering(Ordering);
284 setSyncScopeID(SSID);
302 return getPointerOperandType()->getPointerAddressSpace();
310 return isa<Instruction>(V) &&
classof(cast<Instruction>(V));
316 void setInstructionSubclassData(
unsigned short D) {
357 void *
operator new(
size_t s) {
358 return User::operator
new(s, 2);
397 ((
unsigned)Ordering << 7));
414 setOrdering(Ordering);
415 setSyncScopeID(SSID);
436 return getPointerOperandType()->getPointerAddressSpace();
444 return isa<Instruction>(V) &&
classof(cast<Instruction>(V));
450 void setInstructionSubclassData(
unsigned short D) {
476 friend class Instruction;
485 Instruction *InsertBefore =
nullptr);
490 void *
operator new(
size_t s) {
491 return User::operator
new(s, 0);
503 ((
unsigned)Ordering << 1));
518 return I->
getOpcode() == Instruction::Fence;
521 return isa<Instruction>(V) &&
classof(cast<Instruction>(V));
527 void setInstructionSubclassData(
unsigned short D) {
569 void *
operator new(
size_t s) {
570 return User::operator
new(s, 3);
608 "CmpXchg instructions can only be atomic.");
610 ((
unsigned)Ordering << 2));
621 "CmpXchg instructions can only be atomic.");
623 ((
unsigned)Ordering << 5));
660 switch (SuccessOrdering) {
676 return I->
getOpcode() == Instruction::AtomicCmpXchg;
679 return isa<Instruction>(V) &&
classof(cast<Instruction>(V));
685 void setInstructionSubclassData(
unsigned short D) {
765 void *
operator new(
size_t s) {
766 return User::operator
new(s, 2);
787 setInstructionSubclassData((SubclassData & 31) |
815 "atomicrmw instructions can only be atomic.");
817 ((
unsigned)Ordering << 2));
843 return isFPOperation(getOperation());
848 return I->
getOpcode() == Instruction::AtomicRMW;
851 return isa<Instruction>(V) &&
classof(cast<Instruction>(V));
860 void setInstructionSubclassData(
unsigned short D) {
885 assert(Ty &&
"Invalid GetElementPtrInst indices for type!");
893 Type *SourceElementType;
894 Type *ResultElementType;
920 const Twine &NameStr =
"",
931 NameStr, InsertBefore);
936 const Twine &NameStr,
947 NameStr, InsertAtEnd);
954 const Twine &NameStr =
"",
956 return CreateInBounds(
nullptr, Ptr, IdxList, NameStr, InsertBefore);
961 const Twine &NameStr =
"",
964 Create(PointeeType, Ptr, IdxList, NameStr, InsertBefore);
971 const Twine &NameStr,
973 return CreateInBounds(
nullptr, Ptr, IdxList, NameStr, InsertAtEnd);
978 const Twine &NameStr,
981 Create(PointeeType, Ptr, IdxList, NameStr, InsertAtEnd);
995 assert(ResultElementType ==
996 cast<PointerType>(
getType()->getScalarType())->getElementType());
997 return ResultElementType;
1004 return getPointerAddressSpace();
1048 return getPointerOperandType()->getPointerAddressSpace();
1063 if (
Index->getType()->isVectorTy()) {
1064 unsigned NumElem =
Index->getType()->getVectorNumElements();
1082 bool hasAllZeroIndices()
const;
1087 bool hasAllConstantIndices()
const;
1091 void setIsInBounds(
bool b =
true);
1094 bool isInBounds()
const;
1108 return (I->
getOpcode() == Instruction::GetElementPtr);
1111 return isa<Instruction>(V) &&
classof(cast<Instruction>(V));
1120 GetElementPtrInst::GetElementPtrInst(
Type *PointeeType,
Value *Ptr,
1122 const Twine &NameStr,
1124 :
Instruction(getGEPReturnType(PointeeType, Ptr, IdxList), GetElementPtr,
1126 Values, InsertBefore),
1127 SourceElementType(PointeeType),
1128 ResultElementType(getIndexedType(PointeeType, IdxList)) {
1129 assert(ResultElementType ==
1130 cast<PointerType>(
getType()->getScalarType())->getElementType());
1131 init(Ptr, IdxList, NameStr);
1134 GetElementPtrInst::GetElementPtrInst(
Type *PointeeType,
Value *Ptr,
1136 const Twine &NameStr,
1138 :
Instruction(getGEPReturnType(PointeeType, Ptr, IdxList), GetElementPtr,
1140 Values, InsertAtEnd),
1141 SourceElementType(PointeeType),
1142 ResultElementType(getIndexedType(PointeeType, IdxList)) {
1143 assert(ResultElementType ==
1144 cast<PointerType>(
getType()->getScalarType())->getElementType());
1145 init(Ptr, IdxList, NameStr);
1160 assert(isIntPredicate() &&
1161 "Invalid ICmp predicate value");
1163 "Both operands to ICmp instruction are not of the same type!");
1167 "Invalid operand types for ICmp instruction");
1184 const Twine &NameStr =
"" 1199 const Twine &NameStr =
"" 1213 const Twine &NameStr =
"" 1248 return P == ICMP_EQ || P == ICMP_NE;
1264 return !isEquality();
1270 return !isEquality(P);
1280 Op<0>().
swap(Op<1>());
1285 return I->
getOpcode() == Instruction::ICmp;
1288 return isa<Instruction>(V) &&
classof(cast<Instruction>(V));
1302 assert(isFPPredicate() &&
"Invalid FCmp predicate value");
1304 "Both operands to FCmp instruction are not of the same type!");
1307 "Invalid operand types for FCmp instruction");
1324 const Twine &NameStr =
"" 1337 const Twine &NameStr =
"" 1349 const Twine &NameStr =
"",
1352 RHS, NameStr, nullptr, FlagsSource) {
1359 return Pred == FCMP_OEQ || Pred == FCMP_ONE || Pred == FCMP_UEQ ||
1370 return isEquality() ||
1388 Op<0>().
swap(Op<1>());
1393 return I->
getOpcode() == Instruction::FCmp;
1396 return isa<Instruction>(V) &&
classof(cast<Instruction>(V));
1417 :
CallInst(Ty, Func, Args,
None, NameStr, InsertBefore) {}
1436 static int ComputeNumOperands(
int NumArgs,
int NumBundleInputs = 0) {
1439 return 1 + NumArgs + NumBundleInputs;
1451 return new (ComputeNumOperands(0))
CallInst(Ty, F, NameStr, InsertBefore);
1455 const Twine &NameStr,
1457 return new (ComputeNumOperands(Args.
size()))
1463 const Twine &NameStr =
"",
1465 const int NumOperands =
1466 ComputeNumOperands(Args.
size(), CountBundleInputs(Bundles));
1469 return new (NumOperands, DescriptorBytes)
1470 CallInst(Ty, Func, Args, Bundles, NameStr, InsertBefore);
1475 return new (ComputeNumOperands(0))
CallInst(Ty, F, NameStr, InsertAtEnd);
1480 return new (ComputeNumOperands(Args.
size()))
1487 const int NumOperands =
1488 ComputeNumOperands(Args.
size(), CountBundleInputs(Bundles));
1491 return new (NumOperands, DescriptorBytes)
1492 CallInst(Ty, Func, Args, Bundles, NameStr, InsertAtEnd);
1503 const Twine &NameStr =
"",
1506 NameStr, InsertBefore);
1510 const Twine &NameStr,
1532 NameStr, InsertAtEnd);
1538 return Create(cast<FunctionType>(
1539 cast<PointerType>(Func->
getType())->getElementType()),
1540 Func, NameStr, InsertBefore);
1545 const Twine &NameStr,
1547 return Create(cast<FunctionType>(
1548 cast<PointerType>(Func->
getType())->getElementType()),
1549 Func, Args, NameStr, InsertBefore);
1555 const Twine &NameStr =
"",
1557 return Create(cast<FunctionType>(
1558 cast<PointerType>(Func->
getType())->getElementType()),
1559 Func, Args, Bundles, NameStr, InsertBefore);
1565 return Create(cast<FunctionType>(
1566 cast<PointerType>(Func->
getType())->getElementType()),
1567 Func, NameStr, InsertAtEnd);
1573 return Create(cast<FunctionType>(
1574 cast<PointerType>(Func->
getType())->getElementType()),
1575 Func, Args, NameStr, InsertAtEnd);
1582 return Create(cast<FunctionType>(
1583 cast<PointerType>(Func->
getType())->getElementType()),
1584 Func, Args, Bundles, NameStr, InsertAtEnd);
1604 Value *ArraySize =
nullptr,
1609 Value *ArraySize =
nullptr,
1614 Value *ArraySize =
nullptr,
1620 Value *ArraySize =
nullptr,
1647 return Kind == TCK_Tail || Kind == TCK_MustTail;
1660 unsigned(isTC ? TCK_Tail : TCK_None));
1679 return isa<Instruction>(V) &&
classof(cast<Instruction>(V));
1683 void updateProfWeight(uint64_t S, uint64_t
T);
1688 void setInstructionSubclassData(
unsigned short D) {
1698 (Args.
size() + CountBundleInputs(Bundles) + 1),
1699 unsigned(Args.
size() + CountBundleInputs(Bundles) + 1),
1701 init(Ty, Func, Args, Bundles, NameStr);
1709 (Args.
size() + CountBundleInputs(Bundles) + 1),
1710 unsigned(Args.
size() + CountBundleInputs(Bundles) + 1),
1712 init(Ty, Func, Args, Bundles, NameStr);
1725 &Op<0>(), 3, InsertBefore) {
1733 &Op<0>(), 3, InsertAtEnd) {
1739 assert(!areInvalidOperands(C, S1, S2) &&
"Invalid operands for select");
1753 const Twine &NameStr =
"",
1763 const Twine &NameStr,
1765 return new(3)
SelectInst(C, S1, S2, NameStr, InsertAtEnd);
1785 static const char *areInvalidOperands(
Value *Cond,
Value *True,
Value *False);
1799 return isa<Instruction>(V) &&
classof(cast<Instruction>(V));
1845 return isa<Instruction>(V) &&
classof(cast<Instruction>(V));
1870 const Twine &NameStr =
"",
1876 const Twine &NameStr,
1883 static bool isValidOperands(
const Value *Vec,
const Value *Idx);
1891 return cast<VectorType>(getVectorOperand()->getType());
1899 return I->
getOpcode() == Instruction::ExtractElement;
1902 return isa<Instruction>(V) &&
classof(cast<Instruction>(V));
1922 const Twine &NameStr =
"",
1935 const Twine &NameStr =
"",
1941 const Twine &NameStr,
1948 static bool isValidOperands(
const Value *Vec,
const Value *NewElt,
1962 return I->
getOpcode() == Instruction::InsertElement;
1965 return isa<Instruction>(V) &&
classof(cast<Instruction>(V));
1992 const Twine &NameStr =
"",
1998 void *
operator new(
size_t s) {
1999 return User::operator
new(s, 3);
2008 static bool isValidOperands(
const Value *V1,
const Value *
V2,
2026 static int getMaskValue(
const Constant *Mask,
unsigned Elt);
2031 return getMaskValue(getMask(), Elt);
2036 static void getShuffleMask(
const Constant *Mask,
2042 return getShuffleMask(getMask(), Result);
2047 getShuffleMask(Mask);
2057 unsigned NumMaskElts = getMask()->getType()->getVectorNumElements();
2058 return NumSourceElts != NumMaskElts;
2066 unsigned NumMaskElts = getMask()->getType()->getVectorNumElements();
2067 return NumSourceElts < NumMaskElts;
2078 getShuffleMask(Mask, MaskAsInts);
2079 return isSingleSourceMask(MaskAsInts);
2087 return !changesLength() && isSingleSourceMask(getMask());
2099 getShuffleMask(Mask, MaskAsInts);
2100 return isIdentityMask(MaskAsInts);
2108 return !changesLength() && isIdentityMask(getShuffleMask());
2113 bool isIdentityWithPadding()
const;
2117 bool isIdentityWithExtract()
const;
2122 bool isConcat()
const;
2136 getShuffleMask(Mask, MaskAsInts);
2137 return isSelectMask(MaskAsInts);
2149 return !changesLength() && isSelectMask(getMask());
2160 getShuffleMask(Mask, MaskAsInts);
2180 getShuffleMask(Mask, MaskAsInts);
2181 return isZeroEltSplatMask(MaskAsInts);
2191 return !changesLength() && isZeroEltSplatMask(getMask());
2230 getShuffleMask(Mask, MaskAsInts);
2231 return isTransposeMask(MaskAsInts);
2240 return !changesLength() && isTransposeMask(getMask());
2246 static bool isExtractSubvectorMask(
ArrayRef<int> Mask,
int NumSrcElts,
2252 getShuffleMask(Mask, MaskAsInts);
2253 return isExtractSubvectorMask(MaskAsInts, NumSrcElts, Index);
2259 return isExtractSubvectorMask(getMask(), NumSrcElts, Index);
2265 unsigned InVecNumElts) {
2266 for (
int &Idx : Mask) {
2269 Idx = Idx < (int)InVecNumElts ? Idx + InVecNumElts : Idx - InVecNumElts;
2270 assert(Idx >= 0 && Idx < (
int)InVecNumElts * 2 &&
2271 "shufflevector mask index out of range");
2277 return I->
getOpcode() == Instruction::ShuffleVector;
2280 return isa<Instruction>(V) &&
classof(cast<Instruction>(V));
2309 const Twine &NameStr,
2326 const Twine &NameStr =
"",
2334 const Twine &NameStr,
2368 return (
unsigned)Indices.
size();
2377 return I->
getOpcode() == Instruction::ExtractValue;
2380 return isa<Instruction>(V) &&
classof(cast<Instruction>(V));
2384 ExtractValueInst::ExtractValueInst(
Value *Agg,
2386 const Twine &NameStr,
2389 ExtractValue, Agg, InsertBefore) {
2390 init(Idxs, NameStr);
2393 ExtractValueInst::ExtractValueInst(
Value *Agg,
2395 const Twine &NameStr,
2398 ExtractValue, Agg, InsertAtEnd) {
2399 init(Idxs, NameStr);
2420 const Twine &NameStr,
2429 const Twine &NameStr =
"",
2435 const Twine &NameStr);
2445 void *
operator new(
size_t s) {
2446 return User::operator
new(s, 2);
2451 const Twine &NameStr =
"",
2458 const Twine &NameStr,
2499 return (
unsigned)Indices.
size();
2508 return I->
getOpcode() == Instruction::InsertValue;
2511 return isa<Instruction>(V) &&
classof(cast<Instruction>(V));
2520 InsertValueInst::InsertValueInst(
Value *Agg,
2523 const Twine &NameStr,
2528 init(Agg, Val, Idxs, NameStr);
2531 InsertValueInst::InsertValueInst(
Value *Agg,
2534 const Twine &NameStr,
2539 init(Agg, Val, Idxs, NameStr);
2555 unsigned ReservedSpace;
2559 explicit PHINode(
Type *Ty,
unsigned NumReservedValues,
2560 const Twine &NameStr =
"",
2562 :
Instruction(Ty, Instruction::PHI,
nullptr, 0, InsertBefore),
2563 ReservedSpace(NumReservedValues) {
2570 :
Instruction(Ty, Instruction::PHI,
nullptr, 0, InsertAtEnd),
2571 ReservedSpace(NumReservedValues) {
2593 const Twine &NameStr =
"",
2595 return new PHINode(Ty, NumReservedValues, NameStr, InsertBefore);
2600 return new PHINode(Ty, NumReservedValues, NameStr, InsertAtEnd);
2633 return make_range(block_begin(), block_end());
2637 return make_range(block_begin(), block_end());
2654 assert(V &&
"PHI node got a null value!");
2656 "All operands to PHI node must be the same type as the PHI node!");
2671 return block_begin()[i];
2678 assert(
this == U.
getUser() &&
"Iterator doesn't point to PHI's Uses?");
2679 return getIncomingBlock(
unsigned(&U -
op_begin()));
2686 return getIncomingBlock(I.getUse());
2690 assert(BB &&
"PHI node got a null basic block!");
2691 block_begin()[i] = BB;
2696 assert(New && Old &&
"PHI node got a null basic block!");
2698 if (getIncomingBlock(
Op) == Old)
2699 setIncomingBlock(
Op, New);
2721 Value *removeIncomingValue(
unsigned Idx,
bool DeletePHIIfEmpty =
true);
2724 int Idx = getBasicBlockIndex(BB);
2725 assert(Idx >= 0 &&
"Invalid basic block argument to remove!");
2726 return removeIncomingValue(Idx, DeletePHIIfEmpty);
2734 if (block_begin()[i] == BB)
2740 int Idx = getBasicBlockIndex(BB);
2741 assert(Idx >= 0 &&
"Invalid basic block argument!");
2742 return getIncomingValue(Idx);
2747 assert(BB &&
"PHI node got a null basic block!");
2750 if (getIncomingBlock(
Op) == BB) {
2752 setIncomingValue(
Op, V);
2755 assert(Found &&
"Invalid basic block argument to set!");
2760 Value *hasConstantValue()
const;
2765 bool hasConstantOrUndefValue()
const;
2769 return I->
getOpcode() == Instruction::PHI;
2772 return isa<Instruction>(V) &&
classof(cast<Instruction>(V));
2776 void growOperands();
2800 unsigned ReservedSpace;
2814 void *
operator new(
size_t s) {
2815 return User::operator
new(s);
2818 void growOperands(
unsigned Size);
2819 void init(
unsigned NumReservedValues,
const Twine &NameStr);
2831 const Twine &NameStr =
"",
2851 void addClause(
Constant *ClauseVal);
2878 return I->
getOpcode() == Instruction::LandingPad;
2881 return isa<Instruction>(V) &&
classof(cast<Instruction>(V));
2928 return new(!!retVal)
ReturnInst(C, retVal, InsertBefore);
2933 return new(!!retVal)
ReturnInst(C, retVal, InsertAtEnd);
2955 return isa<Instruction>(V) &&
classof(cast<Instruction>(V));
3016 std::random_access_iterator_tag, BasicBlock *,
3017 ptrdiff_t, BasicBlock *, BasicBlock *> {
3027 std::random_access_iterator_tag,
3028 const BasicBlock *, ptrdiff_t, const BasicBlock *,
3029 const BasicBlock *> {
3039 return new(1)
BranchInst(IfTrue, InsertBefore);
3044 return new(3)
BranchInst(IfTrue, IfFalse, Cond, InsertBefore);
3048 return new(1)
BranchInst(IfTrue, InsertAtEnd);
3053 return new(3)
BranchInst(IfTrue, IfFalse, Cond, InsertAtEnd);
3063 assert(isConditional() &&
"Cannot get condition of an uncond branch!");
3068 assert(isConditional() &&
"Cannot set condition of unconditional branch!");
3076 return cast_or_null<BasicBlock>((&
Op<-1>() - i)->get());
3081 *(&
Op<-1>() - idx) = NewSucc;
3089 void swapSuccessors();
3105 return (I->
getOpcode() == Instruction::Br);
3108 return isa<Instruction>(V) &&
classof(cast<Instruction>(V));
3126 unsigned ReservedSpace;
3149 void *
operator new(
size_t s) {
3150 return User::operator
new(s);
3153 void init(Value *Value,
BasicBlock *Default,
unsigned NumReserved);
3154 void growOperands();
3164 static const unsigned DefaultPseudoIndex =
static_cast<unsigned>(~0L-1);
3173 template <
typename SwitchInstT,
typename ConstantIntT,
typename BasicBlockT>
3192 assert((
unsigned)Index < SI->getNumCases() &&
3193 "Index out the number of cases.");
3194 return reinterpret_cast<ConstantIntT *
>(SI->getOperand(2 + Index * 2));
3199 assert(((
unsigned)Index < SI->getNumCases() ||
3200 (
unsigned)Index == DefaultPseudoIndex) &&
3201 "Index out the number of cases.");
3202 return SI->getSuccessor(getSuccessorIndex());
3210 assert(((
unsigned)Index == DefaultPseudoIndex ||
3211 (
unsigned)Index < SI->getNumCases()) &&
3212 "Index out the number of cases.");
3213 return (
unsigned)Index != DefaultPseudoIndex ? Index + 1 : 0;
3217 assert(SI == RHS.
SI &&
"Incompatible operators.");
3218 return Index == RHS.
Index;
3234 assert((
unsigned)Index < SI->getNumCases() &&
3235 "Index out the number of cases.");
3245 template <
typename CaseHandleT>
3248 std::random_access_iterator_tag,
3250 using SwitchInstT =
typename CaseHandleT::SwitchInstType;
3266 unsigned SuccessorIndex) {
3268 "Successor index # out of range!");
3282 assert(Case.Index + N >= 0 &&
3283 (
unsigned)(Case.Index + N) <= Case.SI->getNumCases() &&
3284 "Case.Index out the number of cases.");
3291 assert(Case.Index - N >= 0 &&
3292 (
unsigned)(Case.Index - N) <= Case.SI->getNumCases() &&
3293 "Case.Index out the number of cases.");
3298 assert(Case.SI == RHS.Case.SI &&
"Incompatible operators.");
3299 return Case.Index - RHS.Case.Index;
3302 return Case == RHS.Case;
3305 assert(Case.SI == RHS.Case.SI &&
"Incompatible operators.");
3306 return Case.Index < RHS.Case.Index;
3318 return new SwitchInst(Value, Default, NumCases, InsertBefore);
3322 unsigned NumCases,
BasicBlock *InsertAtEnd) {
3323 return new SwitchInst(Value, Default, NumCases, InsertAtEnd);
3338 setOperand(1, reinterpret_cast<Value*>(DefaultCase));
3362 return CaseIt(
this, getNumCases());
3387 return CaseIt(
this, DefaultPseudoIndex);
3400 if (I != case_end())
3403 return case_default();
3409 if (I != case_end())
3412 return case_default();
3418 if (BB == getDefaultDest())
3422 for (
auto Case : cases()) {
3423 if (Case.getCaseSuccessor() != BB)
3429 CI = Case.getCaseValue();
3453 return cast<BasicBlock>(
getOperand(idx*2+1));
3462 return I->
getOpcode() == Instruction::Switch;
3465 return isa<Instruction>(V) &&
classof(cast<Instruction>(V));
3474 bool Changed =
false;
3479 MDNode *buildProfBranchWeightsMD();
3493 SI.
setMetadata(LLVMContext::MD_prof, buildProfBranchWeightsMD());
3528 unsigned ReservedSpace;
3547 void *
operator new(
size_t s) {
3548 return User::operator
new(s);
3551 void init(Value *Address,
unsigned NumDests);
3552 void growOperands();
3567 std::random_access_iterator_tag, BasicBlock *,
3568 ptrdiff_t, BasicBlock *, BasicBlock *> {
3578 std::random_access_iterator_tag,
3579 const BasicBlock *, ptrdiff_t, const BasicBlock *,
3580 const BasicBlock *> {
3620 void removeDestination(
unsigned i);
3642 return I->
getOpcode() == Instruction::IndirectBr;
3645 return isa<Instruction>(V) &&
classof(cast<Instruction>(V));
3665 static constexpr
int NumExtraOperands = 2;
3668 static constexpr
int NormalDestOpEndIdx = -3;
3671 static constexpr
int UnwindDestOpEndIdx = -2;
3693 static int ComputeNumOperands(
int NumArgs,
int NumBundleInputs = 0) {
3696 return 1 + NumExtraOperands + NumArgs + NumBundleInputs;
3708 const Twine &NameStr,
3710 int NumOperands = ComputeNumOperands(Args.
size());
3711 return new (NumOperands)
3712 InvokeInst(Ty, Func, IfNormal, IfException, Args,
None, NumOperands,
3713 NameStr, InsertBefore);
3719 const Twine &NameStr =
"",
3722 ComputeNumOperands(Args.
size(), CountBundleInputs(Bundles));
3725 return new (NumOperands, DescriptorBytes)
3726 InvokeInst(Ty, Func, IfNormal, IfException, Args, Bundles, NumOperands,
3727 NameStr, InsertBefore);
3733 int NumOperands = ComputeNumOperands(Args.
size());
3734 return new (NumOperands)
3735 InvokeInst(Ty, Func, IfNormal, IfException, Args,
None, NumOperands,
3736 NameStr, InsertAtEnd);
3744 ComputeNumOperands(Args.
size(), CountBundleInputs(Bundles));
3747 return new (NumOperands, DescriptorBytes)
3748 InvokeInst(Ty, Func, IfNormal, IfException, Args, Bundles, NumOperands,
3749 NameStr, InsertAtEnd);
3754 const Twine &NameStr,
3757 IfException,
Args,
None, NameStr, InsertBefore);
3763 const Twine &NameStr =
"",
3766 IfException,
Args, Bundles, NameStr, InsertBefore);
3773 IfException,
Args, NameStr, InsertAtEnd);
3781 IfException,
Args, Bundles, NameStr, InsertAtEnd);
3787 const Twine &NameStr,
3789 return Create(cast<FunctionType>(
3790 cast<PointerType>(Func->
getType())->getElementType()),
3791 Func, IfNormal, IfException, Args,
None, NameStr,
3799 const Twine &NameStr =
"",
3801 return Create(cast<FunctionType>(
3802 cast<PointerType>(Func->
getType())->getElementType()),
3803 Func, IfNormal, IfException, Args, Bundles, NameStr,
3811 return Create(cast<FunctionType>(
3812 cast<PointerType>(Func->
getType())->getElementType()),
3813 Func, IfNormal, IfException, Args, NameStr, InsertAtEnd);
3821 return Create(cast<FunctionType>(
3822 cast<PointerType>(Func->
getType())->getElementType()),
3823 Func, IfNormal, IfException, Args, Bundles, NameStr,
3847 return cast<BasicBlock>(Op<NormalDestOpEndIdx>());
3850 return cast<BasicBlock>(Op<UnwindDestOpEndIdx>());
3853 Op<NormalDestOpEndIdx>() = reinterpret_cast<Value *>(B);
3856 Op<UnwindDestOpEndIdx>() = reinterpret_cast<Value *>(B);
3861 LandingPadInst *getLandingPadInst()
const;
3864 assert(i < 2 &&
"Successor # out of range for invoke!");
3865 return i == 0 ? getNormalDest() : getUnwindDest();
3869 assert(i < 2 &&
"Successor # out of range for invoke!");
3871 setNormalDest(NewSucc);
3873 setUnwindDest(NewSucc);
3880 return (I->
getOpcode() == Instruction::Invoke);
3883 return isa<Instruction>(V) &&
classof(cast<Instruction>(V));
3890 void setInstructionSubclassData(
unsigned short D) {
3902 init(Ty, Func, IfNormal, IfException, Args, Bundles, NameStr);
3912 init(Ty, Func, IfNormal, IfException, Args, Bundles, NameStr);
3925 unsigned NumIndirectDests;
3949 void updateArgBlockAddresses(
unsigned i,
BasicBlock *B);
3952 static int ComputeNumOperands(
int NumArgs,
int NumIndirectDests,
3953 int NumBundleInputs = 0) {
3956 return 2 + NumIndirectDests + NumArgs + NumBundleInputs;
3971 int NumOperands = ComputeNumOperands(Args.
size(), IndirectDests.
size());
3972 return new (NumOperands)
3974 NumOperands, NameStr, InsertBefore);
3982 const Twine &NameStr =
"",
3984 int NumOperands = ComputeNumOperands(Args.
size(), IndirectDests.
size(),
3985 CountBundleInputs(Bundles));
3988 return new (NumOperands, DescriptorBytes)
3989 CallBrInst(Ty, Func, DefaultDest, IndirectDests, Args, Bundles,
3990 NumOperands, NameStr, InsertBefore);
3998 int NumOperands = ComputeNumOperands(Args.
size(), IndirectDests.
size());
3999 return new (NumOperands)
4001 NumOperands, NameStr, InsertAtEnd);
4010 int NumOperands = ComputeNumOperands(Args.
size(), IndirectDests.
size(),
4011 CountBundleInputs(Bundles));
4014 return new (NumOperands, DescriptorBytes)
4015 CallBrInst(Ty, Func, DefaultDest, IndirectDests, Args, Bundles,
4016 NumOperands, NameStr, InsertAtEnd);
4024 IndirectDests,
Args, NameStr, InsertBefore);
4031 const Twine &NameStr =
"",
4034 IndirectDests,
Args, Bundles, NameStr, InsertBefore);
4042 IndirectDests,
Args, NameStr, InsertAtEnd);
4052 IndirectDests,
Args, Bundles, NameStr, InsertAtEnd);
4072 assert(i < getNumIndirectDests() &&
"Out of bounds!");
4073 return getOperand(i + getNumArgOperands() + getNumTotalBundleOperands() +
4078 assert(i < getNumIndirectDests() &&
"Out of bounds!");
4079 return getOperandUse(i + getNumArgOperands() + getNumTotalBundleOperands() +
4085 return cast<BasicBlock>(*(&
Op<-1>() - getNumIndirectDests() - 1));
4088 return cast_or_null<BasicBlock>(*(&
Op<-1>() - getNumIndirectDests() + i));
4092 for (
unsigned i = 0,
e = getNumIndirectDests(); i <
e; ++i)
4093 IndirectDests.
push_back(getIndirectDest(i));
4094 return IndirectDests;
4097 *(&
Op<-1>() - getNumIndirectDests() - 1) = reinterpret_cast<Value *>(B);
4100 updateArgBlockAddresses(i, B);
4101 *(&
Op<-1>() - getNumIndirectDests() + i) = reinterpret_cast<Value *>(B);
4106 "Successor # out of range for callbr!");
4107 return i == 0 ? getDefaultDest() : getIndirectDest(i - 1);
4111 assert(i < getNumIndirectDests() + 1 &&
4112 "Successor # out of range for callbr!");
4113 return i == 0 ? setDefaultDest(NewSucc) : setIndirectDest(i - 1, NewSucc);
4120 return (I->
getOpcode() == Instruction::CallBr);
4123 return isa<Instruction>(V) &&
classof(cast<Instruction>(V));
4130 void setInstructionSubclassData(
unsigned short D) {
4143 init(Ty, Func, DefaultDest, IndirectDests, Args, Bundles, NameStr);
4154 init(Ty, Func, DefaultDest, IndirectDests, Args, Bundles, NameStr);
4195 return I->
getOpcode() == Instruction::Resume;
4198 return isa<Instruction>(V) &&
classof(cast<Instruction>(V));
4224 unsigned ReservedSpace;
4236 unsigned NumHandlers,
const Twine &NameStr,
4244 unsigned NumHandlers,
const Twine &NameStr,
4248 void *
operator new(
size_t s) {
return User::operator
new(s); }
4250 void init(Value *ParentPad,
BasicBlock *UnwindDest,
unsigned NumReserved);
4251 void growOperands(
unsigned Size);
4261 unsigned NumHandlers,
4262 const Twine &NameStr =
"",
4264 return new CatchSwitchInst(ParentPad, UnwindDest, NumHandlers, NameStr,
4269 unsigned NumHandlers,
const Twine &NameStr,
4271 return new CatchSwitchInst(ParentPad, UnwindDest, NumHandlers, NameStr,
4286 if (hasUnwindDest())
4299 if (hasUnwindDest())
4305 static BasicBlock *handler_helper(Value *V) {
return cast<BasicBlock>(V); }
4306 static const BasicBlock *handler_helper(
const Value *V) {
4307 return cast<BasicBlock>(V);
4322 if (hasUnwindDest())
4331 if (hasUnwindDest())
4333 return const_handler_iterator(It,
ConstDerefFnTy(handler_helper));
4350 return make_range(handler_begin(), handler_end());
4355 return make_range(handler_begin(), handler_end());
4369 "Successor # out of range for catchswitch!");
4370 return cast<BasicBlock>(
getOperand(Idx + 1));
4374 "Successor # out of range for catchswitch!");
4380 return I->
getOpcode() == Instruction::CatchSwitch;
4383 return isa<Instruction>(V) &&
classof(cast<Instruction>(V));
4398 unsigned Values,
const Twine &NameStr,
4400 :
FuncletPadInst(Instruction::CleanupPad, ParentPad, Args, Values,
4401 NameStr, InsertBefore) {}
4403 unsigned Values,
const Twine &NameStr,
4405 :
FuncletPadInst(Instruction::CleanupPad, ParentPad, Args, Values,
4406 NameStr, InsertAtEnd) {}
4410 const Twine &NameStr =
"",
4412 unsigned Values = 1 + Args.
size();
4419 unsigned Values = 1 + Args.
size();
4426 return I->
getOpcode() == Instruction::CleanupPad;
4429 return isa<Instruction>(V) &&
classof(cast<Instruction>(V));
4439 unsigned Values,
const Twine &NameStr,
4441 :
FuncletPadInst(Instruction::CatchPad, CatchSwitch, Args, Values,
4442 NameStr, InsertBefore) {}
4444 unsigned Values,
const Twine &NameStr,
4446 :
FuncletPadInst(Instruction::CatchPad, CatchSwitch, Args, Values,
4447 NameStr, InsertAtEnd) {}
4451 const Twine &NameStr =
"",
4453 unsigned Values = 1 + Args.
size();
4455 CatchPadInst(CatchSwitch, Args, Values, NameStr, InsertBefore);
4460 unsigned Values = 1 + Args.
size();
4462 CatchPadInst(CatchSwitch, Args, Values, NameStr, InsertAtEnd);
4467 return cast<CatchSwitchInst>(
Op<-1>());
4471 Op<-1>() = CatchSwitch;
4476 return I->
getOpcode() == Instruction::CatchPad;
4479 return isa<Instruction>(V) &&
classof(cast<Instruction>(V));
4535 return getCatchPad()->getCatchSwitch()->getParentPad();
4540 return (I->
getOpcode() == Instruction::CatchRet);
4543 return isa<Instruction>(V) &&
classof(cast<Instruction>(V));
4589 unsigned Values = 1;
4599 unsigned Values = 1;
4614 return cast<CleanupPadInst>(Op<0>());
4618 Op<0>() = CleanupPad;
4624 return hasUnwindDest() ? cast<BasicBlock>(Op<1>()) :
nullptr;
4634 return (I->
getOpcode() == Instruction::CleanupRet);
4637 return isa<Instruction>(V) &&
classof(cast<Instruction>(V));
4643 return getUnwindDest();
4653 void setInstructionSubclassData(
unsigned short D) {
4685 void *
operator new(
size_t s) {
4686 return User::operator
new(s, 0);
4693 return I->
getOpcode() == Instruction::Unreachable;
4696 return isa<Instruction>(V) &&
classof(cast<Instruction>(V));
4727 const Twine &NameStr =
"",
4735 const Twine &NameStr,
4744 return isa<Instruction>(V) &&
classof(cast<Instruction>(V));
4766 const Twine &NameStr =
"",
4774 const Twine &NameStr,
4783 return isa<Instruction>(V) &&
classof(cast<Instruction>(V));
4805 const Twine &NameStr =
"",
4813 const Twine &NameStr,
4822 return isa<Instruction>(V) &&
classof(cast<Instruction>(V));
4844 const Twine &NameStr =
"",
4852 const Twine &NameStr,
4861 return isa<Instruction>(V) &&
classof(cast<Instruction>(V));
4883 const Twine &NameStr =
"",
4891 const Twine &NameStr,
4900 return isa<Instruction>(V) &&
classof(cast<Instruction>(V));
4922 const Twine &NameStr =
"",
4930 const Twine &NameStr,
4939 return isa<Instruction>(V) &&
classof(cast<Instruction>(V));
4961 const Twine &NameStr =
"",
4969 const Twine &NameStr,
4978 return isa<Instruction>(V) &&
classof(cast<Instruction>(V));
5000 const Twine &NameStr =
"",
5008 const Twine &NameStr,
5017 return isa<Instruction>(V) &&
classof(cast<Instruction>(V));
5039 const Twine &NameStr =
"",
5047 const Twine &NameStr,
5056 return isa<Instruction>(V) &&
classof(cast<Instruction>(V));
5074 const Twine &NameStr =
"",
5082 const Twine &NameStr,
5099 return isa<Instruction>(V) &&
classof(cast<Instruction>(V));
5121 const Twine &NameStr =
"",
5129 const Twine &NameStr,
5150 return isa<Instruction>(V) &&
classof(cast<Instruction>(V));
5172 const Twine &NameStr =
"",
5180 const Twine &NameStr,
5189 return isa<Instruction>(V) &&
classof(cast<Instruction>(V));
5212 const Twine &NameStr =
"",
5220 const Twine &NameStr,
5229 return isa<Instruction>(V) &&
classof(cast<Instruction>(V));
5261 if (
auto *
Load = dyn_cast<LoadInst>(V))
5262 return Load->getPointerOperand();
5263 if (
auto *
Store = dyn_cast<StoreInst>(V))
5264 return Store->getPointerOperand();
5268 return const_cast<Value *
>(
5277 if (
auto *Gep = dyn_cast<GetElementPtrInst>(V))
5278 return Gep->getPointerOperand();
5287 assert((isa<LoadInst>(I) || isa<StoreInst>(I)) &&
5288 "Expected Load or Store instruction");
5289 if (
auto *LI = dyn_cast<LoadInst>(I))
5297 assert((isa<LoadInst>(I) || isa<StoreInst>(I)) &&
5298 "Expected Load or Store instruction");
5299 if (
auto *LI = dyn_cast<LoadInst>(I))
5300 return LI->getPointerAddressSpace();
5301 return cast<StoreInst>(
I)->getPointerAddressSpace();
5320 const Twine &NameStr =
"",
5329 return isa<Instruction>(V) &&
classof(cast<Instruction>(V));
5335 #endif // LLVM_IR_INSTRUCTIONS_H static unsigned getInsertedValueOperandIndex()
static GetElementPtrInst * Create(Type *PointeeType, Value *Ptr, ArrayRef< Value *> IdxList, const Twine &NameStr, BasicBlock *InsertAtEnd)
static CallBrInst * Create(FunctionType *Ty, Value *Func, BasicBlock *DefaultDest, ArrayRef< BasicBlock *> IndirectDests, ArrayRef< Value *> Args, 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.
SymbolTableList< Instruction >::iterator eraseFromParent()
This method unlinks 'this' from the containing basic block and deletes it.
static bool isEquality(Predicate Pred)
A parsed version of the target data layout string in and methods for querying it. ...
static bool classof(const Value *V)
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)
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.
*p = old <signed v ? old : v
iterator_range< CaseIt > cases()
Iteration adapter for range-for loops.
static bool classof(const Instruction *I)
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)
Atomic ordering constants.
iterator_range< const_succ_op_iterator > successors() const
bool getAlign(const Function &F, unsigned index, unsigned &align)
const CaseHandleT & operator*() const
static bool classof(const Value *V)
void setSuccessor(unsigned i, BasicBlock *NewSucc)
This class represents lattice values for constants.
static InvokeInst * Create(FunctionCallee Func, BasicBlock *IfNormal, BasicBlock *IfException, ArrayRef< Value *> Args, const Twine &NameStr, BasicBlock *InsertAtEnd)
unsigned getSubclassDataFromInstruction() const
bool isAtomic() const
Return true if this instruction has an AtomicOrdering of unordered or higher.
void allocHungoffUses(unsigned N)
static PHINode * Create(Type *Ty, unsigned NumReservedValues, const Twine &NameStr, BasicBlock *InsertAtEnd)
unsigned getNumIndices() const
static ResumeInst * Create(Value *Exn, Instruction *InsertBefore=nullptr)
void setOrdering(AtomicOrdering Ordering)
Sets the ordering constraint of this rmw instruction.
static bool classof(const Instruction *I)
BasicBlock * getSuccessor(unsigned Idx) const
Return the specified successor. This instruction must be a terminator.
static CallInst * Create(FunctionCallee Func, ArrayRef< Value *> Args, const Twine &NameStr, BasicBlock *InsertAtEnd)
An instruction for ordering other memory operations.
SwitchInstProfUpdateWrapper(SwitchInst &SI)
amdgpu Simplify well known AMD library false FunctionCallee Value const Twine & Name
An instruction that atomically checks whether a specified value is in a memory location, and, if it is, stores a new value there.
static CallBrInst * Create(FunctionCallee Func, BasicBlock *DefaultDest, ArrayRef< BasicBlock *> IndirectDests, ArrayRef< Value *> Args, ArrayRef< OperandBundleDef > Bundles=None, const Twine &NameStr="", Instruction *InsertBefore=nullptr)
static CallInst * Create(FunctionType *Ty, Value *F, const Twine &NameStr="", Instruction *InsertBefore=nullptr)
BasicBlock *const * const_block_iterator
static CallInst * Create(FunctionType *Ty, Value *Func, ArrayRef< Value *> Args, const Twine &NameStr, Instruction *InsertBefore=nullptr)
void setIncomingValueForBlock(const BasicBlock *BB, Value *V)
Set every incoming value(s) for block BB to V.
A handy container for a FunctionType+Callee-pointer pair, which can be passed around as a single enti...
This class represents zero extension of integer types.
static CallInst * Create(FunctionCallee Func, ArrayRef< Value *> Args, ArrayRef< OperandBundleDef > Bundles=None, const Twine &NameStr="", Instruction *InsertBefore=nullptr)
void push_back(const T &Elt)
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)
value_op_iterator value_op_begin()
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.
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.
const BasicBlock * operator->() const
A wrapper class to simplify modification of SwitchInst cases along with their prof branch_weights met...
*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)
iterator_range< const_block_iterator > blocks() const
const Use & getOperandUse(unsigned i) const
Type * getPointerOperandType() const
value_op_iterator value_op_end()
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()
static CallBrInst * Create(FunctionCallee Func, BasicBlock *DefaultDest, ArrayRef< BasicBlock *> IndirectDests, ArrayRef< Value *> Args, const Twine &NameStr, Instruction *InsertBefore=nullptr)
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)
This class represents a sign extension of integer types.
unsigned getPointerAddressSpace() const
Get the address space of this pointer or pointer vector type.
MaybeAlign decodeMaybeAlign(unsigned Value)
Dual operation of the encode function above.
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
BasicBlock * getUnwindDest() const
static CleanupReturnInst * Create(Value *CleanupPad, BasicBlock *UnwindBB, BasicBlock *InsertAtEnd)
void setSuccessor(unsigned Idx, BasicBlock *BB)
Update the specified successor to point at the provided block.
bool isVectorTy() const
True if this is an instance of VectorType.
static bool classof(const Value *V)
Constant * getClause(unsigned Idx) const
Get the value of the clause at index Idx.
static CallBrInst * Create(FunctionCallee Func, BasicBlock *DefaultDest, ArrayRef< BasicBlock *> IndirectDests, ArrayRef< Value *> Args, const Twine &NameStr, BasicBlock *InsertAtEnd)
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 setSyncScopeID(SyncScope::ID SSID)
Sets the synchronization scope ID of this rmw instruction.
*p = old >signed v ? old : v
ConstCaseIt findCaseValue(const ConstantInt *C) const
static CallBrInst * Create(FunctionType *Ty, Value *Func, BasicBlock *DefaultDest, ArrayRef< BasicBlock *> IndirectDests, ArrayRef< Value *> Args, const Twine &NameStr, Instruction *InsertBefore=nullptr)
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)
unsigned getPointerAddressSpace() const
Returns the address space of the pointer operand.
static bool classof(const Instruction *I)
static bool isExtractSubvectorMask(const Constant *Mask, int NumSrcElts, int &Index)
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)
ConstantInt * findCaseDest(BasicBlock *BB)
Finds the unique case value for a given successor.
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)
static CallBrInst * Create(FunctionType *Ty, Value *Func, BasicBlock *DefaultDest, ArrayRef< BasicBlock *> IndirectDests, ArrayRef< Value *> Args, ArrayRef< OperandBundleDef > Bundles=None, const Twine &NameStr="", Instruction *InsertBefore=nullptr)
unsigned getNumDestinations() const
return the number of possible destinations in this indirectbr instruction.
BasicBlock * getSuccessor(unsigned i) const
static InvokeInst * Create(FunctionCallee Func, BasicBlock *IfNormal, BasicBlock *IfException, ArrayRef< Value *> Args, const Twine &NameStr, Instruction *InsertBefore=nullptr)
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)
iterator_range< succ_op_iterator > successors()
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
MaybeAlign getAlign() const
static unsigned getOperandNumForIncomingValue(unsigned i)
static bool isRelational(Predicate P)
Return true if the predicate is relational (not EQ or NE).
const Value * getLoadStorePointerOperand(const Value *V)
A helper function that returns the pointer operand of a load or store instruction.
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
Used to keep track of an operand bundle.
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 replaceIncomingBlockWith(const BasicBlock *Old, BasicBlock *New)
Replace every incoming basic block Old to basic block New.
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
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
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 Instruction *I)
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...
BasicBlock * operator*() const
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.
FCmpInst(Predicate Pred, Value *LHS, Value *RHS, const Twine &NameStr="", Instruction *FlagsSource=nullptr)
Constructor with no-insertion semantics.
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()
static CallInst * Create(FunctionCallee Func, ArrayRef< Value *> Args, ArrayRef< OperandBundleDef > Bundles, const Twine &NameStr, BasicBlock *InsertAtEnd)
unsigned getNumClauses() const
Get the number of clauses for this landing pad.
BasicBlock * getDestination(unsigned i)
Return the specified destination.
APInt operator*(APInt a, uint64_t RHS)
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 successor index.
bool doesNotThrow() const
Determine if the call cannot unwind.
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.
static CallBrInst * Create(FunctionType *Ty, Value *Func, BasicBlock *DefaultDest, ArrayRef< BasicBlock *> IndirectDests, ArrayRef< Value *> Args, ArrayRef< OperandBundleDef > Bundles, const Twine &NameStr, BasicBlock *InsertAtEnd)
const_succ_op_iterator(const_value_op_iterator I)
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.
iterator_range< succ_op_iterator > successors()
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)
Iterator type that casts an operand to a basic block.
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
~SwitchInstProfUpdateWrapper()
const BasicBlock * operator*() const
static BranchInst * Create(BasicBlock *IfTrue, BasicBlock *IfFalse, Value *Cond, Instruction *InsertBefore=nullptr)
bool isUsedWithInAlloca() const
Return true if this alloca is used as an inalloca argument to a call.
const_op_iterator idx_begin() const
This instruction compares its operands according to the predicate given to the constructor.
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.
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory)...
LoadInst(Value *Ptr, const Twine &NameStr, bool isVolatile, MaybeAlign Align, BasicBlock *InsertAtEnd)
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)
void setInstructionSubclassData(unsigned short D)
An instruction for storing to memory.
unsigned getLoadStoreAddressSpace(Value *I)
A helper function that returns the address space of the pointer operand of load or store instruction...
This class represents a cast from floating point to signed integer.
BasicBlock * operator*() const
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
static CallInst * Create(FunctionType *Ty, Value *Func, ArrayRef< Value *> Args, const Twine &NameStr, BasicBlock *InsertAtEnd)
static bool classof(const Value *V)
bool operator<(const CaseIteratorImpl &RHS) 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.
unsigned getNumSuccessors() const
Return the number of successors that this instruction has.
Value * getOperand(unsigned i) const
Value * getIndirectDestLabelUse(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.
Type * getScalarType() const
If this is a vector type, return the element type, otherwise return 'this'.
void setUnwindDest(BasicBlock *NewDest)
CaseHandle(SwitchInst *SI, ptrdiff_t Index)
an instruction for type-safe pointer arithmetic to access elements of arrays and structs ...
unsigned getNumSuccessors() const
LoadInst(Value *Ptr, const Twine &NameStr, bool isVolatile, Instruction *InsertBefore=nullptr)
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)
void setIndirectDest(unsigned i, BasicBlock *B)
static bool classof(const Value *V)
static unsigned getPointerOperandIndex()
static bool isFPOperation(BinOp Op)
initializer< Ty > init(const Ty &Val)
This instruction inserts a single (scalar) element into a VectorType value.
void setParentPad(Value *ParentPad)
const Use * getOperandList() const
MaybeAlign getAlign() const
Return the alignment of the access that is being performed.
unsigned getNumIndirectDests() const
Return the number of callbr indirect dest labels.
The landingpad instruction holds all of the information necessary to generate correct exception handl...
The const version of succ_op_iterator.
VAArgInst(Value *List, Type *Ty, const Twine &NameStr, BasicBlock *InsertAtEnd)
static GCRegistry::Add< OcamlGC > B("ocaml", "ocaml 3.10-compatible GC")
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 setSyncScopeID(SyncScope::ID SSID)
Sets the synchronization scope ID of this store instruction.
CRTP base class for adapting an iterator to a different type.
iterator_range< const_succ_op_iterator > successors() const
static InvokeInst * Create(FunctionType *Ty, Value *Func, BasicBlock *IfNormal, BasicBlock *IfException, ArrayRef< Value *> Args, const Twine &NameStr, BasicBlock *InsertAtEnd)
size_t size() const
size - Get the array size.
This function has undefined behavior.
This is an important base class in LLVM.
bool isExtractSubvectorMask(int &Index) const
Return true if this shuffle mask is an extract subvector mask.
bool isFloatingPointOperation() const
Resume the propagation of an exception.
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 chooses elements from exactly one source vector without lane crossings an...
void setUsedWithInAlloca(bool V)
Specify whether this alloca is used to represent the arguments to a call.
static BranchInst * Create(BasicBlock *IfTrue, BasicBlock *InsertAtEnd)
Indirect Branch Instruction.
static bool isReverseMask(ArrayRef< int > M, EVT VT)
LoadInst(Value *Ptr, const Twine &NameStr, bool isVolatile, MaybeAlign Align, Instruction *InsertBefore=nullptr)
unsigned getPointerAddressSpace() const
Returns the address space of the pointer operand.
static CallInst * Create(FunctionCallee Func, const Twine &NameStr, BasicBlock *InsertAtEnd)
BasicBlock * getDefaultDest() const
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 CallInst * Create(Value *Func, const Twine &NameStr="", Instruction *InsertBefore=nullptr)
static unsigned getPointerOperandIndex()
static bool classof(const Value *V)
This instruction compares its operands according to the predicate given to the constructor.
static InvokeInst * Create(FunctionType *Ty, Value *Func, BasicBlock *IfNormal, BasicBlock *IfException, ArrayRef< Value *> Args, ArrayRef< OperandBundleDef > Bundles, const Twine &NameStr, BasicBlock *InsertAtEnd)
static GetElementPtrInst * CreateInBounds(Type *PointeeType, Value *Ptr, ArrayRef< Value *> IdxList, const Twine &NameStr, BasicBlock *InsertAtEnd)
Value * getPointerOperand()
static InvokeInst * Create(FunctionCallee Func, BasicBlock *IfNormal, BasicBlock *IfException, ArrayRef< Value *> Args, ArrayRef< OperandBundleDef > Bundles, const Twine &NameStr, BasicBlock *InsertAtEnd)
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.
LoadInst(Value *Ptr, const Twine &NameStr, bool isVolatile, BasicBlock *InsertAtEnd)
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)
static CallInst * Create(Value *Func, const Twine &NameStr, BasicBlock *InsertAtEnd)
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.
LoadInst(Value *Ptr, const Twine &NameStr, BasicBlock *InsertAtEnd)
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.
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.
static InvokeInst * Create(FunctionCallee Func, BasicBlock *IfNormal, BasicBlock *IfException, ArrayRef< Value *> Args, ArrayRef< OperandBundleDef > Bundles=None, const Twine &NameStr="", Instruction *InsertBefore=nullptr)
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
const Value * getAggregateOperand() const
void setMetadata(unsigned KindID, MDNode *Node)
Set the metadata of the specified kind to the specified node.
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)
This struct is a compact representation of a valid (non-zero power of two) alignment.
Type * getAllocatedType() const
Return the type that is being allocated by the instruction.
CallBr instruction, tracking function calls that may not return control but instead transfer it to a ...
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.
Synchronized with respect to all concurrently executing threads.
void setSyncScopeID(SyncScope::ID SSID)
Sets the synchronization scope ID of this load instruction.
static bool classof(const Instruction *I)
LoadInst(Value *Ptr, const Twine &NameStr, bool isVolatile, MaybeAlign Align, AtomicOrdering Order, SyncScope::ID SSID, BasicBlock *InsertAtEnd)
void setSuccessor(unsigned idx, BasicBlock *NewSucc)
BasicBlock * operator->() const
Optional< uint64_t > getAllocationSizeInBits(const DataLayout &DL) const
Get allocation size in bits.
static bool classof(const Value *V)
idx_iterator idx_begin() const
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 for directly iterating over the operand Values.
iterator_range< T > make_range(T x, T y)
Convenience function for iterating over sub-ranges.
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.
const_succ_op_iterator(const_value_op_iterator I)
static bool classof(const Value *V)
static CallInst * Create(FunctionCallee Func, const Twine &NameStr="", Instruction *InsertBefore=nullptr)
unsigned getNumOperands() const
This is the shared class of boolean and integer constants.
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)
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)
LoadInst(Value *Ptr, const Twine &NameStr, bool isVolatile, MaybeAlign Align, AtomicOrdering Order, SyncScope::ID SSID=SyncScope::System, Instruction *InsertBefore=nullptr)
static bool classof(const Instruction *I)
bool hasUnwindDest() const
static SwitchInst * Create(Value *Value, BasicBlock *Default, unsigned NumCases, Instruction *InsertBefore=nullptr)
This struct is a compact representation of a valid (power of two) or undefined (0) alignment...
BasicBlock * getSuccessor(unsigned i) const
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)
static bool classof(const Instruction *I)
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small...
static bool classof(const Instruction *I)
Methods for support type inquiry through isa, cast, and dyn_cast:
BasicBlock * getIndirectDest(unsigned i) const
SwitchInst * operator->()
This class represents a freeze function that returns random concrete value if an operand is either a ...
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 vect...
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.
CaseIt findCaseValue(const ConstantInt *C)
Search all of the case values for the specified constant.
void setSuccessor(unsigned idx, BasicBlock *NewSucc)
void setAlignment(MaybeAlign Align)
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
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.
void setWeak(bool IsWeak)
SmallVector< BasicBlock *, 16 > getIndirectDests() const
void setResultElementType(Type *Ty)
unsigned getSuccessorIndex() const
Returns successor index for current case successor.
succ_op_iterator(value_op_iterator I)
static bool classof(const Value *V)
static ReturnInst * Create(LLVMContext &C, BasicBlock *InsertAtEnd)
void setDefaultDest(BasicBlock *B)
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 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
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
BasicBlock * getDefaultDest() const
static CallInst * Create(FunctionCallee Func, ArrayRef< Value *> Args, const Twine &NameStr, Instruction *InsertBefore=nullptr)
SyncScope::ID getSyncScopeID() const
Returns the synchronization scope ID of this fence instruction.
List that automatically updates parent links and symbol tables.
bool isVolatile() const
Return true if this is a store to a volatile memory location.
Value * getPointerOperand()
Gets the pointer operand.
void setTrueValue(Value *V)
static CallInst * Create(Value *Func, ArrayRef< Value *> Args, ArrayRef< OperandBundleDef > Bundles, const Twine &NameStr, BasicBlock *InsertAtEnd)
bool unwindsToCaller() const
Type * getPointerOperandType() const
unsigned getAlignment() const
Return the alignment of the access that is being performed.
Value * getIndirectDestLabel(unsigned i) const
getIndirectDestLabel - Return the i-th indirect dest label.
static bool classof(const Instruction *I)
Methods for support type inquiry through isa, cast, and dyn_cast:
void setCondition(Value *V)
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)
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 VectorType * get(Type *ElementType, ElementCount EC)
This static method is the primary way to construct an VectorType.
static InsertValueInst * Create(Value *Agg, Value *Val, ArrayRef< unsigned > Idxs, const Twine &NameStr="", Instruction *InsertBefore=nullptr)
BasicBlock * getIncomingBlock(unsigned i) const
Return incoming basic block number i.
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.
const BasicBlock * operator*() const
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.
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.
void swapValues()
Swap the true and false values of the select instruction.
succ_op_iterator(value_op_iterator I)
Compile-time customization of User operands.
static bool classof(const Instruction *I)
Methods for support type inquiry through isa, cast, and dyn_cast:
FunctionType * getFunctionType()
void setSyncScopeID(SyncScope::ID SSID)
Sets the synchronization scope ID of this cmpxchg instruction.
The const version of succ_op_iterator.
static bool classof(const Value *V)
void setFalseValue(Value *V)
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.
const Value * getPointerOperand(const Value *V)
A helper function that returns the pointer operand of a load, store or GEP instruction.
unsigned getAlignment() const
Return the alignment of the access that is being performed FIXME: Remove this function once transitio...
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.
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 setCondition(Value *V)
unsigned getPointerAddressSpace() const
Returns the address space of the pointer operand.
LoadInst(Value *Ptr, const Twine &NameStr="", Instruction *InsertBefore=nullptr)
static CallBrInst * Create(FunctionCallee Func, BasicBlock *DefaultDest, ArrayRef< BasicBlock *> IndirectDests, ArrayRef< Value *> Args, ArrayRef< OperandBundleDef > Bundles, const Twine &NameStr, BasicBlock *InsertAtEnd)
const BasicBlock * operator->() const
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.
void swapOperands()
Exchange the two operands to this instruction in such a way that it does not modify the semantics of ...
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.
BasicBlock * operator->() const
SmallVector< int, 16 > getShuffleMask() const
unsigned getNumSuccessors() const
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
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.
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.
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.
bool increasesLength() const
Return true if this shuffle returns a vector with a greater number of elements than its source vector...
Iterator type that casts an operand to a basic block.
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)
op_range incoming_values()
This class represents an extension of floating point types.
unsigned getNumSuccessors() const
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.
MaybeAlign getLoadStoreAlignment(Value *I)
A helper function that returns the alignment of load or store instruction.
static bool classof(const Value *V)
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)
Returns the pointer type returned by the GEP instruction, which may be a vector of pointers...
static bool classof(const Value *V)
static CallInst * Create(FunctionType *Ty, Value *F, const Twine &NameStr, BasicBlock *InsertAtEnd)
static bool classof(const Instruction *I)
constexpr char Args[]
Key for Kernel::Metadata::mArgs.
static unsigned getPointerOperandIndex()
void setSuccessor(unsigned i, BasicBlock *NewSucc)
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.
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.
void setCatchPad(CatchPadInst *CatchPad)
bool isCommutative() const
static CallInst * Create(FunctionType *Ty, Value *Func, ArrayRef< Value *> Args, ArrayRef< OperandBundleDef > Bundles, const Twine &NameStr, BasicBlock *InsertAtEnd)
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. ...
Predicate getSwappedPredicate(Predicate Opcode)
Assume the condition register is set by MI(a,b), return the predicate if we modify the instructions s...