16 #ifndef LLVM_IR_INSTRUCTIONS_H
17 #define LLVM_IR_INSTRUCTIONS_H
71 Value *ArraySize =
nullptr,
144 return (I->
getOpcode() == Instruction::Alloca);
147 return isa<Instruction>(V) &&
classof(cast<Instruction>(V));
153 void setInstructionSubclassData(
unsigned short D) {
187 NameStr, isVolatile, Align, InsertBefore) {}
196 NameStr, isVolatile, Align, Order, SSID, InsertBefore) {}
241 ((
unsigned)Ordering << 7));
285 return isa<Instruction>(V) &&
classof(cast<Instruction>(V));
291 void setInstructionSubclassData(
unsigned short D) {
334 void *
operator new(
size_t s) {
335 return User::operator
new(s, 2);
366 ((
unsigned)Ordering << 7));
413 return isa<Instruction>(V) &&
classof(cast<Instruction>(V));
419 void setInstructionSubclassData(
unsigned short D) {
445 friend class Instruction;
454 Instruction *InsertBefore =
nullptr);
459 void *
operator new(
size_t s) {
460 return User::operator
new(s, 0);
471 setInstructionSubclassData((getSubclassDataFromInstruction() & 1) |
472 ((
unsigned)Ordering << 1));
487 return I->
getOpcode() == Instruction::Fence;
490 return isa<Instruction>(V) && classof(cast<Instruction>(V));
496 void setInstructionSubclassData(
unsigned short D) {
536 void *
operator new(
size_t s) {
537 return User::operator
new(s, 3);
575 "CmpXchg instructions can only be atomic.");
577 ((
unsigned)Ordering << 2));
588 "CmpXchg instructions can only be atomic.");
590 ((
unsigned)Ordering << 5));
627 switch (SuccessOrdering) {
643 return I->
getOpcode() == Instruction::AtomicCmpXchg;
646 return isa<Instruction>(V) &&
classof(cast<Instruction>(V));
652 void setInstructionSubclassData(
unsigned short D) {
680 friend class Instruction;
720 Instruction *InsertBefore =
nullptr);
726 void *
operator new(
size_t s) {
727 return User::operator
new(s, 2);
731 return static_cast<BinOp>(getSubclassDataFromInstruction() >> 5);
735 unsigned short SubclassData = getSubclassDataFromInstruction();
736 setInstructionSubclassData((SubclassData & 31) |
743 return getSubclassDataFromInstruction() & 1;
749 setInstructionSubclassData((getSubclassDataFromInstruction() & ~1) |
758 return AtomicOrdering((getSubclassDataFromInstruction() >> 2) & 7);
764 "atomicrmw instructions can only be atomic.");
765 setInstructionSubclassData((getSubclassDataFromInstruction() & ~(7 << 2)) |
766 ((
unsigned)Ordering << 2));
793 return I->
getOpcode() == Instruction::AtomicRMW;
796 return isa<Instruction>(V) && classof(cast<Instruction>(V));
805 void setInstructionSubclassData(
unsigned short D) {
830 assert(Ty &&
"Invalid GetElementPtrInst indices for type!");
838 Type *SourceElementType;
839 Type *ResultElementType;
865 const Twine &NameStr =
"",
876 NameStr, InsertBefore);
881 const Twine &NameStr,
892 NameStr, InsertAtEnd);
899 const Twine &NameStr =
"",
901 return CreateInBounds(
nullptr, Ptr, IdxList, NameStr, InsertBefore);
906 const Twine &NameStr =
"",
909 Create(PointeeType, Ptr, IdxList, NameStr, InsertBefore);
916 const Twine &NameStr,
918 return CreateInBounds(
nullptr, Ptr, IdxList, NameStr, InsertAtEnd);
923 const Twine &NameStr,
926 Create(PointeeType, Ptr, IdxList, NameStr, InsertAtEnd);
940 assert(ResultElementType ==
941 cast<PointerType>(
getType()->getScalarType())->getElementType());
942 return ResultElementType;
1012 for (
Value *Index : IdxList)
1013 if (Index->getType()->isVectorTy()) {
1014 unsigned NumElem = Index->getType()->getVectorNumElements();
1058 return (I->
getOpcode() == Instruction::GetElementPtr);
1061 return isa<Instruction>(V) &&
classof(cast<Instruction>(V));
1070 GetElementPtrInst::GetElementPtrInst(
Type *PointeeType,
Value *
Ptr,
1072 const Twine &NameStr,
1074 :
Instruction(getGEPReturnType(PointeeType, Ptr, IdxList), GetElementPtr,
1076 Values, InsertBefore),
1077 SourceElementType(PointeeType),
1078 ResultElementType(getIndexedType(PointeeType, IdxList)) {
1079 assert(ResultElementType ==
1080 cast<PointerType>(
getType()->getScalarType())->getElementType());
1081 init(Ptr, IdxList, NameStr);
1084 GetElementPtrInst::GetElementPtrInst(
Type *PointeeType, Value *Ptr,
1085 ArrayRef<Value *> IdxList,
unsigned Values,
1086 const Twine &NameStr,
1088 : Instruction(getGEPReturnType(PointeeType, Ptr, IdxList), GetElementPtr,
1089 OperandTraits<GetElementPtrInst>::op_end(this) - Values,
1090 Values, InsertAtEnd),
1091 SourceElementType(PointeeType),
1092 ResultElementType(getIndexedType(PointeeType, IdxList)) {
1093 assert(ResultElementType ==
1094 cast<PointerType>(
getType()->getScalarType())->getElementType());
1095 init(Ptr, IdxList, NameStr);
1110 assert(isIntPredicate() &&
1111 "Invalid ICmp predicate value");
1113 "Both operands to ICmp instruction are not of the same type!");
1116 getOperand(0)->
getType()->isPtrOrPtrVectorTy()) &&
1117 "Invalid operand types for ICmp instruction");
1134 const Twine &NameStr =
""
1135 ) : CmpInst(makeCmpResultType(LHS->
getType()),
1149 const Twine &NameStr =
""
1150 ) : CmpInst(makeCmpResultType(LHS->
getType()),
1163 const Twine &NameStr =
""
1164 ) : CmpInst(makeCmpResultType(LHS->
getType()),
1176 return getSignedPredicate(getPredicate());
1188 return getUnsignedPredicate(getPredicate());
1198 return P == ICMP_EQ || P == ICMP_NE;
1204 return isEquality(getPredicate());
1214 return !isEquality();
1220 return !isEquality(P);
1230 Op<0>().
swap(Op<1>());
1235 return I->
getOpcode() == Instruction::ICmp;
1238 return isa<Instruction>(V) && classof(cast<Instruction>(V));
1254 "Both operands to FCmp instruction are not of the same type!");
1257 "Invalid operand types for FCmp instruction");
1274 const Twine &NameStr =
""
1287 const Twine &NameStr =
""
1299 const Twine &NameStr =
""
1337 Op<0>().
swap(Op<1>());
1342 return I->
getOpcode() == Instruction::FCmp;
1345 return isa<Instruction>(V) &&
classof(cast<Instruction>(V));
1366 inline CallInst(FunctionType *Ty, Value *Func, ArrayRef<Value *> Args,
1367 ArrayRef<OperandBundleDef> Bundles, const Twine &NameStr,
1368 Instruction *InsertBefore);
1371 ArrayRef<OperandBundleDef> Bundles, const Twine &NameStr,
1372 Instruction *InsertBefore)
1374 cast<PointerType>(Func->getType())->getElementType()),
1375 Func,
Args, Bundles, NameStr, InsertBefore) {}
1383 inline CallInst(
Value *Func, ArrayRef<Value *>
Args,
1384 ArrayRef<OperandBundleDef> Bundles,
const Twine &NameStr,
1387 explicit CallInst(
Value *
F,
const Twine &NameStr,
1392 void init(
Value *Func, ArrayRef<Value *>
Args,
1393 ArrayRef<OperandBundleDef> Bundles,
const Twine &NameStr) {
1394 init(cast<FunctionType>(
1395 cast<PointerType>(Func->getType())->getElementType()),
1396 Func, Args, Bundles, NameStr);
1398 void init(FunctionType *FTy,
Value *Func, ArrayRef<Value *> Args,
1399 ArrayRef<OperandBundleDef> Bundles,
const Twine &NameStr);
1400 void init(
Value *Func,
const Twine &NameStr);
1413 const Twine &NameStr =
"",
1415 return Create(cast<FunctionType>(
1416 cast<PointerType>(Func->
getType())->getElementType()),
1417 Func, Args, Bundles, NameStr, InsertBefore);
1421 const Twine &NameStr,
1423 return Create(cast<FunctionType>(
1424 cast<PointerType>(Func->
getType())->getElementType()),
1425 Func, Args,
None, NameStr, InsertBefore);
1429 const Twine &NameStr,
1437 const Twine &NameStr =
"",
1439 const unsigned TotalOps =
1441 const unsigned DescriptorBytes = Bundles.size() *
sizeof(
BundleOpInfo);
1443 return new (TotalOps, DescriptorBytes)
1444 CallInst(Ty, Func, Args, Bundles, NameStr, InsertBefore);
1450 const unsigned TotalOps =
1454 return new (TotalOps, DescriptorBytes)
1455 CallInst(Func, Args, Bundles, NameStr, InsertAtEnd);
1466 return new(1)
CallInst(F, NameStr, InsertBefore);
1471 return new(1)
CallInst(F, NameStr, InsertAtEnd);
1491 Value *AllocSize,
Value *ArraySize =
nullptr,
1496 Value *AllocSize,
Value *ArraySize =
nullptr,
1501 Value *AllocSize,
Value *ArraySize =
nullptr,
1507 Value *AllocSize,
Value *ArraySize =
nullptr,
1628 auto ID =
static_cast<unsigned>(CC);
1675 assert(Kind != Attribute::NoBuiltin &&
1676 "Use CallInst::isNoBuiltin() to check for Attribute::NoBuiltin");
1677 return hasFnAttrImpl(Kind);
1682 return hasFnAttrImpl(Kind);
1733 return Attrs.getParamAlignment(ArgNo);
1739 return Attrs.getDereferenceableBytes(i);
1745 return Attrs.getDereferenceableOrNullBytes(i);
1756 return hasFnAttrImpl(Attribute::NoBuiltin) &&
1757 !hasFnAttrImpl(Attribute::Builtin);
1768 return hasFnAttr(Attribute::ReturnsTwice);
1801 return hasFnAttr(Attribute::ArgMemOnly);
1846 return Attrs.hasAttrSomewhere(Attribute::ByVal);
1864 cast<FunctionType>(cast<PointerType>(Fn->
getType())->getElementType()),
1869 assert(FTy == cast<FunctionType>(
1870 cast<PointerType>(Fn->
getType())->getElementType()));
1876 return isa<InlineAsm>(
Op<-1>());
1884 return isa<Instruction>(V) &&
classof(cast<Instruction>(V));
1888 template <
typename AttrKind>
bool hasFnAttrImpl(AttrKind
Kind)
const {
1905 void setInstructionSubclassData(
unsigned short D) {
1919 ->getElementType())->getReturnType(),
1921 (Args.size() + CountBundleInputs(Bundles) + 1),
1922 unsigned(Args.size() + CountBundleInputs(Bundles) + 1), InsertAtEnd) {
1923 init(Func, Args, Bundles, NameStr);
1926 CallInst::CallInst(FunctionType *Ty, Value *Func, ArrayRef<Value *> Args,
1927 ArrayRef<OperandBundleDef> Bundles,
const Twine &NameStr,
1928 Instruction *InsertBefore)
1929 : Instruction(Ty->getReturnType(), Instruction::Call,
1930 OperandTraits<CallInst>::op_end(this) -
1931 (Args.size() + CountBundleInputs(Bundles) + 1),
1932 unsigned(Args.size() + CountBundleInputs(Bundles) + 1),
1934 init(Ty, Func, Args, Bundles, NameStr);
1950 Instruction *InsertBefore)
1952 &Op<0>(), 3, InsertBefore) {
1960 &Op<0>(), 3, InsertAtEnd) {
1966 assert(!areInvalidOperands(C, S1, S2) &&
"Invalid operands for select");
1974 friend class Instruction;
1980 const Twine &NameStr =
"",
1981 Instruction *InsertBefore =
nullptr,
1982 Instruction *MDFrom =
nullptr) {
1990 const Twine &NameStr,
1992 return new(3)
SelectInst(C, S1, S2, NameStr, InsertAtEnd);
2008 static const char *areInvalidOperands(
Value *Cond,
Value *True,
Value *False);
2022 return isa<Instruction>(V) && classof(cast<Instruction>(V));
2049 : UnaryInstruction(Ty, VAArg, List, InsertBefore) {
2055 : UnaryInstruction(Ty, VAArg, List, InsertAtEnd) {
2068 return isa<Instruction>(V) && classof(cast<Instruction>(V));
2093 const Twine &NameStr =
"",
2099 const Twine &NameStr,
2122 return I->
getOpcode() == Instruction::ExtractElement;
2125 return isa<Instruction>(V) &&
classof(cast<Instruction>(V));
2145 const Twine &NameStr =
"",
2146 Instruction *InsertBefore =
nullptr);
2152 friend class Instruction;
2158 const Twine &NameStr =
"",
2159 Instruction *InsertBefore =
nullptr) {
2164 const Twine &NameStr,
2171 static bool isValidOperands(
const Value *Vec,
const Value *NewElt,
2185 return I->
getOpcode() == Instruction::InsertElement;
2188 return isa<Instruction>(V) && classof(cast<Instruction>(V));
2209 friend class Instruction;
2215 const Twine &NameStr =
"",
2216 Instruction *InsertBefor =
nullptr);
2221 void *
operator new(
size_t s) {
2222 return User::operator
new(s, 3);
2227 static bool isValidOperands(
const Value *V1,
const Value *
V2,
2240 return cast<Constant>(getOperand(2));
2250 return getMaskValue(getMask(), Elt);
2260 return getShuffleMask(getMask(), Result);
2265 getShuffleMask(Mask);
2272 unsigned InVecNumElts) {
2273 for (
int &Idx : Mask) {
2276 Idx = Idx < (int)InVecNumElts ? Idx + InVecNumElts : Idx - InVecNumElts;
2277 assert(Idx >= 0 && Idx < (
int)InVecNumElts * 2 &&
2278 "shufflevector mask index out of range");
2284 return I->
getOpcode() == Instruction::ShuffleVector;
2287 return isa<Instruction>(V) && classof(cast<Instruction>(V));
2316 const Twine &NameStr,
2333 const Twine &NameStr =
"",
2341 const Twine &NameStr,
2361 return getOperand(0);
2364 return getOperand(0);
2375 return (
unsigned)Indices.
size();
2384 return I->
getOpcode() == Instruction::ExtractValue;
2387 return isa<Instruction>(V) && classof(cast<Instruction>(V));
2391 ExtractValueInst::ExtractValueInst(Value *Agg,
2392 ArrayRef<unsigned> Idxs,
2393 const Twine &NameStr,
2394 Instruction *InsertBefore)
2396 ExtractValue, Agg, InsertBefore) {
2397 init(Idxs, NameStr);
2400 ExtractValueInst::ExtractValueInst(Value *Agg,
2401 ArrayRef<unsigned> Idxs,
2402 const Twine &NameStr,
2405 ExtractValue, Agg, InsertAtEnd) {
2406 init(Idxs, NameStr);
2427 const Twine &NameStr,
2436 const Twine &NameStr =
"",
2442 const Twine &NameStr);
2452 void *
operator new(
size_t s) {
2453 return User::operator
new(s, 2);
2458 const Twine &NameStr =
"",
2465 const Twine &NameStr,
2506 return (
unsigned)Indices.
size();
2515 return I->
getOpcode() == Instruction::InsertValue;
2518 return isa<Instruction>(V) &&
classof(cast<Instruction>(V));
2527 InsertValueInst::InsertValueInst(
Value *Agg,
2530 const Twine &NameStr,
2535 init(Agg, Val, Idxs, NameStr);
2538 InsertValueInst::InsertValueInst(Value *Agg,
2540 ArrayRef<unsigned> Idxs,
2541 const Twine &NameStr,
2543 : Instruction(Agg->
getType(), InsertValue,
2544 OperandTraits<InsertValueInst>::op_begin(this),
2546 init(Agg, Val, Idxs, NameStr);
2562 unsigned ReservedSpace;
2566 explicit PHINode(
Type *Ty,
unsigned NumReservedValues,
2567 const Twine &NameStr =
"",
2568 Instruction *InsertBefore =
nullptr)
2569 : Instruction(Ty, Instruction::PHI,
nullptr, 0, InsertBefore),
2570 ReservedSpace(NumReservedValues) {
2572 allocHungoffUses(ReservedSpace);
2577 : Instruction(Ty, Instruction::PHI,
nullptr, 0, InsertAtEnd),
2578 ReservedSpace(NumReservedValues) {
2580 allocHungoffUses(ReservedSpace);
2585 friend class Instruction;
2600 const Twine &NameStr =
"",
2601 Instruction *InsertBefore =
nullptr) {
2602 return new PHINode(Ty, NumReservedValues, NameStr, InsertBefore);
2607 return new PHINode(Ty, NumReservedValues, NameStr, InsertAtEnd);
2621 reinterpret_cast<Use::UserRef*
>(op_begin() + ReservedSpace);
2627 reinterpret_cast<const Use::UserRef*
>(op_begin() + ReservedSpace);
2632 return block_begin() + getNumOperands();
2636 return block_begin() + getNumOperands();
2640 return make_range(block_begin(), block_end());
2644 return make_range(block_begin(), block_end());
2658 return getOperand(i);
2661 assert(V &&
"PHI node got a null value!");
2663 "All operands to PHI node must be the same type as the PHI node!");
2678 return block_begin()[i];
2685 assert(
this == U.
getUser() &&
"Iterator doesn't point to PHI's Uses?");
2686 return getIncomingBlock(
unsigned(&U - op_begin()));
2693 return getIncomingBlock(I.getUse());
2697 assert(BB &&
"PHI node got a null basic block!");
2698 block_begin()[i] = BB;
2704 if (getNumOperands() == ReservedSpace)
2707 setNumHungOffUseOperands(getNumOperands() + 1);
2708 setIncomingValue(getNumOperands() - 1, V);
2709 setIncomingBlock(getNumOperands() - 1, BB);
2720 Value *removeIncomingValue(
unsigned Idx,
bool DeletePHIIfEmpty =
true);
2723 int Idx = getBasicBlockIndex(BB);
2724 assert(Idx >= 0 &&
"Invalid basic block argument to remove!");
2725 return removeIncomingValue(Idx, DeletePHIIfEmpty);
2732 for (
unsigned i = 0, e = getNumOperands(); i != e; ++i)
2733 if (block_begin()[i] == BB)
2739 int Idx = getBasicBlockIndex(BB);
2740 assert(Idx >= 0 &&
"Invalid basic block argument!");
2741 return getIncomingValue(Idx);
2746 Value *hasConstantValue()
const;
2751 bool hasConstantOrUndefValue()
const;
2755 return I->
getOpcode() == Instruction::PHI;
2758 return isa<Instruction>(V) && classof(cast<Instruction>(V));
2762 void growOperands();
2786 unsigned ReservedSpace;
2795 const Twine &NameStr, Instruction *InsertBefore);
2800 void *
operator new(
size_t s) {
2801 return User::operator
new(s);
2804 void growOperands(
unsigned Size);
2805 void init(
unsigned NumReservedValues,
const Twine &NameStr);
2809 friend class Instruction;
2817 const Twine &NameStr =
"",
2818 Instruction *InsertBefore =
nullptr);
2828 bool isCleanup()
const {
return getSubclassDataFromInstruction() & 1; }
2832 setInstructionSubclassData((getSubclassDataFromInstruction() & ~1) |
2837 void addClause(
Constant *ClauseVal);
2842 return cast<Constant>(getOperandList()[Idx]);
2847 return !isa<ArrayType>(getOperandList()[Idx]->getType());
2852 return isa<ArrayType>(getOperandList()[Idx]->getType());
2864 return I->
getOpcode() == Instruction::LandingPad;
2867 return isa<Instruction>(V) && classof(cast<Instruction>(V));
2914 return new(!!retVal)
ReturnInst(C, retVal, InsertBefore);
2919 return new(!!retVal)
ReturnInst(C, retVal, InsertAtEnd);
2931 return getNumOperands() != 0 ? getOperand(0) :
nullptr;
2941 return isa<Instruction>(V) && classof(cast<Instruction>(V));
2945 friend TerminatorInst;
2947 BasicBlock *getSuccessor(
unsigned idx)
const {
3000 return new(1)
BranchInst(IfTrue, InsertBefore);
3005 return new(3)
BranchInst(IfTrue, IfFalse, Cond, InsertBefore);
3009 return new(1)
BranchInst(IfTrue, InsertAtEnd);
3014 return new(3)
BranchInst(IfTrue, IfFalse, Cond, InsertAtEnd);
3024 assert(isConditional() &&
"Cannot get condition of an uncond branch!");
3029 assert(isConditional() &&
"Cannot set condition of unconditional branch!");
3036 assert(i < getNumSuccessors() &&
"Successor # out of range for Branch!");
3037 return cast_or_null<BasicBlock>((&
Op<-1>() - i)->get());
3041 assert(idx < getNumSuccessors() &&
"Successor # out of range for Branch!");
3042 *(&
Op<-1>() - idx) = NewSucc;
3050 void swapSuccessors();
3054 return (I->
getOpcode() == Instruction::Br);
3057 return isa<Instruction>(V) && classof(cast<Instruction>(V));
3075 unsigned ReservedSpace;
3098 void *
operator new(
size_t s) {
3099 return User::operator
new(s);
3102 void init(Value *Value,
BasicBlock *Default,
unsigned NumReserved);
3103 void growOperands();
3113 static const unsigned DefaultPseudoIndex =
static_cast<unsigned>(~0
L-1);
3122 template <
typename SwitchInstT,
typename ConstantIntT,
typename BasicBlockT>
3141 assert((
unsigned)Index < SI->getNumCases() &&
3142 "Index out the number of cases.");
3143 return reinterpret_cast<ConstantIntT *
>(SI->
getOperand(2 + Index * 2));
3148 assert(((
unsigned)Index < SI->getNumCases() ||
3149 (
unsigned)Index == DefaultPseudoIndex) &&
3150 "Index out the number of cases.");
3159 assert(((
unsigned)Index == DefaultPseudoIndex ||
3160 (
unsigned)Index < SI->getNumCases()) &&
3161 "Index out the number of cases.");
3162 return (
unsigned)Index != DefaultPseudoIndex ? Index + 1 : 0;
3166 assert(SI == RHS.
SI &&
"Incompatible operators.");
3167 return Index == RHS.
Index;
3171 using ConstCaseHandle =
3183 assert((
unsigned)Index < SI->getNumCases() &&
3184 "Index out the number of cases.");
3185 SI->
setOperand(2 + Index*2, reinterpret_cast<Value*>(V));
3194 template <
typename CaseHandleT>
3195 class CaseIteratorImpl
3197 std::random_access_iterator_tag,
3199 using SwitchInstT =
typename CaseHandleT::SwitchInstType;
3206 CaseIteratorImpl() =
default;
3215 unsigned SuccessorIndex) {
3216 assert(SuccessorIndex < SI->getNumSuccessors() &&
3217 "Successor index # out of range!");
3231 assert(Case.Index + N >= 0 &&
3232 (
unsigned)(Case.Index + N) <= Case.SI->getNumCases() &&
3233 "Case.Index out the number of cases.");
3240 assert(Case.Index - N >= 0 &&
3241 (
unsigned)(Case.Index - N) <= Case.SI->getNumCases() &&
3242 "Case.Index out the number of cases.");
3247 assert(Case.SI == RHS.Case.SI &&
"Incompatible operators.");
3248 return Case.Index - RHS.Case.Index;
3251 return Case == RHS.Case;
3254 assert(Case.SI == RHS.Case.SI &&
"Incompatible operators.");
3255 return Case.Index < RHS.Case.Index;
3267 return new SwitchInst(Value, Default, NumCases, InsertBefore);
3271 unsigned NumCases,
BasicBlock *InsertAtEnd) {
3272 return new SwitchInst(Value, Default, NumCases, InsertAtEnd);
3283 return cast<BasicBlock>(getOperand(1));
3287 setOperand(1, reinterpret_cast<Value*>(DefaultCase));
3293 return getNumOperands()/2 - 1;
3311 return CaseIt(
this, getNumCases());
3336 return CaseIt(
this, DefaultPseudoIndex);
3349 if (I != case_end())
3352 return case_default();
3358 if (I != case_end())
3361 return case_default();
3367 if (BB == getDefaultDest())
3371 for (
auto Case : cases()) {
3372 if (Case.getCaseSuccessor() != BB)
3378 CI = Case.getCaseValue();
3397 CaseIt removeCase(CaseIt
I);
3401 assert(idx < getNumSuccessors() &&
"Successor idx out of range for switch!");
3402 return cast<BasicBlock>(getOperand(idx*2+1));
3405 assert(idx < getNumSuccessors() &&
"Successor # out of range for switch!");
3406 setOperand(idx * 2 + 1, NewSucc);
3414 return isa<Instruction>(V) && classof(cast<Instruction>(V));
3432 unsigned ReservedSpace;
3451 void *
operator new(
size_t s) {
3452 return User::operator
new(s);
3455 void init(
Value *Address,
unsigned NumDests);
3456 void growOperands();
3497 void removeDestination(
unsigned i);
3501 return cast<BasicBlock>(getOperand(i+1));
3504 setOperand(i + 1, NewSucc);
3509 return I->
getOpcode() == Instruction::IndirectBr;
3512 return isa<Instruction>(V) && classof(cast<Instruction>(V));
3536 InvokeInst(const InvokeInst &BI);
3541 inline InvokeInst(Value *Func, BasicBlock *IfNormal, BasicBlock *IfException,
3542 ArrayRef<Value *> Args, ArrayRef<OperandBundleDef> Bundles,
3543 unsigned Values, const Twine &NameStr,
3544 Instruction *InsertBefore)
3545 : InvokeInst(cast<FunctionType>(
3546 cast<PointerType>(Func->getType())->getElementType()),
3547 Func, IfNormal, IfException, Args, Bundles, Values, NameStr,
3559 unsigned Values,
const Twine &NameStr,
3562 bool hasDescriptor()
const {
return HasDescriptor; }
3565 ArrayRef<Value *> Args, ArrayRef<OperandBundleDef> Bundles,
3566 const Twine &NameStr) {
3567 init(cast<FunctionType>(
3568 cast<PointerType>(Func->getType())->getElementType()),
3569 Func, IfNormal, IfException, Args, Bundles, NameStr);
3573 BasicBlock *IfException, ArrayRef<Value *> Args,
3574 ArrayRef<OperandBundleDef> Bundles,
const Twine &NameStr);
3580 InvokeInst *cloneImpl()
const;
3585 const Twine &NameStr,
3587 return Create(cast<FunctionType>(
3588 cast<PointerType>(Func->
getType())->getElementType()),
3589 Func, IfNormal, IfException, Args,
None, NameStr,
3596 const Twine &NameStr =
"",
3598 return Create(cast<FunctionType>(
3599 cast<PointerType>(Func->
getType())->getElementType()),
3600 Func, IfNormal, IfException, Args, Bundles, NameStr,
3606 const Twine &NameStr,
3609 return new (Values) InvokeInst(Ty, Func, IfNormal, IfException, Args,
None,
3610 Values, NameStr, InsertBefore);
3616 const Twine &NameStr =
"",
3618 unsigned Values =
unsigned(Args.
size()) + CountBundleInputs(Bundles) + 3;
3619 unsigned DescriptorBytes = Bundles.size() *
sizeof(BundleOpInfo);
3621 return new (Values, DescriptorBytes)
3622 InvokeInst(Ty, Func, IfNormal, IfException, Args, Bundles, Values,
3623 NameStr, InsertBefore);
3631 return new (Values) InvokeInst(Func, IfNormal, IfException, Args,
None,
3632 Values, NameStr, InsertAtEnd);
3639 unsigned Values =
unsigned(Args.
size()) + CountBundleInputs(Bundles) + 3;
3640 unsigned DescriptorBytes = Bundles.
size() *
sizeof(BundleOpInfo);
3642 return new (Values, DescriptorBytes)
3643 InvokeInst(Func, IfNormal, IfException, Args, Bundles, Values, NameStr,
3669 return getNumOperands() - getNumTotalBundleOperands() - 3;
3675 assert(i < getNumArgOperands() &&
"Out of bounds!");
3676 return getOperand(i);
3679 assert(i < getNumArgOperands() &&
"Out of bounds!");
3689 return op_end() - getNumTotalBundleOperands() - 3;
3703 return op_end() - getNumTotalBundleOperands() - 3;
3713 assert(i < getNumArgOperands() &&
"Out of bounds!");
3714 return getOperandUse(i);
3717 assert(i < getNumArgOperands() &&
"Out of bounds!");
3718 return getOperandUse(i);
3723 Value *getReturnedArgOperand()
const;
3728 return static_cast<CallingConv::ID>(getSubclassDataFromInstruction());
3731 auto ID =
static_cast<unsigned>(CC);
3733 setInstructionSubclassData(
ID);
3748 void addAttribute(
unsigned i,
Attribute Attr);
3757 void removeAttribute(
unsigned i,
StringRef Kind);
3763 void addDereferenceableAttr(
unsigned i, uint64_t Bytes);
3767 void addDereferenceableOrNullAttr(
unsigned i, uint64_t Bytes);
3771 assert(Kind != Attribute::NoBuiltin &&
3772 "Use CallInst::isNoBuiltin() to check for Attribute::NoBuiltin");
3773 return hasFnAttrImpl(Kind);
3778 return hasFnAttrImpl(Kind);
3818 return Attrs.getParamAlignment(ArgNo);
3824 return Attrs.getDereferenceableBytes(i);
3830 return Attrs.getDereferenceableOrNullBytes(i);
3843 return hasFnAttrImpl(Attribute::NoBuiltin) &&
3844 !hasFnAttrImpl(Attribute::Builtin);
3848 bool isNoInline()
const {
return hasFnAttr(Attribute::NoInline); }
3855 return hasFnAttr(Attribute::ReadNone);
3863 return doesNotAccessMemory() || hasFnAttr(Attribute::ReadOnly);
3871 return doesNotAccessMemory() || hasFnAttr(Attribute::WriteOnly);
3880 return hasFnAttr(Attribute::ArgMemOnly);
3916 if (getNumArgOperands() == 0)
3920 return paramHasAttr(0, Attribute::StructRet);
3925 return Attrs.hasAttrSomewhere(Attribute::ByVal);
3943 cast<FunctionType>(cast<PointerType>(Fn->
getType())->getElementType()),
3948 assert(FTy == cast<FunctionType>(
3949 cast<PointerType>(Fn->
getType())->getElementType()));
3955 return cast<BasicBlock>(
Op<-2>());
3958 return cast<BasicBlock>(
Op<-1>());
3961 Op<-2>() = reinterpret_cast<Value*>(B);
3964 Op<-1>() = reinterpret_cast<Value*>(B);
3972 assert(i < 2 &&
"Successor # out of range for invoke!");
3973 return i == 0 ? getNormalDest() : getUnwindDest();
3977 assert(idx < 2 &&
"Successor # out of range for invoke!");
3978 *(&
Op<-2>() + idx) =
reinterpret_cast<Value*
>(NewSucc);
3985 return (I->
getOpcode() == Instruction::Invoke);
3988 return isa<Instruction>(V) && classof(cast<Instruction>(V));
3992 template <
typename AttrKind>
bool hasFnAttrImpl(AttrKind Kind)
const {
3998 if (isFnAttrDisallowedByOpBundle(Kind))
4009 void setInstructionSubclassData(
unsigned short D) {
4022 : TerminatorInst(Ty->getReturnType(),
Instruction::Invoke,
4025 init(Ty, Func, IfNormal, IfException, Args, Bundles, NameStr);
4028 InvokeInst::InvokeInst(Value *Func,
BasicBlock *IfNormal,
4029 BasicBlock *IfException, ArrayRef<Value *> Args,
4030 ArrayRef<OperandBundleDef> Bundles,
unsigned Values,
4031 const Twine &NameStr,
BasicBlock *InsertAtEnd)
4034 ->getElementType())->getReturnType(),
4035 Instruction::Invoke, OperandTraits<InvokeInst>::op_end(this) - Values,
4036 Values, InsertAtEnd) {
4037 init(Func, IfNormal, IfException, Args, Bundles, NameStr);
4080 return I->
getOpcode() == Instruction::Resume;
4083 return isa<Instruction>(V) && classof(cast<Instruction>(V));
4087 friend TerminatorInst;
4089 BasicBlock *getSuccessor(
unsigned idx)
const {
4093 void setSuccessor(
unsigned idx,
BasicBlock *NewSucc) {
4111 unsigned ReservedSpace;
4123 unsigned NumHandlers,
const Twine &NameStr,
4131 unsigned NumHandlers,
const Twine &NameStr,
4135 void *
operator new(
size_t s) {
return User::operator
new(s); }
4138 void growOperands(
unsigned Size);
4148 unsigned NumHandlers,
4149 const Twine &NameStr =
"",
4151 return new CatchSwitchInst(ParentPad, UnwindDest, NumHandlers, NameStr,
4156 unsigned NumHandlers,
const Twine &NameStr,
4158 return new CatchSwitchInst(ParentPad, UnwindDest, NumHandlers, NameStr,
4173 if (hasUnwindDest())
4174 return cast<BasicBlock>(getOperand(1));
4180 setOperand(1, UnwindDest);
4186 if (hasUnwindDest())
4187 return getNumOperands() - 2;
4188 return getNumOperands() - 1;
4192 static BasicBlock *handler_helper(
Value *V) {
return cast<BasicBlock>(V); }
4193 static const BasicBlock *handler_helper(
const Value *V) {
4194 return cast<BasicBlock>(V);
4198 using DerefFnTy = std::pointer_to_unary_function<Value *, BasicBlock *>;
4202 std::pointer_to_unary_function<const Value *, const BasicBlock *>;
4209 op_iterator It = op_begin() + 1;
4210 if (hasUnwindDest())
4219 if (hasUnwindDest())
4238 return make_range(handler_begin(), handler_end());
4243 return make_range(handler_begin(), handler_end());
4252 void removeHandler(handler_iterator
HI);
4256 assert(Idx < getNumSuccessors() &&
4257 "Successor # out of range for catchswitch!");
4258 return cast<BasicBlock>(getOperand(Idx + 1));
4261 assert(Idx < getNumSuccessors() &&
4262 "Successor # out of range for catchswitch!");
4263 setOperand(Idx + 1, NewSucc);
4268 return I->
getOpcode() == Instruction::CatchSwitch;
4271 return isa<Instruction>(V) && classof(cast<Instruction>(V));
4286 unsigned Values,
const Twine &NameStr,
4288 : FuncletPadInst(Instruction::CleanupPad, ParentPad, Args, Values,
4289 NameStr, InsertBefore) {}
4291 unsigned Values,
const Twine &NameStr,
4293 : FuncletPadInst(Instruction::CleanupPad, ParentPad, Args, Values,
4294 NameStr, InsertAtEnd) {}
4298 const Twine &NameStr =
"",
4300 unsigned Values = 1 + Args.
size();
4307 unsigned Values = 1 + Args.
size();
4314 return I->
getOpcode() == Instruction::CleanupPad;
4317 return isa<Instruction>(V) && classof(cast<Instruction>(V));
4327 unsigned Values,
const Twine &NameStr,
4329 :
FuncletPadInst(Instruction::CatchPad, CatchSwitch, Args, Values,
4330 NameStr, InsertBefore) {}
4332 unsigned Values,
const Twine &NameStr,
4334 :
FuncletPadInst(Instruction::CatchPad, CatchSwitch, Args, Values,
4335 NameStr, InsertAtEnd) {}
4339 const Twine &NameStr =
"",
4341 unsigned Values = 1 + Args.
size();
4343 CatchPadInst(CatchSwitch, Args, Values, NameStr, InsertBefore);
4348 unsigned Values = 1 + Args.
size();
4350 CatchPadInst(CatchSwitch, Args, Values, NameStr, InsertAtEnd);
4355 return cast<CatchSwitchInst>(
Op<-1>());
4359 Op<-1>() = CatchSwitch;
4364 return I->
getOpcode() == Instruction::CatchPad;
4367 return isa<Instruction>(V) &&
classof(cast<Instruction>(V));
4428 return (I->
getOpcode() == Instruction::CatchRet);
4431 return isa<Instruction>(V) &&
classof(cast<Instruction>(V));
4435 friend TerminatorInst;
4479 unsigned Values = 1;
4489 unsigned Values = 1;
4504 return cast<CleanupPadInst>(Op<0>());
4508 Op<0>() = CleanupPad;
4514 return hasUnwindDest() ? cast<BasicBlock>(Op<1>()) :
nullptr;
4524 return (I->
getOpcode() == Instruction::CleanupRet);
4527 return isa<Instruction>(V) && classof(cast<Instruction>(V));
4531 friend TerminatorInst;
4533 BasicBlock *getSuccessor(
unsigned Idx)
const {
4535 return getUnwindDest();
4545 void setInstructionSubclassData(
unsigned short D) {
4577 void *
operator new(
size_t s) {
4578 return User::operator
new(s, 0);
4585 return I->
getOpcode() == Instruction::Unreachable;
4588 return isa<Instruction>(V) && classof(cast<Instruction>(V));
4592 friend TerminatorInst;
4594 BasicBlock *getSuccessor(
unsigned idx)
const {
4621 const Twine &NameStr =
"",
4629 const Twine &NameStr,
4638 return isa<Instruction>(V) &&
classof(cast<Instruction>(V));
4660 const Twine &NameStr =
"",
4668 const Twine &NameStr,
4677 return isa<Instruction>(V) &&
classof(cast<Instruction>(V));
4699 const Twine &NameStr =
"",
4707 const Twine &NameStr,
4716 return isa<Instruction>(V) &&
classof(cast<Instruction>(V));
4738 const Twine &NameStr =
"",
4746 const Twine &NameStr,
4755 return isa<Instruction>(V) &&
classof(cast<Instruction>(V));
4777 const Twine &NameStr =
"",
4785 const Twine &NameStr,
4794 return isa<Instruction>(V) &&
classof(cast<Instruction>(V));
4816 const Twine &NameStr =
"",
4824 const Twine &NameStr,
4833 return isa<Instruction>(V) &&
classof(cast<Instruction>(V));
4855 const Twine &NameStr =
"",
4863 const Twine &NameStr,
4872 return isa<Instruction>(V) &&
classof(cast<Instruction>(V));
4894 const Twine &NameStr =
"",
4902 const Twine &NameStr,
4911 return isa<Instruction>(V) &&
classof(cast<Instruction>(V));
4933 const Twine &NameStr =
"",
4941 const Twine &NameStr,
4950 return isa<Instruction>(V) &&
classof(cast<Instruction>(V));
4968 const Twine &NameStr =
"",
4976 const Twine &NameStr,
4993 return isa<Instruction>(V) &&
classof(cast<Instruction>(V));
5015 const Twine &NameStr =
"",
5023 const Twine &NameStr,
5044 return isa<Instruction>(V) &&
classof(cast<Instruction>(V));
5066 const Twine &NameStr =
"",
5074 const Twine &NameStr,
5083 return isa<Instruction>(V) &&
classof(cast<Instruction>(V));
5106 const Twine &NameStr =
"",
5114 const Twine &NameStr,
5123 return isa<Instruction>(V) &&
classof(cast<Instruction>(V));
5154 #endif // LLVM_IR_INSTRUCTIONS_H
static unsigned getInsertedValueOperandIndex()
const Value * getAddress() const
const Use & getOperandUse(unsigned i) const
bool hasFnAttr(Attribute::AttrKind Kind) const
Determine whether this call has the given attribute.
BasicBlock * getSuccessor(unsigned i) const
Return a value (possibly void), from a function.
Value * getValueOperand()
const Value * getCalledValue() const
Get a pointer to the function that is invoked by this instruction.
bool hasStructRetAttr() const
Determine if the call returns a structure through first pointer argument.
static bool isEquality(Predicate Pred)
A parsed version of the target data layout string in and methods for querying it. ...
AtomicOrdering getFailureOrdering() const
Returns the failure ordering constraint of this cmpxchg instruction.
Value * getPointerOperand()
unsigned getNumHandlers() const
return the number of 'handlers' in this catchswitch instruction, except the default handler ...
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.
static bool classof(const Instruction *I)
Methods for support type inquiry through isa, cast, and dyn_cast:
void getShuffleMask(SmallVectorImpl< int > &Result) const
Return the mask for this instruction as a vector of integers.
void setUnwindDest(BasicBlock *UnwindDest)
void addIncoming(Value *V, BasicBlock *BB)
Add an incoming value to the end of the PHI list.
CatchPadInst * getCatchPad() const
Convenience accessors.
Attribute getAttribute(unsigned i, Attribute::AttrKind Kind) const
Get the attribute of a given kind at a position.
*p = old <signed v ? old : v
iterator_range< CaseIt > cases()
Iteration adapter for range-for loops.
Value * getAggregateOperand()
static bool classof(const Instruction *I)
static bool classof(const Instruction *I)
static bool classof(const Instruction *I)
Atomic ordering constants.
static Type * makeCmpResultType(Type *opnd_type)
Create a result type for fcmp/icmp.
Type * getSourceElementType() const
static bool classof(const Value *V)
bool isVolatile() const
Return true if this is a store to a volatile memory location.
ArrayRef< unsigned > getIndices() const
void setCalledFunction(Value *Fn)
Set the function called.
void allocHungoffUses(unsigned N)
bool hasRetAttr(Attribute::AttrKind Kind) const
Determine whether the return value has the given attribute.
static PHINode * Create(Type *Ty, unsigned NumReservedValues, const Twine &NameStr, BasicBlock *InsertAtEnd)
const Use & getArgOperandUse(unsigned i) const
Wrappers for getting the Use of a invoke argument.
Constant * getClause(unsigned Idx) const
Get the value of the clause at index Idx.
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)
void setAlignment(unsigned Align)
int getMaskValue(unsigned Elt) const
Return the shuffle mask value of this instruction for the given element index.
AtomicOrdering getSuccessOrdering() const
Returns the success ordering constraint of this cmpxchg instruction.
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.
PtrToIntInst * cloneImpl() const
Clone an identical PtrToIntInst.
bool hasFnAttr(Attribute::AttrKind Kind) const
Determine whether this call has the given attribute.
BasicBlock *const * const_block_iterator
iterator_range< const_op_iterator > arg_operands() const
Iteration adapter for range-for loops.
Attribute getAttribute(unsigned Index, Attribute::AttrKind Kind) const
Return the attribute object that exists at the given index.
This class represents zero extension of integer types.
unsigned getNumOperands() const
SyncScope::ID getSyncScopeID() const
Returns the synchronization scope ID of this cmpxchg instruction.
unsigned getNumSuccessors() const
bool hasFnAttr(StringRef Kind) const
Determine whether this call has the given attribute.
unsigned getPointerAddressSpace() const
Returns the address space of the pointer operand.
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 * getValue() const
Convenience accessor.
void setDoesNotReadMemory()
static unsigned CountBundleInputs(ArrayRef< OperandBundleDef > Bundles)
Return the total number of values used in Bundles.
unsigned getPointerAddressSpace() const
Returns the address space of the pointer operand.
Value * getPointerOperand()
Gets the pointer operand.
unsigned getParamAlignment(unsigned ArgNo) const
Extract the alignment for a call or parameter (0=unknown).
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)
void setOrdering(AtomicOrdering Ordering)
Sets the ordering constraint of this load instruction.
unsigned getCaseIndex() const
Returns number of current case.
static unsigned getPointerOperandIndex()
Gets the operand index of the pointer operand.
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...
Function * getCalledFunction() const
Return the function called, or null if this is an indirect function invocation.
static CallInst * Create(FunctionType *Ty, Value *Func, ArrayRef< Value * > Args, ArrayRef< OperandBundleDef > Bundles=None, const Twine &NameStr="", Instruction *InsertBefore=nullptr)
CaseIt case_begin()
Returns a read/write iterator that points to the first case in the SwitchInst.
*p = old <unsigned v ? old : v
void setAllocatedType(Type *Ty)
for use only in special circumstances that need to generically transform a whole instruction (eg: IR ...
const_handler_range handlers() const
iteration adapter for range-for loops.
void setVolatile(bool V)
Specify whether this is a volatile cmpxchg.
std::pointer_to_unary_function< const Value *, const BasicBlock * > ConstDerefFnTy
*p = old >unsigned v ? old : v
Attribute getAttribute(unsigned i, StringRef Kind) const
Get the attribute of a given kind at a position.
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)
static CleanupPadInst * Create(Value *ParentPad, ArrayRef< Value * > Args=None, const Twine &NameStr="", Instruction *InsertBefore=nullptr)
static CallInst * Create(Value *Func, ArrayRef< Value * > Args, ArrayRef< OperandBundleDef > Bundles, const Twine &NameStr, BasicBlock *InsertAtEnd)
iterator_range< op_iterator > arg_operands()
Iteration adapter for range-for loops.
1 1 1 0 True if unordered or not equal
Type * getScalarType() const
If this is a vector type, return the element type, otherwise return 'this'.
bool doesNotThrow() const
Determine if the call cannot unwind.
static bool classof(const Instruction *I)
static bool isEquality(Predicate P)
Return true if this predicate is either EQ or NE.
unsigned getNumIndices() const
void setSuccessor(unsigned i, BasicBlock *NewSucc)
void setSuccessor(BasicBlock *NewSucc)
Value * getNewValOperand()
The two locations do not alias at all.
This class represents a sign extension of integer types.
An instruction for reading from memory.
static bool classof(const Value *V)
static bool classof(const Value *V)
CleanupPadInst * getCleanupPad() const
Convenience accessor.
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)
static InvokeInst * Create(Value *Func, BasicBlock *IfNormal, BasicBlock *IfException, ArrayRef< Value * > Args, ArrayRef< OperandBundleDef > Bundles, const Twine &NameStr, BasicBlock *InsertAtEnd)
static CleanupReturnInst * Create(Value *CleanupPad, BasicBlock *UnwindBB, BasicBlock *InsertAtEnd)
LoadInst(Value *Ptr, const char *NameStr=nullptr, bool isVolatile=false, Instruction *InsertBefore=nullptr)
static Instruction * CreateFree(Value *Source, Instruction *InsertBefore)
Generate the IR for a call to the builtin free function.
static bool classof(const Value *V)
This defines the Use class.
const Use & getArgOperandUse(unsigned i) const
Wrappers for getting the Use of a call argument.
handler_iterator handler_begin()
Returns an iterator that points to the first handler in CatchSwitchInst.
static bool classof(const Instruction *I)
bool isNoBuiltin() const
Return true if the call should not be treated as a call to a builtin.
void setAtomic(AtomicOrdering Ordering, SyncScope::ID SSID=SyncScope::System)
Sets the ordering constraint and the synchronization scope ID of this store instruction.
SExtInst * cloneImpl() const
Clone an identical SExtInst.
static bool classof(const Instruction *I)
const Value * getPointerOperand() const
void setSyncScopeID(SyncScope::ID SSID)
Sets the synchronization scope ID of this rmw instruction.
*p = old >signed v ? old : v
unsigned getSrcAddressSpace() const
Returns the address space of the pointer operand.
bool doesNotReturn() const
Determine if the call cannot return.
unsigned getNumIndices() const
static bool classof(const Instruction *I)
Value * removeIncomingValue(const BasicBlock *BB, bool DeletePHIIfEmpty=true)
ConstantInt * findCaseDest(BasicBlock *BB)
Finds the unique case value for a given successor.
static SwitchInst * Create(Value *Value, BasicBlock *Default, unsigned NumCases, BasicBlock *InsertAtEnd)
Constant * getMask() const
CaseIteratorImpl(SwitchInstT *SI, unsigned CaseNum)
Initializes case iterator for given SwitchInst and for given case number.
FPExtInst * cloneImpl() const
Clone an identical FPExtInst.
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()
static bool classof(const Instruction *I)
void setCallingConv(CallingConv::ID CC)
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)
bool isArrayAllocation() const
Return true if there is an allocation size parameter to the allocation instruction that is not 1...
bool isFnAttrDisallowedByOpBundle(StringRef S) const
Is the function attribute S disallowed by some operand bundle on this operand bundle user...
static bool classof(const Instruction *I)
1 0 0 1 True if unordered or equal
void setAtomic(AtomicOrdering Ordering, SyncScope::ID SSID=SyncScope::System)
Sets the ordering constraint and the synchronization scope ID of this load instruction.
bool onlyReadsMemory() const
Determine if the call does not access or only reads memory.
static unsigned getOperandNumForIncomingValue(unsigned i)
static GetElementPtrInst * Create(Type *PointeeType, Value *Ptr, ArrayRef< Value * > IdxList, const Twine &NameStr, BasicBlock *InsertAtEnd)
static bool isRelational(Predicate P)
Return true if the predicate is relational (not EQ or NE).
static InsertElementInst * Create(Value *Vec, Value *NewElt, Value *Idx, const Twine &NameStr="", Instruction *InsertBefore=nullptr)
1 0 0 0 True if unordered: isnan(X) | isnan(Y)
bool isUnconditional() const
This class represents a conversion between pointers from one address space to another.
static Value * getPointerOperand(Instruction &Inst)
unsigned getSubclassDataFromInstruction() const
This class represents the LLVM 'select' instruction.
IntToPtrInst(Value *S, Type *Ty, const Twine &NameStr="", Instruction *InsertBefore=nullptr)
Constructor with insert-before-instruction semantics.
static bool classof(const Value *V)
Value * getReturnValue() const
Convenience accessor. Returns null if there is no return value.
Twine - A lightweight data structure for efficiently representing the concatenation of temporary valu...
SyncScope::ID getSyncScopeID() const
Returns the synchronization scope ID of this store instruction.
void setCleanupPad(CleanupPadInst *CleanupPad)
This is the base class for all instructions that perform data casts.
bool onlyReadsMemory() const
Determine if the call does not access or only reads memory.
static InvokeInst * Create(FunctionType *Ty, Value *Func, BasicBlock *IfNormal, BasicBlock *IfException, ArrayRef< Value * > Args, ArrayRef< OperandBundleDef > Bundles=None, const Twine &NameStr="", Instruction *InsertBefore=nullptr)
CallInst * cloneImpl() const
static bool classof(const Instruction *I)
bool doesNotReturn() const
Determine if the call cannot return.
static bool classof(const Value *V)
A Use represents the edge between a Value definition and its users.
static bool classof(const Value *V)
void setOrdering(AtomicOrdering Ordering)
Sets the ordering constraint of this fence instruction.
bool onlyAccessesArgMemory() const
Determine if the call access memmory only using it's pointer arguments.
Type * getPointerOperandType() const
void setIsInBounds(bool b=true)
Set or clear the inbounds flag on this GEP instruction.
PtrToIntInst(Value *S, Type *Ty, const Twine &NameStr="", Instruction *InsertBefore=nullptr)
Constructor with insert-before-instruction semantics.
unsigned getNumArgOperands() const
Return the number of call arguments.
Attribute getParamAttr(unsigned ArgNo, StringRef Kind) const
Get the attribute of a given kind from a given arg.
DECLARE_TRANSPARENT_OPERAND_ACCESSORS(Value)
Transparently provide more efficient getOperand methods.
const Value * getCalledValue() const
Get a pointer to the function that is invoked by this instruction.
UIToFPInst(Value *S, Type *Ty, const Twine &NameStr="", Instruction *InsertBefore=nullptr)
Constructor with insert-before-instruction semantics.
This file contains the simple types necessary to represent the attributes associated with functions a...
unsigned getNumTotalBundleOperands() const
Return the total number operands (not operand bundles) used by every operand bundle in this OperandBu...
FCmpInst * cloneImpl() const
Clone an identical FCmpInst.
bool isCommutative() const
bool isMustTailCall() const
static bool classof(const Value *V)
static bool classof(const Instruction *I)
Methods for support type inquiry through isa, cast, and dyn_cast:
void setCalledFunction(FunctionType *FTy, Value *Fn)
FPToUIInst * cloneImpl() const
Clone an identical FPToUIInst.
Value * getPointerOperand()
Type * getPointerOperandType() const
Method to return the pointer operand as a PointerType.
block_iterator block_begin()
unsigned getNumSuccessors() const
BasicBlock * getDestination(unsigned i)
Return the specified destination.
iterator_range< ConstCaseIt > cases() const
Constant iteration adapter for range-for loops.
static bool classof(const Instruction *I)
This class represents a cast from a pointer to an integer.
AtomicOrdering
Atomic ordering for LLVM's memory model.
bool doesNotThrow() const
Determine if the call cannot unwind.
static CaseIteratorImpl fromSuccessorIndex(SwitchInstT *SI, unsigned SuccessorIndex)
Initializes case iterator for given SwitchInst and for given TerminatorInst's successor index...
unsigned getPointerAddressSpace() const
Returns the address space of the pointer operand.
AttributeList getAttributes(LLVMContext &C, ID id)
Return the attributes for an intrinsic.
void setUnwindDest(BasicBlock *B)
Value * getPointerOperand()
UIToFPInst * cloneImpl() const
Clone an identical UIToFPInst.
const_op_iterator idx_end() const
#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.
const CaseHandleT & operator*() const
Class to represent function types.
bool isVolatile() const
Return true if this is a cmpxchg from a volatile memory location.
AtomicOrdering getOrdering() const
Returns the ordering constraint of this rmw instruction.
static GetElementPtrInst * CreateInBounds(Value *Ptr, ArrayRef< Value * > IdxList, const Twine &NameStr="", Instruction *InsertBefore=nullptr)
Create an "inbounds" getelementptr.
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.
static bool classof(const Instruction *I)
BitCastInst * cloneImpl() const
Clone an identical BitCastInst.
static bool classof(const Value *V)
static bool classof(const Instruction *I)
VectorType * getType() const
Overload to return most specific vector type.
bool isNoInline() const
Return true if the call should not be inlined.
op_iterator arg_begin()
Return the iterator pointing to the beginning of the argument list.
BinOp
This enumeration lists the possible modifications atomicrmw can make.
void setNormalDest(BasicBlock *B)
bool doesNotAccessMemory() const
Determine if the call does not access memory.
void mutateFunctionType(FunctionType *FTy)
static BranchInst * Create(BasicBlock *IfTrue, BasicBlock *IfFalse, Value *Cond, Instruction *InsertBefore=nullptr)
DECLARE_TRANSPARENT_OPERAND_ACCESSORS(Value)
Provide fast operand accessors.
This instruction compares its operands according to the predicate given to the constructor.
idx_iterator idx_end() const
BasicBlock * getSuccessor(unsigned i) 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.
BasicBlock * getIncomingBlock(const Use &U) const
Return incoming basic block corresponding to an operand of the PHI.
StoreInst * cloneImpl() const
bool hasFnAttr(StringRef Kind) const
Determine whether this call has the given attribute.
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory)...
Value * getInsertedValueOperand()
Used to keep track of an operand bundle.
unsigned getNumSuccessors() const
const Value * getInsertedValueOperand() const
void addDereferenceableOrNullAttr(unsigned i, uint64_t Bytes)
adds the dereferenceable_or_null attribute to the list of attributes.
SIToFPInst(Value *S, Type *Ty, const Twine &NameStr="", Instruction *InsertBefore=nullptr)
Constructor with insert-before-instruction semantics.
DECLARE_TRANSPARENT_OPERAND_ACCESSORS(Value)
Transparently provide more efficient getOperand methods.
Predicate getUnsignedPredicate() const
For example, EQ->EQ, SLE->ULE, UGT->UGT, etc.
static bool classof(const Value *V)
unsigned getNumClauses() const
Get the number of clauses for this landing pad.
FPToSIInst(Value *S, Type *Ty, const Twine &NameStr="", Instruction *InsertBefore=nullptr)
Constructor with insert-before-instruction semantics.
ConstantIntT * getCaseValue() const
Resolves case value for current case.
void setInstructionSubclassData(unsigned short D)
An instruction for storing to memory.
This class represents a cast from floating point to signed integer.
const_handler_iterator handler_begin() const
Returns an iterator that points to the first handler in the CatchSwitchInst.
bool operator<(const CaseIteratorImpl &RHS) const
BasicBlock * getIncomingBlock(Value::const_user_iterator I) const
Return incoming basic block corresponding to value use iterator.
bool isNoTailCall() const
const Value * getPointerOperand() const
Gets the pointer operand.
static bool classof(const Value *V)
BasicBlock * getSuccessor() 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.
DECLARE_TRANSPARENT_OPERAND_ACCESSORS(Value)
Transparently provide more efficient getOperand methods.
static bool classof(const Value *V)
uint64_t getDereferenceableOrNullBytes(unsigned i) const
Extract the number of dereferenceable_or_null bytes for a call or parameter (0=unknown).
bool cannotDuplicate() const
Determine if the invoke cannot be duplicated.
This class represents a truncation of integer types.
size_t size() const
size - Get the array size.
static unsigned getPointerOperandIndex()
Gets the operand index of the pointer operand.
bool isAtomic() const
Return true if this instruction has an AtomicOrdering of unordered or higher.
bool hasByValArgument() const
Determine if any call argument is an aggregate passed by value.
BasicBlock * getNormalDest() const
unsigned getNumSuccessors() const
std::enable_if<!is_simple_type< Y >::value, typename cast_retty< X, const Y >::ret_type >::type cast(const Y &Val)
bool isInBounds() const
Determine whether the GEP has the inbounds flag.
Class to represent pointers.
OtherOps getOpcode() const
unsigned getNumIncomingValues() const
Return the number of incoming edges.
FPTruncInst(Value *S, Type *Ty, const Twine &NameStr="", Instruction *InsertBefore=nullptr)
Constructor with insert-before-instruction semantics.
void setUnwindDest(BasicBlock *NewDest)
CaseHandle(SwitchInst *SI, ptrdiff_t Index)
SIToFPInst * cloneImpl() const
Clone an identical SIToFPInst.
an instruction for type-safe pointer arithmetic to access elements of arrays and structs ...
constexpr char Attrs[]
Key for Kernel::Metadata::mAttrs.
LoadInst * cloneImpl() const
static bool classof(const Instruction *I)
bool isFilter(unsigned Idx) const
Return 'true' if the clause and index Idx is a filter clause.
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)
Type * getPointerOperandType() const
The landingpad instruction holds all of the information necessary to generate correct exception handl...
void setDoesNotAccessMemory()
VAArgInst(Value *List, Type *Ty, const Twine &NameStr, BasicBlock *InsertAtEnd)
unsigned getAlignment() const
Return the alignment of the access that is being performed.
Subclasses of this class are all able to terminate a basic block.
MutableArrayRef - Represent a mutable reference to an array (0 or more elements consecutively in memo...
static unsigned getAggregateOperandIndex()
LLVM Basic Block Representation.
iterator_range< idx_iterator > indices() const
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...
iterator_range< const_op_iterator > indices() const
static unsigned getPointerOperandIndex()
This is an important class for using LLVM in a threaded context.
std::pointer_to_unary_function< Value *, BasicBlock * > DerefFnTy
const_handler_iterator handler_end() const
Returns an iterator that points one past the last handler in the CatchSwitchInst. ...
Conditional or Unconditional Branch instruction.
bool isVectorTy() const
True if this is an instance of VectorType.
void setSyncScopeID(SyncScope::ID SSID)
Sets the synchronization scope ID of this store instruction.
bool isEquality() const
Return true if this predicate is either EQ or NE.
uint64_t getDereferenceableBytes(unsigned i) const
Extract the number of dereferenceable bytes for a call or parameter (0=unknown).
This function has undefined behavior.
This is an important base class in LLVM.
PointerType * getType() const
Overload to return most specific pointer type.
const Value * getCondition() const
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.
void setDoesNotReadMemory()
constexpr char Args[]
Key for Kernel::Metadata::mArgs.
void setUsedWithInAlloca(bool V)
Specify whether this alloca is used to represent the arguments to a call.
static BranchInst * Create(BasicBlock *IfTrue, BasicBlock *InsertAtEnd)
DECLARE_TRANSPARENT_OPERAND_ACCESSORS(Value)
Provide fast operand accessors.
void setCalledFunction(FunctionType *FTy, Value *Fn)
Indirect Branch Instruction.
unsigned getAlignment() const
Return the alignment of the memory that is being allocated by the instruction.
static CallInst * Create(Value *Func, ArrayRef< Value * > Args, const Twine &NameStr, BasicBlock *InsertAtEnd)
static bool classof(const Value *V)
unsigned getPointerAddressSpace() const
Returns the address space of the pointer operand.
static SelectInst * Create(Value *C, Value *S1, Value *S2, const Twine &NameStr, BasicBlock *InsertAtEnd)
bool hasAllZeroIndices() const
Return true if all of the indices of this GEP are zeros.
BasicBlock * getIncomingBlock(unsigned i) const
Return incoming basic block number i.
static GetElementPtrInst * CreateInBounds(Type *PointeeType, Value *Ptr, ArrayRef< Value * > IdxList, const Twine &NameStr, BasicBlock *InsertAtEnd)
static unsigned getPointerOperandIndex()
bool doesNotReadMemory() const
Determine if the call does not access or only writes memory.
static bool classof(const Value *V)
bool isUsedWithInAlloca() const
Return true if this alloca is used as an inalloca argument to a call.
static GetElementPtrInst * CreateInBounds(Type *PointeeType, Value *Ptr, ArrayRef< Value * > IdxList, const Twine &NameStr="", Instruction *InsertBefore=nullptr)
This instruction compares its operands according to the predicate given to the constructor.
Predicate
This enumeration lists the possible predicates for CmpInst subclasses.
const Value * getValueOperand() const
bool unwindsToCaller() const
bool doesNotAccessMemory() const
Determine if the call does not access memory.
Value * getOperand(unsigned i) const
0 1 1 1 True if ordered (no nans)
Value * getPointerOperand()
static InvokeInst * Create(Value *Func, BasicBlock *IfNormal, BasicBlock *IfException, ArrayRef< Value * > Args, const Twine &NameStr, BasicBlock *InsertAtEnd)
static bool classof(const Value *V)
CatchSwitchInst * getCatchSwitch() const
Convenience accessors.
CaseIteratorImpl & operator+=(ptrdiff_t N)
op_iterator arg_end()
Return the iterator pointing to the end of the argument list.
iterator_range< block_iterator > blocks()
iterator_range< const_op_iterator > arg_operands() const
Iteration adapter for range-for loops.
Predicate getPredicate() const
Return the predicate for this instruction.
static bool classof(const Value *V)
static Type * getGEPReturnType(Type *ElTy, Value *Ptr, ArrayRef< Value * > IdxList)
bool dataOperandHasImpliedAttr(unsigned i, Attribute::AttrKind Kind) const
Return true if the data operand at index i has the attribute A.
void setTailCallKind(TailCallKind TCK)
void setSourceElementType(Type *Ty)
void setAlignment(unsigned Align)
This class represents a cast from an integer to a pointer.
1 1 1 1 Always true (always folded)
static CallInst * Create(FunctionType *Ty, Value *Func, ArrayRef< Value * > Args, const Twine &NameStr, Instruction *InsertBefore=nullptr)
op_iterator arg_begin()
Return the iterator pointing to the beginning of the argument list.
static bool classof(const Value *V)
#define DECLARE_TRANSPARENT_OPERAND_ACCESSORS(VALUECLASS)
Macro for generating in-class operand accessor declarations.
void setTailCall(bool isTC=true)
FunctionType * getFunctionType() const
This class represents the va_arg llvm instruction, which returns an argument of the specified type gi...
FPToUIInst(Value *S, Type *Ty, const Twine &NameStr="", Instruction *InsertBefore=nullptr)
Constructor with insert-before-instruction semantics.
static InvokeInst * Create(FunctionType *Ty, Value *Func, BasicBlock *IfNormal, BasicBlock *IfException, ArrayRef< Value * > Args, const Twine &NameStr, Instruction *InsertBefore=nullptr)
Value(Type *Ty, unsigned scid)
bool unwindsToCaller() const
void swapOperands()
Exchange the two operands to this instruction in such a way that it does not modify the semantics of ...
static CatchReturnInst * Create(Value *CatchPad, BasicBlock *BB, BasicBlock *InsertAtEnd)
bool hasAllConstantIndices() const
Return true if all of the indices of this GEP are constant integers.
static unsigned getIncomingValueNumForOperand(unsigned i)
static wasm::ValType getType(const TargetRegisterClass *RC)
void setSuccessor(unsigned Idx, BasicBlock *NewSucc)
bool isNoInline() const
Return true if the call should not be inlined.
const Value * getTrueValue() const
static CatchPadInst * Create(Value *CatchSwitch, ArrayRef< Value * > Args, const Twine &NameStr, BasicBlock *InsertAtEnd)
ConstCaseIt case_end() const
Returns a read-only iterator that points one past the last in the SwitchInst.
static GetElementPtrInst * Create(Type *PointeeType, Value *Ptr, ArrayRef< Value * > IdxList, const Twine &NameStr="", Instruction *InsertBefore=nullptr)
static IndirectBrInst * Create(Value *Address, unsigned NumDests, Instruction *InsertBefore=nullptr)
BasicBlock * getSuccessor(unsigned Idx) const
CaseIteratorImpl & operator-=(ptrdiff_t N)
static CatchPadInst * Create(Value *CatchSwitch, ArrayRef< Value * > Args, const Twine &NameStr="", Instruction *InsertBefore=nullptr)
unsigned getNumSuccessors() const
static InvokeInst * Create(Value *Func, BasicBlock *IfNormal, BasicBlock *IfException, ArrayRef< Value * > Args, ArrayRef< OperandBundleDef > Bundles=None, const Twine &NameStr="", Instruction *InsertBefore=nullptr)
FunctionType * getFunctionType() const
bool isRelational() const
Return true if the predicate is relational (not EQ or NE).
void setSyncScopeID(SyncScope::ID SSID)
Sets the synchronization scope ID of this load instruction.
static bool classof(const Instruction *I)
CallingConv::ID getCallingConv() const
getCallingConv/setCallingConv - Get or set the calling convention of this function call...
void setSuccessor(unsigned idx, BasicBlock *NewSucc)
BasicBlock * getSuccessor(unsigned i) const
Attribute getAttribute(unsigned i, StringRef Kind) const
Get the attribute of a given kind at a position.
static bool classof(const Value *V)
FCmpInst(Predicate pred, Value *LHS, Value *RHS, const Twine &NameStr="")
Constructor with no-insertion semantics.
unsigned getAddressSpace() const
Returns the address space of this instruction's pointer type.
void setOnlyAccessesArgMemory()
static AtomicOrdering getStrongestFailureOrdering(AtomicOrdering SuccessOrdering)
Returns the strongest permitted ordering on failure, given the desired ordering on success...
bool hasByValArgument() const
Determine if any call argument is an aggregate passed by value.
TruncInst(Value *S, Type *Ty, const Twine &NameStr="", Instruction *InsertBefore=nullptr)
Constructor with insert-before-instruction semantics.
BasicBlock * getUnwindDest() const
static InsertElementInst * Create(Value *Vec, Value *NewElt, Value *Idx, const Twine &NameStr, BasicBlock *InsertAtEnd)
bool isConditional() const
static InvokeInst * Create(Value *Func, BasicBlock *IfNormal, BasicBlock *IfException, ArrayRef< Value * > Args, const Twine &NameStr, Instruction *InsertBefore=nullptr)
BasicBlock * getUnwindDest() const
iterator_range< T > make_range(T x, T y)
Convenience function for iterating over sub-ranges.
idx_iterator idx_begin() const
LoadInst(Value *Ptr, const Twine &NameStr, bool isVolatile=false, Instruction *InsertBefore=nullptr)
static bool classof(const Instruction *I)
Methods for support type inquiry through isa, cast, and dyn_cast:
static bool classof(const Value *V)
static bool classof(const Instruction *I)
unsigned getSuccessorIndex() const
Returns TerminatorInst's successor index for current case successor.
Synchronized with respect to all concurrently executing threads.
static bool classof(const Value *V)
BasicBlock * getUnwindDest() const
AtomicOrdering getOrdering() const
Returns the ordering constraint of this store instruction.
bool returnDoesNotAlias() const
Determine if the return value is marked with NoAlias attribute.
bool isSwiftError() const
Return true if this alloca is used as a swifterror argument to a call.
This is the shared class of boolean and integer constants.
static bool classof(const Instruction *I)
void setIncomingBlock(unsigned i, BasicBlock *BB)
static CatchSwitchInst * Create(Value *ParentPad, BasicBlock *UnwindDest, unsigned NumHandlers, const Twine &NameStr="", Instruction *InsertBefore=nullptr)
static bool classof(const Instruction *I)
Value * getIncomingValue(unsigned i) const
Return incoming value number x.
AtomicCmpXchgInst * cloneImpl() const
bool cannotDuplicate() const
Determine if the call cannot be duplicated.
static Type * getGEPReturnType(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 Instruction *I)
SyncScope::ID getSyncScopeID() const
Returns the synchronization scope ID of this rmw instruction.
static SwitchInst * Create(Value *Value, BasicBlock *Default, unsigned NumCases, Instruction *InsertBefore=nullptr)
AddrSpaceCastInst(Value *S, Type *Ty, const Twine &NameStr="", Instruction *InsertBefore=nullptr)
Constructor with insert-before-instruction semantics.
Type * checkGEPType(Type *Ty)
unsigned getDestAddressSpace() const
Returns the address space of the result.
unsigned getNumSuccessors() const
const BasicBlock * getDestination(unsigned i) const
static CallInst * Create(Value *Func, ArrayRef< Value * > Args, const Twine &NameStr, Instruction *InsertBefore=nullptr)
static bool classof(const Instruction *I)
static CallInst * Create(Value *Func, ArrayRef< Value * > Args, ArrayRef< OperandBundleDef > Bundles=None, const Twine &NameStr="", Instruction *InsertBefore=nullptr)
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small...
Use & getArgOperandUse(unsigned i)
ConstCaseIt case_begin() const
Returns a read-only iterator that points to the first case in the SwitchInst.
bool isStaticAlloca() const
Return true if this alloca is in the entry block of the function and is a constant size...
Type * getType() const
All values are typed, get the type of this value.
const Value * getCompareOperand() const
static bool classof(const Instruction *I)
Methods for support type inquiry through isa, cast, and dyn_cast:
void mutateFunctionType(FunctionType *FTy)
SyncScope::ID getSyncScopeID() const
Returns the synchronization scope ID of this load instruction.
const Value * getValOperand() const
Predicate getSwappedPredicate(Predicate Opcode)
Assume the condition register is set by MI(a,b), return the predicate if we modify the instructions s...
LoadInst(Value *Ptr, const Twine &NameStr, Instruction *InsertBefore)
Predicate
Predicate - These are "(BI << 5) | BO" for various predicates.
TailCallKind getTailCallKind() const
op_iterator arg_end()
Return the iterator pointing to the end of the argument list.
bool isVolatile() const
Return true if this is a load from a volatile memory location.
AtomicCmpXchgInst(Value *Ptr, Value *Cmp, Value *NewVal, AtomicOrdering SuccessOrdering, AtomicOrdering FailureOrdering, SyncScope::ID SSID, Instruction *InsertBefore=nullptr)
This class represents a cast from floating point to unsigned integer.
Value * getCatchSwitchParentPad() const
Get the parentPad of this catchret's catchpad's catchswitch.
static bool classof(const Instruction *I)
Methods for support type inquiry through isa, cast, and dyn_cast:
void setCannotDuplicate()
bool operator==(const CaseHandleImpl &RHS) const
Predicate getSwappedPredicate() const
For example, EQ->EQ, SLE->SGE, ULT->UGT, OEQ->OEQ, ULE->UGE, OLT->OGT, etc.
bool operator==(const CaseIteratorImpl &RHS) const
Function * getCalledFunction() const
Return the function called, or null if this is an indirect function invocation.
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:
AtomicOrdering getOrdering() const
Returns the ordering constraint of this load instruction.
const Value * getAggregateOperand() const
static bool classof(const Instruction *I)
bool paramHasAttr(unsigned ArgNo, Attribute::AttrKind Kind) const
Determine whether the argument or parameter has the given attribute.
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...
SExtInst(Value *S, Type *Ty, const Twine &NameStr="", Instruction *InsertBefore=nullptr)
Constructor with insert-before-instruction semantics.
bool isConvergent() const
Determine if the call is convergent.
ZExtInst * cloneImpl() const
Clone an identical ZExtInst.
unsigned getPointerAddressSpace() const
Returns the address space of the pointer operand.
static const Function * getCalledFunction(const Value *V, bool LookThroughBitCast, bool &IsNoBuiltin)
CaseIt findCaseValue(const ConstantInt *C)
Search all of the case values for the specified constant.
void setSuccessor(unsigned idx, BasicBlock *NewSucc)
BinOp getOperation() const
static bool classof(const Instruction *I)
void setPredicate(Predicate P)
Set the predicate for this instruction to the specified value.
unsigned getAddressSpace() const
Returns the address space of this instruction's pointer type.
FCmpInst(BasicBlock &InsertAtEnd, Predicate pred, Value *LHS, Value *RHS, const Twine &NameStr="")
Constructor with insert-at-end semantics.
void setOperand(unsigned i, Value *Val)
bool doesNotReadMemory() const
Determine if the call does not access or only writes memory.
void swap(llvm::BitVector &LHS, llvm::BitVector &RHS)
Implement std::swap in terms of BitVector swap.
bool accumulateConstantOffset(const DataLayout &DL, APInt &Offset) const
Accumulate the constant address offset of this GEP if possible.
Value * getArgOperand(unsigned i) const
getArgOperand/setArgOperand - Return/set the i-th call argument.
A range adaptor for a pair of iterators.
Class to represent vector types.
void setVolatile(bool V)
Specify whether this is a volatile store or not.
void setAttributes(AttributeList A)
Set the parameter attributes for this call.
Class for arbitrary precision integers.
static bool classof(const Instruction *I)
static bool classof(const Value *V)
static bool classof(const Value *V)
ConstCaseIt findCaseValue(const ConstantInt *C) const
const Value * getPointerOperand() const
Value * getReturnedArgOperand() const
If one of the arguments has the 'returned' attribute, return its operand value.
VAArgInst(Value *List, Type *Ty, const Twine &NameStr="", Instruction *InsertBefore=nullptr)
Value * getIncomingValueForBlock(const BasicBlock *BB) const
void setWeak(bool IsWeak)
void setResultElementType(Type *Ty)
Attribute getParamAttr(unsigned ArgNo, Attribute::AttrKind Kind) const
Get the attribute of a given kind from a given arg.
bool isCommutative() const
unsigned getVectorNumElements() const
static bool classof(const Value *V)
ZExtInst(Value *S, Type *Ty, const Twine &NameStr="", Instruction *InsertBefore=nullptr)
Constructor with insert-before-instruction semantics.
static ReturnInst * Create(LLVMContext &C, BasicBlock *InsertAtEnd)
bool hasStructRetAttr() const
Determine if the call returns a structure through first pointer argument.
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)
Value * getCondition() const
BitCastInst(Value *S, Type *Ty, const Twine &NameStr="", Instruction *InsertBefore=nullptr)
Constructor with insert-before-instruction semantics.
bool isInlineAsm() const
Check if this call is an inline asm statement.
void setCondition(Value *V)
static CallInst * Create(Value *F, const Twine &NameStr="", Instruction *InsertBefore=nullptr)
void setSwiftError(bool V)
Specify whether this alloca is used to represent a swifterror.
bool isFPPredicate() const
user_iterator_impl< const User > const_user_iterator
constexpr char Size[]
Key for Kernel::Arg::Metadata::mSize.
bool isNoBuiltin() const
Return true if the call should not be treated as a call to a builtin.
static Instruction * CreateMalloc(Instruction *InsertBefore, Type *IntPtrTy, Type *AllocTy, Value *AllocSize, Value *ArraySize=nullptr, Function *MallocF=nullptr, const Twine &Name="")
Generate the IR for a call to malloc:
unsigned getNumSuccessors() const
ptrdiff_t operator-(const CaseIteratorImpl &RHS) const
llvm_unreachable("Unknown RegBank!")
const Value * getNewValOperand() const
Value * getParentPad() const
AllocaInst * cloneImpl() const
static Type * getIndexedType(Type *Ty, ArrayRef< Value * > IdxList)
Returns the type of the element that would be loaded with a load instruction with the specified param...
bool onlyAccessesArgMemory() const
Determine if the call can access memmory only using pointers based on its arguments.
static bool classof(const Value *V)
iterator_range< op_iterator > indices()
void setOrdering(AtomicOrdering Ordering)
Sets the ordering constraint of this store instruction.
ConstCaseIt case_default() const
void setCalledFunction(Value *Fn)
Set the function called.
bool isConvergent() const
Determine if the invoke is convergent.
Value * getArgOperand(unsigned i) const
getArgOperand/setArgOperand - Return/set the i-th invoke argument.
BasicBlock * getSuccessor(unsigned idx) const
uint64_t getDereferenceableBytes(unsigned i) const
Extract the number of dereferenceable bytes for a call or parameter (0=unknown).
LLVM_ATTRIBUTE_ALWAYS_INLINE iterator end()
AttributeList getAttributes() const
Return the parameter attributes for this invoke.
Value * getCondition() const
Value * getPointerOperand()
Gets the pointer operand.
BasicBlock * getDefaultDest() const
void setTrueValue(Value *V)
void setArgOperand(unsigned i, Value *v)
void setDoesNotAccessMemory()
static bool classof(const Instruction *I)
Methods for support type inquiry through isa, cast, and dyn_cast:
unsigned getNumSuccessors() const
void setCondition(Value *V)
AtomicOrdering getOrdering() const
Returns the ordering constraint of this fence instruction.
CatchReturnInst * cloneImpl() const
const_op_iterator arg_end() const
Return the iterator pointing to the end of the argument list.
unsigned getAlignment() const
Return the alignment of the access that is being performed.
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)
uint64_t getDereferenceableOrNullBytes(unsigned i) const
Extract the number of dereferenceable_or_null bytes for a call or parameter (0=unknown).
void setOnlyAccessesArgMemory()
static bool classof(const Instruction *I)
Methods for support type inquiry through isa, cast, and dyn_cast:
static bool classof(const Value *V)
unsigned getRetAlignment() const
Extract the alignment of the return value.
AttributeList getAttributes() const
Return the parameter attributes for this call.
void setValue(ConstantInt *V)
Sets the new value for current case.
Attribute getAttribute(unsigned i, Attribute::AttrKind Kind) const
Get the attribute of a given kind at a position.
bool isCatch(unsigned Idx) const
Return 'true' if the clause and index Idx is a catch clause.
static ReturnInst * Create(LLVMContext &C, Value *retVal, BasicBlock *InsertAtEnd)
LLVM_ATTRIBUTE_ALWAYS_INLINE size_type size() const
iterator_range< const_block_iterator > blocks() const
void setSuccessor(unsigned idx, BasicBlock *NewSucc)
void setArgOperand(unsigned i, Value *v)
static CleanupPadInst * Create(Value *ParentPad, ArrayRef< Value * > Args, const Twine &NameStr, BasicBlock *InsertAtEnd)
static bool classof(const Value *V)
This class represents a cast unsigned integer to floating point.
static GetElementPtrInst * CreateInBounds(Value *Ptr, ArrayRef< Value * > IdxList, const Twine &NameStr, BasicBlock *InsertAtEnd)
static bool classof(const Value *V)
constexpr char Align[]
Key for Kernel::Arg::Metadata::mAlign.
static bool classof(const Value *V)
0 1 1 0 True if ordered and operands are unequal
Compile-time customization of User operands.
static bool classof(const Instruction *I)
Methods for support type inquiry through isa, cast, and dyn_cast:
void setSyncScopeID(SyncScope::ID SSID)
Sets the synchronization scope ID of this cmpxchg instruction.
LLVM_NODISCARD std::enable_if<!is_simple_type< Y >::value, typename cast_retty< X, const Y >::ret_type >::type dyn_cast(const Y &Val)
static bool classof(const Value *V)
void setFalseValue(Value *V)
unsigned getNumSuccessors() const
void removeAttribute(unsigned i, Attribute::AttrKind Kind)
removes the attribute from the list of attributes.
unsigned getParamAlignment(unsigned ArgNo) const
Extract the alignment for a call or parameter (0=unknown).
VectorType * getType() const
Overload to return most specific vector type.
SyncScope::ID getSyncScopeID() const
Returns the synchronization scope ID of this fence instruction.
IntToPtrInst * cloneImpl() const
Clone an identical IntToPtrInst.
static unsigned getPointerOperandIndex()
void setOnlyReadsMemory()
bool returnDoesNotAlias() const
Determine if the return value is marked with NoAlias attribute.
CaseIt case_default()
Returns an iterator that points to the default case.
ICmpInst(Predicate pred, Value *LHS, Value *RHS, const Twine &NameStr="")
Constructor with no-insertion semantics.
const_op_iterator arg_begin() const
Return the iterator pointing to the beginning of the argument list.
unsigned getNumCases() const
Return the number of 'cases' in this switch instruction, excluding the default case.
bool hasUnwindDest() const
void mutateType(Type *Ty)
Mutate the type of this Value to be of the specified type.
static bool classof(const Instruction *I)
Methods for support type inquiry through isa, cast, and dyn_cast:
void setCatchSwitch(Value *CatchSwitch)
static CallInst * Create(Value *F, const Twine &NameStr, BasicBlock *InsertAtEnd)
void reserveClauses(unsigned Size)
Grow the size of the operand list to accommodate the new number of clauses.
bool hasUnwindDest() const
static bool classof(const Value *V)
static bool classof(const Value *V)
void setCondition(Value *V)
const_block_iterator block_begin() const
Use & getArgOperandUse(unsigned i)
iterator_range< op_iterator > arg_operands()
Iteration adapter for range-for loops.
static unsigned getPointerOperandIndex()
const Value * getPointerOperand() const
This class represents a cast from signed integer to floating point.
void swapOperands()
Exchange the two operands to this instruction in such a way that it does not modify the semantics of ...
bool isWeak() const
Return true if this cmpxchg may spuriously fail.
GetElementPtrInst * cloneImpl() const
Type * getReturnType() const
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
handler_iterator handler_end()
Returns a read-only iterator that points one past the last handler in the CatchSwitchInst.
void setAttributes(AttributeList A)
Set the parameter attributes for this invoke.
Attribute getParamAttr(unsigned ArgNo, Attribute::AttrKind Kind) const
Return the attribute object that exists at the arg index.
unsigned getPointerAddressSpace() const
Returns the address space of the pointer operand.
This class represents a truncation of floating point types.
const Value * getPointerOperand() const
Gets the pointer operand.
const_op_iterator arg_begin() const
Return the iterator pointing to the beginning of the argument list.
static CatchReturnInst * Create(Value *CatchPad, BasicBlock *BB, Instruction *InsertBefore=nullptr)
void removeParamAttr(unsigned ArgNo, Attribute::AttrKind Kind)
Removes the attribute from the given argument.
void setSuccessOrdering(AtomicOrdering Ordering)
Sets the success ordering constraint of this cmpxchg instruction.
0 0 0 1 True if ordered and equal
LLVM Value Representation.
void setAlignment(unsigned Align)
FPExtInst(Value *S, Type *Ty, const Twine &NameStr="", Instruction *InsertBefore=nullptr)
Constructor with insert-before-instruction semantics.
FPToSIInst * cloneImpl() const
Clone an identical FPToSIInst.
unsigned getOpcode() const
Returns a member of one of the enums like Instruction::Add.
void setDefaultDest(BasicBlock *DefaultCase)
void setOnlyReadsMemory()
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.
BasicBlockT * getCaseSuccessor() const
Resolves successor for current case.
static CleanupReturnInst * Create(Value *CleanupPad, BasicBlock *UnwindBB=nullptr, Instruction *InsertBefore=nullptr)
const Value * getArraySize() const
Get the number of elements allocated.
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.
StoreInst(Value *Val, Value *Ptr, Instruction *InsertBefore)
void setCallingConv(CallingConv::ID CC)
The highest possible calling convention ID. Must be some 2^k - 1.
DECLARE_TRANSPARENT_OPERAND_ACCESSORS(Value)
Transparently provide more efficient getOperand methods.
static bool classof(const Instruction *I)
TruncInst * cloneImpl() const
Clone an identical TruncInst.
Predicate getSignedPredicate() const
For example, EQ->EQ, SLE->SLE, UGT->SGT, etc.
bool isCleanup() const
Return 'true' if this landingpad instruction is a cleanup.
unsigned getRetAlignment() const
Extract the alignment of the return value.
void setSuccessor(BasicBlock *S)
Sets the new successor for current case.
const Value * getFalseValue() const
A handle to a particular switch case.
StringRef - Represent a constant reference to a string, i.e.
const_block_iterator block_end() const
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.
CallingConv::ID getCallingConv() const
getCallingConv/setCallingConv - Get or set the calling convention of this function call...
void addAttribute(unsigned i, Attribute::AttrKind Kind)
adds the attribute to the list of attributes.
static bool classof(const Value *V)
CaseHandleT & operator*()
const_op_range incoming_values() const
VariadicOperandTraits - determine the allocation regime of the Use array when it is a prefix to the U...
void setIncomingValue(unsigned i, Value *V)
static bool classof(const Value *V)
auto find_if(R &&Range, UnaryPredicate P) -> decltype(std::begin(Range))
Provide wrappers to std::find_if which take ranges instead of having to pass begin/end explicitly...
Type * getAllocatedType() const
Return the type that is being allocated by the instruction.
op_range incoming_values()
This class represents an extension of floating point types.
bool isRelational() const
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.
const Value * getPointerOperand() const
unsigned getPointerAddressSpace() const
Get the address space of this pointer or pointer vector type.
void setCannotDuplicate()
FPTruncInst * cloneImpl() const
Clone an identical FPTruncInst.
unsigned getNumArgOperands() const
Return the number of invoke arguments.
InsertValueInst * cloneImpl() const
Value * getPointerOperand()
unsigned getNumSuccessors() const
int getBasicBlockIndex(const BasicBlock *BB) const
Return the first index of the specified basic block in the value list for this PHI.
unsigned getNumDestinations() const
return the number of possible destinations in this indirectbr instruction.
const Value * getPointerOperand() const
static bool classof(const Value *V)
static bool classof(const Instruction *I)
Type * getResultElementType() const
static unsigned getPointerOperandIndex()
A mixin to add operand bundle functionality to llvm instruction classes.
const_op_iterator arg_end() const
Return the iterator pointing to the end of the argument list.
const_op_iterator idx_begin() const
static void commuteShuffleMask(MutableArrayRef< int > Mask, unsigned InVecNumElts)
Change values in a shuffle permute mask assuming the two vector operands of length InVecNumElts have ...
SmallVector< int, 16 > getShuffleMask() const
void addDereferenceableAttr(unsigned i, uint64_t Bytes)
adds the dereferenceable attribute to the list of attributes.
0 0 0 0 Always false (always folded)
bool canReturnTwice() const
Return true if the call can return twice.
static bool classof(const Value *V)
AddrSpaceCastInst * cloneImpl() const
Clone an identical AddrSpaceCastInst.
static IndirectBrInst * Create(Value *Address, unsigned NumDests, BasicBlock *InsertAtEnd)
an instruction to allocate memory on the stack
static bool classof(const Instruction *I)
This instruction inserts a struct field of array element value into an aggregate value.
AttrKind
This enumeration lists the attributes that can be associated with parameters, function results...
void setCatchPad(CatchPadInst *CatchPad)
bool isVolatile() const
Return true if this is a RMW on a volatile memory location.
void addParamAttr(unsigned ArgNo, Attribute::AttrKind Kind)
Adds the attribute to the indicated argument.
static bool classof(const Instruction *I)
const Value * getPointerOperand() const
LoadInst(Value *Ptr, const Twine &NameStr, bool isVolatile, unsigned Align, Instruction *InsertBefore=nullptr)