58 Size *=
C->getZExtValue();
70 ? cast<CallInst>(II)->
op_end() - 1
71 : cast<InvokeInst>(II)->
op_end() - 3;
80 #define HANDLE_TERM_INST(N, OPC, CLASS) \ 81 case Instruction::OPC: \ 82 return static_cast<const CLASS *>(this)->getNumSuccessors(); 83 #include "llvm/IR/Instruction.def" 92 #define HANDLE_TERM_INST(N, OPC, CLASS) \ 93 case Instruction::OPC: \ 94 return static_cast<const CLASS *>(this)->getSuccessor(idx); 95 #include "llvm/IR/Instruction.def" 104 #define HANDLE_TERM_INST(N, OPC, CLASS) \ 105 case Instruction::OPC: \ 106 return static_cast<CLASS *>(this)->setSuccessor(idx, B); 107 #include "llvm/IR/Instruction.def" 122 return "both values to select must have same type";
125 return "select values cannot have token type";
130 return "vector select condition element type must be i1";
133 return "selected values for vector select must be vectors";
135 return "vector select requires selected vectors to have " 136 "the same vector length as select condition";
138 return "select condition must be i1 or <n x i1>";
147 PHINode::PHINode(
const PHINode &PN)
159 Value *Removed = getIncomingValue(Idx);
167 std::copy(block_begin() + Idx + 1, block_end(), block_begin() + Idx);
170 Op<-1>().
set(
nullptr);
186 void PHINode::growOperands() {
188 unsigned NumOps = e + e / 2;
189 if (NumOps < 2) NumOps = 2;
191 ReservedSpace = NumOps;
199 Value *ConstantValue = getIncomingValue(0);
200 for (
unsigned i = 1, e = getNumIncomingValues(); i != e; ++i)
201 if (getIncomingValue(i) != ConstantValue && getIncomingValue(i) !=
this) {
202 if (ConstantValue !=
this)
205 ConstantValue = getIncomingValue(i);
207 if (ConstantValue ==
this)
209 return ConstantValue;
218 Value *ConstantValue =
nullptr;
219 for (
unsigned i = 0, e = getNumIncomingValues(); i != e; ++i) {
220 Value *Incoming = getIncomingValue(i);
221 if (Incoming !=
this && !isa<UndefValue>(Incoming)) {
222 if (ConstantValue && ConstantValue != Incoming)
224 ConstantValue = Incoming;
234 LandingPadInst::LandingPadInst(
Type *RetTy,
unsigned NumReservedValues,
236 :
Instruction(RetTy, Instruction::LandingPad,
nullptr, 0, InsertBefore) {
237 init(NumReservedValues, NameStr);
240 LandingPadInst::LandingPadInst(
Type *RetTy,
unsigned NumReservedValues,
242 :
Instruction(RetTy, Instruction::LandingPad,
nullptr, 0, InsertAtEnd) {
243 init(NumReservedValues, NameStr);
253 for (
unsigned I = 0,
E = ReservedSpace;
I !=
E; ++
I)
260 const Twine &NameStr,
262 return new LandingPadInst(RetTy, NumReservedClauses, NameStr, InsertBefore);
266 const Twine &NameStr,
268 return new LandingPadInst(RetTy, NumReservedClauses, NameStr, InsertAtEnd);
271 void LandingPadInst::init(
unsigned NumReservedValues,
const Twine &NameStr) {
272 ReservedSpace = NumReservedValues;
281 void LandingPadInst::growOperands(
unsigned Size) {
283 if (ReservedSpace >= e + Size)
return;
284 ReservedSpace = (
std::max(e, 1U) + Size / 2) * 2;
291 assert(OpNo < ReservedSpace &&
"Growing didn't work!");
304 "NumOperands not set up?");
310 "Calling a function with bad signature!");
312 for (
unsigned i = 0; i != Args.
size(); ++i)
315 "Calling a function with a bad signature!");
320 auto It = populateBundleOperandInfos(Bundles, Args.
size());
327 void CallInst::init(
Value *Func,
const Twine &NameStr) {
329 cast<FunctionType>(cast<PointerType>(Func->
getType())->getElementType());
341 cast<PointerType>(Func->
getType())->getElementType())
352 cast<PointerType>(Func->
getType())->getElementType())
359 CallInst::CallInst(
const CallInst &CI)
369 bundle_op_info_begin());
398 assert(val &&
"IsConstantOne does not work with nullptr val");
400 return CVal && CVal->
isOne();
409 assert(((!InsertBefore && InsertAtEnd) || (InsertBefore && !InsertAtEnd)) &&
410 "createMalloc needs either InsertBefore or InsertAtEnd");
418 else if (ArraySize->
getType() != IntPtrTy) {
429 AllocSize = ArraySize;
430 }
else if (
Constant *CO = dyn_cast<Constant>(ArraySize)) {
439 "mallocsize", InsertBefore);
442 "mallocsize", InsertAtEnd);
446 assert(AllocSize->
getType() == IntPtrTy &&
"malloc arg is wrong size");
449 Module *M = BB->getParent()->getParent();
451 Value *MallocFunc = MallocF;
462 if (Result->
getType() != AllocPtrType)
464 Result =
new BitCastInst(MCall, AllocPtrType, Name, InsertBefore);
468 if (Result->
getType() != AllocPtrType) {
471 Result =
new BitCastInst(MCall, AllocPtrType, Name);
475 if (
Function *
F = dyn_cast<Function>(MallocFunc)) {
477 if (!
F->returnDoesNotAlias())
478 F->setReturnDoesNotAlias();
496 return createMalloc(InsertBefore,
nullptr, IntPtrTy, AllocTy, AllocSize,
497 ArraySize,
None, MallocF, Name);
505 return createMalloc(InsertBefore,
nullptr, IntPtrTy, AllocTy, AllocSize,
506 ArraySize, OpB, MallocF, Name);
521 return createMalloc(
nullptr, InsertAtEnd, IntPtrTy, AllocTy, AllocSize,
522 ArraySize,
None, MallocF, Name);
529 return createMalloc(
nullptr, InsertAtEnd, IntPtrTy, AllocTy, AllocSize,
530 ArraySize, OpB, MallocF, Name);
537 assert(((!InsertBefore && InsertAtEnd) || (InsertBefore && !InsertAtEnd)) &&
538 "createFree needs either InsertBefore or InsertAtEnd");
540 "Can not free something of nonpointer type!");
543 Module *M = BB->getParent()->getParent();
552 if (Source->
getType() != IntPtrTy)
553 PtrCast =
new BitCastInst(Source, IntPtrTy,
"", InsertBefore);
556 if (Source->
getType() != IntPtrTy)
557 PtrCast =
new BitCastInst(Source, IntPtrTy,
"", InsertAtEnd);
561 if (
Function *
F = dyn_cast<Function>(FreeFunc))
574 return createFree(Source, Bundles, InsertBefore,
nullptr);
582 assert(FreeCall &&
"CreateFree did not create a CallInst");
589 assert(FreeCall &&
"CreateFree did not create a CallInst");
600 const Twine &NameStr) {
604 "NumOperands not set up?");
607 Op<-1>() = IfException;
612 "Invoking a function with bad signature");
614 for (
unsigned i = 0, e = Args.
size(); i != e; i++)
617 "Invoking a function with a bad signature!");
622 auto It = populateBundleOperandInfos(Bundles, Args.
size());
637 bundle_op_info_begin());
657 return cast<LandingPadInst>(getUnwindDest()->getFirstNonPHI());
670 Op<0>() = RI.
Op<0>();
702 Op<0>() = RI.
Op<0>();
727 Op<0>() = CRI.
Op<0>();
729 Op<1>() = CRI.
Op<1>();
732 void CleanupReturnInst::init(
Value *CleanupPad,
BasicBlock *UnwindBB) {
736 Op<0>() = CleanupPad;
741 CleanupReturnInst::CleanupReturnInst(
Value *CleanupPad,
BasicBlock *UnwindBB,
744 Instruction::CleanupRet,
746 Values, InsertBefore) {
747 init(CleanupPad, UnwindBB);
750 CleanupReturnInst::CleanupReturnInst(
Value *CleanupPad,
BasicBlock *UnwindBB,
753 Instruction::CleanupRet,
755 Values, InsertAtEnd) {
756 init(CleanupPad, UnwindBB);
770 Op<0>() = CRI.
Op<0>();
771 Op<1>() = CRI.
Op<1>();
794 CatchSwitchInst::CatchSwitchInst(
Value *ParentPad,
BasicBlock *UnwindDest,
795 unsigned NumReservedValues,
796 const Twine &NameStr,
802 init(ParentPad, UnwindDest, NumReservedValues + 1);
806 CatchSwitchInst::CatchSwitchInst(
Value *ParentPad,
BasicBlock *UnwindDest,
807 unsigned NumReservedValues,
813 init(ParentPad, UnwindDest, NumReservedValues + 1);
824 for (
unsigned I = 1,
E = ReservedSpace;
I !=
E; ++
I)
829 unsigned NumReservedValues) {
830 assert(ParentPad && NumReservedValues);
832 ReservedSpace = NumReservedValues;
839 setUnwindDest(UnwindDest);
845 void CatchSwitchInst::growOperands(
unsigned Size) {
848 if (ReservedSpace >= NumOperands + Size)
850 ReservedSpace = (NumOperands + Size / 2) * 2;
857 assert(OpNo < ReservedSpace &&
"Growing didn't work!");
865 for (
Use *CurDst = HI.
getCurrent(); CurDst != EndDst; ++CurDst)
866 *CurDst = *(CurDst + 1);
877 const Twine &NameStr) {
880 setParentPad(ParentPad);
899 init(ParentPad, Args, NameStr);
908 init(ParentPad, Args, NameStr);
918 nullptr, 0, InsertBefore) {
922 nullptr, 0, InsertAtEnd) {
929 void BranchInst::AssertOK() {
932 "May only branch on boolean predicates!");
939 assert(IfTrue &&
"Branch destination may not be null!");
960 assert(IfTrue &&
"Branch destination may not be null!");
977 BranchInst::BranchInst(
const BranchInst &BI) :
981 Op<-1>() = BI.
Op<-1>();
984 Op<-3>() = BI.
Op<-3>();
985 Op<-2>() = BI.
Op<-2>();
992 "Cannot swap successors of an unconditional branch");
1008 assert(!isa<BasicBlock>(Amt) &&
1009 "Passed basic block into allocation size parameter! Use other ctor");
1011 "Allocation array size is not an integer!");
1018 :
AllocaInst(Ty, AddrSpace, nullptr, Name, InsertBefore) {}
1022 :
AllocaInst(Ty, AddrSpace, nullptr, Name, InsertAtEnd) {}
1026 :
AllocaInst(Ty, AddrSpace, ArraySize, 0, Name, InsertBefore) {}
1030 :
AllocaInst(Ty, AddrSpace, ArraySize, 0, Name, InsertAtEnd) {}
1055 assert((Align & (Align-1)) == 0 &&
"Alignment is not a power of 2!");
1057 "Alignment is greater than MaximumAlignment!");
1065 return !CI->isOne();
1085 void LoadInst::AssertOK() {
1087 "Ptr must have pointer type.");
1089 "Alignment required for atomic load");
1100 :
LoadInst(Ty, Ptr, Name, isVolatile, 0, InsertBef) {}
1104 :
LoadInst(Ptr, Name, isVolatile, 0, InsertAE) {}
1109 SyncScope::
System, InsertBef) {}
1114 SyncScope::
System, InsertAE) {}
1120 assert(Ty == cast<PointerType>(Ptr->
getType())->getElementType());
1133 Load, Ptr, InsertAE) {
1143 Load, Ptr, InsertBef) {
1148 if (Name && Name[0])
setName(Name);
1153 Load, Ptr, InsertAE) {
1158 if (Name && Name[0])
setName(Name);
1164 assert(Ty == cast<PointerType>(Ptr->
getType())->getElementType());
1169 if (Name && Name[0])
setName(Name);
1175 Load, Ptr, InsertAE) {
1180 if (Name && Name[0])
setName(Name);
1184 assert((Align & (Align-1)) == 0 &&
"Alignment is not a power of 2!");
1186 "Alignment is greater than MaximumAlignment!");
1196 void StoreInst::AssertOK() {
1199 "Ptr must have pointer type!");
1202 &&
"Ptr must be a pointer to Val type!");
1204 "Alignment required for atomic store");
1215 :
StoreInst(val, addr, isVolatile, 0, InsertBefore) {}
1219 :
StoreInst(val, addr, isVolatile, 0, InsertAtEnd) {}
1224 SyncScope::
System, InsertBefore) {}
1229 SyncScope::
System, InsertAtEnd) {}
1264 assert((Align & (Align-1)) == 0 &&
"Alignment is not a power of 2!");
1266 "Alignment is greater than MaximumAlignment!");
1283 setSuccessOrdering(SuccessOrdering);
1284 setFailureOrdering(FailureOrdering);
1288 "All operands must be non-null!");
1290 "Ptr must have pointer type!");
1293 &&
"Ptr must be a pointer to Cmp type!");
1296 &&
"Ptr must be a pointer to NewVal type!");
1298 "AtomicCmpXchg instructions must be atomic!");
1300 "AtomicCmpXchg instructions must be atomic!");
1302 "AtomicCmpXchg failure argument shall be no stronger than the success " 1306 "AtomicCmpXchg failure ordering cannot include release semantics");
1318 Init(Ptr, Cmp, NewVal, SuccessOrdering, FailureOrdering, SSID);
1330 Init(Ptr, Cmp, NewVal, SuccessOrdering, FailureOrdering, SSID);
1343 setOrdering(Ordering);
1347 "All operands must be non-null!");
1349 "Ptr must have pointer type!");
1352 &&
"Ptr must be a pointer to Val type!");
1354 "AtomicRMW instructions must be atomic!");
1365 Init(Operation, Ptr, Val, Ordering, SSID);
1376 Init(Operation, Ptr, Val, Ordering, SSID);
1404 const Twine &Name) {
1406 "NumOperands not initialized?");
1417 SourceElementType(GEPI.SourceElementType),
1418 ResultElementType(GEPI.ResultElementType) {
1432 template <
typename IndexTy>
1435 if (IdxList.
empty())
1443 unsigned CurIdx = 1;
1444 for (; CurIdx != IdxList.
size(); ++CurIdx) {
1447 IndexTy
Index = IdxList[CurIdx];
1451 return CurIdx == IdxList.
size() ? Agg :
nullptr;
1473 if (!CI->isZero())
return false;
1493 cast<GEPOperator>(
this)->setIsInBounds(B);
1497 return cast<GEPOperator>(
this)->isInBounds();
1503 return cast<GEPOperator>(
this)->accumulateConstantOffset(DL, Offset);
1517 assert(isValidOperands(Val, Index) &&
1518 "Invalid extractelement instruction operands!");
1524 ExtractElementInst::ExtractElementInst(
Value *Val,
Value *Index,
1531 assert(isValidOperands(Val, Index) &&
1532 "Invalid extractelement instruction operands!");
1549 InsertElementInst::InsertElementInst(
Value *Vec,
Value *Elt,
Value *Index,
1555 assert(isValidOperands(Vec, Elt, Index) &&
1556 "Invalid insertelement instruction operands!");
1563 InsertElementInst::InsertElementInst(
Value *Vec,
Value *Elt,
Value *Index,
1569 assert(isValidOperands(Vec, Elt, Index) &&
1570 "Invalid insertelement instruction operands!");
1579 const Value *Index) {
1583 if (Elt->
getType() != cast<VectorType>(Vec->
getType())->getElementType())
1605 "Invalid shuffle vector instruction operands!");
1622 "Invalid shuffle vector instruction operands!");
1638 if (!MaskTy || !MaskTy->getElementType()->isIntegerTy(32))
1642 if (isa<UndefValue>(Mask) || isa<ConstantAggregateZero>(
Mask))
1645 if (
const auto *MV = dyn_cast<ConstantVector>(Mask)) {
1646 unsigned V1Size = cast<VectorType>(V1->
getType())->getNumElements();
1647 for (
Value *
Op : MV->operands()) {
1648 if (
auto *CI = dyn_cast<ConstantInt>(
Op)) {
1649 if (CI->uge(V1Size*2))
1651 }
else if (!isa<UndefValue>(
Op)) {
1658 if (
const auto *CDS = dyn_cast<ConstantDataSequential>(Mask)) {
1659 unsigned V1Size = cast<VectorType>(V1->
getType())->getNumElements();
1660 for (
unsigned i = 0, e = MaskTy->getNumElements(); i != e; ++i)
1661 if (CDS->getElementAsInteger(i) >= V1Size*2)
1670 if (
const auto *CE = dyn_cast<ConstantExpr>(Mask))
1671 if (CE->getOpcode() == Instruction::UserOp1)
1678 assert(i < Mask->
getType()->getVectorNumElements() &&
"Index out of range");
1679 if (
auto *CDS = dyn_cast<ConstantDataSequential>(Mask))
1680 return CDS->getElementAsInteger(i);
1682 if (isa<UndefValue>(C))
1684 return cast<ConstantInt>(
C)->getZExtValue();
1691 if (
auto *CDS = dyn_cast<ConstantDataSequential>(Mask)) {
1692 for (
unsigned i = 0; i != NumElts; ++i)
1693 Result.
push_back(CDS->getElementAsInteger(i));
1696 for (
unsigned i = 0; i != NumElts; ++i) {
1698 Result.
push_back(isa<UndefValue>(C) ? -1 :
1699 cast<ConstantInt>(C)->getZExtValue());
1704 assert(!Mask.
empty() &&
"Shuffle mask must contain elements");
1705 bool UsesLHS =
false;
1706 bool UsesRHS =
false;
1707 for (
int i = 0, NumElts = Mask.
size(); i < NumElts; ++i) {
1710 assert(Mask[i] >= 0 && Mask[i] < (NumElts * 2) &&
1711 "Out-of-bounds shuffle mask element");
1712 UsesLHS |= (Mask[i] < NumElts);
1713 UsesRHS |= (Mask[i] >= NumElts);
1714 if (UsesLHS && UsesRHS)
1717 assert((UsesLHS ^ UsesRHS) &&
"Should have selected from exactly 1 source");
1724 for (
int i = 0, NumElts = Mask.
size(); i < NumElts; ++i) {
1727 if (Mask[i] != i && Mask[i] != (NumElts + i))
1736 for (
int i = 0, NumElts = Mask.
size(); i < NumElts; ++i) {
1739 if (Mask[i] != (NumElts - 1 - i) && Mask[i] != (NumElts + NumElts - 1 - i))
1748 for (
int i = 0, NumElts = Mask.
size(); i < NumElts; ++i) {
1751 if (Mask[i] != 0 && Mask[i] != NumElts)
1761 for (
int i = 0, NumElts = Mask.
size(); i < NumElts; ++i) {
1764 if (Mask[i] != i && Mask[i] != (NumElts + i))
1778 int NumElts = Mask.
size();
1783 if (Mask[0] != 0 && Mask[0] != 1)
1788 if ((Mask[1] - Mask[0]) != NumElts)
1793 for (
int i = 2; i < NumElts; ++i) {
1794 int MaskEltVal = Mask[i];
1795 if (MaskEltVal == -1)
1797 int MaskEltPrevVal = Mask[i - 2];
1798 if (MaskEltVal - MaskEltPrevVal != 2)
1810 const Twine &Name) {
1817 assert(!Idxs.
empty() &&
"InsertValueInst must have at least one index");
1820 Val->
getType() &&
"Inserted value must match indexed type!");
1824 Indices.append(Idxs.
begin(), Idxs.
end());
1831 Indices(IVI.Indices) {
1846 assert(!Idxs.
empty() &&
"ExtractValueInst must have at least one index");
1848 Indices.append(Idxs.
begin(), Idxs.
end());
1854 Indices(EVI.Indices) {
1866 for (
unsigned Index : Idxs) {
1873 if (
ArrayType *AT = dyn_cast<ArrayType>(Agg)) {
1874 if (Index >= AT->getNumElements())
1876 }
else if (
StructType *
ST = dyn_cast<StructType>(Agg)) {
1877 if (Index >=
ST->getNumElements())
1884 Agg = cast<CompositeType>(Agg)->getTypeAtIndex(Index);
1886 return const_cast<Type*
>(Agg);
1919 void BinaryOperator::AssertOK() {
1921 (void)LHS; (void)RHS;
1923 "Binary operator operand types must match!");
1929 "Arithmetic operation should return same type as operands!");
1931 "Tried to create an integer operation on a non-integer type!");
1933 case FAdd:
case FSub:
1936 "Arithmetic operation should return same type as operands!");
1938 "Tried to create a floating-point operation on a " 1939 "non-floating-point type!");
1944 "Arithmetic operation should return same type as operands!");
1946 "Incorrect operand type (not integer) for S/UDIV");
1950 "Arithmetic operation should return same type as operands!");
1952 "Incorrect operand type (not floating point) for FDIV");
1957 "Arithmetic operation should return same type as operands!");
1959 "Incorrect operand type (not integer) for S/UREM");
1963 "Arithmetic operation should return same type as operands!");
1965 "Incorrect operand type (not floating point) for FREM");
1971 "Shift operation should return same type as operands!");
1973 "Tried to create a shift operation on a non-integral type!");
1978 "Logical operation should return same type as operands!");
1980 "Tried to create a logical operation on a non-integral type!");
1991 "Cannot create binary operator with two operands of differing type!");
2022 return BinaryOperator::CreateNSWSub(zero, Op, Name, InsertBefore);
2028 return BinaryOperator::CreateNSWSub(zero, Op, Name, InsertAtEnd);
2034 return BinaryOperator::CreateNUWSub(zero, Op, Name, InsertBefore);
2040 return BinaryOperator::CreateNUWSub(zero, Op, Name, InsertAtEnd);
2073 if (
const Constant *C = dyn_cast<Constant>(V))
2074 return C->isAllOnesValue();
2080 if (Bop->getOpcode() == Instruction::Sub)
2081 if (
Constant *C = dyn_cast<Constant>(Bop->getOperand(0)))
2082 return C->isNegativeZeroValue();
2088 if (Bop->getOpcode() == Instruction::FSub)
2089 if (
Constant *C = dyn_cast<Constant>(Bop->getOperand(0))) {
2090 if (!IgnoreZeroSign)
2092 return !IgnoreZeroSign ? C->isNegativeZeroValue() : C->isZeroValue();
2099 return (Bop->getOpcode() == Instruction::Xor &&
2106 return cast<BinaryOperator>(BinOp)->
getOperand(1);
2114 return cast<BinaryOperator>(BinOp)->
getOperand(1);
2122 assert(
isNot(BinOp) &&
"getNotArgument on non-'not' instruction!");
2143 Op<0>().
swap(Op<1>());
2167 default:
return false;
2168 case Instruction::ZExt:
2169 case Instruction::SExt:
2170 case Instruction::Trunc:
2172 case Instruction::BitCast:
2180 if (
getOpcode() != Instruction::BitCast)
2209 case Instruction::Trunc:
2210 case Instruction::ZExt:
2211 case Instruction::SExt:
2212 case Instruction::FPTrunc:
2213 case Instruction::FPExt:
2214 case Instruction::UIToFP:
2215 case Instruction::SIToFP:
2216 case Instruction::FPToUI:
2217 case Instruction::FPToSI:
2218 case Instruction::AddrSpaceCast:
2221 case Instruction::BitCast:
2223 case Instruction::PtrToInt:
2226 case Instruction::IntToPtr:
2247 Type *DstIntPtrTy) {
2278 const unsigned numCastOps =
2279 Instruction::CastOpsEnd - Instruction::CastOpsBegin;
2280 static const uint8_t CastResults[numCastOps][numCastOps] = {
2286 { 1, 0, 0,99,99, 0, 0,99,99,99, 0, 3, 0},
2287 { 8, 1, 9,99,99, 2,17,99,99,99, 2, 3, 0},
2288 { 8, 0, 1,99,99, 0, 2,99,99,99, 0, 3, 0},
2289 { 0, 0, 0,99,99, 0, 0,99,99,99, 0, 3, 0},
2290 { 0, 0, 0,99,99, 0, 0,99,99,99, 0, 3, 0},
2291 { 99,99,99, 0, 0,99,99, 0, 0,99,99, 4, 0},
2292 { 99,99,99, 0, 0,99,99, 0, 0,99,99, 4, 0},
2293 { 99,99,99, 0, 0,99,99, 0, 0,99,99, 4, 0},
2294 { 99,99,99, 2, 2,99,99, 8, 2,99,99, 4, 0},
2295 { 1, 0, 0,99,99, 0, 0,99,99,99, 7, 3, 0},
2296 { 99,99,99,99,99,99,99,99,99,11,99,15, 0},
2297 { 5, 5, 5, 6, 6, 5, 5, 6, 6,16, 5, 1,14},
2298 { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,13,12},
2305 bool IsFirstBitcast = (firstOp == Instruction::BitCast);
2306 bool IsSecondBitcast = (secondOp == Instruction::BitCast);
2307 bool AreBothBitcasts = IsFirstBitcast && IsSecondBitcast;
2310 if ((IsFirstBitcast && isa<VectorType>(SrcTy) != isa<VectorType>(MidTy)) ||
2311 (IsSecondBitcast && isa<VectorType>(MidTy) != isa<VectorType>(DstTy)))
2312 if (!AreBothBitcasts)
2315 int ElimCase = CastResults[firstOp-Instruction::CastOpsBegin]
2316 [secondOp-Instruction::CastOpsBegin];
2363 return Instruction::BitCast;
2366 if (!SrcIntPtrTy || DstIntPtrTy != SrcIntPtrTy)
2369 if (MidSize >= PtrSize)
2370 return Instruction::BitCast;
2379 if (SrcSize == DstSize)
2380 return Instruction::BitCast;
2381 else if (SrcSize < DstSize)
2387 return Instruction::ZExt;
2395 if (SrcSize <= PtrSize && SrcSize == DstSize)
2396 return Instruction::BitCast;
2403 return Instruction::AddrSpaceCast;
2404 return Instruction::BitCast;
2415 "Illegal addrspacecast, bitcast sequence!");
2423 return Instruction::AddrSpaceCast;
2434 "Illegal inttoptr, bitcast sequence!");
2446 "Illegal bitcast, ptrtoint sequence!");
2451 return Instruction::UIToFP;
2463 assert(castIsValid(op, S, Ty) &&
"Invalid cast!");
2466 case Trunc:
return new TruncInst (S, Ty, Name, InsertBefore);
2467 case ZExt:
return new ZExtInst (S, Ty, Name, InsertBefore);
2468 case SExt:
return new SExtInst (S, Ty, Name, InsertBefore);
2469 case FPTrunc:
return new FPTruncInst (S, Ty, Name, InsertBefore);
2470 case FPExt:
return new FPExtInst (S, Ty, Name, InsertBefore);
2471 case UIToFP:
return new UIToFPInst (S, Ty, Name, InsertBefore);
2472 case SIToFP:
return new SIToFPInst (S, Ty, Name, InsertBefore);
2473 case FPToUI:
return new FPToUIInst (S, Ty, Name, InsertBefore);
2474 case FPToSI:
return new FPToSIInst (S, Ty, Name, InsertBefore);
2475 case PtrToInt:
return new PtrToIntInst (S, Ty, Name, InsertBefore);
2476 case IntToPtr:
return new IntToPtrInst (S, Ty, Name, InsertBefore);
2477 case BitCast:
return new BitCastInst (S, Ty, Name, InsertBefore);
2485 assert(castIsValid(op, S, Ty) &&
"Invalid cast!");
2488 case Trunc:
return new TruncInst (S, Ty, Name, InsertAtEnd);
2489 case ZExt:
return new ZExtInst (S, Ty, Name, InsertAtEnd);
2490 case SExt:
return new SExtInst (S, Ty, Name, InsertAtEnd);
2491 case FPTrunc:
return new FPTruncInst (S, Ty, Name, InsertAtEnd);
2492 case FPExt:
return new FPExtInst (S, Ty, Name, InsertAtEnd);
2493 case UIToFP:
return new UIToFPInst (S, Ty, Name, InsertAtEnd);
2494 case SIToFP:
return new SIToFPInst (S, Ty, Name, InsertAtEnd);
2495 case FPToUI:
return new FPToUIInst (S, Ty, Name, InsertAtEnd);
2496 case FPToSI:
return new FPToSIInst (S, Ty, Name, InsertAtEnd);
2497 case PtrToInt:
return new PtrToIntInst (S, Ty, Name, InsertAtEnd);
2498 case IntToPtr:
return new IntToPtrInst (S, Ty, Name, InsertAtEnd);
2499 case BitCast:
return new BitCastInst (S, Ty, Name, InsertAtEnd);
2509 return Create(Instruction::BitCast, S, Ty, Name, InsertBefore);
2510 return Create(Instruction::ZExt, S, Ty, Name, InsertBefore);
2517 return Create(Instruction::BitCast, S, Ty, Name, InsertAtEnd);
2518 return Create(Instruction::ZExt, S, Ty, Name, InsertAtEnd);
2525 return Create(Instruction::BitCast, S, Ty, Name, InsertBefore);
2526 return Create(Instruction::SExt, S, Ty, Name, InsertBefore);
2533 return Create(Instruction::BitCast, S, Ty, Name, InsertAtEnd);
2534 return Create(Instruction::SExt, S, Ty, Name, InsertAtEnd);
2541 return Create(Instruction::BitCast, S, Ty, Name, InsertBefore);
2542 return Create(Instruction::Trunc, S, Ty, Name, InsertBefore);
2549 return Create(Instruction::BitCast, S, Ty, Name, InsertAtEnd);
2550 return Create(Instruction::Trunc, S, Ty, Name, InsertAtEnd);
2565 return Create(Instruction::PtrToInt, S, Ty, Name, InsertAtEnd);
2567 return CreatePointerBitCastOrAddrSpaceCast(S, Ty, Name, InsertAtEnd);
2583 return Create(Instruction::PtrToInt, S, Ty, Name, InsertBefore);
2585 return CreatePointerBitCastOrAddrSpaceCast(S, Ty, Name, InsertBefore);
2596 return Create(Instruction::AddrSpaceCast, S, Ty, Name, InsertAtEnd);
2598 return Create(Instruction::BitCast, S, Ty, Name, InsertAtEnd);
2609 return Create(Instruction::AddrSpaceCast, S, Ty, Name, InsertBefore);
2611 return Create(Instruction::BitCast, S, Ty, Name, InsertBefore);
2618 return Create(Instruction::PtrToInt, S, Ty, Name, InsertBefore);
2620 return Create(Instruction::IntToPtr, S, Ty, Name, InsertBefore);
2622 return Create(Instruction::BitCast, S, Ty, Name, InsertBefore);
2629 "Invalid integer cast");
2633 (SrcBits == DstBits ? Instruction::BitCast :
2634 (SrcBits > DstBits ? Instruction::Trunc :
2635 (isSigned ? Instruction::SExt : Instruction::ZExt)));
2636 return Create(opcode, C, Ty, Name, InsertBefore);
2647 (SrcBits == DstBits ? Instruction::BitCast :
2648 (SrcBits > DstBits ? Instruction::Trunc :
2649 (isSigned ? Instruction::SExt : Instruction::ZExt)));
2650 return Create(opcode, C, Ty, Name, InsertAtEnd);
2661 (SrcBits == DstBits ? Instruction::BitCast :
2662 (SrcBits > DstBits ? Instruction::FPTrunc : Instruction::FPExt));
2663 return Create(opcode, C, Ty, Name, InsertBefore);
2674 (SrcBits == DstBits ? Instruction::BitCast :
2675 (SrcBits > DstBits ? Instruction::FPTrunc : Instruction::FPExt));
2676 return Create(opcode, C, Ty, Name, InsertAtEnd);
2685 if (SrcTy == DestTy)
2688 if (
VectorType *SrcVecTy = dyn_cast<VectorType>(SrcTy))
2689 if (
VectorType *DestVecTy = dyn_cast<VectorType>(DestTy))
2690 if (SrcVecTy->getNumElements() == DestVecTy->getNumElements()) {
2692 SrcTy = SrcVecTy->getElementType();
2693 DestTy = DestVecTy->getElementType();
2707 return DestBits == SrcBits;
2717 return DestBits == SrcBits;
2722 return DestBits == SrcBits;
2730 return DestBits == SrcBits;
2740 if (SrcTy == DestTy)
2743 if (
VectorType *SrcVecTy = dyn_cast<VectorType>(SrcTy)) {
2744 if (
VectorType *DestVecTy = dyn_cast<VectorType>(DestTy)) {
2745 if (SrcVecTy->getNumElements() == DestVecTy->getNumElements()) {
2747 SrcTy = SrcVecTy->getElementType();
2748 DestTy = DestVecTy->getElementType();
2753 if (
PointerType *DestPtrTy = dyn_cast<PointerType>(DestTy)) {
2754 if (
PointerType *SrcPtrTy = dyn_cast<PointerType>(SrcTy)) {
2755 return SrcPtrTy->getAddressSpace() == DestPtrTy->getAddressSpace();
2764 if (SrcBits == 0 || DestBits == 0)
2767 if (SrcBits != DestBits)
2779 if (
auto *PtrTy = dyn_cast<PointerType>(SrcTy))
2780 if (
auto *IntTy = dyn_cast<IntegerType>(DestTy))
2783 if (
auto *PtrTy = dyn_cast<PointerType>(DestTy))
2784 if (
auto *IntTy = dyn_cast<IntegerType>(SrcTy))
2788 return isBitCastable(SrcTy, DestTy);
2800 const Value *Src,
bool SrcIsSigned,
Type *DestTy,
bool DestIsSigned) {
2804 "Only first class types are castable!");
2806 if (SrcTy == DestTy)
2810 if (
VectorType *SrcVecTy = dyn_cast<VectorType>(SrcTy))
2811 if (
VectorType *DestVecTy = dyn_cast<VectorType>(DestTy))
2812 if (SrcVecTy->getNumElements() == DestVecTy->getNumElements()) {
2815 SrcTy = SrcVecTy->getElementType();
2816 DestTy = DestVecTy->getElementType();
2826 if (DestBits < SrcBits)
2828 else if (DestBits > SrcBits) {
2842 assert(DestBits == SrcBits &&
2843 "Casting vector to integer of different width");
2847 "Casting from a value that is not first-class type");
2857 if (DestBits < SrcBits) {
2859 }
else if (DestBits > SrcBits) {
2865 assert(DestBits == SrcBits &&
2866 "Casting vector to floating point of different width");
2871 assert(DestBits == SrcBits &&
2872 "Illegal cast to vector (wrong type or size)");
2877 return AddrSpaceCast;
2885 assert(DestBits == SrcBits &&
"Casting vector of wrong width to X86_MMX");
2918 cast<VectorType>(SrcTy)->getNumElements() : 0;
2920 cast<VectorType>(DstTy)->getNumElements() : 0;
2924 default:
return false;
2925 case Instruction::Trunc:
2927 SrcLength == DstLength && SrcBitSize > DstBitSize;
2928 case Instruction::ZExt:
2930 SrcLength == DstLength && SrcBitSize < DstBitSize;
2931 case Instruction::SExt:
2933 SrcLength == DstLength && SrcBitSize < DstBitSize;
2934 case Instruction::FPTrunc:
2936 SrcLength == DstLength && SrcBitSize > DstBitSize;
2937 case Instruction::FPExt:
2939 SrcLength == DstLength && SrcBitSize < DstBitSize;
2940 case Instruction::UIToFP:
2941 case Instruction::SIToFP:
2943 SrcLength == DstLength;
2944 case Instruction::FPToUI:
2945 case Instruction::FPToSI:
2947 SrcLength == DstLength;
2948 case Instruction::PtrToInt:
2949 if (isa<VectorType>(SrcTy) != isa<VectorType>(DstTy))
2951 if (
VectorType *VT = dyn_cast<VectorType>(SrcTy))
2952 if (VT->getNumElements() != cast<VectorType>(DstTy)->getNumElements())
2955 case Instruction::IntToPtr:
2956 if (isa<VectorType>(SrcTy) != isa<VectorType>(DstTy))
2958 if (
VectorType *VT = dyn_cast<VectorType>(SrcTy))
2959 if (VT->getNumElements() != cast<VectorType>(DstTy)->getNumElements())
2962 case Instruction::BitCast: {
2968 if (!SrcPtrTy != !DstPtrTy)
2981 if (
VectorType *SrcVecTy = dyn_cast<VectorType>(SrcTy)) {
2982 if (
VectorType *DstVecTy = dyn_cast<VectorType>(DstTy))
2983 return (SrcVecTy->getNumElements() == DstVecTy->getNumElements());
2990 case Instruction::AddrSpaceCast: {
3002 if (
VectorType *SrcVecTy = dyn_cast<VectorType>(SrcTy)) {
3003 if (
VectorType *DstVecTy = dyn_cast<VectorType>(DstTy))
3004 return (SrcVecTy->getNumElements() == DstVecTy->getNumElements());
3016 ) :
CastInst(Ty, Trunc, S, Name, InsertBefore) {
3022 ) :
CastInst(Ty, Trunc, S, Name, InsertAtEnd) {
3028 ) :
CastInst(Ty, ZExt, S, Name, InsertBefore) {
3034 ) :
CastInst(Ty, ZExt, S, Name, InsertAtEnd) {
3039 ) :
CastInst(Ty, SExt, S, Name, InsertBefore) {
3045 ) :
CastInst(Ty, SExt, S, Name, InsertAtEnd) {
3051 ) :
CastInst(Ty, FPTrunc, S, Name, InsertBefore) {
3057 ) :
CastInst(Ty, FPTrunc, S, Name, InsertAtEnd) {
3063 ) :
CastInst(Ty, FPExt, S, Name, InsertBefore) {
3069 ) :
CastInst(Ty, FPExt, S, Name, InsertAtEnd) {
3075 ) :
CastInst(Ty, UIToFP, S, Name, InsertBefore) {
3081 ) :
CastInst(Ty, UIToFP, S, Name, InsertAtEnd) {
3087 ) :
CastInst(Ty, SIToFP, S, Name, InsertBefore) {
3093 ) :
CastInst(Ty, SIToFP, S, Name, InsertAtEnd) {
3099 ) :
CastInst(Ty, FPToUI, S, Name, InsertBefore) {
3105 ) :
CastInst(Ty, FPToUI, S, Name, InsertAtEnd) {
3111 ) :
CastInst(Ty, FPToSI, S, Name, InsertBefore) {
3117 ) :
CastInst(Ty, FPToSI, S, Name, InsertAtEnd) {
3123 ) :
CastInst(Ty, PtrToInt, S, Name, InsertBefore) {
3129 ) :
CastInst(Ty, PtrToInt, S, Name, InsertAtEnd) {
3135 ) :
CastInst(Ty, IntToPtr, S, Name, InsertBefore) {
3141 ) :
CastInst(Ty, IntToPtr, S, Name, InsertAtEnd) {
3147 ) :
CastInst(Ty, BitCast, S, Name, InsertBefore) {
3153 ) :
CastInst(Ty, BitCast, S, Name, InsertAtEnd) {
3159 ) :
CastInst(Ty, AddrSpaceCast, S, Name, InsertBefore) {
3165 ) :
CastInst(Ty, AddrSpaceCast, S, Name, InsertAtEnd) {
3200 if (Op == Instruction::ICmp) {
3220 if (Op == Instruction::ICmp) {
3229 if (
ICmpInst *IC = dyn_cast<ICmpInst>(
this))
3236 if (
const ICmpInst *IC = dyn_cast<ICmpInst>(
this))
3237 return IC->isCommutative();
3242 if (
const ICmpInst *IC = dyn_cast<ICmpInst>(
this))
3243 return IC->isEquality();
3282 default:
return "unknown";
3401 default:
return pred;
3423 switch (predicate) {
3424 default:
return false;
3431 switch (predicate) {
3432 default:
return false;
3439 switch (predicate) {
3440 default:
return false;
3448 switch (predicate) {
3449 default:
return false;
3458 default:
return false;
3468 default:
return false;
3506 assert(Value && Default && NumReserved);
3507 ReservedSpace = NumReserved;
3519 SwitchInst::SwitchInst(Value *Value,
BasicBlock *Default,
unsigned NumCases,
3522 nullptr, 0, InsertBefore) {
3523 init(Value, Default, 2+NumCases*2);
3530 SwitchInst::SwitchInst(Value *Value,
BasicBlock *Default,
unsigned NumCases,
3533 nullptr, 0, InsertAtEnd) {
3534 init(Value, Default, 2+NumCases*2);
3545 OL[i+1] = InOL[i+1];
3554 unsigned NewCaseIdx = getNumCases();
3556 if (OpNo+2 > ReservedSpace)
3559 assert(OpNo+1 < ReservedSpace &&
"Growing didn't work!");
3569 unsigned idx = I->getCaseIndex();
3577 if (2 + (idx + 1) * 2 != NumOps) {
3578 OL[2 + idx * 2] = OL[NumOps - 2];
3579 OL[2 + idx * 2 + 1] = OL[NumOps - 1];
3583 OL[NumOps-2].
set(
nullptr);
3584 OL[NumOps-2+1].
set(
nullptr);
3587 return CaseIt(
this, idx);
3593 void SwitchInst::growOperands() {
3595 unsigned NumOps = e*3;
3597 ReservedSpace = NumOps;
3605 void IndirectBrInst::init(Value *
Address,
unsigned NumDests) {
3607 "Address of indirectbr must be a pointer");
3608 ReservedSpace = 1+NumDests;
3619 void IndirectBrInst::growOperands() {
3621 unsigned NumOps = e*2;
3623 ReservedSpace = NumOps;
3627 IndirectBrInst::IndirectBrInst(Value *Address,
unsigned NumCases,
3630 nullptr, 0, InsertBefore) {
3631 init(Address, NumCases);
3634 IndirectBrInst::IndirectBrInst(Value *Address,
unsigned NumCases,
3637 nullptr, 0, InsertAtEnd) {
3638 init(Address, NumCases);
3656 if (OpNo+1 > ReservedSpace)
3659 assert(OpNo < ReservedSpace &&
"Growing didn't work!");
3673 OL[idx+1] = OL[NumOps-1];
3676 OL[NumOps-1].
set(
nullptr);
3734 getSuccessOrdering(), getFailureOrdering(),
3744 getOrdering(), getSyncScopeID());
3806 if (hasOperandBundles()) {
3807 unsigned DescriptorBytes = getNumOperandBundles() *
sizeof(BundleOpInfo);
3854 if (hasOperandBundles()) {
3855 unsigned DescriptorBytes = getNumOperandBundles() *
sizeof(BundleOpInfo);
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.
void push_back(const T &Elt)
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
bool hasNoSignedZeros() const
Determine whether the no-signed-zeros flag is set.
static IntegerType * getInt1Ty(LLVMContext &C)
StoreInst * cloneImpl() const
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.
Compute iterated dominance frontiers using a linear time algorithm.
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.
BasicBlock * getSuccessor(unsigned idx) const
Return the specified successor.
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.
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 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.
Value * getCondition() const
User::op_iterator arg_begin()
Return the iterator pointing to the beginning of the argument list.
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)
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.
static CallInst * Create(Value *Func, ArrayRef< Value *> Args, ArrayRef< OperandBundleDef > Bundles=None, const Twine &NameStr="", Instruction *InsertBefore=nullptr)
AttributeList Attrs
parameter attributes for callable
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.
CallingConv::ID getCallingConv() const
getCallingConv/setCallingConv - Get or set the calling convention of this function call...
void setAtomic(AtomicOrdering Ordering, SyncScope::ID SSID=SyncScope::System)
Sets the ordering constraint and the synchronization scope ID of this store instruction.
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()
Predicate getSignedPredicate()
For example, ULT->SLT, ULE->SLE, UGT->SGT, UGE->SGE, SLT->Failed assert.
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 const Value * getNegArgument(const Value *BinOp)
Helper functions to extract the unary argument of a NEG, FNEG or NOT operation implemented via Sub...
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...
Value * removeIncomingValue(unsigned Idx, bool DeletePHIIfEmpty=true)
Remove an incoming value.
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.
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...
bundle_op_iterator bundle_op_info_begin()
Return the start of the list of BundleOpInfo instances associated with this OperandBundleUser.
void setName(const Twine &Name)
Change the name of the value.
uint64_t getNumElements() const
static const unsigned MaximumAlignment
block_iterator block_begin()
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...
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
AttributeList getAttributes() const
Return the parameter attributes for this call.
This class represents a truncation of integer types.
static const Value * getNotArgument(const Value *BinOp)
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.
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'.
User::op_iterator op_end()
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)
unsigned getNumOperands() const
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")
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.
constexpr bool isPowerOf2_32(uint32_t Value)
Return true if the argument is a power of two > 0.
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
User::op_iterator op_begin()
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 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 isNot(const Value *V)
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 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.
static InvokeInst * Create(Value *Func, BasicBlock *IfNormal, BasicBlock *IfException, ArrayRef< Value *> Args, const Twine &NameStr, Instruction *InsertBefore=nullptr)
unsigned char SubclassOptionalData
Hold subclass data that can be dropped.
Type * getAllocatedType() const
Return the type that is being allocated by the instruction.
void setCallingConv(CallingConv::ID CC)
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.
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
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.
LoadInst(Value *Ptr, const Twine &NameStr, Instruction *InsertBefore)
bool isAggregateType() const
Return true if the type is an aggregate type.
BasicBlock * getUnwindDest() 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.
bundle_op_iterator bundle_op_info_end()
Return the end of the list of BundleOpInfo instances associated with this OperandBundleUser.
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.
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.
static bool isNeg(const Value *V)
Check if the given Value is a NEG, FNeg, or NOT instruction.
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.
CmpInst(Type *ty, Instruction::OtherOps op, Predicate pred, Value *LHS, Value *RHS, const Twine &Name="", Instruction *InsertBefore=nullptr)
BitCastInst(Value *S, Type *Ty, const Twine &NameStr="", Instruction *InsertBefore=nullptr)
Constructor with insert-before-instruction semantics.
AtomicCmpXchgInst * cloneImpl() const
static bool isConstantAllOnes(const Value *V)
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:
GetElementPtrInst * cloneImpl() const
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.
ZExtInst * cloneImpl() const
Clone an identical ZExtInst.
unsigned greater or equal
static bool isUnordered(Predicate predicate)
Determine if the predicate is an unordered operation.
bool isTokenTy() const
Return true if this is 'token'.
static bool isFNeg(const Value *V, bool IgnoreZeroSign=false)
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.
StringRef getName() const
Return a constant reference to the value's name.
static bool isSigned(Value *V)
Can the given value generate sign bits.
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.
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.
bool isFPOrFPVectorTy() const
Return true if this is a FP type or a vector of FP.
Synchronized with respect to all concurrently executing threads.
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.
const Value * getCalledValue() const
Get a pointer to the function that is invoked by this instruction.
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
unsigned getNumSuccessors() const
Return the number of successors that this terminator has.
User::op_iterator arg_end()
Return the iterator pointing to the end of the argument list.
SmallVector< int, 16 > getShuffleMask() const
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. ...
constexpr char Size[]
Key for Kernel::Arg::Metadata::mSize.
void allocHungoffUses(unsigned N, bool IsPhi=false)
Allocate the array of Uses, followed by a pointer (with bottom bit set) to the User.
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)
FPTruncInst * cloneImpl() const
Clone an identical FPTruncInst.
const Value * getCalledValue() const
Get a pointer to the function that is invoked by this instruction.
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.
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...