59 Size *=
C->getZExtValue();
69 return cast<CallBase>(getInstruction())->
op_end() - 1;
80 return "both values to select must have same type";
83 return "select values cannot have token type";
88 return "vector select condition element type must be i1";
91 return "selected values for vector select must be vectors";
93 return "vector select requires selected vectors to have " 94 "the same vector length as select condition";
96 return "select condition must be i1 or <n x i1>";
105 PHINode::PHINode(
const PHINode &PN)
117 Value *Removed = getIncomingValue(Idx);
125 std::copy(block_begin() + Idx + 1, block_end(), block_begin() + Idx);
128 Op<-1>().
set(
nullptr);
144 void PHINode::growOperands() {
146 unsigned NumOps = e + e / 2;
147 if (NumOps < 2) NumOps = 2;
149 ReservedSpace = NumOps;
157 Value *ConstantValue = getIncomingValue(0);
158 for (
unsigned i = 1, e = getNumIncomingValues(); i != e; ++i)
159 if (getIncomingValue(i) != ConstantValue && getIncomingValue(i) !=
this) {
160 if (ConstantValue !=
this)
163 ConstantValue = getIncomingValue(i);
165 if (ConstantValue ==
this)
167 return ConstantValue;
176 Value *ConstantValue =
nullptr;
177 for (
unsigned i = 0, e = getNumIncomingValues(); i != e; ++i) {
178 Value *Incoming = getIncomingValue(i);
179 if (Incoming !=
this && !isa<UndefValue>(Incoming)) {
180 if (ConstantValue && ConstantValue != Incoming)
182 ConstantValue = Incoming;
192 LandingPadInst::LandingPadInst(
Type *RetTy,
unsigned NumReservedValues,
194 :
Instruction(RetTy, Instruction::LandingPad,
nullptr, 0, InsertBefore) {
195 init(NumReservedValues, NameStr);
198 LandingPadInst::LandingPadInst(
Type *RetTy,
unsigned NumReservedValues,
200 :
Instruction(RetTy, Instruction::LandingPad,
nullptr, 0, InsertAtEnd) {
201 init(NumReservedValues, NameStr);
211 for (
unsigned I = 0,
E = ReservedSpace;
I !=
E; ++
I)
218 const Twine &NameStr,
220 return new LandingPadInst(RetTy, NumReservedClauses, NameStr, InsertBefore);
224 const Twine &NameStr,
226 return new LandingPadInst(RetTy, NumReservedClauses, NameStr, InsertAtEnd);
229 void LandingPadInst::init(
unsigned NumReservedValues,
const Twine &NameStr) {
230 ReservedSpace = NumReservedValues;
239 void LandingPadInst::growOperands(
unsigned Size) {
241 if (ReservedSpace >= e + Size)
return;
242 ReservedSpace = (
std::max(e, 1U) + Size / 2) * 2;
249 assert(OpNo < ReservedSpace &&
"Growing didn't work!");
261 const Value *V = getCalledValue();
262 if (isa<Function>(V) || isa<Constant>(V))
264 if (
const CallInst *CI = dyn_cast<CallInst>(
this))
265 if (CI->isInlineAsm())
272 return F->getIntrinsicID();
282 getType()->getPointerAddressSpace()))
313 assert(ArgNo < getNumArgOperands() &&
"Param index out of bounds!");
315 if (
Attrs.hasParamAttribute(ArgNo, Kind))
318 return F->getAttributes().hasParamAttribute(ArgNo, Kind);
328 bool CallBase::hasFnAttrOnCalledFunction(
StringRef Kind)
const {
336 const unsigned BeginIndex) {
338 for (
auto &
B : Bundles)
339 It =
std::copy(
B.input_begin(),
B.input_end(), It);
342 auto BI = Bundles.begin();
343 unsigned CurrentIndex = BeginIndex;
345 for (
auto &BOI : bundle_op_infos()) {
346 assert(BI != Bundles.end() &&
"Incorrect allocation?");
348 BOI.Tag = ContextImpl->getOrInsertBundleTag(BI->getTag());
349 BOI.Begin = CurrentIndex;
350 BOI.End = CurrentIndex + BI->input_size();
351 CurrentIndex = BOI.End;
355 assert(BI == Bundles.end() &&
"Incorrect allocation?");
368 "NumOperands not set up?");
369 setCalledOperand(Func);
374 "Calling a function with bad signature!");
376 for (
unsigned i = 0; i != Args.
size(); ++i)
379 "Calling a function with a bad signature!");
384 auto It = populateBundleOperandInfos(Bundles, Args.
size());
394 setCalledOperand(Func);
405 init(Ty, Func, Name);
412 init(Ty, Func, Name);
415 CallInst::CallInst(
const CallInst &CI)
424 bundle_op_info_begin());
453 assert(val &&
"IsConstantOne does not work with nullptr val");
455 return CVal && CVal->
isOne();
464 assert(((!InsertBefore && InsertAtEnd) || (InsertBefore && !InsertAtEnd)) &&
465 "createMalloc needs either InsertBefore or InsertAtEnd");
473 else if (ArraySize->
getType() != IntPtrTy) {
484 AllocSize = ArraySize;
485 }
else if (
Constant *CO = dyn_cast<Constant>(ArraySize)) {
494 "mallocsize", InsertBefore);
497 "mallocsize", InsertAtEnd);
501 assert(AllocSize->
getType() == IntPtrTy &&
"malloc arg is wrong size");
504 Module *M = BB->getParent()->getParent();
506 Value *MallocFunc = MallocF;
517 if (Result->
getType() != AllocPtrType)
519 Result =
new BitCastInst(MCall, AllocPtrType, Name, InsertBefore);
523 if (Result->
getType() != AllocPtrType) {
526 Result =
new BitCastInst(MCall, AllocPtrType, Name);
530 if (
Function *
F = dyn_cast<Function>(MallocFunc)) {
532 if (!
F->returnDoesNotAlias())
533 F->setReturnDoesNotAlias();
551 return createMalloc(InsertBefore,
nullptr, IntPtrTy, AllocTy, AllocSize,
552 ArraySize,
None, MallocF, Name);
560 return createMalloc(InsertBefore,
nullptr, IntPtrTy, AllocTy, AllocSize,
561 ArraySize, OpB, MallocF, Name);
576 return createMalloc(
nullptr, InsertAtEnd, IntPtrTy, AllocTy, AllocSize,
577 ArraySize,
None, MallocF, Name);
584 return createMalloc(
nullptr, InsertAtEnd, IntPtrTy, AllocTy, AllocSize,
585 ArraySize, OpB, MallocF, Name);
592 assert(((!InsertBefore && InsertAtEnd) || (InsertBefore && !InsertAtEnd)) &&
593 "createFree needs either InsertBefore or InsertAtEnd");
595 "Can not free something of nonpointer type!");
598 Module *M = BB->getParent()->getParent();
607 if (Source->
getType() != IntPtrTy)
608 PtrCast =
new BitCastInst(Source, IntPtrTy,
"", InsertBefore);
611 if (Source->
getType() != IntPtrTy)
612 PtrCast =
new BitCastInst(Source, IntPtrTy,
"", InsertAtEnd);
616 if (
Function *
F = dyn_cast<Function>(FreeFunc))
629 return createFree(Source, Bundles, InsertBefore,
nullptr);
637 assert(FreeCall &&
"CreateFree did not create a CallInst");
644 assert(FreeCall &&
"CreateFree did not create a CallInst");
655 const Twine &NameStr) {
659 ComputeNumOperands(Args.
size(), CountBundleInputs(Bundles)) &&
660 "NumOperands not set up?");
661 setNormalDest(IfNormal);
662 setUnwindDest(IfException);
663 setCalledOperand(Fn);
668 "Invoking a function with bad signature");
670 for (
unsigned i = 0, e = Args.
size(); i != e; i++)
673 "Invoking a function with a bad signature!");
678 auto It = populateBundleOperandInfos(Bundles, Args.
size());
692 bundle_op_info_begin());
712 return cast<LandingPadInst>(getUnwindDest()->getFirstNonPHI());
724 Op<0>() = RI.
Op<0>();
755 Op<0>() = RI.
Op<0>();
780 Op<0>() = CRI.
Op<0>();
782 Op<1>() = CRI.
Op<1>();
785 void CleanupReturnInst::init(
Value *CleanupPad,
BasicBlock *UnwindBB) {
789 Op<0>() = CleanupPad;
794 CleanupReturnInst::CleanupReturnInst(
Value *CleanupPad,
BasicBlock *UnwindBB,
797 Instruction::CleanupRet,
799 Values, InsertBefore) {
800 init(CleanupPad, UnwindBB);
803 CleanupReturnInst::CleanupReturnInst(
Value *CleanupPad,
BasicBlock *UnwindBB,
806 Instruction::CleanupRet,
808 Values, InsertAtEnd) {
809 init(CleanupPad, UnwindBB);
823 Op<0>() = CRI.
Op<0>();
824 Op<1>() = CRI.
Op<1>();
847 CatchSwitchInst::CatchSwitchInst(
Value *ParentPad,
BasicBlock *UnwindDest,
848 unsigned NumReservedValues,
849 const Twine &NameStr,
855 init(ParentPad, UnwindDest, NumReservedValues + 1);
859 CatchSwitchInst::CatchSwitchInst(
Value *ParentPad,
BasicBlock *UnwindDest,
860 unsigned NumReservedValues,
866 init(ParentPad, UnwindDest, NumReservedValues + 1);
877 for (
unsigned I = 1,
E = ReservedSpace;
I !=
E; ++
I)
882 unsigned NumReservedValues) {
883 assert(ParentPad && NumReservedValues);
885 ReservedSpace = NumReservedValues;
892 setUnwindDest(UnwindDest);
898 void CatchSwitchInst::growOperands(
unsigned Size) {
901 if (ReservedSpace >= NumOperands + Size)
903 ReservedSpace = (NumOperands + Size / 2) * 2;
910 assert(OpNo < ReservedSpace &&
"Growing didn't work!");
918 for (
Use *CurDst = HI.
getCurrent(); CurDst != EndDst; ++CurDst)
919 *CurDst = *(CurDst + 1);
930 const Twine &NameStr) {
933 setParentPad(ParentPad);
952 init(ParentPad, Args, NameStr);
961 init(ParentPad, Args, NameStr);
980 void BranchInst::AssertOK() {
983 "May only branch on boolean predicates!");
990 assert(IfTrue &&
"Branch destination may not be null!");
1010 assert(IfTrue &&
"Branch destination may not be null!");
1030 Op<-1>() = BI.
Op<-1>();
1033 Op<-3>() = BI.
Op<-3>();
1034 Op<-2>() = BI.
Op<-2>();
1040 assert(isConditional() &&
1041 "Cannot swap successors of an unconditional branch");
1057 assert(!isa<BasicBlock>(Amt) &&
1058 "Passed basic block into allocation size parameter! Use other ctor");
1060 "Allocation array size is not an integer!");
1067 :
AllocaInst(Ty, AddrSpace, nullptr, Name, InsertBefore) {}
1071 :
AllocaInst(Ty, AddrSpace, nullptr, Name, InsertAtEnd) {}
1075 :
AllocaInst(Ty, AddrSpace, ArraySize, 0, Name, InsertBefore) {}
1079 :
AllocaInst(Ty, AddrSpace, ArraySize, 0, Name, InsertAtEnd) {}
1104 assert((Align & (Align-1)) == 0 &&
"Alignment is not a power of 2!");
1106 "Alignment is greater than MaximumAlignment!");
1114 return !CI->isOne();
1134 void LoadInst::AssertOK() {
1136 "Ptr must have pointer type.");
1138 "Alignment required for atomic load");
1151 :
LoadInst(Ty, Ptr, Name, isVolatile, 0, InsertBef) {}
1155 :
LoadInst(Ty, Ptr, Name, isVolatile, 0, InsertAE) {}
1160 SyncScope::
System, InsertBef) {}
1165 SyncScope::
System, InsertAE) {}
1171 assert(Ty == cast<PointerType>(Ptr->
getType())->getElementType());
1183 assert(Ty == cast<PointerType>(Ptr->
getType())->getElementType());
1192 assert((Align & (Align-1)) == 0 &&
"Alignment is not a power of 2!");
1194 "Alignment is greater than MaximumAlignment!");
1204 void StoreInst::AssertOK() {
1207 "Ptr must have pointer type!");
1210 &&
"Ptr must be a pointer to Val type!");
1212 "Alignment required for atomic store");
1223 :
StoreInst(val, addr, isVolatile, 0, InsertBefore) {}
1227 :
StoreInst(val, addr, isVolatile, 0, InsertAtEnd) {}
1232 SyncScope::
System, InsertBefore) {}
1237 SyncScope::
System, InsertAtEnd) {}
1272 assert((Align & (Align-1)) == 0 &&
"Alignment is not a power of 2!");
1274 "Alignment is greater than MaximumAlignment!");
1291 setSuccessOrdering(SuccessOrdering);
1292 setFailureOrdering(FailureOrdering);
1296 "All operands must be non-null!");
1298 "Ptr must have pointer type!");
1301 &&
"Ptr must be a pointer to Cmp type!");
1304 &&
"Ptr must be a pointer to NewVal type!");
1306 "AtomicCmpXchg instructions must be atomic!");
1308 "AtomicCmpXchg instructions must be atomic!");
1310 "AtomicCmpXchg failure argument shall be no stronger than the success " 1314 "AtomicCmpXchg failure ordering cannot include release semantics");
1326 Init(Ptr, Cmp, NewVal, SuccessOrdering, FailureOrdering, SSID);
1338 Init(Ptr, Cmp, NewVal, SuccessOrdering, FailureOrdering, SSID);
1351 setOrdering(Ordering);
1355 "All operands must be non-null!");
1357 "Ptr must have pointer type!");
1360 &&
"Ptr must be a pointer to Val type!");
1362 "AtomicRMW instructions must be atomic!");
1373 Init(Operation, Ptr, Val, Ordering, SSID);
1384 Init(Operation, Ptr, Val, Ordering, SSID);
1412 return "<invalid operation>";
1443 const Twine &Name) {
1445 "NumOperands not initialized?");
1456 SourceElementType(GEPI.SourceElementType),
1457 ResultElementType(GEPI.ResultElementType) {
1471 template <
typename IndexTy>
1474 if (IdxList.
empty())
1482 unsigned CurIdx = 1;
1483 for (; CurIdx != IdxList.
size(); ++CurIdx) {
1486 IndexTy
Index = IdxList[CurIdx];
1490 return CurIdx == IdxList.
size() ? Agg :
nullptr;
1512 if (!CI->isZero())
return false;
1532 cast<GEPOperator>(
this)->setIsInBounds(B);
1536 return cast<GEPOperator>(
this)->isInBounds();
1542 return cast<GEPOperator>(
this)->accumulateConstantOffset(DL, Offset);
1556 assert(isValidOperands(Val, Index) &&
1557 "Invalid extractelement instruction operands!");
1563 ExtractElementInst::ExtractElementInst(
Value *Val,
Value *Index,
1570 assert(isValidOperands(Val, Index) &&
1571 "Invalid extractelement instruction operands!");
1588 InsertElementInst::InsertElementInst(
Value *Vec,
Value *Elt,
Value *Index,
1594 assert(isValidOperands(Vec, Elt, Index) &&
1595 "Invalid insertelement instruction operands!");
1602 InsertElementInst::InsertElementInst(
Value *Vec,
Value *Elt,
Value *Index,
1608 assert(isValidOperands(Vec, Elt, Index) &&
1609 "Invalid insertelement instruction operands!");
1618 const Value *Index) {
1622 if (Elt->
getType() != cast<VectorType>(Vec->
getType())->getElementType())
1644 "Invalid shuffle vector instruction operands!");
1661 "Invalid shuffle vector instruction operands!");
1677 if (!MaskTy || !MaskTy->getElementType()->isIntegerTy(32))
1681 if (isa<UndefValue>(Mask) || isa<ConstantAggregateZero>(
Mask))
1684 if (
const auto *MV = dyn_cast<ConstantVector>(Mask)) {
1685 unsigned V1Size = cast<VectorType>(V1->
getType())->getNumElements();
1686 for (
Value *
Op : MV->operands()) {
1687 if (
auto *CI = dyn_cast<ConstantInt>(
Op)) {
1688 if (CI->uge(V1Size*2))
1690 }
else if (!isa<UndefValue>(
Op)) {
1697 if (
const auto *CDS = dyn_cast<ConstantDataSequential>(Mask)) {
1698 unsigned V1Size = cast<VectorType>(V1->
getType())->getNumElements();
1699 for (
unsigned i = 0, e = MaskTy->getNumElements(); i != e; ++i)
1700 if (CDS->getElementAsInteger(i) >= V1Size*2)
1709 if (
const auto *CE = dyn_cast<ConstantExpr>(Mask))
1710 if (CE->getOpcode() == Instruction::UserOp1)
1717 assert(i < Mask->
getType()->getVectorNumElements() &&
"Index out of range");
1718 if (
auto *CDS = dyn_cast<ConstantDataSequential>(Mask))
1719 return CDS->getElementAsInteger(i);
1721 if (isa<UndefValue>(C))
1723 return cast<ConstantInt>(
C)->getZExtValue();
1730 if (
auto *CDS = dyn_cast<ConstantDataSequential>(Mask)) {
1731 for (
unsigned i = 0; i != NumElts; ++i)
1732 Result.
push_back(CDS->getElementAsInteger(i));
1735 for (
unsigned i = 0; i != NumElts; ++i) {
1737 Result.
push_back(isa<UndefValue>(C) ? -1 :
1738 cast<ConstantInt>(C)->getZExtValue());
1743 assert(!Mask.
empty() &&
"Shuffle mask must contain elements");
1744 bool UsesLHS =
false;
1745 bool UsesRHS =
false;
1746 for (
int i = 0, NumMaskElts = Mask.
size(); i < NumMaskElts; ++i) {
1749 assert(Mask[i] >= 0 && Mask[i] < (NumOpElts * 2) &&
1750 "Out-of-bounds shuffle mask element");
1751 UsesLHS |= (Mask[i] < NumOpElts);
1752 UsesRHS |= (Mask[i] >= NumOpElts);
1753 if (UsesLHS && UsesRHS)
1756 assert((UsesLHS ^ UsesRHS) &&
"Should have selected from exactly 1 source");
1769 for (
int i = 0, NumMaskElts = Mask.
size(); i < NumMaskElts; ++i) {
1772 if (Mask[i] != i && Mask[i] != (NumOpElts + i))
1787 for (
int i = 0, NumElts = Mask.
size(); i < NumElts; ++i) {
1790 if (Mask[i] != (NumElts - 1 - i) && Mask[i] != (NumElts + NumElts - 1 - i))
1799 for (
int i = 0, NumElts = Mask.
size(); i < NumElts; ++i) {
1802 if (Mask[i] != 0 && Mask[i] != NumElts)
1812 for (
int i = 0, NumElts = Mask.
size(); i < NumElts; ++i) {
1815 if (Mask[i] != i && Mask[i] != (NumElts + i))
1829 int NumElts = Mask.
size();
1834 if (Mask[0] != 0 && Mask[0] != 1)
1839 if ((Mask[1] - Mask[0]) != NumElts)
1844 for (
int i = 2; i < NumElts; ++i) {
1845 int MaskEltVal = Mask[i];
1846 if (MaskEltVal == -1)
1848 int MaskEltPrevVal = Mask[i - 2];
1849 if (MaskEltVal - MaskEltPrevVal != 2)
1856 int NumSrcElts,
int &Index) {
1862 if (NumSrcElts <= (
int)Mask.
size())
1867 for (
int i = 0, e = Mask.
size(); i != e; ++i) {
1871 int Offset = (M % NumSrcElts) - i;
1872 if (0 <= SubIndex && SubIndex != Offset)
1877 if (0 <= SubIndex) {
1887 if (NumMaskElts <= NumOpElts)
1896 for (
int i = NumOpElts; i < NumMaskElts; ++i)
1906 if (NumMaskElts >= NumOpElts)
1914 if (isa<UndefValue>(Op<0>()) || isa<UndefValue>(Op<1>()))
1919 if (NumMaskElts != NumOpElts * 2)
1934 const Twine &Name) {
1941 assert(!Idxs.
empty() &&
"InsertValueInst must have at least one index");
1944 Val->
getType() &&
"Inserted value must match indexed type!");
1948 Indices.append(Idxs.
begin(), Idxs.
end());
1955 Indices(IVI.Indices) {
1970 assert(!Idxs.
empty() &&
"ExtractValueInst must have at least one index");
1972 Indices.append(Idxs.
begin(), Idxs.
end());
1978 Indices(EVI.Indices) {
1990 for (
unsigned Index : Idxs) {
1997 if (
ArrayType *AT = dyn_cast<ArrayType>(Agg)) {
1998 if (Index >= AT->getNumElements())
2000 }
else if (
StructType *
ST = dyn_cast<StructType>(Agg)) {
2001 if (Index >=
ST->getNumElements())
2008 Agg = cast<CompositeType>(Agg)->getTypeAtIndex(Index);
2010 return const_cast<Type*
>(Agg);
2049 void UnaryOperator::AssertOK() {
2056 "Unary operation should return same type as operand!");
2058 "Tried to create a floating-point operation on a " 2059 "non-floating-point type!");
2096 void BinaryOperator::AssertOK() {
2098 (void)LHS; (void)RHS;
2100 "Binary operator operand types must match!");
2106 "Arithmetic operation should return same type as operands!");
2108 "Tried to create an integer operation on a non-integer type!");
2110 case FAdd:
case FSub:
2113 "Arithmetic operation should return same type as operands!");
2115 "Tried to create a floating-point operation on a " 2116 "non-floating-point type!");
2121 "Arithmetic operation should return same type as operands!");
2123 "Incorrect operand type (not integer) for S/UDIV");
2127 "Arithmetic operation should return same type as operands!");
2129 "Incorrect operand type (not floating point) for FDIV");
2134 "Arithmetic operation should return same type as operands!");
2136 "Incorrect operand type (not integer) for S/UREM");
2140 "Arithmetic operation should return same type as operands!");
2142 "Incorrect operand type (not floating point) for FREM");
2148 "Shift operation should return same type as operands!");
2150 "Tried to create a shift operation on a non-integral type!");
2155 "Logical operation should return same type as operands!");
2157 "Tried to create a logical operation on a non-integral type!");
2168 "Cannot create binary operator with two operands of differing type!");
2199 return BinaryOperator::CreateNSWSub(zero, Op, Name, InsertBefore);
2205 return BinaryOperator::CreateNSWSub(zero, Op, Name, InsertAtEnd);
2211 return BinaryOperator::CreateNUWSub(zero, Op, Name, InsertBefore);
2217 return BinaryOperator::CreateNUWSub(zero, Op, Name, InsertAtEnd);
2255 Op<0>().
swap(Op<1>());
2279 default:
return false;
2280 case Instruction::ZExt:
2281 case Instruction::SExt:
2282 case Instruction::Trunc:
2284 case Instruction::BitCast:
2292 if (
getOpcode() != Instruction::BitCast)
2321 case Instruction::Trunc:
2322 case Instruction::ZExt:
2323 case Instruction::SExt:
2324 case Instruction::FPTrunc:
2325 case Instruction::FPExt:
2326 case Instruction::UIToFP:
2327 case Instruction::SIToFP:
2328 case Instruction::FPToUI:
2329 case Instruction::FPToSI:
2330 case Instruction::AddrSpaceCast:
2333 case Instruction::BitCast:
2335 case Instruction::PtrToInt:
2338 case Instruction::IntToPtr:
2359 Type *DstIntPtrTy) {
2390 const unsigned numCastOps =
2391 Instruction::CastOpsEnd - Instruction::CastOpsBegin;
2392 static const uint8_t CastResults[numCastOps][numCastOps] = {
2398 { 1, 0, 0,99,99, 0, 0,99,99,99, 0, 3, 0},
2399 { 8, 1, 9,99,99, 2,17,99,99,99, 2, 3, 0},
2400 { 8, 0, 1,99,99, 0, 2,99,99,99, 0, 3, 0},
2401 { 0, 0, 0,99,99, 0, 0,99,99,99, 0, 3, 0},
2402 { 0, 0, 0,99,99, 0, 0,99,99,99, 0, 3, 0},
2403 { 99,99,99, 0, 0,99,99, 0, 0,99,99, 4, 0},
2404 { 99,99,99, 0, 0,99,99, 0, 0,99,99, 4, 0},
2405 { 99,99,99, 0, 0,99,99, 0, 0,99,99, 4, 0},
2406 { 99,99,99, 2, 2,99,99, 8, 2,99,99, 4, 0},
2407 { 1, 0, 0,99,99, 0, 0,99,99,99, 7, 3, 0},
2408 { 99,99,99,99,99,99,99,99,99,11,99,15, 0},
2409 { 5, 5, 5, 6, 6, 5, 5, 6, 6,16, 5, 1,14},
2410 { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,13,12},
2417 bool IsFirstBitcast = (firstOp == Instruction::BitCast);
2418 bool IsSecondBitcast = (secondOp == Instruction::BitCast);
2419 bool AreBothBitcasts = IsFirstBitcast && IsSecondBitcast;
2422 if ((IsFirstBitcast && isa<VectorType>(SrcTy) != isa<VectorType>(MidTy)) ||
2423 (IsSecondBitcast && isa<VectorType>(MidTy) != isa<VectorType>(DstTy)))
2424 if (!AreBothBitcasts)
2427 int ElimCase = CastResults[firstOp-Instruction::CastOpsBegin]
2428 [secondOp-Instruction::CastOpsBegin];
2475 return Instruction::BitCast;
2478 if (!SrcIntPtrTy || DstIntPtrTy != SrcIntPtrTy)
2481 if (MidSize >= PtrSize)
2482 return Instruction::BitCast;
2491 if (SrcSize == DstSize)
2492 return Instruction::BitCast;
2493 else if (SrcSize < DstSize)
2499 return Instruction::ZExt;
2507 if (SrcSize <= PtrSize && SrcSize == DstSize)
2508 return Instruction::BitCast;
2515 return Instruction::AddrSpaceCast;
2516 return Instruction::BitCast;
2527 "Illegal addrspacecast, bitcast sequence!");
2535 return Instruction::AddrSpaceCast;
2546 "Illegal inttoptr, bitcast sequence!");
2558 "Illegal bitcast, ptrtoint sequence!");
2563 return Instruction::UIToFP;
2575 assert(castIsValid(op, S, Ty) &&
"Invalid cast!");
2578 case Trunc:
return new TruncInst (S, Ty, Name, InsertBefore);
2579 case ZExt:
return new ZExtInst (S, Ty, Name, InsertBefore);
2580 case SExt:
return new SExtInst (S, Ty, Name, InsertBefore);
2581 case FPTrunc:
return new FPTruncInst (S, Ty, Name, InsertBefore);
2582 case FPExt:
return new FPExtInst (S, Ty, Name, InsertBefore);
2583 case UIToFP:
return new UIToFPInst (S, Ty, Name, InsertBefore);
2584 case SIToFP:
return new SIToFPInst (S, Ty, Name, InsertBefore);
2585 case FPToUI:
return new FPToUIInst (S, Ty, Name, InsertBefore);
2586 case FPToSI:
return new FPToSIInst (S, Ty, Name, InsertBefore);
2587 case PtrToInt:
return new PtrToIntInst (S, Ty, Name, InsertBefore);
2588 case IntToPtr:
return new IntToPtrInst (S, Ty, Name, InsertBefore);
2589 case BitCast:
return new BitCastInst (S, Ty, Name, InsertBefore);
2597 assert(castIsValid(op, S, Ty) &&
"Invalid cast!");
2600 case Trunc:
return new TruncInst (S, Ty, Name, InsertAtEnd);
2601 case ZExt:
return new ZExtInst (S, Ty, Name, InsertAtEnd);
2602 case SExt:
return new SExtInst (S, Ty, Name, InsertAtEnd);
2603 case FPTrunc:
return new FPTruncInst (S, Ty, Name, InsertAtEnd);
2604 case FPExt:
return new FPExtInst (S, Ty, Name, InsertAtEnd);
2605 case UIToFP:
return new UIToFPInst (S, Ty, Name, InsertAtEnd);
2606 case SIToFP:
return new SIToFPInst (S, Ty, Name, InsertAtEnd);
2607 case FPToUI:
return new FPToUIInst (S, Ty, Name, InsertAtEnd);
2608 case FPToSI:
return new FPToSIInst (S, Ty, Name, InsertAtEnd);
2609 case PtrToInt:
return new PtrToIntInst (S, Ty, Name, InsertAtEnd);
2610 case IntToPtr:
return new IntToPtrInst (S, Ty, Name, InsertAtEnd);
2611 case BitCast:
return new BitCastInst (S, Ty, Name, InsertAtEnd);
2621 return Create(Instruction::BitCast, S, Ty, Name, InsertBefore);
2622 return Create(Instruction::ZExt, S, Ty, Name, InsertBefore);
2629 return Create(Instruction::BitCast, S, Ty, Name, InsertAtEnd);
2630 return Create(Instruction::ZExt, S, Ty, Name, InsertAtEnd);
2637 return Create(Instruction::BitCast, S, Ty, Name, InsertBefore);
2638 return Create(Instruction::SExt, S, Ty, Name, InsertBefore);
2645 return Create(Instruction::BitCast, S, Ty, Name, InsertAtEnd);
2646 return Create(Instruction::SExt, S, Ty, Name, InsertAtEnd);
2653 return Create(Instruction::BitCast, S, Ty, Name, InsertBefore);
2654 return Create(Instruction::Trunc, S, Ty, Name, InsertBefore);
2661 return Create(Instruction::BitCast, S, Ty, Name, InsertAtEnd);
2662 return Create(Instruction::Trunc, S, Ty, Name, InsertAtEnd);
2677 return Create(Instruction::PtrToInt, S, Ty, Name, InsertAtEnd);
2679 return CreatePointerBitCastOrAddrSpaceCast(S, Ty, Name, InsertAtEnd);
2695 return Create(Instruction::PtrToInt, S, Ty, Name, InsertBefore);
2697 return CreatePointerBitCastOrAddrSpaceCast(S, Ty, Name, InsertBefore);
2708 return Create(Instruction::AddrSpaceCast, S, Ty, Name, InsertAtEnd);
2710 return Create(Instruction::BitCast, S, Ty, Name, InsertAtEnd);
2721 return Create(Instruction::AddrSpaceCast, S, Ty, Name, InsertBefore);
2723 return Create(Instruction::BitCast, S, Ty, Name, InsertBefore);
2730 return Create(Instruction::PtrToInt, S, Ty, Name, InsertBefore);
2732 return Create(Instruction::IntToPtr, S, Ty, Name, InsertBefore);
2734 return Create(Instruction::BitCast, S, Ty, Name, InsertBefore);
2738 bool isSigned,
const Twine &Name,
2741 "Invalid integer cast");
2745 (SrcBits == DstBits ? Instruction::BitCast :
2746 (SrcBits > DstBits ? Instruction::Trunc :
2747 (isSigned ? Instruction::SExt : Instruction::ZExt)));
2748 return Create(opcode, C, Ty, Name, InsertBefore);
2752 bool isSigned,
const Twine &Name,
2759 (SrcBits == DstBits ? Instruction::BitCast :
2760 (SrcBits > DstBits ? Instruction::Trunc :
2761 (isSigned ? Instruction::SExt : Instruction::ZExt)));
2762 return Create(opcode, C, Ty, Name, InsertAtEnd);
2773 (SrcBits == DstBits ? Instruction::BitCast :
2774 (SrcBits > DstBits ? Instruction::FPTrunc : Instruction::FPExt));
2775 return Create(opcode, C, Ty, Name, InsertBefore);
2786 (SrcBits == DstBits ? Instruction::BitCast :
2787 (SrcBits > DstBits ? Instruction::FPTrunc : Instruction::FPExt));
2788 return Create(opcode, C, Ty, Name, InsertAtEnd);
2797 if (SrcTy == DestTy)
2800 if (
VectorType *SrcVecTy = dyn_cast<VectorType>(SrcTy))
2801 if (
VectorType *DestVecTy = dyn_cast<VectorType>(DestTy))
2802 if (SrcVecTy->getNumElements() == DestVecTy->getNumElements()) {
2804 SrcTy = SrcVecTy->getElementType();
2805 DestTy = DestVecTy->getElementType();
2819 return DestBits == SrcBits;
2829 return DestBits == SrcBits;
2834 return DestBits == SrcBits;
2842 return DestBits == SrcBits;
2852 if (SrcTy == DestTy)
2855 if (
VectorType *SrcVecTy = dyn_cast<VectorType>(SrcTy)) {
2856 if (
VectorType *DestVecTy = dyn_cast<VectorType>(DestTy)) {
2857 if (SrcVecTy->getNumElements() == DestVecTy->getNumElements()) {
2859 SrcTy = SrcVecTy->getElementType();
2860 DestTy = DestVecTy->getElementType();
2865 if (
PointerType *DestPtrTy = dyn_cast<PointerType>(DestTy)) {
2866 if (
PointerType *SrcPtrTy = dyn_cast<PointerType>(SrcTy)) {
2867 return SrcPtrTy->getAddressSpace() == DestPtrTy->getAddressSpace();
2876 if (SrcBits == 0 || DestBits == 0)
2879 if (SrcBits != DestBits)
2891 if (
auto *PtrTy = dyn_cast<PointerType>(SrcTy))
2892 if (
auto *IntTy = dyn_cast<IntegerType>(DestTy))
2895 if (
auto *PtrTy = dyn_cast<PointerType>(DestTy))
2896 if (
auto *IntTy = dyn_cast<IntegerType>(SrcTy))
2900 return isBitCastable(SrcTy, DestTy);
2912 const Value *Src,
bool SrcIsSigned,
Type *DestTy,
bool DestIsSigned) {
2916 "Only first class types are castable!");
2918 if (SrcTy == DestTy)
2922 if (
VectorType *SrcVecTy = dyn_cast<VectorType>(SrcTy))
2923 if (
VectorType *DestVecTy = dyn_cast<VectorType>(DestTy))
2924 if (SrcVecTy->getNumElements() == DestVecTy->getNumElements()) {
2927 SrcTy = SrcVecTy->getElementType();
2928 DestTy = DestVecTy->getElementType();
2938 if (DestBits < SrcBits)
2940 else if (DestBits > SrcBits) {
2954 assert(DestBits == SrcBits &&
2955 "Casting vector to integer of different width");
2959 "Casting from a value that is not first-class type");
2969 if (DestBits < SrcBits) {
2971 }
else if (DestBits > SrcBits) {
2977 assert(DestBits == SrcBits &&
2978 "Casting vector to floating point of different width");
2983 assert(DestBits == SrcBits &&
2984 "Illegal cast to vector (wrong type or size)");
2989 return AddrSpaceCast;
2997 assert(DestBits == SrcBits &&
"Casting vector of wrong width to X86_MMX");
3030 cast<VectorType>(SrcTy)->getNumElements() : 0;
3032 cast<VectorType>(DstTy)->getNumElements() : 0;
3036 default:
return false;
3037 case Instruction::Trunc:
3039 SrcLength == DstLength && SrcBitSize > DstBitSize;
3040 case Instruction::ZExt:
3042 SrcLength == DstLength && SrcBitSize < DstBitSize;
3043 case Instruction::SExt:
3045 SrcLength == DstLength && SrcBitSize < DstBitSize;
3046 case Instruction::FPTrunc:
3048 SrcLength == DstLength && SrcBitSize > DstBitSize;
3049 case Instruction::FPExt:
3051 SrcLength == DstLength && SrcBitSize < DstBitSize;
3052 case Instruction::UIToFP:
3053 case Instruction::SIToFP:
3055 SrcLength == DstLength;
3056 case Instruction::FPToUI:
3057 case Instruction::FPToSI:
3059 SrcLength == DstLength;
3060 case Instruction::PtrToInt:
3061 if (isa<VectorType>(SrcTy) != isa<VectorType>(DstTy))
3063 if (
VectorType *VT = dyn_cast<VectorType>(SrcTy))
3064 if (VT->getNumElements() != cast<VectorType>(DstTy)->getNumElements())
3067 case Instruction::IntToPtr:
3068 if (isa<VectorType>(SrcTy) != isa<VectorType>(DstTy))
3070 if (
VectorType *VT = dyn_cast<VectorType>(SrcTy))
3071 if (VT->getNumElements() != cast<VectorType>(DstTy)->getNumElements())
3074 case Instruction::BitCast: {
3080 if (!SrcPtrTy != !DstPtrTy)
3095 if (SrcVecTy && DstVecTy)
3096 return (SrcVecTy->
getNumElements() == DstVecTy->getNumElements());
3100 return DstVecTy->getNumElements() == 1;
3104 case Instruction::AddrSpaceCast: {
3116 if (
VectorType *SrcVecTy = dyn_cast<VectorType>(SrcTy)) {
3117 if (
VectorType *DstVecTy = dyn_cast<VectorType>(DstTy))
3118 return (SrcVecTy->getNumElements() == DstVecTy->getNumElements());
3130 ) :
CastInst(Ty, Trunc, S, Name, InsertBefore) {
3136 ) :
CastInst(Ty, Trunc, S, Name, InsertAtEnd) {
3142 ) :
CastInst(Ty, ZExt, S, Name, InsertBefore) {
3148 ) :
CastInst(Ty, ZExt, S, Name, InsertAtEnd) {
3153 ) :
CastInst(Ty, SExt, S, Name, InsertBefore) {
3159 ) :
CastInst(Ty, SExt, S, Name, InsertAtEnd) {
3165 ) :
CastInst(Ty, FPTrunc, S, Name, InsertBefore) {
3171 ) :
CastInst(Ty, FPTrunc, S, Name, InsertAtEnd) {
3177 ) :
CastInst(Ty, FPExt, S, Name, InsertBefore) {
3183 ) :
CastInst(Ty, FPExt, S, Name, InsertAtEnd) {
3189 ) :
CastInst(Ty, UIToFP, S, Name, InsertBefore) {
3195 ) :
CastInst(Ty, UIToFP, S, Name, InsertAtEnd) {
3201 ) :
CastInst(Ty, SIToFP, S, Name, InsertBefore) {
3207 ) :
CastInst(Ty, SIToFP, S, Name, InsertAtEnd) {
3213 ) :
CastInst(Ty, FPToUI, S, Name, InsertBefore) {
3219 ) :
CastInst(Ty, FPToUI, S, Name, InsertAtEnd) {
3225 ) :
CastInst(Ty, FPToSI, S, Name, InsertBefore) {
3231 ) :
CastInst(Ty, FPToSI, S, Name, InsertAtEnd) {
3237 ) :
CastInst(Ty, PtrToInt, S, Name, InsertBefore) {
3243 ) :
CastInst(Ty, PtrToInt, S, Name, InsertAtEnd) {
3249 ) :
CastInst(Ty, IntToPtr, S, Name, InsertBefore) {
3255 ) :
CastInst(Ty, IntToPtr, S, Name, InsertAtEnd) {
3261 ) :
CastInst(Ty, BitCast, S, Name, InsertBefore) {
3267 ) :
CastInst(Ty, BitCast, S, Name, InsertAtEnd) {
3273 ) :
CastInst(Ty, AddrSpaceCast, S, Name, InsertBefore) {
3279 ) :
CastInst(Ty, AddrSpaceCast, S, Name, InsertAtEnd) {
3317 if (Op == Instruction::ICmp) {
3337 if (Op == Instruction::ICmp) {
3346 if (
ICmpInst *IC = dyn_cast<ICmpInst>(
this))
3353 if (
const ICmpInst *IC = dyn_cast<ICmpInst>(
this))
3354 return IC->isCommutative();
3359 if (
const ICmpInst *IC = dyn_cast<ICmpInst>(
this))
3360 return IC->isEquality();
3399 default:
return "unknown";
3518 default:
return pred;
3540 switch (predicate) {
3541 default:
return false;
3548 switch (predicate) {
3549 default:
return false;
3556 switch (predicate) {
3557 default:
return false;
3565 switch (predicate) {
3566 default:
return false;
3575 default:
return false;
3585 default:
return false;
3623 assert(Value && Default && NumReserved);
3624 ReservedSpace = NumReserved;
3636 SwitchInst::SwitchInst(Value *Value,
BasicBlock *Default,
unsigned NumCases,
3639 nullptr, 0, InsertBefore) {
3640 init(Value, Default, 2+NumCases*2);
3647 SwitchInst::SwitchInst(Value *Value,
BasicBlock *Default,
unsigned NumCases,
3650 nullptr, 0, InsertAtEnd) {
3651 init(Value, Default, 2+NumCases*2);
3662 OL[i+1] = InOL[i+1];
3670 unsigned NewCaseIdx = getNumCases();
3672 if (OpNo+2 > ReservedSpace)
3675 assert(OpNo+1 < ReservedSpace &&
"Growing didn't work!");
3685 unsigned idx = I->getCaseIndex();
3693 if (2 + (idx + 1) * 2 != NumOps) {
3694 OL[2 + idx * 2] = OL[NumOps - 2];
3695 OL[2 + idx * 2 + 1] = OL[NumOps - 1];
3699 OL[NumOps-2].
set(
nullptr);
3700 OL[NumOps-2+1].
set(
nullptr);
3703 return CaseIt(
this, idx);
3709 void SwitchInst::growOperands() {
3711 unsigned NumOps = e*3;
3713 ReservedSpace = NumOps;
3721 void IndirectBrInst::init(Value *
Address,
unsigned NumDests) {
3723 "Address of indirectbr must be a pointer");
3724 ReservedSpace = 1+NumDests;
3735 void IndirectBrInst::growOperands() {
3737 unsigned NumOps = e*2;
3739 ReservedSpace = NumOps;
3743 IndirectBrInst::IndirectBrInst(Value *Address,
unsigned NumCases,
3746 Instruction::IndirectBr,
nullptr, 0, InsertBefore) {
3747 init(Address, NumCases);
3750 IndirectBrInst::IndirectBrInst(Value *Address,
unsigned NumCases,
3753 Instruction::IndirectBr,
nullptr, 0, InsertAtEnd) {
3754 init(Address, NumCases);
3772 if (OpNo+1 > ReservedSpace)
3775 assert(OpNo < ReservedSpace &&
"Growing didn't work!");
3789 OL[idx+1] = OL[NumOps-1];
3792 OL[NumOps-1].
set(
nullptr);
3854 getSuccessOrdering(), getFailureOrdering(),
3864 getOrdering(), getSyncScopeID());
3926 if (hasOperandBundles()) {
3927 unsigned DescriptorBytes = getNumOperandBundles() *
sizeof(
BundleOpInfo);
3974 if (hasOperandBundles()) {
3975 unsigned DescriptorBytes = getNumOperandBundles() *
sizeof(
BundleOpInfo);
bool isIdentityWithExtract() const
Return true if this shuffle extracts the first N elements of exactly one source vector.
Return a value (possibly void), from a function.
SymbolTableList< Instruction >::iterator eraseFromParent()
This method unlinks 'this' from the containing basic block and deletes it.
Predicate getNonStrictPredicate() const
For example, SGT -> SGE, SLT -> SLE, ULT -> ULE, UGT -> UGE.
A parsed version of the target data layout string in and methods for querying it. ...
constexpr char Align[]
Key for Kernel::Arg::Metadata::mAlign.
This class is the base class for the comparison instructions.
FuncletPadInst * cloneImpl() const
static IntegerType * getInt1Ty(LLVMContext &C)
StoreInst * cloneImpl() const
*p = old <signed v ? old : v
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)
Atomic ordering constants.
This class represents lattice values for constants.
BinaryOps getOpcode() const
unsigned getSubclassDataFromInstruction() const
void swapSuccessors()
Swap the successors of this branch instruction.
bool isAtomic() const
Return true if this instruction has an AtomicOrdering of unordered or higher.
Type * getParamType(unsigned i) const
Parameter type accessors.
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.
IndirectBrInst * cloneImpl() const
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. ...
bool isSized(SmallPtrSetImpl< Type *> *Visited=nullptr) const
Return true if it makes sense to take the size of this type.
void setAlignment(unsigned Align)
An instruction for ordering other memory operations.
an instruction that atomically checks whether a specified value is in a memory location, and, if it is, stores a new value there.
Function * getCaller()
Helper to get the caller (the parent function).
static CallInst * Create(FunctionType *Ty, Value *F, const Twine &NameStr="", Instruction *InsertBefore=nullptr)
bool isIntegerCast() const
There are several places where we need to know if a cast instruction only deals with integer source a...
BitCastInst * cloneImpl() const
Clone an identical BitCastInst.
This class represents zero extension of integer types.
void push_back(const T &Elt)
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)
ShuffleVectorInst * cloneImpl() const
This class represents a function call, abstracting a target machine's calling convention.
bool isIdentityWithPadding() const
Return true if this shuffle lengthens exactly one source vector with undefs in the high elements...
Value * getCondition() const
*p = old <unsigned v ? old : v
float convertToFloat() const
void setVolatile(bool V)
Specify whether this is a volatile cmpxchg.
0 1 0 0 True if ordered and less than
FenceInst * cloneImpl() const
void removeHandler(handler_iterator HI)
*p = old >unsigned v ? old : v
This instruction constructs a fixed permutation of two input vectors.
static SelectInst * Create(Value *C, Value *S1, Value *S2, const Twine &NameStr="", Instruction *InsertBefore=nullptr, Instruction *MDFrom=nullptr)
LLVMContext & getContext() const
All values hold a context through their type.
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.
static bool isOrdered(Predicate predicate)
Determine if the predicate is an ordered operation.
SIToFPInst * cloneImpl() const
Clone an identical SIToFPInst.
Base class for all callable instructions (InvokeInst and CallInst) Holds everything related to callin...
User::op_iterator arg_end()
Return the iterator pointing to the end of the argument list.
CatchSwitchInst * cloneImpl() const
const MDOperand & getOperand(unsigned I) const
FenceInst(LLVMContext &C, AtomicOrdering Ordering, SyncScope::ID SSID=SyncScope::System, Instruction *InsertBefore=nullptr)
This class represents a sign extension of integer types.
unsigned getPointerAddressSpace() const
Get the address space of this pointer or pointer vector type.
An instruction for reading from memory.
an instruction that atomically reads a memory location, combines it with another value, and then stores the result back.
static bool isReverseMask(ArrayRef< int > Mask)
Return true if this shuffle mask swaps the order of elements from exactly one source vector...
bool isVectorTy() const
True if this is an instance of VectorType.
InsertElementInst * cloneImpl() const
static Instruction * CreateFree(Value *Source, Instruction *InsertBefore)
Generate the IR for a call to the builtin free function.
void setAtomic(AtomicOrdering Ordering, SyncScope::ID SSID=SyncScope::System)
Sets the ordering constraint and the synchronization scope ID of this store instruction.
void copyIRFlags(const Value *V, bool IncludeWrapFlags=true)
Convenience method to copy supported exact, fast-math, and (optionally) wrapping flags from V to this...
*p = old >signed v ? old : v
bool isIndirectCall() const
Return true if the callsite is an indirect call.
bool isReturnNonNull() const
Return true if the return value is known to be not null.
LLVMContext & getContext() const
Get the context in which this basic block lives.
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...
ICmpInst * cloneImpl() const
Clone an identical ICmpInst.
void setVolatile(bool V)
Specify whether this is a volatile RMW or not.
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()
bool hasRetAttr(Attribute::AttrKind Kind) const
Determine whether the return value has the given attribute.
Predicate getSignedPredicate()
For example, ULT->SLT, ULE->SLE, UGT->SGT, UGE->SGE, SLT->Failed assert.
CmpInst(Type *ty, Instruction::OtherOps op, Predicate pred, Value *LHS, Value *RHS, const Twine &Name="", Instruction *InsertBefore=nullptr, Instruction *FlagsSource=nullptr)
bool indexValid(const Value *V) const
bool swapOperands()
Exchange the two operands to this instruction.
AllocaInst * cloneImpl() const
SwitchInst * cloneImpl() const
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 uint32_t getAlignment(const MCSectionCOFF &Sec)
bool isVolatile() const
Return true if this is a load from a volatile memory location.
This class represents a conversion between pointers from one address space to another.
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...
amdgpu Simplify well known AMD library false Value Value const Twine & Name
Value * removeIncomingValue(unsigned Idx, bool DeletePHIIfEmpty=true)
Remove an incoming value.
Used to keep track of an operand bundle.
This class represents the LLVM 'select' instruction.
Predicate getInversePredicate() const
For example, EQ -> NE, UGT -> ULE, SLT -> SGE, OEQ -> UNE, UGT -> OLE, OLT -> UGE, etc.
Type * getPointerElementType() const
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...
unsigned getAlignment() const
Return the alignment of the memory that is being allocated by the instruction.
This is the base class for all instructions that perform data casts.
unsigned getPointerTypeSizeInBits(Type *) const
Layout pointer size, in bits, based on the type.
PointerType * getType() const
Overload to return most specific pointer type.
CatchReturnInst * cloneImpl() const
bool isFloatingPointTy() const
Return true if this is one of the six floating-point types.
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.
TailCallKind getTailCallKind() const
PtrToIntInst * cloneImpl() const
Clone an identical PtrToIntInst.
bool isCommutative() const
This is just a convenience that dispatches to the subclasses.
Class to represent struct types.
LLVMContext & getContext() const
Get the global data context.
bundle_op_iterator bundle_op_info_end()
Return the end of the list of BundleOpInfo instances associated with this OperandBundleUser.
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.
bool isIntegerTy() const
True if this is an instance of IntegerType.
static bool isImpliedTrueByMatchingCmp(Predicate Pred1, Predicate Pred2)
Determine if Pred1 implies Pred2 is true when two compares have matching operands.
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...
void setName(const Twine &Name)
Change the name of the value.
uint64_t getNumElements() const
static const unsigned MaximumAlignment
block_iterator block_begin()
bool paramHasAttr(unsigned ArgNo, Attribute::AttrKind Kind) const
Determine whether the argument or parameter has the given attribute.
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...
static StringRef getOperationName(BinOp Op)
bool isOne() const
This is just a convenience method to make client code smaller for a common case.
OtherOps getOpcode() const
Get the opcode casted to the right type.
Class to represent function types.
static bool isIdentityMask(ArrayRef< int > Mask)
Return true if this shuffle mask chooses elements from exactly one source vector without lane crossin...
Instruction::CastOps getOpcode() const
Return the opcode of this CastInst.
Type * getType() const
All values are typed, get the type of this value.
bool isFirstClassType() const
Return true if the type is "first class", meaning it is a valid type for a Value. ...
LandingPadInst * getLandingPadInst() const
Get the landingpad instruction from the landing pad block (the unwind destination).
bool isInBounds() const
Determine whether the GEP has the inbounds flag.
BinOp
This enumeration lists the possible modifications atomicrmw can make.
bool isSwiftError() const
Return true if this value is a swifterror value.
Class to represent array types.
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.
AddrSpaceCastInst * cloneImpl() const
Clone an identical AddrSpaceCastInst.
UnreachableInst * cloneImpl() const
LandingPadInst * cloneImpl() const
This class represents a no-op cast from one type to another.
static Instruction * createFree(Value *Source, ArrayRef< OperandBundleDef > Bundles, Instruction *InsertBefore, BasicBlock *InsertAtEnd)
MDNode * getMetadata(unsigned KindID) const
Get the metadata of given kind attached to this Instruction.
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)...
SIToFPInst(Value *S, Type *Ty, const Twine &NameStr="", Instruction *InsertBefore=nullptr)
Constructor with insert-before-instruction semantics.
unsigned getOpcode() const
Returns a member of one of the enums like Instruction::Add.
FPToSIInst(Value *S, Type *Ty, const Twine &NameStr="", Instruction *InsertBefore=nullptr)
Constructor with insert-before-instruction semantics.
An instruction for storing to memory.
bool isIntOrIntVectorTy() const
Return true if this is an integer type or a vector of integer types.
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.
Value * getParentPad() const
LoadInst * cloneImpl() const
constexpr char Attrs[]
Key for Kernel::Metadata::mAttrs.
This class represents a truncation of integer types.
std::enable_if<!is_simple_type< Y >::value, typename cast_retty< X, const Y >::ret_type >::type cast(const Y &Val)
Value * getOperand(unsigned i) const
Class to represent pointers.
TruncInst * cloneImpl() const
Clone an identical TruncInst.
static bool isExtractSubvectorMask(ArrayRef< int > Mask, int NumSrcElts, int &Index)
Return true if this shuffle mask is an extract subvector mask.
FPTruncInst(Value *S, Type *Ty, const Twine &NameStr="", Instruction *InsertBefore=nullptr)
Constructor with insert-before-instruction semantics.
Constant * getAggregateElement(unsigned Elt) const
For aggregates (struct/array/vector) return the constant that corresponds to the specified element if...
Type * getScalarType() const
If this is a vector type, return the element type, otherwise return 'this'.
static bool isSingleSourceMaskImpl(ArrayRef< int > Mask, int NumOpElts)
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 isVoidTy() const
Return true if this is 'void'.
an instruction for type-safe pointer arithmetic to access elements of arrays and structs ...
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...
ReturnInst * cloneImpl() const
initializer< Ty > init(const Ty &Val)
This instruction inserts a single (scalar) element into a VectorType value.
const Use * getOperandList() const
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...
static GCRegistry::Add< OcamlGC > B("ocaml", "ocaml 3.10-compatible GC")
op_iterator populateBundleOperandInfos(ArrayRef< OperandBundleDef > Bundles, const unsigned BeginIndex)
Populate the BundleOpInfo instances and the Use& vector from Bundles.
constexpr bool isPowerOf2_32(uint32_t Value)
Return true if the argument is a power of two > 0.
Value * getCalledValue() const
LLVM Basic Block Representation.
The instances of the Type class are immutable: once they are created, they are never changed...
static bool isNoopCast(Instruction::CastOps Opcode, Type *SrcTy, Type *DstTy, const DataLayout &DL)
A no-op cast is one that can be effected without changing any bits.
This is an important class for using LLVM in a threaded context.
UnreachableInst(LLVMContext &C, Instruction *InsertBefore=nullptr)
Conditional or Unconditional Branch instruction.
PowerPC Reduce CR logical Operation
void setSyncScopeID(SyncScope::ID SSID)
Sets the synchronization scope ID of this store instruction.
size_t size() const
size - Get the array size.
This function has undefined behavior.
static GCRegistry::Add< CoreCLRGC > E("coreclr", "CoreCLR-compatible GC")
This is an important base class in LLVM.
Resume the propagation of an exception.
PHINode * cloneImpl() const
static StringRef getPredicateName(Predicate P)
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.
SelectInst * cloneImpl() const
bool isPointerTy() const
True if this is an instance of PointerType.
Indirect Branch Instruction.
unsigned getNumParams() const
Return the number of fixed parameters this function type requires.
ConstantFP - Floating Point Values [float, double].
BasicBlock * getDefaultDest() const
static bool isBitCastable(Type *SrcTy, Type *DestTy)
Check whether a bitcast between these types is valid.
static Type * getVoidTy(LLVMContext &C)
UIToFPInst * cloneImpl() const
Clone an identical UIToFPInst.
This instruction compares its operands according to the predicate given to the constructor.
Predicate
This enumeration lists the possible predicates for CmpInst subclasses.
void setCallingConv(CallingConv::ID CC)
void addClause(Constant *ClauseVal)
Add a catch or filter clause to the landing pad.
BinaryOperator * cloneImpl() 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.
unsigned getAddressSpace() const
Return the address space of the Pointer type.
bool isX86_MMXTy() const
Return true if this is X86 MMX.
static bool isZeroEltSplatMask(ArrayRef< int > Mask)
Return true if this shuffle mask chooses all elements with the same value as the first element of exa...
FPExtInst * cloneImpl() const
Clone an identical FPExtInst.
AtomicRMWInst(BinOp Operation, Value *Ptr, Value *Val, AtomicOrdering Ordering, SyncScope::ID SSID, Instruction *InsertBefore=nullptr)
static CastInst * CreatePointerCast(Value *S, Type *Ty, const Twine &Name, BasicBlock *InsertAtEnd)
Create a BitCast AddrSpaceCast, or a PtrToInt cast instruction.
void setTailCallKind(TailCallKind TCK)
CaseIt removeCase(CaseIt I)
This method removes the specified case and its successor from the switch instruction.
void setAlignment(unsigned Align)
VAArgInst * cloneImpl() const
bool hasConstantOrUndefValue() const
Whether the specified PHI node always merges together the same value, assuming undefs are equal to a ...
This class represents a cast from an integer to a pointer.
static Constant * getAllOnesValue(Type *Ty)
1 1 1 1 Always true (always folded)
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...
ShuffleVectorInst(Value *V1, Value *V2, Value *Mask, const Twine &NameStr="", Instruction *InsertBefor=nullptr)
void setTailCall(bool isTC=true)
BranchInst * cloneImpl() const
static UndefValue * get(Type *T)
Static factory methods - Return an 'undef' object of the specified type.
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.
const Value * getArraySize() const
Get the number of elements allocated.
static UnaryOperator * Create(UnaryOps Op, Value *S, const Twine &Name=Twine(), Instruction *InsertBefore=nullptr)
Construct a unary instruction, given the opcode and an operand.
static CastInst * CreateZExtOrBitCast(Value *S, Type *Ty, const Twine &Name="", Instruction *InsertBefore=nullptr)
Create a ZExt or BitCast cast instruction.
static bool isSelectMask(ArrayRef< int > Mask)
Return true if this shuffle mask chooses elements from its source vectors without lane crossings...
static PointerType * getInt8PtrTy(LLVMContext &C, unsigned AS=0)
static int getMaskValue(const Constant *Mask, unsigned Elt)
Return the shuffle mask value for the specified element of the mask.
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...
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
void swapOperands()
This is just a convenience that dispatches to the subclasses.
unsigned char SubclassOptionalData
Hold subclass data that can be dropped.
UnaryOperator(UnaryOps iType, Value *S, Type *Ty, const Twine &Name, Instruction *InsertBefore)
LLVMContextImpl *const pImpl
Type * getAllocatedType() const
Return the type that is being allocated by the instruction.
Value * getParentPad() const
Convenience accessors.
Optional< uint64_t > getAllocationSizeInBits(const DataLayout &DL) const
Get allocation size in bits.
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.
const APFloat & getValueAPF() const
static Instruction * createMalloc(Instruction *InsertBefore, BasicBlock *InsertAtEnd, Type *IntPtrTy, Type *AllocTy, Value *AllocSize, Value *ArraySize, ArrayRef< OperandBundleDef > OpB, Function *MallocF, const Twine &Name)
0 0 1 0 True if ordered and greater than
BasicBlock * getNormalDest() const
InsertValueInst * cloneImpl() const
Value * hasConstantValue() const
If the specified PHI node always merges together the same value, return the value, otherwise return null.
static BinaryOperator * CreateFNeg(Value *Op, const Twine &Name="", Instruction *InsertBefore=nullptr)
bool isPtrOrPtrVectorTy() const
Return true if this is a pointer type or a vector of pointer types.
const InstListType & getInstList() const
Return the underlying instruction list container.
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.
unsigned getNumOperands() const
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.
UnaryOperator * cloneImpl() const
bool hasUnwindDest() const
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.
1 1 0 0 True if unordered or less than
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small...
Module.h This file contains the declarations for the Module class.
static bool isCastable(Type *SrcTy, Type *DestTy)
Check whether it is valid to call getCastOpcode for these types.
bool isAggregateType() const
Return true if the type is an aggregate type.
BasicBlock * getUnwindDest() const
Type * getReturnType() const
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.
static CastInst * CreateFPCast(Value *S, Type *Ty, const Twine &Name="", Instruction *InsertBefore=nullptr)
Create an FPExt, BitCast, or FPTrunc for fp -> fp casts.
static bool isTransposeMask(ArrayRef< int > Mask)
Return true if this shuffle mask is a transpose mask.
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.
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.
Predicate getSignedPredicate() const
For example, EQ->EQ, SLE->SLE, UGT->SGT, etc.
SExtInst(Value *S, Type *Ty, const Twine &NameStr="", Instruction *InsertBefore=nullptr)
Constructor with insert-before-instruction semantics.
IntToPtrInst * cloneImpl() const
Clone an identical IntToPtrInst.
AttributeList getAttributes() const
Return the parameter attributes for this call.
static const Function * getCalledFunction(const Value *V, bool LookThroughBitCast, bool &IsNoBuiltin)
bool NullPointerIsDefined(const Function *F, unsigned AS=0)
Check whether null pointer dereferencing is considered undefined behavior for a given function or an ...
bool isCommutative() const
Return true if the instruction is commutative:
void setPredicate(Predicate P)
Set the predicate for this instruction to the specified value.
Predicate getFlippedStrictnessPredicate() const
For predicate of kind "is X or equal to 0" returns the predicate "is X".
CleanupReturnInst * cloneImpl() const
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.
unsigned getVectorNumElements() const
bool isTrueWhenEqual() const
This is just a convenience.
Class to represent vector types.
void setVolatile(bool V)
Specify whether this is a volatile store or not.
Class for arbitrary precision integers.
BinaryOperator(BinaryOps iType, Value *S1, Value *S2, Type *Ty, const Twine &Name, Instruction *InsertBefore)
bool isFalseWhenEqual() const
This is just a convenience.
void push_back(pointer val)
static bool isWeak(const MCSymbolELF &Sym)
bool isCleanup() const
Return 'true' if this landingpad instruction is a cleanup.
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)
ZExtInst(Value *S, Type *Ty, const Twine &NameStr="", Instruction *InsertBefore=nullptr)
Constructor with insert-before-instruction semantics.
BitCastInst(Value *S, Type *Ty, const Twine &NameStr="", Instruction *InsertBefore=nullptr)
Constructor with insert-before-instruction semantics.
AtomicCmpXchgInst * cloneImpl() const
Common super class of ArrayType, StructType and VectorType.
bool isNonIntegralPointerType(PointerType *PT) const
void setSwiftError(bool V)
Specify whether this alloca is used to represent a swifterror.
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:
LoadInst(Type *Ty, Value *Ptr, const Twine &NameStr="", Instruction *InsertBefore=nullptr)
GetElementPtrInst * cloneImpl() const
User::op_iterator arg_begin()
Return the iterator pointing to the beginning of the argument list.
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 ...
Predicate getPredicate() const
Return the predicate for this instruction.
bool isVolatile() const
Return true if this is a store to a volatile memory location.
const DebugLoc & getDebugLoc() const
Return the debug location for this node as a DebugLoc.
unsigned getAlignment() const
Return the alignment of the access that is being performed.
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...
static IntegerType * getInt32Ty(LLVMContext &C)
bool accumulateConstantOffset(const DataLayout &DL, APInt &Offset) const
Accumulate the constant address offset of this GEP if possible.
static CastInst * CreateTruncOrBitCast(Value *S, Type *Ty, const Twine &Name="", Instruction *InsertBefore=nullptr)
Create a Trunc or BitCast cast instruction.
UnaryOps getOpcode() const
ZExtInst * cloneImpl() const
Clone an identical ZExtInst.
unsigned greater or equal
AttributeList Attrs
parameter attributes for callable
static bool isUnordered(Predicate predicate)
Determine if the predicate is an unordered operation.
static InvokeInst * Create(FunctionType *Ty, Value *Func, BasicBlock *IfNormal, BasicBlock *IfException, ArrayRef< Value *> Args, const Twine &NameStr, Instruction *InsertBefore=nullptr)
bool isTokenTy() const
Return true if this is 'token'.
CallingConv::ID getCallingConv() const
void setSyncScopeID(SyncScope::ID SSID)
Sets the synchronization scope ID of this fence instruction.
float getFPAccuracy() const
Get the maximum error permitted by this operation in ULPs.
static bool isIdentityMaskImpl(ArrayRef< int > Mask, int NumOpElts)
StringRef getName() const
Return a constant reference to the value's name.
const Function * getParent() const
Return the enclosing method, or null if none.
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.
Value * getReturnedArgOperand() const
If one of the arguments has the 'returned' attribute, returns its operand value.
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.
FCmpInst * cloneImpl() const
Clone an identical FCmpInst.
0 1 1 0 True if ordered and operands are unequal
AtomicRMWInst * cloneImpl() const
FPToSIInst * cloneImpl() const
Clone an identical FPToSIInst.
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)
1 0 1 0 True if unordered or greater than
unsigned getAlignment() const
Return the alignment of the access that is being performed.
void addDestination(BasicBlock *Dest)
Add a destination.
Instruction(const Instruction &)=delete
bool isFPOrFPVectorTy() const
Return true if this is a FP type or a vector of FP.
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 isArrayAllocation() const
Return true if there is an allocation size parameter to the allocation instruction that is not 1...
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
SExtInst * cloneImpl() const
Clone an identical SExtInst.
const BasicBlock & front() const
SmallVector< int, 16 > getShuffleMask() const
bool isConcat() const
Return true if this shuffle concatenates its 2 source vectors.
This class represents a truncation of floating point types.
BasicBlock * getUnwindDest() const
unsigned getPrimitiveSizeInBits() const LLVM_READONLY
Return the basic size of this type if it is a primitive type.
0 0 0 1 True if ordered and equal
LLVM Value Representation.
void setAlignment(unsigned Align)
bool isEquality() const
This is just a convenience that dispatches to the subclasses.
FPExtInst(Value *S, Type *Ty, const Twine &NameStr="", Instruction *InsertBefore=nullptr)
Constructor with insert-before-instruction semantics.
1 0 1 1 True if unordered, greater than, or equal
static bool isSingleSourceMask(ArrayRef< int > Mask)
Return true if this shuffle mask chooses elements from exactly one source vector. ...
void allocHungoffUses(unsigned N, bool IsPhi=false)
Allocate the array of Uses, followed by a pointer (with bottom bit set) to the User.
Synchronized with respect to all concurrently executing threads.
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)
ResumeInst * cloneImpl() const
StoreInst(Value *Val, Value *Ptr, Instruction *InsertBefore)
bundle_op_iterator bundle_op_info_begin()
Return the start of the list of BundleOpInfo instances associated with this OperandBundleUser.
FPTruncInst * cloneImpl() const
Clone an identical FPTruncInst.
uint64_t getTypeAllocSizeInBits(Type *Ty) const
Returns the offset in bits between successive objects of the specified type, including alignment padd...
void setSuccessor(BasicBlock *S)
Sets the new successor for current case.
StringRef - Represent a constant reference to a string, i.e.
Predicate getSwappedPredicate() const
For example, EQ->EQ, SLE->SGE, ULT->UGT, OEQ->OEQ, ULE->UGE, OLT->OGT, etc.
static bool isVolatile(Instruction *Inst)
bool isStaticAlloca() const
Return true if this alloca is in the entry block of the function and is a constant size...
void setNumHungOffUseOperands(unsigned NumOps)
Subclasses with hung off uses need to manage the operand count themselves.
bool hasAllZeroIndices() const
Return true if all of the indices of this GEP are zeros.
static Constant * getMul(Constant *C1, Constant *C2, bool HasNUW=false, bool HasNSW=false)
static BinaryOperator * CreateMul(Value *S1, Value *S2, const Twine &Name, Instruction *InsertBefore, Value *FlagsOp)
This class represents an extension of floating point types.
OutputIt copy(R &&Range, OutputIt Out)
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.
Predicate getUnsignedPredicate() const
For example, EQ->EQ, SLE->ULE, UGT->UGT, etc.
VectorType * getType() const
Overload to return most specific vector type.
void removeDestination(unsigned i)
This method removes the specified successor from the indirectbr instruction.
constexpr char Args[]
Key for Kernel::Metadata::mArgs.
CallInst * cloneImpl() const
bool isLosslessCast() const
A lossless cast is one that does not alter the basic value.
0 0 0 0 Always false (always folded)
bool empty() const
empty - Check if the array is empty.
InvokeInst * cloneImpl() const
bool hasAllConstantIndices() const
Return true if all of the indices of this GEP are constant integers.
Type * getTypeAtIndex(const Value *V) const
Given an index value into the type, return the type of the element.
const BasicBlock * getParent() const
an instruction to allocate memory on the stack
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...
Intrinsic::ID getIntrinsicID() const
Returns the intrinsic ID of the intrinsic called or Intrinsic::not_intrinsic if the called function i...
FPToUIInst * cloneImpl() const
Clone an identical FPToUIInst.
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...