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) {
208 isVolatile, InsertBefore) {}
212 isVolatile, InsertAtEnd) {}
216 isVolatile, Align, InsertBefore) {}
220 isVolatile, Align, InsertAtEnd) {}
225 isVolatile, Align, Order, SSID, InsertBefore) {}
229 isVolatile, Align, Order, SSID, InsertAtEnd) {}
256 ((
unsigned)Ordering << 7));
273 setOrdering(Ordering);
274 setSyncScopeID(SSID);
292 return getPointerOperandType()->getPointerAddressSpace();
300 return isa<Instruction>(V) &&
classof(cast<Instruction>(V));
306 void setInstructionSubclassData(
unsigned short D) {
349 void *
operator new(
size_t s) {
350 return User::operator
new(s, 2);
381 ((
unsigned)Ordering << 7));
398 setOrdering(Ordering);
399 setSyncScopeID(SSID);
420 return getPointerOperandType()->getPointerAddressSpace();
428 return isa<Instruction>(V) &&
classof(cast<Instruction>(V));
434 void setInstructionSubclassData(
unsigned short D) {
460 friend class Instruction;
469 Instruction *InsertBefore =
nullptr);
474 void *
operator new(
size_t s) {
475 return User::operator
new(s, 0);
487 ((
unsigned)Ordering << 1));
502 return I->
getOpcode() == Instruction::Fence;
505 return isa<Instruction>(V) &&
classof(cast<Instruction>(V));
511 void setInstructionSubclassData(
unsigned short D) {
551 void *
operator new(
size_t s) {
552 return User::operator
new(s, 3);
590 "CmpXchg instructions can only be atomic.");
592 ((
unsigned)Ordering << 2));
603 "CmpXchg instructions can only be atomic.");
605 ((
unsigned)Ordering << 5));
642 switch (SuccessOrdering) {
658 return I->
getOpcode() == Instruction::AtomicCmpXchg;
661 return isa<Instruction>(V) &&
classof(cast<Instruction>(V));
667 void setInstructionSubclassData(
unsigned short D) {
741 void *
operator new(
size_t s) {
742 return User::operator
new(s, 2);
753 setInstructionSubclassData((SubclassData & 31) |
781 "atomicrmw instructions can only be atomic.");
783 ((
unsigned)Ordering << 2));
810 return I->
getOpcode() == Instruction::AtomicRMW;
813 return isa<Instruction>(V) &&
classof(cast<Instruction>(V));
822 void setInstructionSubclassData(
unsigned short D) {
847 assert(Ty &&
"Invalid GetElementPtrInst indices for type!");
855 Type *SourceElementType;
856 Type *ResultElementType;
882 const Twine &NameStr =
"",
893 NameStr, InsertBefore);
898 const Twine &NameStr,
909 NameStr, InsertAtEnd);
916 const Twine &NameStr =
"",
918 return CreateInBounds(
nullptr, Ptr, IdxList, NameStr, InsertBefore);
923 const Twine &NameStr =
"",
926 Create(PointeeType, Ptr, IdxList, NameStr, InsertBefore);
933 const Twine &NameStr,
935 return CreateInBounds(
nullptr, Ptr, IdxList, NameStr, InsertAtEnd);
940 const Twine &NameStr,
943 Create(PointeeType, Ptr, IdxList, NameStr, InsertAtEnd);
957 assert(ResultElementType ==
958 cast<PointerType>(
getType()->getScalarType())->getElementType());
959 return ResultElementType;
966 return getPointerAddressSpace();
1010 return getPointerOperandType()->getPointerAddressSpace();
1016 return getGEPReturnType(
1030 if (
Index->getType()->isVectorTy()) {
1031 unsigned NumElem =
Index->getType()->getVectorNumElements();
1049 bool hasAllZeroIndices()
const;
1054 bool hasAllConstantIndices()
const;
1058 void setIsInBounds(
bool b =
true);
1061 bool isInBounds()
const;
1075 return (I->
getOpcode() == Instruction::GetElementPtr);
1078 return isa<Instruction>(V) &&
classof(cast<Instruction>(V));
1087 GetElementPtrInst::GetElementPtrInst(
Type *PointeeType,
Value *Ptr,
1089 const Twine &NameStr,
1091 :
Instruction(getGEPReturnType(PointeeType, Ptr, IdxList), GetElementPtr,
1093 Values, InsertBefore),
1094 SourceElementType(PointeeType),
1095 ResultElementType(getIndexedType(PointeeType, IdxList)) {
1096 assert(ResultElementType ==
1097 cast<PointerType>(
getType()->getScalarType())->getElementType());
1098 init(Ptr, IdxList, NameStr);
1101 GetElementPtrInst::GetElementPtrInst(
Type *PointeeType,
Value *Ptr,
1103 const Twine &NameStr,
1105 :
Instruction(getGEPReturnType(PointeeType, Ptr, IdxList), GetElementPtr,
1107 Values, InsertAtEnd),
1108 SourceElementType(PointeeType),
1109 ResultElementType(getIndexedType(PointeeType, IdxList)) {
1110 assert(ResultElementType ==
1111 cast<PointerType>(
getType()->getScalarType())->getElementType());
1112 init(Ptr, IdxList, NameStr);
1158 #define HANDLE_UNARY_INST(N, OPC, CLASS) \ 1159 static UnaryInstruction *Create##OPC(Value *V, \ 1160 const Twine &Name = "") {\ 1161 return Create(Instruction::OPC, V, Name);\ 1163 #include "llvm/IR/Instruction.def" 1164 #define HANDLE_UNARY_INST(N, OPC, CLASS) \ 1165 static UnaryInstruction *Create##OPC(Value *V, \ 1166 const Twine &Name, BasicBlock *BB) {\ 1167 return Create(Instruction::OPC, V, Name, BB);\ 1169 #include "llvm/IR/Instruction.def" 1170 #define HANDLE_UNARY_INST(N, OPC, CLASS) \ 1171 static UnaryInstruction *Create##OPC(Value *V, \ 1172 const Twine &Name, Instruction *I) {\ 1173 return Create(Instruction::OPC, V, Name, I);\ 1175 #include "llvm/IR/Instruction.def" 1192 assert(isIntPredicate() &&
1193 "Invalid ICmp predicate value");
1195 "Both operands to ICmp instruction are not of the same type!");
1199 "Invalid operand types for ICmp instruction");
1216 const Twine &NameStr =
"" 1231 const Twine &NameStr =
"" 1245 const Twine &NameStr =
"" 1280 return P == ICMP_EQ || P == ICMP_NE;
1296 return !isEquality();
1302 return !isEquality(P);
1312 Op<0>().
swap(Op<1>());
1317 return I->
getOpcode() == Instruction::ICmp;
1320 return isa<Instruction>(V) &&
classof(cast<Instruction>(V));
1334 assert(isFPPredicate() &&
"Invalid FCmp predicate value");
1336 "Both operands to FCmp instruction are not of the same type!");
1339 "Invalid operand types for FCmp instruction");
1356 const Twine &NameStr =
"" 1369 const Twine &NameStr =
"" 1381 const Twine &NameStr =
"",
1384 RHS, NameStr, nullptr, FlagsSource) {
1391 return Pred == FCMP_OEQ || Pred == FCMP_ONE || Pred == FCMP_UEQ ||
1402 return isEquality() ||
1420 Op<0>().
swap(Op<1>());
1425 return I->
getOpcode() == Instruction::FCmp;
1428 return isa<Instruction>(V) &&
classof(cast<Instruction>(V));
1449 :
CallInst(Ty, Func, Args,
None, NameStr, InsertBefore) {}
1468 static int ComputeNumOperands(
int NumArgs,
int NumBundleInputs = 0) {
1471 return 1 + NumArgs + NumBundleInputs;
1483 return new (ComputeNumOperands(0))
CallInst(Ty, F, NameStr, InsertBefore);
1487 const Twine &NameStr,
1489 return new (ComputeNumOperands(Args.
size()))
1495 const Twine &NameStr =
"",
1497 const int NumOperands =
1498 ComputeNumOperands(Args.
size(), CountBundleInputs(Bundles));
1501 return new (NumOperands, DescriptorBytes)
1502 CallInst(Ty, Func, Args, Bundles, NameStr, InsertBefore);
1507 return new (ComputeNumOperands(0))
CallInst(Ty, F, NameStr, InsertAtEnd);
1512 return new (ComputeNumOperands(Args.
size()))
1519 const int NumOperands =
1520 ComputeNumOperands(Args.
size(), CountBundleInputs(Bundles));
1523 return new (NumOperands, DescriptorBytes)
1524 CallInst(Ty, Func, Args, Bundles, NameStr, InsertAtEnd);
1533 const Twine &NameStr =
"",
1551 return Create(cast<FunctionType>(
1552 cast<PointerType>(Func->
getType())->getElementType()),
1553 Func, NameStr, InsertBefore);
1558 const Twine &NameStr,
1560 return Create(cast<FunctionType>(
1561 cast<PointerType>(Func->
getType())->getElementType()),
1562 Func, Args, NameStr, InsertBefore);
1568 const Twine &NameStr =
"",
1570 return Create(cast<FunctionType>(
1571 cast<PointerType>(Func->
getType())->getElementType()),
1572 Func, Args, Bundles, NameStr, InsertBefore);
1578 return Create(cast<FunctionType>(
1579 cast<PointerType>(Func->
getType())->getElementType()),
1580 Func, NameStr, InsertAtEnd);
1586 return Create(cast<FunctionType>(
1587 cast<PointerType>(Func->
getType())->getElementType()),
1588 Func, Args, NameStr, InsertAtEnd);
1595 return Create(cast<FunctionType>(
1596 cast<PointerType>(Func->
getType())->getElementType()),
1597 Func, Args, Bundles, NameStr, InsertAtEnd);
1617 Value *ArraySize =
nullptr,
1619 const Twine &Name =
"");
1622 Value *ArraySize =
nullptr,
1624 const Twine &Name =
"");
1627 Value *ArraySize =
nullptr,
1630 const Twine &Name =
"");
1633 Value *ArraySize =
nullptr,
1636 const Twine &Name =
"");
1660 return Kind == TCK_Tail || Kind == TCK_MustTail;
1673 unsigned(isTC ? TCK_Tail : TCK_None));
1688 bool isInlineAsm()
const {
return isa<InlineAsm>(getCalledOperand()); }
1695 return isa<Instruction>(V) &&
classof(cast<Instruction>(V));
1701 void setInstructionSubclassData(
unsigned short D) {
1711 (Args.
size() + CountBundleInputs(Bundles) + 1),
1712 unsigned(Args.
size() + CountBundleInputs(Bundles) + 1),
1714 init(Ty, Func, Args, Bundles, NameStr);
1722 (Args.
size() + CountBundleInputs(Bundles) + 1),
1723 unsigned(Args.
size() + CountBundleInputs(Bundles) + 1),
1725 init(Ty, Func, Args, Bundles, NameStr);
1738 &Op<0>(), 3, InsertBefore) {
1746 &Op<0>(), 3, InsertAtEnd) {
1752 assert(!areInvalidOperands(C, S1, S2) &&
"Invalid operands for select");
1766 const Twine &NameStr =
"",
1776 const Twine &NameStr,
1778 return new(3)
SelectInst(C, S1, S2, NameStr, InsertAtEnd);
1794 static const char *areInvalidOperands(
Value *Cond,
Value *True,
Value *False);
1808 return isa<Instruction>(V) &&
classof(cast<Instruction>(V));
1854 return isa<Instruction>(V) &&
classof(cast<Instruction>(V));
1879 const Twine &NameStr =
"",
1885 const Twine &NameStr,
1892 static bool isValidOperands(
const Value *Vec,
const Value *Idx);
1900 return cast<VectorType>(getVectorOperand()->getType());
1908 return I->
getOpcode() == Instruction::ExtractElement;
1911 return isa<Instruction>(V) &&
classof(cast<Instruction>(V));
1931 const Twine &NameStr =
"",
1944 const Twine &NameStr =
"",
1950 const Twine &NameStr,
1957 static bool isValidOperands(
const Value *Vec,
const Value *NewElt,
1971 return I->
getOpcode() == Instruction::InsertElement;
1974 return isa<Instruction>(V) &&
classof(cast<Instruction>(V));
2001 const Twine &NameStr =
"",
2007 void *
operator new(
size_t s) {
2008 return User::operator
new(s, 3);
2013 static bool isValidOperands(
const Value *V1,
const Value *
V2,
2031 static int getMaskValue(
const Constant *Mask,
unsigned Elt);
2036 return getMaskValue(getMask(), Elt);
2041 static void getShuffleMask(
const Constant *Mask,
2047 return getShuffleMask(getMask(), Result);
2052 getShuffleMask(Mask);
2062 unsigned NumMaskElts = getMask()->getType()->getVectorNumElements();
2063 return NumSourceElts != NumMaskElts;
2071 unsigned NumMaskElts = getMask()->getType()->getVectorNumElements();
2072 return NumSourceElts < NumMaskElts;
2083 getShuffleMask(Mask, MaskAsInts);
2084 return isSingleSourceMask(MaskAsInts);
2092 return !changesLength() && isSingleSourceMask(getMask());
2104 getShuffleMask(Mask, MaskAsInts);
2105 return isIdentityMask(MaskAsInts);
2113 return !changesLength() && isIdentityMask(getShuffleMask());
2118 bool isIdentityWithPadding()
const;
2122 bool isIdentityWithExtract()
const;
2127 bool isConcat()
const;
2141 getShuffleMask(Mask, MaskAsInts);
2142 return isSelectMask(MaskAsInts);
2154 return !changesLength() && isSelectMask(getMask());
2165 getShuffleMask(Mask, MaskAsInts);
2185 getShuffleMask(Mask, MaskAsInts);
2186 return isZeroEltSplatMask(MaskAsInts);
2196 return !changesLength() && isZeroEltSplatMask(getMask());
2235 getShuffleMask(Mask, MaskAsInts);
2236 return isTransposeMask(MaskAsInts);
2245 return !changesLength() && isTransposeMask(getMask());
2251 static bool isExtractSubvectorMask(
ArrayRef<int> Mask,
int NumSrcElts,
2257 getShuffleMask(Mask, MaskAsInts);
2258 return isExtractSubvectorMask(MaskAsInts, NumSrcElts, Index);
2264 return isExtractSubvectorMask(getMask(), NumSrcElts, Index);
2270 unsigned InVecNumElts) {
2271 for (
int &Idx : Mask) {
2274 Idx = Idx < (int)InVecNumElts ? Idx + InVecNumElts : Idx - InVecNumElts;
2275 assert(Idx >= 0 && Idx < (
int)InVecNumElts * 2 &&
2276 "shufflevector mask index out of range");
2282 return I->
getOpcode() == Instruction::ShuffleVector;
2285 return isa<Instruction>(V) &&
classof(cast<Instruction>(V));
2314 const Twine &NameStr,
2331 const Twine &NameStr =
"",
2339 const Twine &NameStr,
2373 return (
unsigned)Indices.
size();
2382 return I->
getOpcode() == Instruction::ExtractValue;
2385 return isa<Instruction>(V) &&
classof(cast<Instruction>(V));
2389 ExtractValueInst::ExtractValueInst(
Value *Agg,
2391 const Twine &NameStr,
2394 ExtractValue, Agg, InsertBefore) {
2395 init(Idxs, NameStr);
2398 ExtractValueInst::ExtractValueInst(
Value *Agg,
2400 const Twine &NameStr,
2403 ExtractValue, Agg, InsertAtEnd) {
2404 init(Idxs, NameStr);
2425 const Twine &NameStr,
2434 const Twine &NameStr =
"",
2440 const Twine &NameStr);
2450 void *
operator new(
size_t s) {
2451 return User::operator
new(s, 2);
2456 const Twine &NameStr =
"",
2463 const Twine &NameStr,
2504 return (
unsigned)Indices.
size();
2513 return I->
getOpcode() == Instruction::InsertValue;
2516 return isa<Instruction>(V) &&
classof(cast<Instruction>(V));
2525 InsertValueInst::InsertValueInst(
Value *Agg,
2528 const Twine &NameStr,
2533 init(Agg, Val, Idxs, NameStr);
2536 InsertValueInst::InsertValueInst(
Value *Agg,
2539 const Twine &NameStr,
2544 init(Agg, Val, Idxs, NameStr);
2560 unsigned ReservedSpace;
2564 explicit PHINode(
Type *Ty,
unsigned NumReservedValues,
2565 const Twine &NameStr =
"",
2567 :
Instruction(Ty, Instruction::PHI,
nullptr, 0, InsertBefore),
2568 ReservedSpace(NumReservedValues) {
2575 :
Instruction(Ty, Instruction::PHI,
nullptr, 0, InsertAtEnd),
2576 ReservedSpace(NumReservedValues) {
2598 const Twine &NameStr =
"",
2600 return new PHINode(Ty, NumReservedValues, NameStr, InsertBefore);
2605 return new PHINode(Ty, NumReservedValues, NameStr, InsertAtEnd);
2638 return make_range(block_begin(), block_end());
2642 return make_range(block_begin(), block_end());
2659 assert(V &&
"PHI node got a null value!");
2661 "All operands to PHI node must be the same type as the PHI node!");
2676 return block_begin()[i];
2683 assert(
this == U.
getUser() &&
"Iterator doesn't point to PHI's Uses?");
2684 return getIncomingBlock(
unsigned(&U -
op_begin()));
2691 return getIncomingBlock(I.getUse());
2695 assert(BB &&
"PHI node got a null basic block!");
2696 block_begin()[i] = BB;
2718 Value *removeIncomingValue(
unsigned Idx,
bool DeletePHIIfEmpty =
true);
2721 int Idx = getBasicBlockIndex(BB);
2722 assert(Idx >= 0 &&
"Invalid basic block argument to remove!");
2723 return removeIncomingValue(Idx, DeletePHIIfEmpty);
2731 if (block_begin()[i] == BB)
2737 int Idx = getBasicBlockIndex(BB);
2738 assert(Idx >= 0 &&
"Invalid basic block argument!");
2739 return getIncomingValue(Idx);
2744 Value *hasConstantValue()
const;
2749 bool hasConstantOrUndefValue()
const;
2753 return I->
getOpcode() == Instruction::PHI;
2756 return isa<Instruction>(V) &&
classof(cast<Instruction>(V));
2760 void growOperands();
2784 unsigned ReservedSpace;
2798 void *
operator new(
size_t s) {
2799 return User::operator
new(s);
2802 void growOperands(
unsigned Size);
2803 void init(
unsigned NumReservedValues,
const Twine &NameStr);
2815 const Twine &NameStr =
"",
2835 void addClause(
Constant *ClauseVal);
2862 return I->
getOpcode() == Instruction::LandingPad;
2865 return isa<Instruction>(V) &&
classof(cast<Instruction>(V));
2912 return new(!!retVal)
ReturnInst(C, retVal, InsertBefore);
2917 return new(!!retVal)
ReturnInst(C, retVal, InsertAtEnd);
2939 return isa<Instruction>(V) &&
classof(cast<Instruction>(V));
3000 std::random_access_iterator_tag, BasicBlock *,
3001 ptrdiff_t, BasicBlock *, BasicBlock *> {
3011 std::random_access_iterator_tag,
3012 const BasicBlock *, ptrdiff_t, const BasicBlock *,
3013 const BasicBlock *> {
3023 return new(1)
BranchInst(IfTrue, InsertBefore);
3028 return new(3)
BranchInst(IfTrue, IfFalse, Cond, InsertBefore);
3032 return new(1)
BranchInst(IfTrue, InsertAtEnd);
3037 return new(3)
BranchInst(IfTrue, IfFalse, Cond, InsertAtEnd);
3047 assert(isConditional() &&
"Cannot get condition of an uncond branch!");
3052 assert(isConditional() &&
"Cannot set condition of unconditional branch!");
3060 return cast_or_null<BasicBlock>((&
Op<-1>() - i)->get());
3065 *(&
Op<-1>() - idx) = NewSucc;
3073 void swapSuccessors();
3089 return (I->
getOpcode() == Instruction::Br);
3092 return isa<Instruction>(V) &&
classof(cast<Instruction>(V));
3110 unsigned ReservedSpace;
3133 void *
operator new(
size_t s) {
3134 return User::operator
new(s);
3137 void init(Value *Value,
BasicBlock *Default,
unsigned NumReserved);
3138 void growOperands();
3148 static const unsigned DefaultPseudoIndex =
static_cast<unsigned>(~0L-1);
3157 template <
typename SwitchInstT,
typename ConstantIntT,
typename BasicBlockT>
3176 assert((
unsigned)Index < SI->getNumCases() &&
3177 "Index out the number of cases.");
3178 return reinterpret_cast<ConstantIntT *
>(SI->getOperand(2 + Index * 2));
3183 assert(((
unsigned)Index < SI->getNumCases() ||
3184 (
unsigned)Index == DefaultPseudoIndex) &&
3185 "Index out the number of cases.");
3186 return SI->getSuccessor(getSuccessorIndex());
3194 assert(((
unsigned)Index == DefaultPseudoIndex ||
3195 (
unsigned)Index < SI->getNumCases()) &&
3196 "Index out the number of cases.");
3197 return (
unsigned)Index != DefaultPseudoIndex ? Index + 1 : 0;
3201 assert(SI == RHS.
SI &&
"Incompatible operators.");
3202 return Index == RHS.
Index;
3218 assert((
unsigned)Index < SI->getNumCases() &&
3219 "Index out the number of cases.");
3229 template <
typename CaseHandleT>
3232 std::random_access_iterator_tag,
3234 using SwitchInstT =
typename CaseHandleT::SwitchInstType;
3250 unsigned SuccessorIndex) {
3252 "Successor index # out of range!");
3266 assert(Case.Index + N >= 0 &&
3267 (
unsigned)(Case.Index + N) <= Case.SI->getNumCases() &&
3268 "Case.Index out the number of cases.");
3275 assert(Case.Index - N >= 0 &&
3276 (
unsigned)(Case.Index - N) <= Case.SI->getNumCases() &&
3277 "Case.Index out the number of cases.");
3282 assert(Case.SI == RHS.Case.SI &&
"Incompatible operators.");
3283 return Case.Index - RHS.Case.Index;
3286 return Case == RHS.Case;
3289 assert(Case.SI == RHS.Case.SI &&
"Incompatible operators.");
3290 return Case.Index < RHS.Case.Index;
3302 return new SwitchInst(Value, Default, NumCases, InsertBefore);
3306 unsigned NumCases,
BasicBlock *InsertAtEnd) {
3307 return new SwitchInst(Value, Default, NumCases, InsertAtEnd);
3322 setOperand(1, reinterpret_cast<Value*>(DefaultCase));
3346 return CaseIt(
this, getNumCases());
3371 return CaseIt(
this, DefaultPseudoIndex);
3384 if (I != case_end())
3387 return case_default();
3393 if (I != case_end())
3396 return case_default();
3402 if (BB == getDefaultDest())
3406 for (
auto Case : cases()) {
3407 if (Case.getCaseSuccessor() != BB)
3413 CI = Case.getCaseValue();
3437 return cast<BasicBlock>(
getOperand(idx*2+1));
3446 return I->
getOpcode() == Instruction::Switch;
3449 return isa<Instruction>(V) &&
classof(cast<Instruction>(V));
3467 unsigned ReservedSpace;
3486 void *
operator new(
size_t s) {
3487 return User::operator
new(s);
3490 void init(Value *Address,
unsigned NumDests);
3491 void growOperands();
3506 std::random_access_iterator_tag, BasicBlock *,
3507 ptrdiff_t, BasicBlock *, BasicBlock *> {
3517 std::random_access_iterator_tag,
3518 const BasicBlock *, ptrdiff_t, const BasicBlock *,
3519 const BasicBlock *> {
3559 void removeDestination(
unsigned i);
3581 return I->
getOpcode() == Instruction::IndirectBr;
3584 return isa<Instruction>(V) &&
classof(cast<Instruction>(V));
3604 static constexpr
int NumExtraOperands = 2;
3607 static constexpr
int NormalDestOpEndIdx = -3;
3610 static constexpr
int UnwindDestOpEndIdx = -2;
3632 static int ComputeNumOperands(
int NumArgs,
int NumBundleInputs = 0) {
3635 return 1 + NumExtraOperands + NumArgs + NumBundleInputs;
3647 const Twine &NameStr,
3649 int NumOperands = ComputeNumOperands(Args.
size());
3650 return new (NumOperands)
3651 InvokeInst(Ty, Func, IfNormal, IfException, Args,
None, NumOperands,
3652 NameStr, InsertBefore);
3658 const Twine &NameStr =
"",
3661 ComputeNumOperands(Args.
size(), CountBundleInputs(Bundles));
3664 return new (NumOperands, DescriptorBytes)
3665 InvokeInst(Ty, Func, IfNormal, IfException, Args, Bundles, NumOperands,
3666 NameStr, InsertBefore);
3672 int NumOperands = ComputeNumOperands(Args.
size());
3673 return new (NumOperands)
3674 InvokeInst(Ty, Func, IfNormal, IfException, Args,
None, NumOperands,
3675 NameStr, InsertAtEnd);
3683 ComputeNumOperands(Args.
size(), CountBundleInputs(Bundles));
3686 return new (NumOperands, DescriptorBytes)
3687 InvokeInst(Ty, Func, IfNormal, IfException, Args, Bundles, NumOperands,
3688 NameStr, InsertAtEnd);
3693 const Twine &NameStr,
3696 None, NameStr, InsertBefore);
3702 const Twine &NameStr =
"",
3705 Bundles, NameStr, InsertBefore);
3712 NameStr, InsertAtEnd);
3720 Bundles, NameStr, InsertAtEnd);
3726 const Twine &NameStr,
3728 return Create(cast<FunctionType>(
3729 cast<PointerType>(Func->
getType())->getElementType()),
3730 Func, IfNormal, IfException, Args,
None, NameStr,
3738 const Twine &NameStr =
"",
3740 return Create(cast<FunctionType>(
3741 cast<PointerType>(Func->
getType())->getElementType()),
3742 Func, IfNormal, IfException, Args, Bundles, NameStr,
3750 return Create(cast<FunctionType>(
3751 cast<PointerType>(Func->
getType())->getElementType()),
3752 Func, IfNormal, IfException, Args, NameStr, InsertAtEnd);
3760 return Create(cast<FunctionType>(
3761 cast<PointerType>(Func->
getType())->getElementType()),
3762 Func, IfNormal, IfException, Args, Bundles, NameStr,
3786 return cast<BasicBlock>(Op<NormalDestOpEndIdx>());
3789 return cast<BasicBlock>(Op<UnwindDestOpEndIdx>());
3792 Op<NormalDestOpEndIdx>() = reinterpret_cast<Value *>(B);
3795 Op<UnwindDestOpEndIdx>() = reinterpret_cast<Value *>(B);
3800 LandingPadInst *getLandingPadInst()
const;
3803 assert(i < 2 &&
"Successor # out of range for invoke!");
3804 return i == 0 ? getNormalDest() : getUnwindDest();
3808 assert(i < 2 &&
"Successor # out of range for invoke!");
3810 setNormalDest(NewSucc);
3812 setUnwindDest(NewSucc);
3819 return (I->
getOpcode() == Instruction::Invoke);
3822 return isa<Instruction>(V) &&
classof(cast<Instruction>(V));
3829 void setInstructionSubclassData(
unsigned short D) {
3841 init(Ty, Func, IfNormal, IfException, Args, Bundles, NameStr);
3851 init(Ty, Func, IfNormal, IfException, Args, Bundles, NameStr);
3892 return I->
getOpcode() == Instruction::Resume;
3895 return isa<Instruction>(V) &&
classof(cast<Instruction>(V));
3921 unsigned ReservedSpace;
3933 unsigned NumHandlers,
const Twine &NameStr,
3941 unsigned NumHandlers,
const Twine &NameStr,
3945 void *
operator new(
size_t s) {
return User::operator
new(s); }
3947 void init(Value *ParentPad,
BasicBlock *UnwindDest,
unsigned NumReserved);
3948 void growOperands(
unsigned Size);
3958 unsigned NumHandlers,
3959 const Twine &NameStr =
"",
3961 return new CatchSwitchInst(ParentPad, UnwindDest, NumHandlers, NameStr,
3966 unsigned NumHandlers,
const Twine &NameStr,
3968 return new CatchSwitchInst(ParentPad, UnwindDest, NumHandlers, NameStr,
3983 if (hasUnwindDest())
3996 if (hasUnwindDest())
4002 static BasicBlock *handler_helper(Value *V) {
return cast<BasicBlock>(V); }
4003 static const BasicBlock *handler_helper(
const Value *V) {
4004 return cast<BasicBlock>(V);
4019 if (hasUnwindDest())
4028 if (hasUnwindDest())
4030 return const_handler_iterator(It,
ConstDerefFnTy(handler_helper));
4047 return make_range(handler_begin(), handler_end());
4052 return make_range(handler_begin(), handler_end());
4066 "Successor # out of range for catchswitch!");
4067 return cast<BasicBlock>(
getOperand(Idx + 1));
4071 "Successor # out of range for catchswitch!");
4077 return I->
getOpcode() == Instruction::CatchSwitch;
4080 return isa<Instruction>(V) &&
classof(cast<Instruction>(V));
4095 unsigned Values,
const Twine &NameStr,
4097 :
FuncletPadInst(Instruction::CleanupPad, ParentPad, Args, Values,
4098 NameStr, InsertBefore) {}
4100 unsigned Values,
const Twine &NameStr,
4102 :
FuncletPadInst(Instruction::CleanupPad, ParentPad, Args, Values,
4103 NameStr, InsertAtEnd) {}
4107 const Twine &NameStr =
"",
4109 unsigned Values = 1 + Args.
size();
4116 unsigned Values = 1 + Args.
size();
4123 return I->
getOpcode() == Instruction::CleanupPad;
4126 return isa<Instruction>(V) &&
classof(cast<Instruction>(V));
4136 unsigned Values,
const Twine &NameStr,
4138 :
FuncletPadInst(Instruction::CatchPad, CatchSwitch, Args, Values,
4139 NameStr, InsertBefore) {}
4141 unsigned Values,
const Twine &NameStr,
4143 :
FuncletPadInst(Instruction::CatchPad, CatchSwitch, Args, Values,
4144 NameStr, InsertAtEnd) {}
4148 const Twine &NameStr =
"",
4150 unsigned Values = 1 + Args.
size();
4152 CatchPadInst(CatchSwitch, Args, Values, NameStr, InsertBefore);
4157 unsigned Values = 1 + Args.
size();
4159 CatchPadInst(CatchSwitch, Args, Values, NameStr, InsertAtEnd);
4164 return cast<CatchSwitchInst>(
Op<-1>());
4168 Op<-1>() = CatchSwitch;
4173 return I->
getOpcode() == Instruction::CatchPad;
4176 return isa<Instruction>(V) &&
classof(cast<Instruction>(V));
4232 return getCatchPad()->getCatchSwitch()->getParentPad();
4237 return (I->
getOpcode() == Instruction::CatchRet);
4240 return isa<Instruction>(V) &&
classof(cast<Instruction>(V));
4286 unsigned Values = 1;
4296 unsigned Values = 1;
4311 return cast<CleanupPadInst>(Op<0>());
4315 Op<0>() = CleanupPad;
4321 return hasUnwindDest() ? cast<BasicBlock>(Op<1>()) :
nullptr;
4331 return (I->
getOpcode() == Instruction::CleanupRet);
4334 return isa<Instruction>(V) &&
classof(cast<Instruction>(V));
4340 return getUnwindDest();
4350 void setInstructionSubclassData(
unsigned short D) {
4382 void *
operator new(
size_t s) {
4383 return User::operator
new(s, 0);
4390 return I->
getOpcode() == Instruction::Unreachable;
4393 return isa<Instruction>(V) &&
classof(cast<Instruction>(V));
4424 const Twine &NameStr =
"",
4432 const Twine &NameStr,
4441 return isa<Instruction>(V) &&
classof(cast<Instruction>(V));
4463 const Twine &NameStr =
"",
4471 const Twine &NameStr,
4480 return isa<Instruction>(V) &&
classof(cast<Instruction>(V));
4502 const Twine &NameStr =
"",
4510 const Twine &NameStr,
4519 return isa<Instruction>(V) &&
classof(cast<Instruction>(V));
4541 const Twine &NameStr =
"",
4549 const Twine &NameStr,
4558 return isa<Instruction>(V) &&
classof(cast<Instruction>(V));
4580 const Twine &NameStr =
"",
4588 const Twine &NameStr,
4597 return isa<Instruction>(V) &&
classof(cast<Instruction>(V));
4619 const Twine &NameStr =
"",
4627 const Twine &NameStr,
4636 return isa<Instruction>(V) &&
classof(cast<Instruction>(V));
4658 const Twine &NameStr =
"",
4666 const Twine &NameStr,
4675 return isa<Instruction>(V) &&
classof(cast<Instruction>(V));
4697 const Twine &NameStr =
"",
4705 const Twine &NameStr,
4714 return isa<Instruction>(V) &&
classof(cast<Instruction>(V));
4736 const Twine &NameStr =
"",
4744 const Twine &NameStr,
4753 return isa<Instruction>(V) &&
classof(cast<Instruction>(V));
4771 const Twine &NameStr =
"",
4779 const Twine &NameStr,
4796 return isa<Instruction>(V) &&
classof(cast<Instruction>(V));
4818 const Twine &NameStr =
"",
4826 const Twine &NameStr,
4847 return isa<Instruction>(V) &&
classof(cast<Instruction>(V));
4869 const Twine &NameStr =
"",
4877 const Twine &NameStr,
4886 return isa<Instruction>(V) &&
classof(cast<Instruction>(V));
4909 const Twine &NameStr =
"",
4917 const Twine &NameStr,
4926 return isa<Instruction>(V) &&
classof(cast<Instruction>(V));
4958 if (
auto *
Load = dyn_cast<LoadInst>(V))
4959 return Load->getPointerOperand();
4960 if (
auto *
Store = dyn_cast<StoreInst>(V))
4961 return Store->getPointerOperand();
4970 if (
auto *Gep = dyn_cast<GetElementPtrInst>(V))
4971 return Gep->getPointerOperand();
4977 assert((isa<LoadInst>(I) || isa<StoreInst>(I)) &&
4978 "Expected Load or Store instruction");
4979 if (
auto *LI = dyn_cast<LoadInst>(I))
4980 return LI->getAlignment();
4987 assert((isa<LoadInst>(I) || isa<StoreInst>(I)) &&
4988 "Expected Load or Store instruction");
4989 if (
auto *LI = dyn_cast<LoadInst>(I))
4990 return LI->getPointerAddressSpace();
4991 return cast<StoreInst>(
I)->getPointerAddressSpace();
4996 #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.
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.
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)
Atomic ordering constants.
iterator_range< const_succ_op_iterator > successors() const
const CaseHandleT & operator*() const
static bool classof(const Value *V)
This class represents lattice values for constants.
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.
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.
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)
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)
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
*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
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()
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.
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.
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 CallInst * Create(Function *Func, const Twine &NameStr, BasicBlock *InsertAtEnd)
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
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)
unsigned getNumDestinations() const
return the number of possible destinations in this indirectbr instruction.
BasicBlock * getSuccessor(unsigned i) const
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
static unsigned getOperandNumForIncomingValue(unsigned i)
static bool isRelational(Predicate P)
Return true if the predicate is relational (not EQ or NE).
static InvokeInst * Create(Function *Func, BasicBlock *IfNormal, BasicBlock *IfException, ArrayRef< Value *> Args, const Twine &NameStr, Instruction *InsertBefore=nullptr)
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.
amdgpu Simplify well known AMD library false Value Value const Twine & Name
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.
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 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()
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.
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.
LoadInst(Value *Ptr, const Twine &NameStr, bool isVolatile, unsigned Align, AtomicOrdering Order, SyncScope::ID SSID, BasicBlock *InsertAtEnd)
unsigned getNumSuccessors() const
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)...
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.
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
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)
static bool classof(const Value *V)
static unsigned getPointerOperandIndex()
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
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.
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 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 InvokeInst * Create(Function *Func, BasicBlock *IfNormal, BasicBlock *IfException, ArrayRef< Value *> Args, const Twine &NameStr, BasicBlock *InsertAtEnd)
static bool isReverseMask(ArrayRef< int > M, EVT VT)
unsigned getPointerAddressSpace() const
Returns the address space of the pointer operand.
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 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.
#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)
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)
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)
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)
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 * 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)
static bool classof(const Instruction *I)
static CallInst * Create(Function *Func, ArrayRef< Value *> Args, const Twine &NameStr, BasicBlock *InsertAtEnd)
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
FunctionType * getFunctionType() const
Returns the FunctionType for me.
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)
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)
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 InvokeInst * Create(Function *Func, BasicBlock *IfNormal, BasicBlock *IfException, ArrayRef< Value *> Args, ArrayRef< OperandBundleDef > Bundles=None, 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
static CallInst * Create(Function *Func, const Twine &NameStr="", Instruction *InsertBefore=nullptr)
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
LLVM_ATTRIBUTE_ALWAYS_INLINE iterator end()
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.
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
Type * getPointerOperandType() const
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)
UnaryOps getOpcode() const
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 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.
LoadInst(Value *Ptr, const Twine &NameStr, bool isVolatile, unsigned Align, BasicBlock *InsertAtEnd)
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.
static CallInst * Create(Function *Func, ArrayRef< Value *> Args, const Twine &NameStr="", Instruction *InsertBefore=nullptr)
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:
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.
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 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 getLoadStoreAlignment(Value *I)
A helper function that returns the alignment of load or store instruction.
unsigned getPointerAddressSpace() const
Returns the address space of the pointer operand.
LoadInst(Value *Ptr, const Twine &NameStr="", Instruction *InsertBefore=nullptr)
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 ...
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.
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.
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.
Synchronized with respect to all concurrently executing threads.
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 InvokeInst * Create(Function *Func, BasicBlock *IfNormal, BasicBlock *IfException, ArrayRef< Value *> Args, ArrayRef< OperandBundleDef > Bundles, const Twine &NameStr, BasicBlock *InsertAtEnd)
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.
LoadInst(Value *Ptr, const Twine &NameStr, bool isVolatile, unsigned Align, AtomicOrdering Order, SyncScope::ID SSID=SyncScope::System, Instruction *InsertBefore=nullptr)
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)
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. ...
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...