54 ? cast<CallInst>(II)->op_end() - 1
55 : cast<InvokeInst>(II)->op_end() - 3;
64 #define HANDLE_TERM_INST(N, OPC, CLASS) \
65 case Instruction::OPC: \
66 return static_cast<const CLASS *>(this)->getNumSuccessors();
67 #include "llvm/IR/Instruction.def"
76 #define HANDLE_TERM_INST(N, OPC, CLASS) \
77 case Instruction::OPC: \
78 return static_cast<const CLASS *>(this)->getSuccessor(idx);
79 #include "llvm/IR/Instruction.def"
88 #define HANDLE_TERM_INST(N, OPC, CLASS) \
89 case Instruction::OPC: \
90 return static_cast<CLASS *>(this)->setSuccessor(idx, B);
91 #include "llvm/IR/Instruction.def"
106 return "both values to select must have same type";
109 return "select values cannot have token type";
114 return "vector select condition element type must be i1";
117 return "selected values for vector select must be vectors";
119 return "vector select requires selected vectors to have "
120 "the same vector length as select condition";
122 return "select condition must be i1 or <n x i1>";
131 PHINode::PHINode(
const PHINode &PN)
133 ReservedSpace(PN.getNumOperands()) {
154 Op<-1>().set(
nullptr);
170 void PHINode::growOperands() {
172 unsigned NumOps = e + e / 2;
173 if (NumOps < 2) NumOps = 2;
175 ReservedSpace = NumOps;
186 if (ConstantValue !=
this)
191 if (ConstantValue ==
this)
193 return ConstantValue;
202 Value *ConstantValue =
nullptr;
205 if (Incoming !=
this && !isa<UndefValue>(Incoming)) {
206 if (ConstantValue && ConstantValue != Incoming)
208 ConstantValue = Incoming;
218 LandingPadInst::LandingPadInst(
Type *RetTy,
unsigned NumReservedValues,
221 init(NumReservedValues, NameStr);
224 LandingPadInst::LandingPadInst(
Type *RetTy,
unsigned NumReservedValues,
227 init(NumReservedValues, NameStr);
232 LP.getNumOperands()),
233 ReservedSpace(LP.getNumOperands()) {
237 for (
unsigned I = 0,
E = ReservedSpace;
I !=
E; ++
I)
244 const Twine &NameStr,
246 return new LandingPadInst(RetTy, NumReservedClauses, NameStr, InsertBefore);
250 const Twine &NameStr,
252 return new LandingPadInst(RetTy, NumReservedClauses, NameStr, InsertAtEnd);
255 void LandingPadInst::init(
unsigned NumReservedValues,
const Twine &NameStr) {
256 ReservedSpace = NumReservedValues;
265 void LandingPadInst::growOperands(
unsigned Size) {
267 if (ReservedSpace >= e + Size)
return;
268 ReservedSpace = (
std::max(e, 1U) + Size / 2) * 2;
275 assert(OpNo < ReservedSpace &&
"Growing didn't work!");
288 "NumOperands not set up?");
294 "Calling a function with bad signature!");
296 for (
unsigned i = 0; i != Args.
size(); ++i)
299 "Calling a function with a bad signature!");
311 void CallInst::init(
Value *Func,
const Twine &NameStr) {
313 cast<FunctionType>(cast<PointerType>(Func->
getType())->getElementType());
325 ->getElementType())->getReturnType(),
335 ->getElementType())->getReturnType(),
342 CallInst::CallInst(
const CallInst &CI)
345 CI.getNumOperands()),
352 bundle_op_info_begin());
376 if (
F->getAttributes().hasAttrSomewhere(Attribute::Returned, &Index) &&
463 return F->getAttributes().hasParamAttribute(i, Kind);
486 "Must be either a call argument or an operand bundle!");
492 assert(val &&
"IsConstantOne does not work with nullptr val");
494 return CVal && CVal->
isOne();
503 assert(((!InsertBefore && InsertAtEnd) || (InsertBefore && !InsertAtEnd)) &&
504 "createMalloc needs either InsertBefore or InsertAtEnd");
512 else if (ArraySize->
getType() != IntPtrTy) {
523 AllocSize = ArraySize;
524 }
else if (
Constant *CO = dyn_cast<Constant>(ArraySize)) {
533 "mallocsize", InsertBefore);
536 "mallocsize", InsertAtEnd);
540 assert(AllocSize->
getType() == IntPtrTy &&
"malloc arg is wrong size");
543 Module *M = BB->getParent()->getParent();
545 Value *MallocFunc = MallocF;
556 if (Result->
getType() != AllocPtrType)
558 Result =
new BitCastInst(MCall, AllocPtrType, Name, InsertBefore);
562 if (Result->
getType() != AllocPtrType) {
565 Result =
new BitCastInst(MCall, AllocPtrType, Name);
569 if (
Function *
F = dyn_cast<Function>(MallocFunc)) {
571 if (!
F->returnDoesNotAlias())
572 F->setReturnDoesNotAlias();
590 return createMalloc(InsertBefore,
nullptr, IntPtrTy, AllocTy, AllocSize,
591 ArraySize,
None, MallocF, Name);
599 return createMalloc(InsertBefore,
nullptr, IntPtrTy, AllocTy, AllocSize,
600 ArraySize, OpB, MallocF, Name);
615 return createMalloc(
nullptr, InsertAtEnd, IntPtrTy, AllocTy, AllocSize,
616 ArraySize,
None, MallocF, Name);
623 return createMalloc(
nullptr, InsertAtEnd, IntPtrTy, AllocTy, AllocSize,
624 ArraySize, OpB, MallocF, Name);
631 assert(((!InsertBefore && InsertAtEnd) || (InsertBefore && !InsertAtEnd)) &&
632 "createFree needs either InsertBefore or InsertAtEnd");
634 "Can not free something of nonpointer type!");
637 Module *M = BB->getParent()->getParent();
646 if (Source->
getType() != IntPtrTy)
647 PtrCast =
new BitCastInst(Source, IntPtrTy,
"", InsertBefore);
650 if (Source->
getType() != IntPtrTy)
651 PtrCast =
new BitCastInst(Source, IntPtrTy,
"", InsertAtEnd);
655 if (
Function *
F = dyn_cast<Function>(FreeFunc))
668 return createFree(Source, Bundles, InsertBefore,
nullptr);
676 assert(FreeCall &&
"CreateFree did not create a CallInst");
683 assert(FreeCall &&
"CreateFree did not create a CallInst");
694 const Twine &NameStr) {
698 "NumOperands not set up?");
701 Op<-1>() = IfException;
706 "Invoking a function with bad signature");
708 for (
unsigned i = 0, e = Args.
size(); i != e; i++)
711 "Invoking a function with a bad signature!");
727 II.getNumOperands()),
756 if (
F->getAttributes().hasAttrSomewhere(Attribute::Returned, &Index) &&
779 return F->getAttributes().hasParamAttribute(i, Kind);
802 "Must be either an invoke argument or an operand bundle!");
866 RI.getNumOperands()) {
868 Op<0>() = RI.
Op<0>();
900 Op<0>() = RI.
Op<0>();
922 CRI.getNumOperands(),
923 CRI.getNumOperands()) {
925 Op<0>() = CRI.
Op<0>();
927 Op<1>() = CRI.
Op<1>();
930 void CleanupReturnInst::init(
Value *CleanupPad,
BasicBlock *UnwindBB) {
934 Op<0>() = CleanupPad;
939 CleanupReturnInst::CleanupReturnInst(
Value *CleanupPad,
BasicBlock *UnwindBB,
944 Values, InsertBefore) {
945 init(CleanupPad, UnwindBB);
948 CleanupReturnInst::CleanupReturnInst(
Value *CleanupPad,
BasicBlock *UnwindBB,
953 Values, InsertAtEnd) {
954 init(CleanupPad, UnwindBB);
968 Op<0>() = CRI.
Op<0>();
969 Op<1>() = CRI.
Op<1>();
992 CatchSwitchInst::CatchSwitchInst(
Value *ParentPad,
BasicBlock *UnwindDest,
993 unsigned NumReservedValues,
994 const Twine &NameStr,
1000 init(ParentPad, UnwindDest, NumReservedValues + 1);
1004 CatchSwitchInst::CatchSwitchInst(
Value *ParentPad,
BasicBlock *UnwindDest,
1005 unsigned NumReservedValues,
1010 ++NumReservedValues;
1011 init(ParentPad, UnwindDest, NumReservedValues + 1);
1017 CSI.getNumOperands()) {
1022 for (
unsigned I = 1,
E = ReservedSpace;
I !=
E; ++
I)
1027 unsigned NumReservedValues) {
1028 assert(ParentPad && NumReservedValues);
1030 ReservedSpace = NumReservedValues;
1034 Op<0>() = ParentPad;
1043 void CatchSwitchInst::growOperands(
unsigned Size) {
1045 assert(NumOperands >= 1);
1046 if (ReservedSpace >= NumOperands + Size)
1048 ReservedSpace = (NumOperands + Size / 2) * 2;
1055 assert(OpNo < ReservedSpace &&
"Growing didn't work!");
1063 for (
Use *CurDst = HI.
getCurrent(); CurDst != EndDst; ++CurDst)
1064 *CurDst = *(CurDst + 1);
1075 const Twine &NameStr) {
1085 FPI.getNumOperands(),
1086 FPI.getNumOperands()) {
1097 init(ParentPad, Args, NameStr);
1106 init(ParentPad, Args, NameStr);
1116 nullptr, 0, InsertBefore) {
1120 nullptr, 0, InsertAtEnd) {
1127 void BranchInst::AssertOK() {
1130 "May only branch on boolean predicates!");
1137 assert(IfTrue &&
"Branch destination may not be null!");
1158 assert(IfTrue &&
"Branch destination may not be null!");
1175 BranchInst::BranchInst(
const BranchInst &BI) :
1178 BI.getNumOperands()) {
1179 Op<-1>() = BI.
Op<-1>();
1182 Op<-3>() = BI.
Op<-3>();
1183 Op<-2>() = BI.
Op<-2>();
1190 "Cannot swap successors of an unconditional branch");
1206 assert(!isa<BasicBlock>(Amt) &&
1207 "Passed basic block into allocation size parameter! Use other ctor");
1209 "Allocation array size is not an integer!");
1216 :
AllocaInst(Ty, AddrSpace, nullptr, Name, InsertBefore) {}
1220 :
AllocaInst(Ty, AddrSpace, nullptr, Name, InsertAtEnd) {}
1224 :
AllocaInst(Ty, AddrSpace, ArraySize, 0, Name, InsertBefore) {}
1228 :
AllocaInst(Ty, AddrSpace, ArraySize, 0, Name, InsertAtEnd) {}
1234 getAISize(Ty->getContext(), ArraySize), InsertBefore),
1245 getAISize(Ty->getContext(), ArraySize), InsertAtEnd),
1253 assert((Align & (Align-1)) == 0 &&
"Alignment is not a power of 2!");
1255 "Alignment is greater than MaximumAlignment!");
1263 return !CI->isOne();
1283 void LoadInst::AssertOK() {
1285 "Ptr must have pointer type.");
1287 "Alignment required for atomic load");
1298 :
LoadInst(Ty, Ptr, Name, isVolatile, 0, InsertBef) {}
1302 :
LoadInst(Ptr, Name, isVolatile, 0, InsertAE) {}
1307 SyncScope::
System, InsertBef) {}
1312 SyncScope::
System, InsertAE) {}
1318 assert(Ty == cast<PointerType>(Ptr->
getType())->getElementType());
1331 Load, Ptr, InsertAE) {
1341 Load, Ptr, InsertBef) {
1346 if (Name && Name[0])
setName(Name);
1351 Load, Ptr, InsertAE) {
1356 if (Name && Name[0])
setName(Name);
1362 assert(Ty == cast<PointerType>(Ptr->
getType())->getElementType());
1367 if (Name && Name[0])
setName(Name);
1373 Load, Ptr, InsertAE) {
1378 if (Name && Name[0])
setName(Name);
1382 assert((Align & (Align-1)) == 0 &&
"Alignment is not a power of 2!");
1384 "Alignment is greater than MaximumAlignment!");
1394 void StoreInst::AssertOK() {
1397 "Ptr must have pointer type!");
1400 &&
"Ptr must be a pointer to Val type!");
1402 "Alignment required for atomic store");
1413 :
StoreInst(val, addr, isVolatile, 0, InsertBefore) {}
1417 :
StoreInst(val, addr, isVolatile, 0, InsertAtEnd) {}
1422 SyncScope::
System, InsertBefore) {}
1427 SyncScope::
System, InsertAtEnd) {}
1462 assert((Align & (Align-1)) == 0 &&
"Alignment is not a power of 2!");
1464 "Alignment is greater than MaximumAlignment!");
1486 "All operands must be non-null!");
1488 "Ptr must have pointer type!");
1491 &&
"Ptr must be a pointer to Cmp type!");
1494 &&
"Ptr must be a pointer to NewVal type!");
1496 "AtomicCmpXchg instructions must be atomic!");
1498 "AtomicCmpXchg instructions must be atomic!");
1500 "AtomicCmpXchg failure argument shall be no stronger than the success "
1504 "AtomicCmpXchg failure ordering cannot include release semantics");
1516 Init(Ptr, Cmp, NewVal, SuccessOrdering, FailureOrdering, SSID);
1528 Init(Ptr, Cmp, NewVal, SuccessOrdering, FailureOrdering, SSID);
1535 void AtomicRMWInst::Init(BinOp Operation,
Value *Ptr,
Value *Val,
1545 "All operands must be non-null!");
1547 "Ptr must have pointer type!");
1550 &&
"Ptr must be a pointer to Val type!");
1552 "AtomicRMW instructions must be atomic!");
1563 Init(Operation, Ptr, Val, Ordering, SSID);
1574 Init(Operation, Ptr, Val, Ordering, SSID);
1604 "NumOperands not initialized?");
1613 GEPI.getNumOperands(),
1614 GEPI.getNumOperands()),
1615 SourceElementType(GEPI.SourceElementType),
1616 ResultElementType(GEPI.ResultElementType) {
1630 template <
typename IndexTy>
1633 if (IdxList.
empty())
1641 unsigned CurIdx = 1;
1642 for (; CurIdx != IdxList.
size(); ++CurIdx) {
1645 IndexTy Index = IdxList[CurIdx];
1649 return CurIdx == IdxList.
size() ? Agg :
nullptr;
1671 if (!CI->isZero())
return false;
1695 return cast<GEPOperator>(
this)->
isInBounds();
1708 ExtractElementInst::ExtractElementInst(
Value *Val,
Value *Index,
1715 assert(isValidOperands(Val, Index) &&
1716 "Invalid extractelement instruction operands!");
1722 ExtractElementInst::ExtractElementInst(
Value *Val,
Value *Index,
1729 assert(isValidOperands(Val, Index) &&
1730 "Invalid extractelement instruction operands!");
1747 InsertElementInst::InsertElementInst(
Value *Vec,
Value *Elt,
Value *Index,
1754 "Invalid insertelement instruction operands!");
1761 InsertElementInst::InsertElementInst(
Value *Vec,
Value *Elt,
Value *Index,
1768 "Invalid insertelement instruction operands!");
1777 const Value *Index) {
1781 if (Elt->
getType() != cast<VectorType>(Vec->
getType())->getElementType())
1803 "Invalid shuffle vector instruction operands!");
1820 "Invalid shuffle vector instruction operands!");
1836 if (!MaskTy || !MaskTy->getElementType()->isIntegerTy(32))
1840 if (isa<UndefValue>(Mask) || isa<ConstantAggregateZero>(
Mask))
1843 if (
const auto *MV = dyn_cast<ConstantVector>(Mask)) {
1844 unsigned V1Size = cast<VectorType>(V1->
getType())->getNumElements();
1845 for (
Value *
Op : MV->operands()) {
1846 if (
auto *CI = dyn_cast<ConstantInt>(
Op)) {
1847 if (CI->uge(V1Size*2))
1849 }
else if (!isa<UndefValue>(
Op)) {
1856 if (
const auto *CDS = dyn_cast<ConstantDataSequential>(Mask)) {
1857 unsigned V1Size = cast<VectorType>(V1->
getType())->getNumElements();
1858 for (
unsigned i = 0, e = MaskTy->getNumElements(); i != e; ++i)
1859 if (CDS->getElementAsInteger(i) >= V1Size*2)
1868 if (
const auto *CE = dyn_cast<ConstantExpr>(Mask))
1869 if (CE->getOpcode() == Instruction::UserOp1)
1876 assert(i < Mask->
getType()->getVectorNumElements() &&
"Index out of range");
1877 if (
auto *CDS = dyn_cast<ConstantDataSequential>(Mask))
1878 return CDS->getElementAsInteger(i);
1880 if (isa<UndefValue>(C))
1882 return cast<ConstantInt>(
C)->getZExtValue();
1889 if (
auto *CDS = dyn_cast<ConstantDataSequential>(Mask)) {
1890 for (
unsigned i = 0; i != NumElts; ++i)
1891 Result.
push_back(CDS->getElementAsInteger(i));
1894 for (
unsigned i = 0; i != NumElts; ++i) {
1896 Result.
push_back(isa<UndefValue>(C) ? -1 :
1897 cast<ConstantInt>(C)->getZExtValue());
1906 const Twine &Name) {
1913 assert(!Idxs.
empty() &&
"InsertValueInst must have at least one index");
1916 Val->
getType() &&
"Inserted value must match indexed type!");
1927 Indices(IVI.Indices) {
1942 assert(!Idxs.
empty() &&
"ExtractValueInst must have at least one index");
1950 Indices(EVI.Indices) {
1962 for (
unsigned Index : Idxs) {
1969 if (
ArrayType *AT = dyn_cast<ArrayType>(Agg)) {
1970 if (Index >= AT->getNumElements())
1972 }
else if (
StructType *
ST = dyn_cast<StructType>(Agg)) {
1973 if (Index >=
ST->getNumElements())
1980 Agg = cast<CompositeType>(Agg)->getTypeAtIndex(Index);
1982 return const_cast<Type*
>(Agg);
2015 void BinaryOperator::AssertOK() {
2017 (void)LHS; (void)RHS;
2019 "Binary operator operand types must match!");
2025 "Arithmetic operation should return same type as operands!");
2027 "Tried to create an integer operation on a non-integer type!");
2029 case FAdd:
case FSub:
2032 "Arithmetic operation should return same type as operands!");
2034 "Tried to create a floating-point operation on a "
2035 "non-floating-point type!");
2040 "Arithmetic operation should return same type as operands!");
2042 "Incorrect operand type (not integer) for S/UDIV");
2046 "Arithmetic operation should return same type as operands!");
2048 "Incorrect operand type (not floating point) for FDIV");
2053 "Arithmetic operation should return same type as operands!");
2055 "Incorrect operand type (not integer) for S/UREM");
2059 "Arithmetic operation should return same type as operands!");
2061 "Incorrect operand type (not floating point) for FREM");
2067 "Shift operation should return same type as operands!");
2069 "Tried to create a shift operation on a non-integral type!");
2074 "Logical operation should return same type as operands!");
2076 "Tried to create a logical operation on a non-integral type!");
2087 "Cannot create binary operator with two operands of differing type!");
2118 return BinaryOperator::CreateNSWSub(zero, Op, Name, InsertBefore);
2124 return BinaryOperator::CreateNSWSub(zero, Op, Name, InsertAtEnd);
2130 return BinaryOperator::CreateNUWSub(zero, Op, Name, InsertBefore);
2136 return BinaryOperator::CreateNUWSub(zero, Op, Name, InsertAtEnd);
2169 if (
const Constant *C = dyn_cast<Constant>(V))
2170 return C->isAllOnesValue();
2176 if (Bop->getOpcode() == Instruction::Sub)
2177 if (
Constant *C = dyn_cast<Constant>(Bop->getOperand(0)))
2178 return C->isNegativeZeroValue();
2184 if (Bop->getOpcode() == Instruction::FSub)
2185 if (
Constant *C = dyn_cast<Constant>(Bop->getOperand(0))) {
2186 if (!IgnoreZeroSign)
2188 return !IgnoreZeroSign ? C->isNegativeZeroValue() : C->isZeroValue();
2195 return (Bop->getOpcode() == Instruction::Xor &&
2202 return cast<BinaryOperator>(BinOp)->
getOperand(1);
2210 return cast<BinaryOperator>(BinOp)->
getOperand(1);
2218 assert(
isNot(BinOp) &&
"getNotArgument on non-'not' instruction!");
2239 Op<0>().
swap(Op<1>());
2263 default:
return false;
2264 case Instruction::ZExt:
2265 case Instruction::SExt:
2266 case Instruction::Trunc:
2268 case Instruction::BitCast:
2276 if (
getOpcode() != Instruction::BitCast)
2305 case Instruction::Trunc:
2306 case Instruction::ZExt:
2307 case Instruction::SExt:
2308 case Instruction::FPTrunc:
2309 case Instruction::FPExt:
2310 case Instruction::UIToFP:
2311 case Instruction::SIToFP:
2312 case Instruction::FPToUI:
2313 case Instruction::FPToSI:
2314 case Instruction::AddrSpaceCast:
2317 case Instruction::BitCast:
2319 case Instruction::PtrToInt:
2322 case Instruction::IntToPtr:
2334 Type *PtrOpTy =
nullptr;
2335 if (
getOpcode() == Instruction::PtrToInt)
2337 else if (
getOpcode() == Instruction::IntToPtr)
2357 Type *DstIntPtrTy) {
2388 const unsigned numCastOps =
2389 Instruction::CastOpsEnd - Instruction::CastOpsBegin;
2390 static const uint8_t CastResults[numCastOps][numCastOps] = {
2396 { 1, 0, 0,99,99, 0, 0,99,99,99, 0, 3, 0},
2397 { 8, 1, 9,99,99, 2,17,99,99,99, 2, 3, 0},
2398 { 8, 0, 1,99,99, 0, 2,99,99,99, 0, 3, 0},
2399 { 0, 0, 0,99,99, 0, 0,99,99,99, 0, 3, 0},
2400 { 0, 0, 0,99,99, 0, 0,99,99,99, 0, 3, 0},
2401 { 99,99,99, 0, 0,99,99, 0, 0,99,99, 4, 0},
2402 { 99,99,99, 0, 0,99,99, 0, 0,99,99, 4, 0},
2403 { 99,99,99, 0, 0,99,99, 0, 0,99,99, 4, 0},
2404 { 99,99,99, 2, 2,99,99,10, 2,99,99, 4, 0},
2405 { 1, 0, 0,99,99, 0, 0,99,99,99, 7, 3, 0},
2406 { 99,99,99,99,99,99,99,99,99,11,99,15, 0},
2407 { 5, 5, 5, 6, 6, 5, 5, 6, 6,16, 5, 1,14},
2408 { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,13,12},
2415 bool IsFirstBitcast = (firstOp == Instruction::BitCast);
2416 bool IsSecondBitcast = (secondOp == Instruction::BitCast);
2417 bool AreBothBitcasts = IsFirstBitcast && IsSecondBitcast;
2420 if ((IsFirstBitcast && isa<VectorType>(SrcTy) != isa<VectorType>(MidTy)) ||
2421 (IsSecondBitcast && isa<VectorType>(MidTy) != isa<VectorType>(DstTy)))
2422 if (!AreBothBitcasts)
2425 int ElimCase = CastResults[firstOp-Instruction::CastOpsBegin]
2426 [secondOp-Instruction::CastOpsBegin];
2473 return Instruction::BitCast;
2476 if (!SrcIntPtrTy || DstIntPtrTy != SrcIntPtrTy)
2479 if (MidSize >= PtrSize)
2480 return Instruction::BitCast;
2489 if (SrcSize == DstSize)
2490 return Instruction::BitCast;
2491 else if (SrcSize < DstSize)
2497 return Instruction::ZExt;
2502 return Instruction::BitCast;
2511 if (SrcSize <= PtrSize && SrcSize == DstSize)
2512 return Instruction::BitCast;
2519 return Instruction::AddrSpaceCast;
2520 return Instruction::BitCast;
2531 "Illegal addrspacecast, bitcast sequence!");
2539 return Instruction::AddrSpaceCast;
2550 "Illegal inttoptr, bitcast sequence!");
2562 "Illegal bitcast, ptrtoint sequence!");
2567 return Instruction::UIToFP;
2582 case Trunc:
return new TruncInst (S, Ty, Name, InsertBefore);
2583 case ZExt:
return new ZExtInst (S, Ty, Name, InsertBefore);
2584 case SExt:
return new SExtInst (S, Ty, Name, InsertBefore);
2585 case FPTrunc:
return new FPTruncInst (S, Ty, Name, InsertBefore);
2586 case FPExt:
return new FPExtInst (S, Ty, Name, InsertBefore);
2587 case UIToFP:
return new UIToFPInst (S, Ty, Name, InsertBefore);
2588 case SIToFP:
return new SIToFPInst (S, Ty, Name, InsertBefore);
2589 case FPToUI:
return new FPToUIInst (S, Ty, Name, InsertBefore);
2590 case FPToSI:
return new FPToSIInst (S, Ty, Name, InsertBefore);
2591 case PtrToInt:
return new PtrToIntInst (S, Ty, Name, InsertBefore);
2592 case IntToPtr:
return new IntToPtrInst (S, Ty, Name, InsertBefore);
2593 case BitCast:
return new BitCastInst (S, Ty, Name, InsertBefore);
2604 case Trunc:
return new TruncInst (S, Ty, Name, InsertAtEnd);
2605 case ZExt:
return new ZExtInst (S, Ty, Name, InsertAtEnd);
2606 case SExt:
return new SExtInst (S, Ty, Name, InsertAtEnd);
2607 case FPTrunc:
return new FPTruncInst (S, Ty, Name, InsertAtEnd);
2608 case FPExt:
return new FPExtInst (S, Ty, Name, InsertAtEnd);
2609 case UIToFP:
return new UIToFPInst (S, Ty, Name, InsertAtEnd);
2610 case SIToFP:
return new SIToFPInst (S, Ty, Name, InsertAtEnd);
2611 case FPToUI:
return new FPToUIInst (S, Ty, Name, InsertAtEnd);
2612 case FPToSI:
return new FPToSIInst (S, Ty, Name, InsertAtEnd);
2613 case PtrToInt:
return new PtrToIntInst (S, Ty, Name, InsertAtEnd);
2614 case IntToPtr:
return new IntToPtrInst (S, Ty, Name, InsertAtEnd);
2615 case BitCast:
return new BitCastInst (S, Ty, Name, InsertAtEnd);
2625 return Create(Instruction::BitCast, S, Ty, Name, InsertBefore);
2626 return Create(Instruction::ZExt, S, Ty, Name, InsertBefore);
2633 return Create(Instruction::BitCast, S, Ty, Name, InsertAtEnd);
2634 return Create(Instruction::ZExt, S, Ty, Name, InsertAtEnd);
2641 return Create(Instruction::BitCast, S, Ty, Name, InsertBefore);
2642 return Create(Instruction::SExt, S, Ty, Name, InsertBefore);
2649 return Create(Instruction::BitCast, S, Ty, Name, InsertAtEnd);
2650 return Create(Instruction::SExt, S, Ty, Name, InsertAtEnd);
2657 return Create(Instruction::BitCast, S, Ty, Name, InsertBefore);
2658 return Create(Instruction::Trunc, S, Ty, Name, InsertBefore);
2665 return Create(Instruction::BitCast, S, Ty, Name, InsertAtEnd);
2666 return Create(Instruction::Trunc, S, Ty, Name, InsertAtEnd);
2681 return Create(Instruction::PtrToInt, S, Ty, Name, InsertAtEnd);
2699 return Create(Instruction::PtrToInt, S, Ty, Name, InsertBefore);
2712 return Create(Instruction::AddrSpaceCast, S, Ty, Name, InsertAtEnd);
2714 return Create(Instruction::BitCast, S, Ty, Name, InsertAtEnd);
2725 return Create(Instruction::AddrSpaceCast, S, Ty, Name, InsertBefore);
2727 return Create(Instruction::BitCast, S, Ty, Name, InsertBefore);
2734 return Create(Instruction::PtrToInt, S, Ty, Name, InsertBefore);
2736 return Create(Instruction::IntToPtr, S, Ty, Name, InsertBefore);
2738 return Create(Instruction::BitCast, S, Ty, Name, InsertBefore);
2742 bool isSigned,
const Twine &Name,
2745 "Invalid integer cast");
2749 (SrcBits == DstBits ? Instruction::BitCast :
2750 (SrcBits > DstBits ? Instruction::Trunc :
2751 (isSigned ? Instruction::SExt : Instruction::ZExt)));
2752 return Create(opcode, C, Ty, Name, InsertBefore);
2756 bool isSigned,
const Twine &Name,
2763 (SrcBits == DstBits ? Instruction::BitCast :
2764 (SrcBits > DstBits ? Instruction::Trunc :
2765 (isSigned ? Instruction::SExt : Instruction::ZExt)));
2766 return Create(opcode, C, Ty, Name, InsertAtEnd);
2777 (SrcBits == DstBits ? Instruction::BitCast :
2778 (SrcBits > DstBits ? Instruction::FPTrunc : Instruction::FPExt));
2779 return Create(opcode, C, Ty, Name, InsertBefore);
2790 (SrcBits == DstBits ? Instruction::BitCast :
2791 (SrcBits > DstBits ? Instruction::FPTrunc : Instruction::FPExt));
2792 return Create(opcode, C, Ty, Name, InsertAtEnd);
2801 if (SrcTy == DestTy)
2804 if (
VectorType *SrcVecTy = dyn_cast<VectorType>(SrcTy))
2805 if (
VectorType *DestVecTy = dyn_cast<VectorType>(DestTy))
2806 if (SrcVecTy->getNumElements() == DestVecTy->getNumElements()) {
2808 SrcTy = SrcVecTy->getElementType();
2809 DestTy = DestVecTy->getElementType();
2823 return DestBits == SrcBits;
2833 return DestBits == SrcBits;
2838 return DestBits == SrcBits;
2846 return DestBits == SrcBits;
2856 if (SrcTy == DestTy)
2859 if (
VectorType *SrcVecTy = dyn_cast<VectorType>(SrcTy)) {
2860 if (
VectorType *DestVecTy = dyn_cast<VectorType>(DestTy)) {
2861 if (SrcVecTy->getNumElements() == DestVecTy->getNumElements()) {
2863 SrcTy = SrcVecTy->getElementType();
2864 DestTy = DestVecTy->getElementType();
2869 if (
PointerType *DestPtrTy = dyn_cast<PointerType>(DestTy)) {
2870 if (
PointerType *SrcPtrTy = dyn_cast<PointerType>(SrcTy)) {
2871 return SrcPtrTy->getAddressSpace() == DestPtrTy->getAddressSpace();
2880 if (SrcBits == 0 || DestBits == 0)
2883 if (SrcBits != DestBits)
2894 if (
auto *PtrTy = dyn_cast<PointerType>(SrcTy))
2895 if (
auto *IntTy = dyn_cast<IntegerType>(DestTy))
2897 if (
auto *PtrTy = dyn_cast<PointerType>(DestTy))
2898 if (
auto *IntTy = dyn_cast<IntegerType>(SrcTy))
2913 const Value *Src,
bool SrcIsSigned,
Type *DestTy,
bool DestIsSigned) {
2917 "Only first class types are castable!");
2919 if (SrcTy == DestTy)
2923 if (
VectorType *SrcVecTy = dyn_cast<VectorType>(SrcTy))
2924 if (
VectorType *DestVecTy = dyn_cast<VectorType>(DestTy))
2925 if (SrcVecTy->getNumElements() == DestVecTy->getNumElements()) {
2928 SrcTy = SrcVecTy->getElementType();
2929 DestTy = DestVecTy->getElementType();
2939 if (DestBits < SrcBits)
2941 else if (DestBits > SrcBits) {
2955 assert(DestBits == SrcBits &&
2956 "Casting vector to integer of different width");
2960 "Casting from a value that is not first-class type");
2970 if (DestBits < SrcBits) {
2972 }
else if (DestBits > SrcBits) {
2978 assert(DestBits == SrcBits &&
2979 "Casting vector to floating point of different width");
2984 assert(DestBits == SrcBits &&
2985 "Illegal cast to vector (wrong type or size)");
2990 return AddrSpaceCast;
2998 assert(DestBits == SrcBits &&
"Casting vector of wrong width to X86_MMX");
3031 cast<VectorType>(SrcTy)->getNumElements() : 0;
3033 cast<VectorType>(DstTy)->getNumElements() : 0;
3037 default:
return false;
3038 case Instruction::Trunc:
3040 SrcLength == DstLength && SrcBitSize > DstBitSize;
3041 case Instruction::ZExt:
3043 SrcLength == DstLength && SrcBitSize < DstBitSize;
3044 case Instruction::SExt:
3046 SrcLength == DstLength && SrcBitSize < DstBitSize;
3047 case Instruction::FPTrunc:
3049 SrcLength == DstLength && SrcBitSize > DstBitSize;
3050 case Instruction::FPExt:
3052 SrcLength == DstLength && SrcBitSize < DstBitSize;
3053 case Instruction::UIToFP:
3054 case Instruction::SIToFP:
3056 SrcLength == DstLength;
3057 case Instruction::FPToUI:
3058 case Instruction::FPToSI:
3060 SrcLength == DstLength;
3061 case Instruction::PtrToInt:
3062 if (isa<VectorType>(SrcTy) != isa<VectorType>(DstTy))
3064 if (
VectorType *VT = dyn_cast<VectorType>(SrcTy))
3065 if (VT->getNumElements() != cast<VectorType>(DstTy)->getNumElements())
3068 case Instruction::IntToPtr:
3069 if (isa<VectorType>(SrcTy) != isa<VectorType>(DstTy))
3071 if (
VectorType *VT = dyn_cast<VectorType>(SrcTy))
3072 if (VT->getNumElements() != cast<VectorType>(DstTy)->getNumElements())
3075 case Instruction::BitCast: {
3081 if (!SrcPtrTy != !DstPtrTy)
3094 if (
VectorType *SrcVecTy = dyn_cast<VectorType>(SrcTy)) {
3095 if (
VectorType *DstVecTy = dyn_cast<VectorType>(DstTy))
3096 return (SrcVecTy->getNumElements() == DstVecTy->getNumElements());
3103 case Instruction::AddrSpaceCast: {
3115 if (
VectorType *SrcVecTy = dyn_cast<VectorType>(SrcTy)) {
3116 if (
VectorType *DstVecTy = dyn_cast<VectorType>(DstTy))
3117 return (SrcVecTy->getNumElements() == DstVecTy->getNumElements());
3129 ) :
CastInst(Ty, Trunc, S, Name, InsertBefore) {
3135 ) :
CastInst(Ty, Trunc, S, Name, InsertAtEnd) {
3141 ) :
CastInst(Ty, ZExt, S, Name, InsertBefore) {
3147 ) :
CastInst(Ty, ZExt, S, Name, InsertAtEnd) {
3152 ) :
CastInst(Ty, SExt, S, Name, InsertBefore) {
3158 ) :
CastInst(Ty, SExt, S, Name, InsertAtEnd) {
3164 ) :
CastInst(Ty, FPTrunc, S, Name, InsertBefore) {
3170 ) :
CastInst(Ty, FPTrunc, S, Name, InsertAtEnd) {
3176 ) :
CastInst(Ty, FPExt, S, Name, InsertBefore) {
3182 ) :
CastInst(Ty, FPExt, S, Name, InsertAtEnd) {
3188 ) :
CastInst(Ty, UIToFP, S, Name, InsertBefore) {
3194 ) :
CastInst(Ty, UIToFP, S, Name, InsertAtEnd) {
3200 ) :
CastInst(Ty, SIToFP, S, Name, InsertBefore) {
3206 ) :
CastInst(Ty, SIToFP, S, Name, InsertAtEnd) {
3212 ) :
CastInst(Ty, FPToUI, S, Name, InsertBefore) {
3218 ) :
CastInst(Ty, FPToUI, S, Name, InsertAtEnd) {
3224 ) :
CastInst(Ty, FPToSI, S, Name, InsertBefore) {
3230 ) :
CastInst(Ty, FPToSI, S, Name, InsertAtEnd) {
3236 ) :
CastInst(Ty, PtrToInt, S, Name, InsertBefore) {
3242 ) :
CastInst(Ty, PtrToInt, S, Name, InsertAtEnd) {
3248 ) :
CastInst(Ty, IntToPtr, S, Name, InsertBefore) {
3254 ) :
CastInst(Ty, IntToPtr, S, Name, InsertAtEnd) {
3260 ) :
CastInst(Ty, BitCast, S, Name, InsertBefore) {
3266 ) :
CastInst(Ty, BitCast, S, Name, InsertAtEnd) {
3272 ) :
CastInst(Ty, AddrSpaceCast, S, Name, InsertBefore) {
3278 ) :
CastInst(Ty, AddrSpaceCast, S, Name, InsertAtEnd) {
3313 if (Op == Instruction::ICmp) {
3333 if (Op == Instruction::ICmp) {
3342 if (
ICmpInst *IC = dyn_cast<ICmpInst>(
this))
3349 if (
const ICmpInst *IC = dyn_cast<ICmpInst>(
this))
3350 return IC->isCommutative();
3355 if (
const ICmpInst *IC = dyn_cast<ICmpInst>(
this))
3356 return IC->isEquality();
3395 default:
return "unknown";
3499 switch (predicate) {
3500 default:
return false;
3507 switch (predicate) {
3508 default:
return false;
3515 switch (predicate) {
3516 default:
return false;
3524 switch (predicate) {
3525 default:
return false;
3534 default:
return false;
3544 default:
return false;
3582 assert(Value && Default && NumReserved);
3583 ReservedSpace = NumReserved;
3598 nullptr, 0, InsertBefore) {
3599 init(Value, Default, 2+NumCases*2);
3609 nullptr, 0, InsertAtEnd) {
3610 init(Value, Default, 2+NumCases*2);
3621 OL[i+1] = InOL[i+1];
3632 if (OpNo+2 > ReservedSpace)
3635 assert(OpNo+1 < ReservedSpace &&
"Growing didn't work!");
3645 unsigned idx = I->getCaseIndex();
3653 if (2 + (idx + 1) * 2 != NumOps) {
3654 OL[2 + idx * 2] = OL[NumOps - 2];
3655 OL[2 + idx * 2 + 1] = OL[NumOps - 1];
3659 OL[NumOps-2].
set(
nullptr);
3660 OL[NumOps-2+1].
set(
nullptr);
3663 return CaseIt(
this, idx);
3669 void SwitchInst::growOperands() {
3671 unsigned NumOps = e*3;
3673 ReservedSpace = NumOps;
3681 void IndirectBrInst::init(
Value *
Address,
unsigned NumDests) {
3683 "Address of indirectbr must be a pointer");
3684 ReservedSpace = 1+NumDests;
3695 void IndirectBrInst::growOperands() {
3697 unsigned NumOps = e*2;
3699 ReservedSpace = NumOps;
3703 IndirectBrInst::IndirectBrInst(
Value *Address,
unsigned NumCases,
3706 nullptr, 0, InsertBefore) {
3707 init(Address, NumCases);
3710 IndirectBrInst::IndirectBrInst(
Value *Address,
unsigned NumCases,
3713 nullptr, 0, InsertAtEnd) {
3714 init(Address, NumCases);
3719 nullptr, IBI.getNumOperands()) {
3732 if (OpNo+1 > ReservedSpace)
3735 assert(OpNo < ReservedSpace &&
"Growing didn't work!");
3749 OL[idx+1] = OL[NumOps-1];
3752 OL[NumOps-1].
set(
nullptr);
Return a value (possibly void), from a function.
const Value * getCalledValue() const
Get a pointer to the function that is invoked by this instruction.
SymbolTableList< Instruction >::iterator eraseFromParent()
This method unlinks 'this' from the containing basic block and deletes it.
void push_back(const T &Elt)
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.
AtomicRMWInst * cloneImpl() const
Instruction::CastOps getOpcode() const
Return the opcode of this CastInst.
This class is the base class for the comparison instructions.
static IntegerType * getInt1Ty(LLVMContext &C)
void setUnwindDest(BasicBlock *UnwindDest)
static bool IsConstantOne(Value *val)
IsConstantOne - Return true only if val is constant int 1.
GCNRegPressure max(const GCNRegPressure &P1, const GCNRegPressure &P2)
static BinaryOperator * CreateNot(Value *Op, const Twine &Name="", Instruction *InsertBefore=nullptr)
static const Value * getFNegArgument(const Value *BinOp)
Atomic ordering constants.
LandingPadInst * cloneImpl() const
bool isVolatile() const
Return true if this is a store to a volatile memory location.
bool paramHasAttr(unsigned ArgNo, Attribute::AttrKind Kind) const
Determine whether the argument or parameter has the given attribute.
void swapSuccessors()
Swap the successors of this branch instruction.
AttributeList removeParamAttribute(LLVMContext &C, unsigned ArgNo, Attribute::AttrKind Kind) const
Remove the specified attribute at the specified arg index from this attribute list.
void allocHungoffUses(unsigned N)
bool hasRetAttr(Attribute::AttrKind Kind) const
Determine whether the return value has the given attribute.
static bool isValidOperands(const Value *Vec, const Value *NewElt, const Value *Idx)
Return true if an insertelement instruction can be formed with the specified operands.
Constant * getOrInsertFunction(StringRef Name, FunctionType *T, AttributeList AttributeList)
Look up the specified function in the module symbol table.
A Module instance is used to store all the information related to an LLVM module. ...
unsigned getNumParams() const
Return the number of fixed parameters this function type requires.
float convertToFloat() const
void setOrdering(AtomicOrdering Ordering)
Sets the ordering constraint of this rmw instruction.
void setAlignment(unsigned Align)
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.
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 getPointerTypeSizeInBits(Type *) const
Layout pointer size, in bits, based on the type.
void addCase(ConstantInt *OnVal, BasicBlock *Dest)
Add an entry to the switch instruction.
AllocaInst(Type *Ty, unsigned AddrSpace, Value *ArraySize=nullptr, const Twine &Name="", Instruction *InsertBefore=nullptr)
static unsigned CountBundleInputs(ArrayRef< OperandBundleDef > Bundles)
Return the total number of values used in Bundles.
This class represents a function call, abstracting a target machine's calling convention.
Predicate getInversePredicate() const
For example, EQ -> NE, UGT -> ULE, SLT -> SGE, OEQ -> UNE, UGT -> OLE, OLT -> UGE, etc.
bool indexValid(const Value *V) const
Function * getCalledFunction() const
Return the function called, or null if this is an indirect function invocation.
bool isSigned() const
Determine if this instruction is using a signed comparison.
void setVolatile(bool V)
Specify whether this is a volatile cmpxchg.
0 1 0 0 True if ordered and less than
void removeHandler(handler_iterator HI)
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)
IndirectBrInst * cloneImpl() const
1 1 1 0 True if unordered or not equal
static CastInst * CreateBitOrPointerCast(Value *S, Type *Ty, const Twine &Name="", Instruction *InsertBefore=nullptr)
Create a BitCast, a PtrToInt, or an IntToPTr cast instruction.
Type * getScalarType() const
If this is a vector type, return the element type, otherwise return 'this'.
bool isTokenTy() const
Return true if this is 'token'.
bool isPtrOrPtrVectorTy() const
Return true if this is a pointer type or a vector of pointer types.
static bool isOrdered(Predicate predicate)
Determine if the predicate is an ordered operation.
const Function * getParent() const
Return the enclosing method, or null if none.
unsigned getNumSuccessors() const
Return the number of successors that this terminator has.
FenceInst(LLVMContext &C, AtomicOrdering Ordering, SyncScope::ID SSID=SyncScope::System, Instruction *InsertBefore=nullptr)
This class represents a sign extension of integer types.
unsigned getAddressSpace() const
Return the address space of the Pointer type.
An instruction for reading from memory.
an instruction that atomically reads a memory location, combines it with another value, and then stores the result back.
static Instruction * CreateFree(Value *Source, Instruction *InsertBefore)
Generate the IR for a call to the builtin free function.
BranchInst * cloneImpl() const
static bool isStrongerThan(AtomicOrdering ao, AtomicOrdering other)
Returns true if ao is stronger than other as defined by the AtomicOrdering lattice, which is based on C++'s definition.
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.
void setSyncScopeID(SyncScope::ID SSID)
Sets the synchronization scope ID of this rmw instruction.
const Use * getOperandList() const
void addDereferenceableOrNullAttr(unsigned i, uint64_t Bytes)
adds the dereferenceable_or_null attribute to the list of attributes.
BinaryOperator * cloneImpl() const
bool isEquality() const
This is just a convenience that dispatches to the subclasses.
static LandingPadInst * Create(Type *RetTy, unsigned NumReservedClauses, const Twine &NameStr="", Instruction *InsertBefore=nullptr)
Constructors - NumReservedClauses is a hint for the number of incoming clauses that this landingpad w...
Type * getPointerElementType() const
UnreachableInst * cloneImpl() const
FPExtInst * cloneImpl() const
Clone an identical FPExtInst.
void setVolatile(bool V)
Specify whether this is a volatile RMW or not.
StringRef getName() const
Return a constant reference to the value's name.
static bool isBitOrNoopPointerCastable(Type *SrcTy, Type *DestTy, const DataLayout &DL)
Check whether a bitcast, inttoptr, or ptrtoint cast between these types is valid and a no-op...
block_iterator block_end()
Predicate getSignedPredicate()
For example, ULT->SLT, ULE->SLE, UGT->SGT, UGE->SGE, SLT->Failed assert.
void setCallingConv(CallingConv::ID CC)
bool swapOperands()
Exchange the two operands to this instruction.
bool isArrayAllocation() const
Return true if there is an allocation size parameter to the allocation instruction that is not 1...
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.
static bool isImpliedFalseByMatchingCmp(Predicate Pred1, Predicate Pred2)
Determine if Pred1 implies Pred2 is false when two compares have matching operands.
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)
static const Value * getNegArgument(const Value *BinOp)
Helper functions to extract the unary argument of a NEG, FNEG or NOT operation implemented via Sub...
This class represents a conversion between pointers from one address space to another.
static Constant * getIntegerCast(Constant *C, Type *Ty, bool isSigned)
Create a ZExt, Bitcast or Trunc for integer -> integer casts.
static bool castIsValid(Instruction::CastOps op, Value *S, Type *DstTy)
This method can be used to determine if a cast from S to DstTy using Opcode op is valid or not...
Value * removeIncomingValue(unsigned Idx, bool DeletePHIIfEmpty=true)
Remove an incoming value.
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.
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.
This is the base class for all instructions that perform data casts.
CallInst * cloneImpl() const
Class to represent struct types.
A Use represents the edge between a Value definition and its users.
void growHungoffUses(unsigned N, bool IsPhi=false)
Grow the number of hung off uses.
void setOrdering(AtomicOrdering Ordering)
Sets the ordering constraint of this fence instruction.
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.
bool isCall() const
Return true if a CallInst is enclosed.
const Value * getCalledValue() const
Get a pointer to the function that is invoked by this instruction.
static bool isImpliedTrueByMatchingCmp(Predicate Pred1, Predicate Pred2)
Determine if Pred1 implies Pred2 is true when two compares have matching operands.
static bool isNoopCast(Instruction::CastOps Opcode, Type *SrcTy, Type *DstTy, Type *IntPtrTy)
A no-op cast is one that can be effected without changing any bits.
UIToFPInst(Value *S, Type *Ty, const Twine &NameStr="", Instruction *InsertBefore=nullptr)
Constructor with insert-before-instruction semantics.
0 1 0 1 True if ordered and less than or equal
This file contains the simple types necessary to represent the attributes associated with functions a...
FCmpInst * cloneImpl() const
Clone an identical FCmpInst.
bundle_op_iterator bundle_op_info_begin()
Return the start of the list of BundleOpInfo instances associated with this OperandBundleUser.
AttributeList addDereferenceableOrNullAttr(LLVMContext &C, unsigned Index, uint64_t Bytes) const
Add the dereferenceable_or_null attribute to the attribute set at the given index.
void setName(const Twine &Name)
Change the name of the value.
FPToUIInst * cloneImpl() const
Clone an identical FPToUIInst.
static const unsigned MaximumAlignment
LandingPadInst * getLandingPadInst() const
Get the landingpad instruction from the landing pad block (the unwind destination).
block_iterator block_begin()
void addAttribute(unsigned i, Attribute::AttrKind Kind)
adds the attribute to the list of attributes.
This class represents a cast from a pointer to an integer.
AtomicOrdering
Atomic ordering for LLVM's memory model.
static bool isValidOperands(const Value *V1, const Value *V2, const Value *Mask)
Return true if a shufflevector instruction can be formed with the specified operands.
void addHandler(BasicBlock *Dest)
Add an entry to the switch instruction...
UIToFPInst * cloneImpl() const
Clone an identical UIToFPInst.
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.
void setCleanup(bool V)
Indicate that this landingpad instruction is a cleanup.
BitCastInst * cloneImpl() const
Clone an identical BitCastInst.
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.
bool hasParamAttribute(unsigned ArgNo, Attribute::AttrKind Kind) const
Equivalent to hasAttribute(ArgNo + FirstArgIndex, Kind).
void setParentPad(Value *ParentPad)
Class to represent array types.
This instruction compares its operands according to the predicate given to the constructor.
unsigned getNumOperandBundles() const
Return the number of operand bundles associated with this User.
bool isIntegerCast() const
There are several places where we need to know if a cast instruction only deals with integer source a...
bool isFirstClassType() const
Return true if the type is "first class", meaning it is a valid type for a Value. ...
This class represents a no-op cast from one type to another.
StoreInst * cloneImpl() const
static Instruction * createFree(Value *Source, ArrayRef< OperandBundleDef > Bundles, Instruction *InsertBefore, BasicBlock *InsertAtEnd)
static CmpInst * Create(OtherOps Op, Predicate predicate, Value *S1, Value *S2, const Twine &Name="", Instruction *InsertBefore=nullptr)
Construct a compare instruction, given the opcode, the predicate and the two operands.
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory)...
void addDereferenceableAttr(unsigned i, uint64_t Bytes)
adds the dereferenceable attribute to the list of attributes.
Used to keep track of an operand bundle.
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.
bool isFloatingPointTy() const
Return true if this is one of the six floating-point types.
Predicate getUnsignedPredicate() const
For example, EQ->EQ, SLE->ULE, UGT->UGT, etc.
FPToSIInst(Value *S, Type *Ty, const Twine &NameStr="", Instruction *InsertBefore=nullptr)
Constructor with insert-before-instruction semantics.
void setInstructionSubclassData(unsigned short D)
An instruction for storing to memory.
void replaceAllUsesWith(Value *V)
Change all uses of this to point to a new Value.
This class represents a cast from floating point to signed integer.
AttributeList addAttribute(LLVMContext &C, unsigned Index, Attribute::AttrKind Kind) const
Add an attribute to the attribute set at the given index.
bool hasOperandBundles() const
Return true if this User has any operand bundles.
This class represents a truncation of integer types.
size_t size() const
size - Get the array size.
bool isAtomic() const
Return true if this instruction has an AtomicOrdering of unordered or higher.
static const Value * getNotArgument(const Value *BinOp)
BasicBlock * getNormalDest() 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.
SwitchInst * cloneImpl() 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.
static Type * getIndexedTypeInternal(Type *Agg, ArrayRef< IndexTy > IdxList)
getIndexedType - Returns the type of the element that would be accessed with a gep instruction with t...
bool isSized(SmallPtrSetImpl< Type * > *Visited=nullptr) const
Return true if it makes sense to take the size of this type.
SIToFPInst * cloneImpl() const
Clone an identical SIToFPInst.
an instruction for type-safe pointer arithmetic to access elements of arrays and structs ...
Function Alias Analysis false
constexpr char Attrs[]
Key for Kernel::Metadata::mAttrs.
LoadInst * cloneImpl() const
bool isX86_MMXTy() const
Return true if this is X86 MMX.
bool isIntOrIntVectorTy() const
Return true if this is an integer type or a vector of integer types.
Type * getParamType(unsigned i) const
Parameter type accessors.
bool hasAttribute(unsigned Index, Attribute::AttrKind Kind) const
Return true if the attribute exists at the given index.
initializer< Ty > init(const Ty &Val)
bool isLosslessCast() const
A lossless cast is one that does not alter the basic value.
This instruction inserts a single (scalar) element into a VectorType value.
void setParentPad(Value *ParentPad)
static BinaryOperator * CreateNSWNeg(Value *Op, const Twine &Name="", Instruction *InsertBefore=nullptr)
The landingpad instruction holds all of the information necessary to generate correct exception handl...
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.
void setSuccessor(unsigned idx, BasicBlock *B)
Update the specified successor to point at the provided block.
LLVM Basic Block Representation.
Value * hasConstantValue() const
If the specified PHI node always merges together the same value, return the value, otherwise return null.
The instances of the Type class are immutable: once they are created, they are never changed...
This is an important class for using LLVM in a threaded context.
UnreachableInst(LLVMContext &C, Instruction *InsertBefore=nullptr)
Conditional or Unconditional Branch instruction.
bool isVectorTy() const
True if this is an instance of VectorType.
This function has undefined behavior.
This is an important base class in LLVM.
PointerType * getType() const
Overload to return most specific pointer type.
Resume the propagation of an exception.
void setFailureOrdering(AtomicOrdering Ordering)
Sets the failure ordering constraint of this cmpxchg instruction.
static StringRef getPredicateName(Predicate P)
constexpr char Args[]
Key for Kernel::Metadata::mArgs.
This file contains the declarations for the subclasses of Constant, which represent the different fla...
void setUsedWithInAlloca(bool V)
Specify whether this alloca is used to represent the arguments to a call.
Indirect Branch Instruction.
unsigned getAlignment() const
Return the alignment of the memory that is being allocated by the instruction.
ConstantFP - Floating Point Values [float, double].
const DebugLoc & getDebugLoc() const
Return the debug location for this node as a DebugLoc.
static bool isBitCastable(Type *SrcTy, Type *DestTy)
Check whether a bitcast between these types is valid.
bool hasAllZeroIndices() const
Return true if all of the indices of this GEP are zeros.
static Type * getVoidTy(LLVMContext &C)
const InstListType & getInstList() const
Return the underlying instruction list container.
bool isFalseWhenEqual() const
This is just a convenience.
bool isUsedWithInAlloca() const
Return true if this alloca is used as an inalloca argument to a call.
This instruction compares its operands according to the predicate given to the constructor.
Predicate
This enumeration lists the possible predicates for CmpInst subclasses.
void removeAttribute(unsigned i, Attribute::AttrKind Kind)
removes the attribute from the list of attributes.
uint64_t getNumElements() const
void addClause(Constant *ClauseVal)
Add a catch or filter clause to the landing pad.
Value * getReturnedArgOperand() const
If one of the arguments has the 'returned' attribute, return its operand value.
Value * getOperand(unsigned i) const
0 1 1 1 True if ordered (no nans)
static CastInst * CreatePointerBitCastOrAddrSpaceCast(Value *S, Type *Ty, const Twine &Name, BasicBlock *InsertAtEnd)
Create a BitCast or an AddrSpaceCast cast instruction.
bool isCommutative() const
Return true if the instruction is commutative:
CatchSwitchInst * cloneImpl() const
static bool isNot(const Value *V)
op_iterator arg_end()
Return the iterator pointing to the end of the argument list.
AtomicRMWInst(BinOp Operation, Value *Ptr, Value *Val, AtomicOrdering Ordering, SyncScope::ID SSID, Instruction *InsertBefore=nullptr)
Predicate getPredicate() const
Return the predicate for this instruction.
static CastInst * CreatePointerCast(Value *S, Type *Ty, const Twine &Name, BasicBlock *InsertAtEnd)
Create a BitCast AddrSpaceCast, or a PtrToInt cast instruction.
bool dataOperandHasImpliedAttr(unsigned i, Attribute::AttrKind Kind) const
Return true if the data operand at index i has the attribute A.
bool empty() const
empty - Check if the array is empty.
void setTailCallKind(TailCallKind TCK)
CaseIt removeCase(CaseIt I)
This method removes the specified case and its successor from the switch instruction.
Constant * getAggregateElement(unsigned Elt) const
For aggregates (struct/array/vector) return the constant that corresponds to the specified element if...
void setAlignment(unsigned Align)
This class represents a cast from an integer to a pointer.
static Constant * getAllOnesValue(Type *Ty)
Get the all ones value.
1 1 1 1 Always true (always folded)
bool hasConstantOrUndefValue() const
Whether the specified PHI node always merges together the same value, assuming undefs are equal to a ...
NUW NUW NUW NUW Exact static Exact BinaryOperator * CreateNeg(Value *Op, const Twine &Name="", Instruction *InsertBefore=nullptr)
Helper functions to construct and inspect unary operations (NEG and NOT) via binary operators SUB and...
op_iterator arg_begin()
Return the iterator pointing to the beginning of the argument list.
ShuffleVectorInst(Value *V1, Value *V2, Value *Mask, const Twine &NameStr="", Instruction *InsertBefor=nullptr)
void setTailCall(bool isTC=true)
bool isPointerTy() const
True if this is an instance of PointerType.
static UndefValue * get(Type *T)
Static factory methods - Return an 'undef' object of the specified type.
bool isCommutative() const
This is just a convenience that dispatches to the subclasses.
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.
AttributeList removeAttribute(LLVMContext &C, unsigned Index, Attribute::AttrKind Kind) const
Remove the specified attribute at the specified index from this attribute list.
AttributeList addDereferenceableAttr(LLVMContext &C, unsigned Index, uint64_t Bytes) const
Add the dereferenceable attribute to the attribute set at the given index.
bool hasAllConstantIndices() const
Return true if all of the indices of this GEP are constant integers.
LLVMContext & getContext() const
All values hold a context through their type.
static CastInst * CreateZExtOrBitCast(Value *S, Type *Ty, const Twine &Name="", Instruction *InsertBefore=nullptr)
Create a ZExt or BitCast cast instruction.
static wasm::ValType getType(const TargetRegisterClass *RC)
bool isFPOrFPVectorTy() const
Return true if this is a FP type or a vector of FP.
static PointerType * getInt8PtrTy(LLVMContext &C, unsigned AS=0)
1 1 0 1 True if unordered, less than, or equal
void swapProfMetadata()
If the instruction has "branch_weights" MD_prof metadata and the MDNode has three operands (including...
void swapOperands()
This is just a convenience that dispatches to the subclasses.
OpIteratorTy populateBundleOperandInfos(ArrayRef< OperandBundleDef > Bundles, const unsigned BeginIndex)
Populate the BundleOpInfo instances and the Use& vector from Bundles.
unsigned char SubclassOptionalData
Hold subclass data that can be dropped.
float getFPAccuracy() const
Get the maximum error permitted by this operation in ULPs.
CallingConv::ID getCallingConv() const
getCallingConv/setCallingConv - Get or set the calling convention of this function call...
static BinaryOperator * CreateNUWNeg(Value *Op, const Twine &Name="", Instruction *InsertBefore=nullptr)
TruncInst(Value *S, Type *Ty, const Twine &NameStr="", Instruction *InsertBefore=nullptr)
Constructor with insert-before-instruction semantics.
bool isConditional() const
static InvokeInst * Create(Value *Func, BasicBlock *IfNormal, BasicBlock *IfException, ArrayRef< Value * > Args, const Twine &NameStr, Instruction *InsertBefore=nullptr)
static Instruction * createMalloc(Instruction *InsertBefore, BasicBlock *InsertAtEnd, Type *IntPtrTy, Type *AllocTy, Value *AllocSize, Value *ArraySize, ArrayRef< OperandBundleDef > OpB, Function *MallocF, const Twine &Name)
IntegerType * getIntPtrType(LLVMContext &C, unsigned AddressSpace=0) const
Returns an integer type with size at least as big as that of a pointer in the given address space...
BasicBlock * getUnwindDest() const
0 0 1 0 True if ordered and greater than
BinaryOps getOpcode() const
static BinaryOperator * CreateFNeg(Value *Op, const Twine &Name="", Instruction *InsertBefore=nullptr)
const MDOperand & getOperand(unsigned I) const
static CastInst * CreateIntegerCast(Value *S, Type *Ty, bool isSigned, const Twine &Name="", Instruction *InsertBefore=nullptr)
Create a ZExt, BitCast, or Trunc for int -> int casts.
Synchronized with respect to all concurrently executing threads.
BasicBlock * getUnwindDest() const
AtomicOrdering getOrdering() const
Returns the ordering constraint of this store instruction.
bool isSwiftError() const
Return true if this alloca is used as a swifterror argument to a call.
static PointerType * getUnqual(Type *ElementType)
This constructs a pointer to an object of the specified type in the generic address space (address sp...
This is the shared class of boolean and integer constants.
Instruction * getInstruction() const
Value * getIncomingValue(unsigned i) const
Return incoming value number x.
AtomicCmpXchgInst * cloneImpl() const
SyncScope::ID getSyncScopeID() const
Returns the synchronization scope ID of this rmw instruction.
unsigned getScalarSizeInBits() const LLVM_READONLY
If this is a vector type, return the getPrimitiveSizeInBits value for the element type...
AddrSpaceCastInst(Value *S, Type *Ty, const Twine &NameStr="", Instruction *InsertBefore=nullptr)
Constructor with insert-before-instruction semantics.
ICmpInst * cloneImpl() const
Clone an identical ICmpInst.
ReturnInst * cloneImpl() const
static CallInst * Create(Value *Func, ArrayRef< Value * > Args, ArrayRef< OperandBundleDef > Bundles=None, const Twine &NameStr="", Instruction *InsertBefore=nullptr)
1 1 0 0 True if unordered or less than
bool isStaticAlloca() const
Return true if this alloca is in the entry block of the function and is a constant size...
Module.h This file contains the declarations for the Module class.
Type * getType() const
All values are typed, get the type of this value.
SyncScope::ID getSyncScopeID() const
Returns the synchronization scope ID of this load instruction.
static bool isCastable(Type *SrcTy, Type *DestTy)
Check whether it is valid to call getCastOpcode for these types.
LoadInst(Value *Ptr, const Twine &NameStr, Instruction *InsertBefore)
TailCallKind getTailCallKind() const
op_iterator arg_end()
Return the iterator pointing to the end of the argument list.
InvokeInst * cloneImpl() const
bool isVolatile() const
Return true if this is a load from a volatile memory location.
unsigned getBundleOperandsStartIndex() const
Return the index of the first bundle operand in the Use array.
bool isTrueWhenEqual() const
This is just a convenience.
AtomicCmpXchgInst(Value *Ptr, Value *Cmp, Value *NewVal, AtomicOrdering SuccessOrdering, AtomicOrdering FailureOrdering, SyncScope::ID SSID, Instruction *InsertBefore=nullptr)
void addParamAttr(unsigned ArgNo, Attribute::AttrKind Kind)
Adds the attribute to the indicated argument.
This class represents a cast from floating point to unsigned integer.
static CastInst * CreateFPCast(Value *S, Type *Ty, const Twine &Name="", Instruction *InsertBefore=nullptr)
Create an FPExt, BitCast, or FPTrunc for fp -> fp casts.
bundle_op_iterator bundle_op_info_end()
Return the end of the list of BundleOpInfo instances associated with this OperandBundleUser.
Value * getParentPad() const
Convenience accessors.
static unsigned isEliminableCastPair(Instruction::CastOps firstOpcode, Instruction::CastOps secondOpcode, Type *SrcTy, Type *MidTy, Type *DstTy, Type *SrcIntPtrTy, Type *MidIntPtrTy, Type *DstIntPtrTy)
Determine how a pair of casts can be eliminated, if they can be at all.
ShuffleVectorInst * cloneImpl() const
Predicate getSwappedPredicate() const
For example, EQ->EQ, SLE->SGE, ULT->UGT, OEQ->OEQ, ULE->UGE, OLT->OGT, etc.
VAArgInst * cloneImpl() const
static Constant * get(Type *Ty, uint64_t V, bool isSigned=false)
If Ty is a vector type, return a Constant with a splat of the given value.
Function * getCalledFunction() const
Return the function called, or null if this is an indirect function invocation.
AtomicOrdering getOrdering() const
Returns the ordering constraint of this load instruction.
bool paramHasAttr(unsigned ArgNo, Attribute::AttrKind Kind) const
Determine whether the argument or parameter has the given attribute.
SExtInst(Value *S, Type *Ty, const Twine &NameStr="", Instruction *InsertBefore=nullptr)
Constructor with insert-before-instruction semantics.
ZExtInst * cloneImpl() const
Clone an identical ZExtInst.
BinOp getOperation() const
BasicBlock * getSuccessor(unsigned idx) const
Return the specified successor.
void setPredicate(Predicate P)
Set the predicate for this instruction to the specified value.
unsigned Log2_32(uint32_t Value)
Return the floor log base 2 of the specified value, -1 if the value is zero.
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.
Class to represent vector types.
void setVolatile(bool V)
Specify whether this is a volatile store or not.
static bool isNeg(const Value *V)
Check if the given Value is a NEG, FNeg, or NOT instruction.
void setAttributes(AttributeList A)
Set the parameter attributes for this call.
Class for arbitrary precision integers.
BinaryOperator(BinaryOps iType, Value *S1, Value *S2, Type *Ty, const Twine &Name, Instruction *InsertBefore)
AttributeList addParamAttribute(LLVMContext &C, unsigned ArgNo, Attribute::AttrKind Kind) const
Add an argument attribute to the list.
void push_back(pointer val)
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)
bool isIntegerTy() const
True if this is an instance of IntegerType.
static BinaryOperator * Create(BinaryOps Op, Value *S1, Value *S2, const Twine &Name=Twine(), Instruction *InsertBefore=nullptr)
Construct a binary instruction, given the opcode and the two operands.
void setWeak(bool IsWeak)
unsigned getVectorNumElements() const
ZExtInst(Value *S, Type *Ty, const Twine &NameStr="", Instruction *InsertBefore=nullptr)
Constructor with insert-before-instruction semantics.
CmpInst(Type *ty, Instruction::OtherOps op, Predicate pred, Value *LHS, Value *RHS, const Twine &Name="", Instruction *InsertBefore=nullptr)
FCmpInst(Instruction *InsertBefore, Predicate pred, Value *LHS, Value *RHS, const Twine &NameStr="")
Constructor with insert-before-instruction semantics.
Value * getCondition() const
BitCastInst(Value *S, Type *Ty, const Twine &NameStr="", Instruction *InsertBefore=nullptr)
Constructor with insert-before-instruction semantics.
void append(in_iter in_start, in_iter in_end)
Add the specified range to the end of the SmallVector.
static bool isConstantAllOnes(const Value *V)
Common super class of ArrayType, StructType and VectorType.
void setSwiftError(bool V)
Specify whether this alloca is used to represent a swifterror.
constexpr char Size[]
Key for Kernel::Arg::Metadata::mSize.
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:
llvm_unreachable("Unknown RegBank!")
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...
InsertElementInst * cloneImpl() const
void removeParamAttr(unsigned ArgNo, Attribute::AttrKind Kind)
Removes the attribute from the given argument.
static CastInst * Create(Instruction::CastOps, Value *S, Type *Ty, const Twine &Name="", Instruction *InsertBefore=nullptr)
Provides a way to construct any of the CastInst subclasses using an opcode instead of the subclass's ...
static int getMaskValue(Constant *Mask, unsigned Elt)
Return the shuffle mask value for the specified element of the mask.
Value * getArgOperand(unsigned i) const
getArgOperand/setArgOperand - Return/set the i-th invoke argument.
AttributeList getAttributes() const
Return the parameter attributes for this invoke.
Value * getCondition() const
BasicBlock * getDefaultDest() const
const RootIt & getCurrent() const
bool isAggregateType() const
Return true if the type is an aggregate type.
static IntegerType * getInt32Ty(LLVMContext &C)
AtomicOrdering getOrdering() const
Returns the ordering constraint of this fence instruction.
CatchReturnInst * cloneImpl() const
static CastInst * CreateTruncOrBitCast(Value *S, Type *Ty, const Twine &Name="", Instruction *InsertBefore=nullptr)
Create a Trunc or BitCast cast instruction.
unsigned greater or equal
static bool isUnordered(Predicate predicate)
Determine if the predicate is an unordered operation.
unsigned getAlignment() const
Return the alignment of the access that is being performed.
static bool isFNeg(const Value *V, bool IgnoreZeroSign=false)
void setOperation(BinOp Operation)
void setSyncScopeID(SyncScope::ID SSID)
Sets the synchronization scope ID of this fence instruction.
AttributeList getAttributes() const
Return the parameter attributes for this call.
void setValue(ConstantInt *V)
Sets the new value for current case.
static Instruction::CastOps getCastOpcode(const Value *Val, bool SrcIsSigned, Type *Ty, bool DstIsSigned)
Returns the opcode necessary to cast Val into Ty using usual casting rules.
static Constant * getZeroValueForNegation(Type *Ty)
Floating point negation must be implemented with f(x) = -0.0 - x.
This class represents a cast unsigned integer to floating point.
constexpr char Align[]
Key for Kernel::Arg::Metadata::mAlign.
0 1 1 0 True if ordered and operands are unequal
Compile-time customization of User operands.
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)
void removeAttribute(unsigned i, Attribute::AttrKind Kind)
removes the attribute from the list of attributes.
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.
bool dataOperandHasImpliedAttr(unsigned i, Attribute::AttrKind Kind) const
Return true if the data operand at index i has the attribute A.
bool hasNoSignedZeros() const
Determine whether the no-signed-zeros flag is set.
1 0 1 0 True if unordered or greater than
unsigned getNumCases() const
Return the number of 'cases' in this switch instruction, excluding the default case.
bool hasUnwindDest() const
void addDestination(BasicBlock *Dest)
Add a destination.
ResumeInst * cloneImpl() const
const APFloat & getValueAPF() const
static CastInst * CreateSExtOrBitCast(Value *S, Type *Ty, const Twine &Name="", Instruction *InsertBefore=nullptr)
Create a SExt or BitCast cast instruction.
This class represents a cast from signed integer to floating point.
bool isUnsigned() const
Determine if this instruction is using an unsigned comparison.
bool isWeak() const
Return true if this cmpxchg may spuriously fail.
GetElementPtrInst * cloneImpl() const
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
void setAttributes(AttributeList A)
Set the parameter attributes for this invoke.
const BasicBlock & front() const
This class represents a truncation of floating point types.
void removeParamAttr(unsigned ArgNo, Attribute::AttrKind Kind)
Removes the attribute from the given argument.
unsigned getPrimitiveSizeInBits() const LLVM_READONLY
Return the basic size of this type if it is a primitive type.
void setSuccessOrdering(AtomicOrdering Ordering)
Sets the success ordering constraint of this cmpxchg instruction.
0 0 0 1 True if ordered and equal
FuncletPadInst * cloneImpl() const
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.
1 0 1 1 True if unordered, greater than, or equal
unsigned getOpcode() const
Returns a member of one of the enums like Instruction::Add.
void allocHungoffUses(unsigned N, bool IsPhi=false)
Allocate the array of Uses, followed by a pointer (with bottom bit set) to the User.
CaseIteratorImpl< CaseHandle > CaseIt
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.
static Value * getAISize(LLVMContext &Context, Value *Amt)
StoreInst(Value *Val, Value *Ptr, Instruction *InsertBefore)
void setCallingConv(CallingConv::ID CC)
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.
void setSuccessor(BasicBlock *S)
Sets the new successor for current case.
StringRef - Represent a constant reference to a string, i.e.
bool hasAttrSomewhere(Attribute::AttrKind Kind, unsigned *Index=nullptr) const
Return true if the specified attribute is set for at least one parameter or for the return value...
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 isVolatile(Instruction *Inst)
bool bundleOperandHasAttr(unsigned OpIdx, Attribute::AttrKind A) const
Return true if the bundle operand at index OpIdx has the attribute A.
void setNumHungOffUseOperands(unsigned NumOps)
Subclasses with hung off uses need to manage the operand count themselves.
static Constant * getMul(Constant *C1, Constant *C2, bool HasNUW=false, bool HasNSW=false)
const Instruction * getFirstNonPHI() const
Returns a pointer to the first instruction in this block that is not a PHINode instruction.
FenceInst * cloneImpl() const
static BinaryOperator * CreateMul(Value *S1, Value *S2, const Twine &Name, Instruction *InsertBefore, Value *FlagsOp)
Type * getAllocatedType() const
Return the type that is being allocated by the instruction.
This class represents an extension of floating point types.
0 0 1 1 True if ordered and greater than or equal
void setVolatile(bool V)
Specify whether this is a volatile load or not.
unsigned getPointerAddressSpace() const
Get the address space of this pointer or pointer vector type.
FPTruncInst * cloneImpl() const
Clone an identical FPTruncInst.
unsigned getNumArgOperands() const
Return the number of invoke arguments.
InsertValueInst * cloneImpl() const
bool hasRetAttr(Attribute::AttrKind Kind) const
Determine whether the return value has the given attribute.
void removeDestination(unsigned i)
This method removes the specified successor from the indirectbr instruction.
const BasicBlock * getParent() const
bool isOne() const
This is just a convenience method to make client code smaller for a common case.
CleanupReturnInst * cloneImpl() const
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)
Type * getTypeAtIndex(const Value *V) const
Given an index value into the type, return the type of the element.
AddrSpaceCastInst * cloneImpl() const
Clone an identical AddrSpaceCastInst.
LLVMContext & getContext() const
Get the global data context.
PHINode * cloneImpl() const
bool isVoidTy() const
Return true if this is 'void'.
an instruction to allocate memory on the stack
SelectInst * cloneImpl() const
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...
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 const char * areInvalidOperands(Value *Cond, Value *True, Value *False)
Return a string if the specified operands are invalid for a select operation, otherwise return null...