36 ? cast<CallInst>(II)->op_end() - 1
37 : cast<InvokeInst>(II)->op_end() - 3;
64 return "both values to select must have same type";
67 return "select values cannot have token type";
72 return "vector select condition element type must be i1";
75 return "selected values for vector select must be vectors";
77 return "vector select requires selected vectors to have "
78 "the same vector length as select condition";
80 return "select condition must be i1 or <n x i1>";
90 void PHINode::anchor() {}
92 PHINode::PHINode(
const PHINode &PN)
94 ReservedSpace(PN.getNumOperands()) {
115 Op<-1>().set(
nullptr);
131 void PHINode::growOperands() {
133 unsigned NumOps = e + e / 2;
134 if (NumOps < 2) NumOps = 2;
136 ReservedSpace = NumOps;
147 if (ConstantValue !=
this)
152 if (ConstantValue ==
this)
154 return ConstantValue;
163 Value *ConstantValue =
nullptr;
166 if (Incoming !=
this && !isa<UndefValue>(Incoming)) {
167 if (ConstantValue && ConstantValue != Incoming)
169 ConstantValue = Incoming;
179 LandingPadInst::LandingPadInst(
Type *RetTy,
unsigned NumReservedValues,
182 init(NumReservedValues, NameStr);
185 LandingPadInst::LandingPadInst(
Type *RetTy,
unsigned NumReservedValues,
188 init(NumReservedValues, NameStr);
193 LP.getNumOperands()),
194 ReservedSpace(LP.getNumOperands()) {
198 for (
unsigned I = 0,
E = ReservedSpace;
I !=
E; ++
I)
205 const Twine &NameStr,
207 return new LandingPadInst(RetTy, NumReservedClauses, NameStr, InsertBefore);
211 const Twine &NameStr,
213 return new LandingPadInst(RetTy, NumReservedClauses, NameStr, InsertAtEnd);
216 void LandingPadInst::init(
unsigned NumReservedValues,
const Twine &NameStr) {
217 ReservedSpace = NumReservedValues;
226 void LandingPadInst::growOperands(
unsigned Size) {
228 if (ReservedSpace >= e + Size)
return;
229 ReservedSpace = (std::max(e, 1U) + Size / 2) * 2;
236 assert(OpNo < ReservedSpace &&
"Growing didn't work!");
252 "NumOperands not set up?");
258 "Calling a function with bad signature!");
260 for (
unsigned i = 0;
i != Args.
size(); ++
i)
263 "Calling a function with a bad signature!");
275 void CallInst::init(
Value *Func,
const Twine &NameStr) {
277 cast<FunctionType>(cast<PointerType>(Func->
getType())->getElementType());
289 ->getElementType())->getReturnType(),
299 ->getElementType())->getReturnType(),
306 CallInst::CallInst(
const CallInst &CI)
309 CI.getNumOperands()),
310 AttributeList(CI.AttributeList), FTy(CI.FTy) {
340 if (
F->getAttributes().hasAttrSomewhere(Attribute::Returned, &Index) &&
389 return F->getAttributes().hasAttribute(i, Kind);
407 "Must be either a call argument or an operand bundle!");
413 assert(val &&
"IsConstantOne does not work with nullptr val");
415 return CVal && CVal->
isOne();
424 assert(((!InsertBefore && InsertAtEnd) || (InsertBefore && !InsertAtEnd)) &&
425 "createMalloc needs either InsertBefore or InsertAtEnd");
433 else if (ArraySize->
getType() != IntPtrTy) {
444 AllocSize = ArraySize;
445 }
else if (
Constant *CO = dyn_cast<Constant>(ArraySize)) {
454 "mallocsize", InsertBefore);
457 "mallocsize", InsertAtEnd);
461 assert(AllocSize->
getType() == IntPtrTy &&
"malloc arg is wrong size");
464 Module *M = BB->getParent()->getParent();
466 Value *MallocFunc = MallocF;
477 if (Result->
getType() != AllocPtrType)
479 Result =
new BitCastInst(MCall, AllocPtrType, Name, InsertBefore);
483 if (Result->
getType() != AllocPtrType) {
486 Result =
new BitCastInst(MCall, AllocPtrType, Name);
490 if (
Function *
F = dyn_cast<Function>(MallocFunc)) {
492 if (!
F->doesNotAlias(0))
F->setDoesNotAlias(0);
510 return createMalloc(InsertBefore,
nullptr, IntPtrTy, AllocTy, AllocSize,
511 ArraySize,
None, MallocF, Name);
519 return createMalloc(InsertBefore,
nullptr, IntPtrTy, AllocTy, AllocSize,
520 ArraySize, OpB, MallocF, Name);
536 return createMalloc(
nullptr, InsertAtEnd, IntPtrTy, AllocTy, AllocSize,
537 ArraySize,
None, MallocF, Name);
544 return createMalloc(
nullptr, InsertAtEnd, IntPtrTy, AllocTy, AllocSize,
545 ArraySize, OpB, MallocF, Name);
552 assert(((!InsertBefore && InsertAtEnd) || (InsertBefore && !InsertAtEnd)) &&
553 "createFree needs either InsertBefore or InsertAtEnd");
555 "Can not free something of nonpointer type!");
558 Module *M = BB->getParent()->getParent();
567 if (Source->
getType() != IntPtrTy)
568 PtrCast =
new BitCastInst(Source, IntPtrTy,
"", InsertBefore);
571 if (Source->
getType() != IntPtrTy)
572 PtrCast =
new BitCastInst(Source, IntPtrTy,
"", InsertAtEnd);
576 if (
Function *
F = dyn_cast<Function>(FreeFunc))
589 return createFree(Source, Bundles, InsertBefore,
nullptr);
597 assert(FreeCall &&
"CreateFree did not create a CallInst");
604 assert(FreeCall &&
"CreateFree did not create a CallInst");
615 const Twine &NameStr) {
619 "NumOperands not set up?");
622 Op<-1>() = IfException;
627 "Invoking a function with bad signature");
629 for (
unsigned i = 0, e = Args.
size();
i != e;
i++)
632 "Invoking a function with a bad signature!");
648 II.getNumOperands()),
649 AttributeList(II.AttributeList), FTy(II.FTy) {
671 BasicBlock *InvokeInst::getSuccessorV(
unsigned idx)
const {
674 unsigned InvokeInst::getNumSuccessorsV()
const {
677 void InvokeInst::setSuccessorV(
unsigned idx,
BasicBlock *
B) {
687 if (
F->getAttributes().hasAttrSomewhere(Attribute::Returned, &Index) &&
700 return F->getAttributes().hasAttribute(i, Kind);
718 "Must be either an invoke argument or an operand bundle!");
770 RI.getNumOperands()) {
772 Op<0>() = RI.
Op<0>();
795 unsigned ReturnInst::getNumSuccessorsV()
const {
801 void ReturnInst::setSuccessorV(
unsigned idx,
BasicBlock *NewSucc) {
805 BasicBlock *ReturnInst::getSuccessorV(
unsigned idx)
const {
819 Op<0>() = RI.
Op<0>();
834 unsigned ResumeInst::getNumSuccessorsV()
const {
838 void ResumeInst::setSuccessorV(
unsigned idx,
BasicBlock *NewSucc) {
842 BasicBlock *ResumeInst::getSuccessorV(
unsigned idx)
const {
853 CRI.getNumOperands(),
854 CRI.getNumOperands()) {
856 Op<0>() = CRI.
Op<0>();
858 Op<1>() = CRI.
Op<1>();
861 void CleanupReturnInst::init(
Value *CleanupPad,
BasicBlock *UnwindBB) {
865 Op<0>() = CleanupPad;
870 CleanupReturnInst::CleanupReturnInst(
Value *CleanupPad,
BasicBlock *UnwindBB,
875 Values, InsertBefore) {
876 init(CleanupPad, UnwindBB);
879 CleanupReturnInst::CleanupReturnInst(
Value *CleanupPad,
BasicBlock *UnwindBB,
884 Values, InsertAtEnd) {
885 init(CleanupPad, UnwindBB);
888 BasicBlock *CleanupReturnInst::getSuccessorV(
unsigned Idx)
const {
892 unsigned CleanupReturnInst::getNumSuccessorsV()
const {
895 void CleanupReturnInst::setSuccessorV(
unsigned Idx,
BasicBlock *
B) {
911 Op<0>() = CRI.
Op<0>();
912 Op<1>() = CRI.
Op<1>();
931 BasicBlock *CatchReturnInst::getSuccessorV(
unsigned Idx)
const {
935 unsigned CatchReturnInst::getNumSuccessorsV()
const {
938 void CatchReturnInst::setSuccessorV(
unsigned Idx,
BasicBlock *
B) {
947 CatchSwitchInst::CatchSwitchInst(
Value *ParentPad,
BasicBlock *UnwindDest,
948 unsigned NumReservedValues,
949 const Twine &NameStr,
955 init(ParentPad, UnwindDest, NumReservedValues + 1);
959 CatchSwitchInst::CatchSwitchInst(
Value *ParentPad,
BasicBlock *UnwindDest,
960 unsigned NumReservedValues,
966 init(ParentPad, UnwindDest, NumReservedValues + 1);
972 CSI.getNumOperands()) {
977 for (
unsigned I = 1,
E = ReservedSpace;
I !=
E; ++
I)
982 unsigned NumReservedValues) {
983 assert(ParentPad && NumReservedValues);
985 ReservedSpace = NumReservedValues;
998 void CatchSwitchInst::growOperands(
unsigned Size) {
1000 assert(NumOperands >= 1);
1001 if (ReservedSpace >= NumOperands + Size)
1003 ReservedSpace = (NumOperands + Size / 2) * 2;
1010 assert(OpNo < ReservedSpace &&
"Growing didn't work!");
1018 for (
Use *CurDst = HI.
getCurrent(); CurDst != EndDst; ++CurDst)
1019 *CurDst = *(CurDst + 1);
1026 BasicBlock *CatchSwitchInst::getSuccessorV(
unsigned idx)
const {
1029 unsigned CatchSwitchInst::getNumSuccessorsV()
const {
1032 void CatchSwitchInst::setSuccessorV(
unsigned idx,
BasicBlock *B) {
1040 const Twine &NameStr) {
1050 FPI.getNumOperands(),
1051 FPI.getNumOperands()) {
1062 init(ParentPad, Args, NameStr);
1071 init(ParentPad, Args, NameStr);
1081 nullptr, 0, InsertBefore) {
1085 nullptr, 0, InsertAtEnd) {
1088 unsigned UnreachableInst::getNumSuccessorsV()
const {
1092 void UnreachableInst::setSuccessorV(
unsigned idx,
BasicBlock *NewSucc) {
1096 BasicBlock *UnreachableInst::getSuccessorV(
unsigned idx)
const {
1104 void BranchInst::AssertOK() {
1107 "May only branch on boolean predicates!");
1114 assert(IfTrue &&
"Branch destination may not be null!");
1134 assert(IfTrue &&
"Branch destination may not be null!");
1152 BranchInst::BranchInst(
const BranchInst &BI) :
1155 BI.getNumOperands()) {
1156 Op<-1>() = BI.
Op<-1>();
1159 Op<-3>() = BI.
Op<-3>();
1160 Op<-2>() = BI.
Op<-2>();
1167 "Cannot swap successors of an unconditional branch");
1175 BasicBlock *BranchInst::getSuccessorV(
unsigned idx)
const {
1178 unsigned BranchInst::getNumSuccessorsV()
const {
1181 void BranchInst::setSuccessorV(
unsigned idx,
BasicBlock *B) {
1194 assert(!isa<BasicBlock>(Amt) &&
1195 "Passed basic block into allocation size parameter! Use other ctor");
1197 "Allocation array size is not an integer!");
1203 :
AllocaInst(Ty, nullptr, Name, InsertBefore) {}
1206 :
AllocaInst(Ty, nullptr, Name, InsertAtEnd) {}
1210 :
AllocaInst(Ty, ArraySize, 0, Name, InsertBefore) {}
1214 :
AllocaInst(Ty, ArraySize, 0, Name, InsertAtEnd) {}
1219 getAISize(Ty->getContext(), ArraySize), InsertBefore),
1229 getAISize(Ty->getContext(), ArraySize), InsertAtEnd),
1241 assert((Align & (Align-1)) == 0 &&
"Alignment is not a power of 2!");
1243 "Alignment is greater than MaximumAlignment!");
1251 return !CI->isOne();
1271 void LoadInst::AssertOK() {
1273 "Ptr must have pointer type.");
1275 "Alignment required for atomic load");
1286 :
LoadInst(Ty, Ptr, Name, isVolatile, 0, InsertBef) {}
1290 :
LoadInst(Ptr, Name, isVolatile, 0, InsertAE) {}
1306 assert(Ty == cast<PointerType>(Ptr->
getType())->getElementType());
1319 Load, Ptr, InsertAE) {
1329 Load, Ptr, InsertBef) {
1334 if (Name && Name[0])
setName(Name);
1339 Load, Ptr, InsertAE) {
1344 if (Name && Name[0])
setName(Name);
1350 assert(Ty == cast<PointerType>(Ptr->
getType())->getElementType());
1355 if (Name && Name[0])
setName(Name);
1361 Load, Ptr, InsertAE) {
1366 if (Name && Name[0])
setName(Name);
1370 assert((Align & (Align-1)) == 0 &&
"Alignment is not a power of 2!");
1372 "Alignment is greater than MaximumAlignment!");
1382 void StoreInst::AssertOK() {
1385 "Ptr must have pointer type!");
1388 &&
"Ptr must be a pointer to Val type!");
1390 "Alignment required for atomic store");
1401 :
StoreInst(val, addr, isVolatile, 0, InsertBefore) {}
1405 :
StoreInst(val, addr, isVolatile, 0, InsertAtEnd) {}
1450 assert((Align & (Align-1)) == 0 &&
"Alignment is not a power of 2!");
1452 "Alignment is greater than MaximumAlignment!");
1474 "All operands must be non-null!");
1476 "Ptr must have pointer type!");
1479 &&
"Ptr must be a pointer to Cmp type!");
1482 &&
"Ptr must be a pointer to NewVal type!");
1484 "AtomicCmpXchg instructions must be atomic!");
1486 "AtomicCmpXchg instructions must be atomic!");
1488 "AtomicCmpXchg failure argument shall be no stronger than the success "
1492 "AtomicCmpXchg failure ordering cannot include release semantics");
1505 Init(Ptr, Cmp, NewVal, SuccessOrdering, FailureOrdering, SynchScope);
1518 Init(Ptr, Cmp, NewVal, SuccessOrdering, FailureOrdering, SynchScope);
1525 void AtomicRMWInst::Init(BinOp Operation,
Value *Ptr,
Value *Val,
1535 "All operands must be non-null!");
1537 "Ptr must have pointer type!");
1540 &&
"Ptr must be a pointer to Val type!");
1542 "AtomicRMW instructions must be atomic!");
1553 Init(Operation, Ptr, Val, Ordering, SynchScope);
1564 Init(Operation, Ptr, Val, Ordering, SynchScope);
1591 void GetElementPtrInst::anchor() {}
1596 "NumOperands not initialized?");
1605 GEPI.getNumOperands(),
1606 GEPI.getNumOperands()),
1607 SourceElementType(GEPI.SourceElementType),
1608 ResultElementType(GEPI.ResultElementType) {
1622 template <
typename IndexTy>
1625 if (IdxList.
empty())
1633 unsigned CurIdx = 1;
1634 for (; CurIdx != IdxList.
size(); ++CurIdx) {
1637 IndexTy Index = IdxList[CurIdx];
1641 return CurIdx == IdxList.
size() ? Agg :
nullptr;
1663 if (!CI->isZero())
return false;
1687 return cast<GEPOperator>(
this)->
isInBounds();
1700 ExtractElementInst::ExtractElementInst(
Value *Val,
Value *Index,
1707 assert(isValidOperands(Val, Index) &&
1708 "Invalid extractelement instruction operands!");
1714 ExtractElementInst::ExtractElementInst(
Value *Val,
Value *Index,
1721 assert(isValidOperands(Val, Index) &&
1722 "Invalid extractelement instruction operands!");
1741 InsertElementInst::InsertElementInst(
Value *Vec,
Value *Elt,
Value *Index,
1748 "Invalid insertelement instruction operands!");
1755 InsertElementInst::InsertElementInst(
Value *Vec,
Value *Elt,
Value *Index,
1762 "Invalid insertelement instruction operands!");
1771 const Value *Index) {
1775 if (Elt->
getType() != cast<VectorType>(Vec->
getType())->getElementType())
1798 "Invalid shuffle vector instruction operands!");
1815 "Invalid shuffle vector instruction operands!");
1835 if (isa<UndefValue>(Mask) || isa<ConstantAggregateZero>(
Mask))
1839 unsigned V1Size = cast<VectorType>(V1->
getType())->getNumElements();
1840 for (
Value *
Op : MV->operands()) {
1842 if (CI->uge(V1Size*2))
1844 }
else if (!isa<UndefValue>(
Op)) {
1852 dyn_cast<ConstantDataSequential>(Mask)) {
1853 unsigned V1Size = cast<VectorType>(V1->
getType())->getNumElements();
1855 if (CDS->getElementAsInteger(
i) >= V1Size*2)
1864 if (
const ConstantExpr *CE = dyn_cast<ConstantExpr>(Mask))
1865 if (CE->getOpcode() == Instruction::UserOp1)
1872 assert(i < Mask->
getType()->getVectorNumElements() &&
"Index out of range");
1874 return CDS->getElementAsInteger(i);
1876 if (isa<UndefValue>(C))
1878 return cast<ConstantInt>(
C)->getZExtValue();
1886 for (
unsigned i = 0;
i != NumElts; ++
i)
1887 Result.
push_back(CDS->getElementAsInteger(
i));
1890 for (
unsigned i = 0;
i != NumElts; ++
i) {
1892 Result.
push_back(isa<UndefValue>(C) ? -1 :
1893 cast<ConstantInt>(C)->getZExtValue());
1903 const Twine &Name) {
1910 assert(Idxs.
size() > 0 &&
"InsertValueInst must have at least one index");
1913 Val->
getType() &&
"Inserted value must match indexed type!");
1924 Indices(IVI.Indices) {
1939 assert(Idxs.
size() > 0 &&
"ExtractValueInst must have at least one index");
1947 Indices(EVI.Indices) {
1959 for (
unsigned Index : Idxs) {
1966 if (
ArrayType *AT = dyn_cast<ArrayType>(Agg)) {
1967 if (Index >= AT->getNumElements())
1969 }
else if (
StructType *
ST = dyn_cast<StructType>(Agg)) {
1970 if (Index >=
ST->getNumElements())
1977 Agg = cast<CompositeType>(Agg)->getTypeAtIndex(Index);
1979 return const_cast<Type*
>(Agg);
2015 (void)LHS; (void)RHS;
2017 "Binary operator operand types must match!");
2023 "Arithmetic operation should return same type as operands!");
2025 "Tried to create an integer operation on a non-integer type!");
2027 case FAdd:
case FSub:
2030 "Arithmetic operation should return same type as operands!");
2032 "Tried to create a floating-point operation on a "
2033 "non-floating-point type!");
2038 "Arithmetic operation should return same type as operands!");
2040 cast<VectorType>(
getType())->getElementType()->isIntegerTy())) &&
2041 "Incorrect operand type (not integer) for S/UDIV");
2045 "Arithmetic operation should return same type as operands!");
2047 "Incorrect operand type (not floating point) for FDIV");
2052 "Arithmetic operation should return same type as operands!");
2054 cast<VectorType>(
getType())->getElementType()->isIntegerTy())) &&
2055 "Incorrect operand type (not integer) for S/UREM");
2059 "Arithmetic operation should return same type as operands!");
2061 "Incorrect operand type (not floating point) for FREM");
2067 "Shift operation should return same type as operands!");
2070 cast<VectorType>(
getType())->getElementType()->isIntegerTy())) &&
2071 "Tried to create a shift operation on a non-integral type!");
2076 "Logical operation should return same type as operands!");
2079 cast<VectorType>(
getType())->getElementType()->isIntegerTy())) &&
2080 "Tried to create a logical operation on a non-integral type!");
2092 "Cannot create binary operator with two operands of differing type!");
2123 return BinaryOperator::CreateNSWSub(zero, Op, Name, InsertBefore);
2129 return BinaryOperator::CreateNSWSub(zero, Op, Name, InsertAtEnd);
2135 return BinaryOperator::CreateNUWSub(zero, Op, Name, InsertBefore);
2141 return BinaryOperator::CreateNUWSub(zero, Op, Name, InsertAtEnd);
2175 if (
const Constant *C = dyn_cast<Constant>(V))
2176 return C->isAllOnesValue();
2182 if (Bop->getOpcode() == Instruction::Sub)
2183 if (
Constant *C = dyn_cast<Constant>(Bop->getOperand(0)))
2184 return C->isNegativeZeroValue();
2190 if (Bop->getOpcode() == Instruction::FSub)
2191 if (
Constant *C = dyn_cast<Constant>(Bop->getOperand(0))) {
2192 if (!IgnoreZeroSign)
2194 return !IgnoreZeroSign ? C->isNegativeZeroValue() : C->isZeroValue();
2208 return cast<BinaryOperator>(BinOp)->
getOperand(1);
2216 return cast<BinaryOperator>(BinOp)->
getOperand(1);
2224 assert(
isNot(BinOp) &&
"getNotArgument on non-'not' instruction!");
2246 Op<0>().
swap(Op<1>());
2269 void CastInst::anchor() {}
2274 default:
return false;
2275 case Instruction::ZExt:
2276 case Instruction::SExt:
2277 case Instruction::Trunc:
2279 case Instruction::BitCast:
2287 if (
getOpcode() != Instruction::BitCast)
2316 case Instruction::Trunc:
2317 case Instruction::ZExt:
2318 case Instruction::SExt:
2319 case Instruction::FPTrunc:
2320 case Instruction::FPExt:
2321 case Instruction::UIToFP:
2322 case Instruction::SIToFP:
2323 case Instruction::FPToUI:
2324 case Instruction::FPToSI:
2325 case Instruction::AddrSpaceCast:
2328 case Instruction::BitCast:
2330 case Instruction::PtrToInt:
2333 case Instruction::IntToPtr:
2345 Type *PtrOpTy =
nullptr;
2346 if (
getOpcode() == Instruction::PtrToInt)
2348 else if (
getOpcode() == Instruction::IntToPtr)
2368 Type *DstIntPtrTy) {
2399 const unsigned numCastOps =
2400 Instruction::CastOpsEnd - Instruction::CastOpsBegin;
2401 static const uint8_t CastResults[numCastOps][numCastOps] = {
2407 { 1, 0, 0,99,99, 0, 0,99,99,99, 0, 3, 0},
2408 { 8, 1, 9,99,99, 2,17,99,99,99, 2, 3, 0},
2409 { 8, 0, 1,99,99, 0, 2,99,99,99, 0, 3, 0},
2410 { 0, 0, 0,99,99, 0, 0,99,99,99, 0, 3, 0},
2411 { 0, 0, 0,99,99, 0, 0,99,99,99, 0, 3, 0},
2412 { 99,99,99, 0, 0,99,99, 0, 0,99,99, 4, 0},
2413 { 99,99,99, 0, 0,99,99, 0, 0,99,99, 4, 0},
2414 { 99,99,99, 0, 0,99,99, 0, 0,99,99, 4, 0},
2415 { 99,99,99, 2, 2,99,99,10, 2,99,99, 4, 0},
2416 { 1, 0, 0,99,99, 0, 0,99,99,99, 7, 3, 0},
2417 { 99,99,99,99,99,99,99,99,99,11,99,15, 0},
2418 { 5, 5, 5, 6, 6, 5, 5, 6, 6,16, 5, 1,14},
2419 { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,13,12},
2426 bool IsFirstBitcast = (firstOp == Instruction::BitCast);
2427 bool IsSecondBitcast = (secondOp == Instruction::BitCast);
2428 bool AreBothBitcasts = IsFirstBitcast && IsSecondBitcast;
2431 if ((IsFirstBitcast && isa<VectorType>(SrcTy) != isa<VectorType>(MidTy)) ||
2432 (IsSecondBitcast && isa<VectorType>(MidTy) != isa<VectorType>(DstTy)))
2433 if (!AreBothBitcasts)
2436 int ElimCase = CastResults[firstOp-Instruction::CastOpsBegin]
2437 [secondOp-Instruction::CastOpsBegin];
2484 return Instruction::BitCast;
2487 if (!SrcIntPtrTy || DstIntPtrTy != SrcIntPtrTy)
2490 if (MidSize >= PtrSize)
2491 return Instruction::BitCast;
2500 if (SrcSize == DstSize)
2501 return Instruction::BitCast;
2502 else if (SrcSize < DstSize)
2508 return Instruction::ZExt;
2513 return Instruction::BitCast;
2522 if (SrcSize <= PtrSize && SrcSize == DstSize)
2523 return Instruction::BitCast;
2530 return Instruction::AddrSpaceCast;
2531 return Instruction::BitCast;
2543 "Illegal addrspacecast, bitcast sequence!");
2551 return Instruction::AddrSpaceCast;
2563 "Illegal inttoptr, bitcast sequence!");
2575 "Illegal bitcast, ptrtoint sequence!");
2580 return Instruction::UIToFP;
2595 case Trunc:
return new TruncInst (S, Ty, Name, InsertBefore);
2596 case ZExt:
return new ZExtInst (S, Ty, Name, InsertBefore);
2597 case SExt:
return new SExtInst (S, Ty, Name, InsertBefore);
2598 case FPTrunc:
return new FPTruncInst (S, Ty, Name, InsertBefore);
2599 case FPExt:
return new FPExtInst (S, Ty, Name, InsertBefore);
2600 case UIToFP:
return new UIToFPInst (S, Ty, Name, InsertBefore);
2601 case SIToFP:
return new SIToFPInst (S, Ty, Name, InsertBefore);
2602 case FPToUI:
return new FPToUIInst (S, Ty, Name, InsertBefore);
2603 case FPToSI:
return new FPToSIInst (S, Ty, Name, InsertBefore);
2604 case PtrToInt:
return new PtrToIntInst (S, Ty, Name, InsertBefore);
2605 case IntToPtr:
return new IntToPtrInst (S, Ty, Name, InsertBefore);
2606 case BitCast:
return new BitCastInst (S, Ty, Name, InsertBefore);
2617 case Trunc:
return new TruncInst (S, Ty, Name, InsertAtEnd);
2618 case ZExt:
return new ZExtInst (S, Ty, Name, InsertAtEnd);
2619 case SExt:
return new SExtInst (S, Ty, Name, InsertAtEnd);
2620 case FPTrunc:
return new FPTruncInst (S, Ty, Name, InsertAtEnd);
2621 case FPExt:
return new FPExtInst (S, Ty, Name, InsertAtEnd);
2622 case UIToFP:
return new UIToFPInst (S, Ty, Name, InsertAtEnd);
2623 case SIToFP:
return new SIToFPInst (S, Ty, Name, InsertAtEnd);
2624 case FPToUI:
return new FPToUIInst (S, Ty, Name, InsertAtEnd);
2625 case FPToSI:
return new FPToSIInst (S, Ty, Name, InsertAtEnd);
2626 case PtrToInt:
return new PtrToIntInst (S, Ty, Name, InsertAtEnd);
2627 case IntToPtr:
return new IntToPtrInst (S, Ty, Name, InsertAtEnd);
2628 case BitCast:
return new BitCastInst (S, Ty, Name, InsertAtEnd);
2638 return Create(Instruction::BitCast, S, Ty, Name, InsertBefore);
2639 return Create(Instruction::ZExt, S, Ty, Name, InsertBefore);
2646 return Create(Instruction::BitCast, S, Ty, Name, InsertAtEnd);
2647 return Create(Instruction::ZExt, S, Ty, Name, InsertAtEnd);
2654 return Create(Instruction::BitCast, S, Ty, Name, InsertBefore);
2655 return Create(Instruction::SExt, S, Ty, Name, InsertBefore);
2662 return Create(Instruction::BitCast, S, Ty, Name, InsertAtEnd);
2663 return Create(Instruction::SExt, S, Ty, Name, InsertAtEnd);
2670 return Create(Instruction::BitCast, S, Ty, Name, InsertBefore);
2671 return Create(Instruction::Trunc, S, Ty, Name, InsertBefore);
2678 return Create(Instruction::BitCast, S, Ty, Name, InsertAtEnd);
2679 return Create(Instruction::Trunc, S, Ty, Name, InsertAtEnd);
2694 return Create(Instruction::PtrToInt, S, Ty, Name, InsertAtEnd);
2712 return Create(Instruction::PtrToInt, S, Ty, Name, InsertBefore);
2725 return Create(Instruction::AddrSpaceCast, S, Ty, Name, InsertAtEnd);
2727 return Create(Instruction::BitCast, S, Ty, Name, InsertAtEnd);
2738 return Create(Instruction::AddrSpaceCast, S, Ty, Name, InsertBefore);
2740 return Create(Instruction::BitCast, S, Ty, Name, InsertBefore);
2747 return Create(Instruction::PtrToInt, S, Ty, Name, InsertBefore);
2749 return Create(Instruction::IntToPtr, S, Ty, Name, InsertBefore);
2751 return Create(Instruction::BitCast, S, Ty, Name, InsertBefore);
2755 bool isSigned,
const Twine &Name,
2758 "Invalid integer cast");
2762 (SrcBits == DstBits ? Instruction::BitCast :
2763 (SrcBits > DstBits ? Instruction::Trunc :
2764 (isSigned ? Instruction::SExt : Instruction::ZExt)));
2765 return Create(opcode, C, Ty, Name, InsertBefore);
2769 bool isSigned,
const Twine &Name,
2776 (SrcBits == DstBits ? Instruction::BitCast :
2777 (SrcBits > DstBits ? Instruction::Trunc :
2778 (isSigned ? Instruction::SExt : Instruction::ZExt)));
2779 return Create(opcode, C, Ty, Name, InsertAtEnd);
2790 (SrcBits == DstBits ? Instruction::BitCast :
2791 (SrcBits > DstBits ? Instruction::FPTrunc : Instruction::FPExt));
2792 return Create(opcode, C, Ty, Name, InsertBefore);
2803 (SrcBits == DstBits ? Instruction::BitCast :
2804 (SrcBits > DstBits ? Instruction::FPTrunc : Instruction::FPExt));
2805 return Create(opcode, C, Ty, Name, InsertAtEnd);
2814 if (SrcTy == DestTy)
2817 if (
VectorType *SrcVecTy = dyn_cast<VectorType>(SrcTy))
2818 if (
VectorType *DestVecTy = dyn_cast<VectorType>(DestTy))
2819 if (SrcVecTy->getNumElements() == DestVecTy->getNumElements()) {
2821 SrcTy = SrcVecTy->getElementType();
2822 DestTy = DestVecTy->getElementType();
2836 return DestBits == SrcBits;
2846 return DestBits == SrcBits;
2851 return DestBits == SrcBits;
2859 return DestBits == SrcBits;
2869 if (SrcTy == DestTy)
2872 if (
VectorType *SrcVecTy = dyn_cast<VectorType>(SrcTy)) {
2873 if (
VectorType *DestVecTy = dyn_cast<VectorType>(DestTy)) {
2874 if (SrcVecTy->getNumElements() == DestVecTy->getNumElements()) {
2876 SrcTy = SrcVecTy->getElementType();
2877 DestTy = DestVecTy->getElementType();
2882 if (
PointerType *DestPtrTy = dyn_cast<PointerType>(DestTy)) {
2883 if (
PointerType *SrcPtrTy = dyn_cast<PointerType>(SrcTy)) {
2884 return SrcPtrTy->getAddressSpace() == DestPtrTy->getAddressSpace();
2893 if (SrcBits == 0 || DestBits == 0)
2896 if (SrcBits != DestBits)
2907 if (
auto *PtrTy = dyn_cast<PointerType>(SrcTy))
2908 if (
auto *IntTy = dyn_cast<IntegerType>(DestTy))
2910 if (
auto *PtrTy = dyn_cast<PointerType>(DestTy))
2911 if (
auto *IntTy = dyn_cast<IntegerType>(SrcTy))
2926 const Value *Src,
bool SrcIsSigned,
Type *DestTy,
bool DestIsSigned) {
2930 "Only first class types are castable!");
2932 if (SrcTy == DestTy)
2936 if (
VectorType *SrcVecTy = dyn_cast<VectorType>(SrcTy))
2937 if (
VectorType *DestVecTy = dyn_cast<VectorType>(DestTy))
2938 if (SrcVecTy->getNumElements() == DestVecTy->getNumElements()) {
2941 SrcTy = SrcVecTy->getElementType();
2942 DestTy = DestVecTy->getElementType();
2952 if (DestBits < SrcBits)
2954 else if (DestBits > SrcBits) {
2968 assert(DestBits == SrcBits &&
2969 "Casting vector to integer of different width");
2973 "Casting from a value that is not first-class type");
2983 if (DestBits < SrcBits) {
2985 }
else if (DestBits > SrcBits) {
2991 assert(DestBits == SrcBits &&
2992 "Casting vector to floating point of different width");
2997 assert(DestBits == SrcBits &&
2998 "Illegal cast to vector (wrong type or size)");
3003 return AddrSpaceCast;
3011 assert(DestBits == SrcBits &&
"Casting vector of wrong width to X86_MMX");
3045 cast<VectorType>(SrcTy)->getNumElements() : 0;
3047 cast<VectorType>(DstTy)->getNumElements() : 0;
3051 default:
return false;
3052 case Instruction::Trunc:
3054 SrcLength == DstLength && SrcBitSize > DstBitSize;
3055 case Instruction::ZExt:
3057 SrcLength == DstLength && SrcBitSize < DstBitSize;
3058 case Instruction::SExt:
3060 SrcLength == DstLength && SrcBitSize < DstBitSize;
3061 case Instruction::FPTrunc:
3063 SrcLength == DstLength && SrcBitSize > DstBitSize;
3064 case Instruction::FPExt:
3066 SrcLength == DstLength && SrcBitSize < DstBitSize;
3067 case Instruction::UIToFP:
3068 case Instruction::SIToFP:
3070 SrcLength == DstLength;
3071 case Instruction::FPToUI:
3072 case Instruction::FPToSI:
3074 SrcLength == DstLength;
3075 case Instruction::PtrToInt:
3076 if (isa<VectorType>(SrcTy) != isa<VectorType>(DstTy))
3078 if (
VectorType *VT = dyn_cast<VectorType>(SrcTy))
3079 if (VT->getNumElements() != cast<VectorType>(DstTy)->getNumElements())
3083 case Instruction::IntToPtr:
3084 if (isa<VectorType>(SrcTy) != isa<VectorType>(DstTy))
3086 if (
VectorType *VT = dyn_cast<VectorType>(SrcTy))
3087 if (VT->getNumElements() != cast<VectorType>(DstTy)->getNumElements())
3091 case Instruction::BitCast: {
3097 if (!SrcPtrTy != !DstPtrTy)
3110 if (
VectorType *SrcVecTy = dyn_cast<VectorType>(SrcTy)) {
3111 if (
VectorType *DstVecTy = dyn_cast<VectorType>(DstTy))
3112 return (SrcVecTy->getNumElements() == DstVecTy->getNumElements());
3119 case Instruction::AddrSpaceCast: {
3131 if (
VectorType *SrcVecTy = dyn_cast<VectorType>(SrcTy)) {
3132 if (
VectorType *DstVecTy = dyn_cast<VectorType>(DstTy))
3133 return (SrcVecTy->getNumElements() == DstVecTy->getNumElements());
3145 ) :
CastInst(Ty, Trunc, S, Name, InsertBefore) {
3151 ) :
CastInst(Ty, Trunc, S, Name, InsertAtEnd) {
3157 ) :
CastInst(Ty, ZExt, S, Name, InsertBefore) {
3163 ) :
CastInst(Ty, ZExt, S, Name, InsertAtEnd) {
3168 ) :
CastInst(Ty, SExt, S, Name, InsertBefore) {
3174 ) :
CastInst(Ty, SExt, S, Name, InsertAtEnd) {
3180 ) :
CastInst(Ty, FPTrunc, S, Name, InsertBefore) {
3186 ) :
CastInst(Ty, FPTrunc, S, Name, InsertAtEnd) {
3192 ) :
CastInst(Ty, FPExt, S, Name, InsertBefore) {
3198 ) :
CastInst(Ty, FPExt, S, Name, InsertAtEnd) {
3204 ) :
CastInst(Ty, UIToFP, S, Name, InsertBefore) {
3210 ) :
CastInst(Ty, UIToFP, S, Name, InsertAtEnd) {
3216 ) :
CastInst(Ty, SIToFP, S, Name, InsertBefore) {
3222 ) :
CastInst(Ty, SIToFP, S, Name, InsertAtEnd) {
3228 ) :
CastInst(Ty, FPToUI, S, Name, InsertBefore) {
3234 ) :
CastInst(Ty, FPToUI, S, Name, InsertAtEnd) {
3240 ) :
CastInst(Ty, FPToSI, S, Name, InsertBefore) {
3246 ) :
CastInst(Ty, FPToSI, S, Name, InsertAtEnd) {
3252 ) :
CastInst(Ty, PtrToInt, S, Name, InsertBefore) {
3258 ) :
CastInst(Ty, PtrToInt, S, Name, InsertAtEnd) {
3264 ) :
CastInst(Ty, IntToPtr, S, Name, InsertBefore) {
3270 ) :
CastInst(Ty, IntToPtr, S, Name, InsertAtEnd) {
3276 ) :
CastInst(Ty, BitCast, S, Name, InsertBefore) {
3282 ) :
CastInst(Ty, BitCast, S, Name, InsertAtEnd) {
3288 ) :
CastInst(Ty, AddrSpaceCast, S, Name, InsertBefore) {
3294 ) :
CastInst(Ty, AddrSpaceCast, S, Name, InsertAtEnd) {
3331 if (Op == Instruction::ICmp) {
3351 if (Op == Instruction::ICmp) {
3360 if (
ICmpInst *IC = dyn_cast<ICmpInst>(
this))
3367 if (
const ICmpInst *IC = dyn_cast<ICmpInst>(
this))
3368 return IC->isCommutative();
3373 if (
const ICmpInst *IC = dyn_cast<ICmpInst>(
this))
3374 return IC->isEquality();
3414 default:
return "unknown";
3444 void ICmpInst::anchor() {}
3520 switch (predicate) {
3521 default:
return false;
3528 switch (predicate) {
3529 default:
return false;
3536 switch (predicate) {
3537 default:
return false;
3545 switch (predicate) {
3546 default:
return false;
3555 default:
return false;
3565 default:
return false;
3603 assert(Value && Default && NumReserved);
3604 ReservedSpace = NumReserved;
3619 nullptr, 0, InsertBefore) {
3620 init(Value, Default, 2+NumCases*2);
3630 nullptr, 0, InsertAtEnd) {
3631 init(Value, Default, 2+NumCases*2);
3642 OL[
i+1] = InOL[
i+1];
3653 if (OpNo+2 > ReservedSpace)
3656 assert(OpNo+1 < ReservedSpace &&
"Growing didn't work!");
3658 CaseIt Case(
this, NewCaseIdx);
3674 if (2 + (idx + 1) * 2 != NumOps) {
3675 OL[2 + idx * 2] = OL[NumOps - 2];
3676 OL[2 + idx * 2 + 1] = OL[NumOps - 1];
3680 OL[NumOps-2].
set(
nullptr);
3681 OL[NumOps-2+1].
set(
nullptr);
3688 void SwitchInst::growOperands() {
3690 unsigned NumOps = e*3;
3692 ReservedSpace = NumOps;
3697 BasicBlock *SwitchInst::getSuccessorV(
unsigned idx)
const {
3700 unsigned SwitchInst::getNumSuccessorsV()
const {
3703 void SwitchInst::setSuccessorV(
unsigned idx,
BasicBlock *B) {
3711 void IndirectBrInst::init(
Value *
Address,
unsigned NumDests) {
3713 "Address of indirectbr must be a pointer");
3714 ReservedSpace = 1+NumDests;
3725 void IndirectBrInst::growOperands() {
3727 unsigned NumOps = e*2;
3729 ReservedSpace = NumOps;
3733 IndirectBrInst::IndirectBrInst(
Value *Address,
unsigned NumCases,
3736 nullptr, 0, InsertBefore) {
3737 init(Address, NumCases);
3740 IndirectBrInst::IndirectBrInst(
Value *Address,
unsigned NumCases,
3743 nullptr, 0, InsertAtEnd) {
3744 init(Address, NumCases);
3749 nullptr, IBI.getNumOperands()) {
3762 if (OpNo+1 > ReservedSpace)
3765 assert(OpNo < ReservedSpace &&
"Growing didn't work!");
3779 OL[idx+1] = OL[NumOps-1];
3782 OL[NumOps-1].
set(
nullptr);
3786 BasicBlock *IndirectBrInst::getSuccessorV(
unsigned idx)
const {
3789 unsigned IndirectBrInst::getNumSuccessorsV()
const {
3792 void IndirectBrInst::setSuccessorV(
unsigned idx,
BasicBlock *B) {
AttributeSet getAttributes() const
Return the parameter attributes for this call.
BasicBlock * getSuccessor(unsigned i) const
Return a value (possibly void), from a function.
const Value * getCalledValue() const
Get a pointer to the function that is invoked by this instruction.
SymbolTableList< Instruction >::iterator eraseFromParent()
This method unlinks 'this' from the containing basic block and deletes it.
bool isImpliedTrueByMatchingCmp(Predicate Pred2)
Determine if Pred1 implies Pred2 is true when two compares have matching operands.
void push_back(const T &Elt)
AllocaInst(Type *Ty, Value *ArraySize=nullptr, const Twine &Name="", Instruction *InsertBefore=nullptr)
A parsed version of the target data layout string in and methods for querying it. ...
AtomicOrdering getFailureOrdering() const
Returns the ordering constraint on this cmpxchg.
AtomicRMWInst * cloneImpl() const
Instruction::CastOps getOpcode() const
Return the opcode of this CastInst.
This class is the base class for the comparison instructions.
static IntegerType * getInt1Ty(LLVMContext &C)
void setUnwindDest(BasicBlock *UnwindDest)
static bool IsConstantOne(Value *val)
IsConstantOne - Return true only if val is constant int 1.
static BinaryOperator * CreateNot(Value *Op, const Twine &Name="", Instruction *InsertBefore=nullptr)
static const Value * getFNegArgument(const Value *BinOp)
bool paramHasAttr(unsigned i, Attribute::AttrKind Kind) const
Determine whether the call or the callee has the given attributes.
void init(BinaryOps iType)
LandingPadInst * cloneImpl() const
bool isVolatile() const
Return true if this is a store to a volatile memory location.
SynchronizationScope getSynchScope() const
void swapSuccessors()
Swap the successors of this branch instruction.
AttributeSet getAttributes() const
Return the parameter attributes for this invoke.
void allocHungoffUses(unsigned N)
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.
A Module instance is used to store all the information related to an LLVM module. ...
unsigned getNumParams() const
Return the number of fixed parameters this function type requires.
float convertToFloat() const
void setOrdering(AtomicOrdering Ordering)
Set the ordering constraint on this RMW.
void setAlignment(unsigned Align)
AtomicOrdering getSuccessOrdering() const
Returns the ordering constraint on this cmpxchg.
An instruction for ordering other memory operations.
an instruction that atomically checks whether a specified value is in a memory location, and, if it is, stores a new value there.
PtrToIntInst * cloneImpl() const
Clone an identical PtrToIntInst.
void setSynchScope(SynchronizationScope xthread)
Specify whether this fence orders other operations with respect to all concurrently executing threads...
This class represents zero extension of integer types.
unsigned getNumOperands() const
unsigned getNumSuccessors() const
unsigned getPointerTypeSizeInBits(Type *) const
Layout pointer size, in bits, based on the type.
void setSuccessor(BasicBlock *S)
Sets the new successor for current case.
void addCase(ConstantInt *OnVal, BasicBlock *Dest)
Add an entry to the switch instruction.
static unsigned CountBundleInputs(ArrayRef< OperandBundleDef > Bundles)
Return the total number of values used in Bundles.
This class represents a function call, abstracting a target machine's calling convention.
Predicate getInversePredicate() const
For example, EQ -> NE, UGT -> ULE, SLT -> SGE, OEQ -> UNE, UGT -> OLE, OLT -> UGE, etc.
bool indexValid(const Value *V) const
Function * getCalledFunction() const
Return the function called, or null if this is an indirect function invocation.
bool isSigned() const
Determine if this instruction is using a signed comparison.
void setVolatile(bool V)
Specify whether this is a volatile cmpxchg.
0 1 0 0 True if ordered and less than
void removeHandler(handler_iterator HI)
This instruction constructs a fixed permutation of two input vectors.
static SelectInst * Create(Value *C, Value *S1, Value *S2, const Twine &NameStr="", Instruction *InsertBefore=nullptr, Instruction *MDFrom=nullptr)
IndirectBrInst * cloneImpl() const
1 1 1 0 True if unordered or not equal
static CastInst * CreateBitOrPointerCast(Value *S, Type *Ty, const Twine &Name="", Instruction *InsertBefore=nullptr)
Create a BitCast, a PtrToInt, or an IntToPTr cast instruction.
bool isTokenTy() const
Return true if this is 'token'.
bool isPtrOrPtrVectorTy() const
Return true if this is a pointer type or a vector of pointer types.
static bool isOrdered(Predicate predicate)
Determine if the predicate is an ordered operation.
const Function * getParent() const
Return the enclosing method, or null if none.
void setSuccessor(unsigned i, BasicBlock *NewSucc)
void setSuccessor(BasicBlock *NewSucc)
This class represents a sign extension of integer types.
unsigned getAddressSpace() const
Return the address space of the Pointer type.
An instruction for reading from memory.
FunctionType * getType(LLVMContext &Context, ID id, ArrayRef< Type * > Tys=None)
Return the function type for an intrinsic.
Maximum length of the test input libFuzzer tries to guess a good value based on the corpus and reports it always prefer smaller inputs during the corpus shuffle When libFuzzer itself reports a bug this exit code will be used If indicates the maximal total time in seconds to run the fuzzer minimizes the provided crash input Use with etc Experimental Use value profile to guide fuzzing Number of simultaneous worker processes to run the jobs If zero
an instruction that atomically reads a memory location, combines it with another value, and then stores the result back.
static Instruction * CreateFree(Value *Source, Instruction *InsertBefore)
Generate the IR for a call to the builtin free function.
BranchInst * cloneImpl() const
static bool isStrongerThan(AtomicOrdering ao, AtomicOrdering other)
Returns true if ao is stronger than other as defined by the AtomicOrdering lattice, which is based on C++'s definition.
bool hasAttribute(unsigned Index, Attribute::AttrKind Kind) const
Return true if the attribute exists at the given index.
SExtInst * cloneImpl() const
Clone an identical SExtInst.
void setSynchScope(SynchronizationScope SynchScope)
Specify whether this cmpxchg is atomic and orders other operations with respect to all concurrently e...
void addDereferenceableOrNullAttr(unsigned i, uint64_t Bytes)
adds the dereferenceable_or_null attribute to the list of attributes.
BinaryOperator * cloneImpl() const
bool isEquality() const
This is just a convenience that dispatches to the subclasses.
static LandingPadInst * Create(Type *RetTy, unsigned NumReservedClauses, const Twine &NameStr="", Instruction *InsertBefore=nullptr)
Constructors - NumReservedClauses is a hint for the number of incoming clauses that this landingpad w...
Type * getPointerElementType() const
void setAttributes(AttributeSet Attrs)
Set the parameter attributes for this invoke.
UnreachableInst * cloneImpl() const
FPExtInst * cloneImpl() const
Clone an identical FPExtInst.
void setVolatile(bool V)
Specify whether this is a volatile RMW or not.
StringRef getName() const
Return a constant reference to the value's name.
static bool isBitOrNoopPointerCastable(Type *SrcTy, Type *DestTy, const DataLayout &DL)
Check whether a bitcast, inttoptr, or ptrtoint cast between these types is valid and a no-op...
block_iterator block_end()
Predicate getSignedPredicate()
For example, ULT->SLT, ULE->SLE, UGT->SGT, UGE->SGE, SLT->Failed assert.
void setCallingConv(CallingConv::ID CC)
bool swapOperands()
Exchange the two operands to this instruction.
bool isArrayAllocation() const
Return true if there is an allocation size parameter to the allocation instruction that is not 1...
1 0 0 1 True if unordered or equal
static InsertElementInst * Create(Value *Vec, Value *NewElt, Value *Idx, const Twine &NameStr="", Instruction *InsertBefore=nullptr)
1 0 0 0 True if unordered: isnan(X) | isnan(Y)
static const Value * getNegArgument(const Value *BinOp)
Helper functions to extract the unary argument of a NEG, FNEG or NOT operation implemented via Sub...
This class represents a conversion between pointers from one address space to another.
static Constant * getIntegerCast(Constant *C, Type *Ty, bool isSigned)
Create a ZExt, Bitcast or Trunc for integer -> integer casts.
static bool castIsValid(Instruction::CastOps op, Value *S, Type *DstTy)
This method can be used to determine if a cast from S to DstTy using Opcode op is valid or not...
Value * removeIncomingValue(unsigned Idx, bool DeletePHIIfEmpty=true)
Remove an incoming value.
unsigned getSubclassDataFromInstruction() const
This class represents the LLVM 'select' instruction.
IntToPtrInst(Value *S, Type *Ty, const Twine &NameStr="", Instruction *InsertBefore=nullptr)
Constructor with insert-before-instruction semantics.
Twine - A lightweight data structure for efficiently representing the concatenation of temporary valu...
This is the base class for all instructions that perform data casts.
CallInst * cloneImpl() const
Class to represent struct types.
A Use represents the edge between a Value definition and its users.
void growHungoffUses(unsigned N, bool IsPhi=false)
Grow the number of hung off uses.
void setOrdering(AtomicOrdering Ordering)
Set the ordering constraint on this fence.
void setIsInBounds(bool b=true)
Set or clear the inbounds flag on this GEP instruction.
PtrToIntInst(Value *S, Type *Ty, const Twine &NameStr="", Instruction *InsertBefore=nullptr)
Constructor with insert-before-instruction semantics.
unsigned getNumArgOperands() const
Return the number of call arguments.
Instruction * getFirstNonPHI()
Returns a pointer to the first instruction in this block that is not a PHINode instruction.
bool isCall() const
isCall - true if a CallInst is enclosed.
const Value * getCalledValue() const
Get a pointer to the function that is invoked by this instruction.
static bool isNoopCast(Instruction::CastOps Opcode, Type *SrcTy, Type *DstTy, Type *IntPtrTy)
A no-op cast is one that can be effected without changing any bits.
UIToFPInst(Value *S, Type *Ty, const Twine &NameStr="", Instruction *InsertBefore=nullptr)
Constructor with insert-before-instruction semantics.
0 1 0 1 True if ordered and less than or equal
FCmpInst * cloneImpl() const
Clone an identical FCmpInst.
bundle_op_iterator bundle_op_info_begin()
Return the start of the list of BundleOpInfo instances associated with this OperandBundleUser.
AttributeSet addDereferenceableAttr(LLVMContext &C, unsigned Index, uint64_t Bytes) const
Add the dereferenceable attribute to the attribute set at the given index.
void setName(const Twine &Name)
Change the name of the value.
FPToUIInst * cloneImpl() const
Clone an identical FPToUIInst.
static const unsigned MaximumAlignment
LandingPadInst * getLandingPadInst() const
Get the landingpad instruction from the landing pad block (the unwind destination).
block_iterator block_begin()
unsigned getNumSuccessors() const
void addAttribute(unsigned i, Attribute::AttrKind Kind)
adds the attribute to the list of attributes.
SynchronizationScope getSynchScope() const
This class represents a cast from a pointer to an integer.
AtomicOrdering
Atomic ordering for LLVM's memory model.
static bool isValidOperands(const Value *V1, const Value *V2, const Value *Mask)
Return true if a shufflevector instruction can be formed with the specified operands.
void addHandler(BasicBlock *Dest)
Add an entry to the switch instruction...
UIToFPInst * cloneImpl() const
Clone an identical UIToFPInst.
void setAtomic(AtomicOrdering Ordering, SynchronizationScope SynchScope=CrossThread)
A constant value that is initialized with an expression using other constant values.
Class to represent function types.
bool isVolatile() const
Return true if this is a cmpxchg from a volatile memory location.
AtomicOrdering getOrdering() const
Returns the ordering constraint on this RMW.
void setCleanup(bool V)
Indicate that this landingpad instruction is a cleanup.
BitCastInst * cloneImpl() const
Clone an identical BitCastInst.
void setValue(ConstantInt *V)
Sets the new value for current case.
op_iterator arg_begin()
Return the iterator pointing to the beginning of the argument list.
ConstantDataSequential - A vector or array constant whose element type is a simple 1/2/4/8-byte integ...
BinOp
This enumeration lists the possible modifications atomicrmw can make.
void setParentPad(Value *ParentPad)
Class to represent array types.
This instruction compares its operands according to the predicate given to the constructor.
Function Alias Analysis false
unsigned getNumOperandBundles() const
Return the number of operand bundles associated with this User.
BasicBlock * getSuccessor(unsigned i) const
bool isIntegerCast() const
There are several places where we need to know if a cast instruction only deals with integer source a...
bool isFirstClassType() const
Return true if the type is "first class", meaning it is a valid type for a Value. ...
This class represents a no-op cast from one type to another.
StoreInst * cloneImpl() const
static Instruction * createFree(Value *Source, ArrayRef< OperandBundleDef > Bundles, Instruction *InsertBefore, BasicBlock *InsertAtEnd)
static CmpInst * Create(OtherOps Op, Predicate predicate, Value *S1, Value *S2, const Twine &Name="", Instruction *InsertBefore=nullptr)
Construct a compare instruction, given the opcode, the predicate and the two operands.
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory)...
void addDereferenceableAttr(unsigned i, uint64_t Bytes)
adds the dereferenceable attribute to the list of attributes.
Used to keep track of an operand bundle.
unsigned getNumSuccessors() const
void addDereferenceableOrNullAttr(unsigned i, uint64_t Bytes)
adds the dereferenceable_or_null attribute to the list of attributes.
SIToFPInst(Value *S, Type *Ty, const Twine &NameStr="", Instruction *InsertBefore=nullptr)
Constructor with insert-before-instruction semantics.
bool isFloatingPointTy() const
Return true if this is one of the six floating-point types.
Predicate getUnsignedPredicate() const
For example, EQ->EQ, SLE->ULE, UGT->UGT, etc.
FPToSIInst(Value *S, Type *Ty, const Twine &NameStr="", Instruction *InsertBefore=nullptr)
Constructor with insert-before-instruction semantics.
static GCRegistry::Add< OcamlGC > B("ocaml","ocaml 3.10-compatible GC")
void setInstructionSubclassData(unsigned short D)
An instruction for storing to memory.
void replaceAllUsesWith(Value *V)
Change all uses of this to point to a new Value.
This class represents a cast from floating point to signed integer.
BasicBlock * getSuccessor() const
Type * getScalarType() const LLVM_READONLY
If this is a vector type, return the element type, otherwise return 'this'.
bool hasOperandBundles() const
Return true if this User has any operand bundles.
This class represents a truncation of integer types.
Type * getElementType() const
size_t size() const
size - Get the array size.
bool isAtomic() const
Return true if this instruction has an AtomicOrdering of unordered or higher.
static const Value * getNotArgument(const Value *BinOp)
BasicBlock * getNormalDest() const
unsigned getNumSuccessors() const
std::enable_if<!is_simple_type< Y >::value, typename cast_retty< X, const Y >::ret_type >::type cast(const Y &Val)
bool isInBounds() const
Determine whether the GEP has the inbounds flag.
Class to represent pointers.
SwitchInst * cloneImpl() const
void setAttributes(AttributeSet Attrs)
Set the parameter attributes for this call.
static GCRegistry::Add< CoreCLRGC > E("coreclr","CoreCLR-compatible GC")
unsigned getNumIncomingValues() const
Return the number of incoming edges.
FPTruncInst(Value *S, Type *Ty, const Twine &NameStr="", Instruction *InsertBefore=nullptr)
Constructor with insert-before-instruction semantics.
void setUnwindDest(BasicBlock *NewDest)
static Type * getIndexedTypeInternal(Type *Agg, ArrayRef< IndexTy > IdxList)
getIndexedType - Returns the type of the element that would be accessed with a gep instruction with t...
bool isSized(SmallPtrSetImpl< Type * > *Visited=nullptr) const
Return true if it makes sense to take the size of this type.
SIToFPInst * cloneImpl() const
Clone an identical SIToFPInst.
an instruction for type-safe pointer arithmetic to access elements of arrays and structs ...
LoadInst * cloneImpl() const
bool isX86_MMXTy() const
Return true if this is X86 MMX.
bool isIntOrIntVectorTy() const
Return true if this is an integer type or a vector of integer types.
Type * getParamType(unsigned i) const
Parameter type accessors.
initializer< Ty > init(const Ty &Val)
bool isLosslessCast() const
A lossless cast is one that does not alter the basic value.
This instruction inserts a single (scalar) element into a VectorType value.
void setParentPad(Value *ParentPad)
static BinaryOperator * CreateNSWNeg(Value *Op, const Twine &Name="", Instruction *InsertBefore=nullptr)
The landingpad instruction holds all of the information necessary to generate correct exception handl...
unsigned getAlignment() const
Return the alignment of the access that is being performed.
Subclasses of this class are all able to terminate a basic block.
unsigned getCaseIndex() const
Returns number of current case.
Constant * getOrInsertFunction(StringRef Name, FunctionType *T, AttributeSet AttributeList)
Look up the specified function in the module symbol table.
SynchronizationScope getSynchScope() const
Returns whether this RMW is atomic between threads or only within a single thread.
LLVM Basic Block Representation.
Value * hasConstantValue() const
If the specified PHI node always merges together the same value, return the value, otherwise return null.
The instances of the Type class are immutable: once they are created, they are never changed...
This is an important class for using LLVM in a threaded context.
UnreachableInst(LLVMContext &C, Instruction *InsertBefore=nullptr)
Conditional or Unconditional Branch instruction.
bool isVectorTy() const
True if this is an instance of VectorType.
AttributeSet addAttribute(LLVMContext &C, unsigned Index, Attribute::AttrKind Kind) const
Add an attribute to the attribute set at the given index.
This function has undefined behavior.
This is an important base class in LLVM.
Resume the propagation of an exception.
void setFailureOrdering(AtomicOrdering Ordering)
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.
Indirect Branch Instruction.
APInt Or(const APInt &LHS, const APInt &RHS)
Bitwise OR function for APInt.
unsigned getAlignment() const
Return the alignment of the memory that is being allocated by the instruction.
ConstantFP - Floating Point Values [float, double].
APInt Xor(const APInt &LHS, const APInt &RHS)
Bitwise XOR function for APInt.
AtomicRMWInst(BinOp Operation, Value *Ptr, Value *Val, AtomicOrdering Ordering, SynchronizationScope SynchScope, Instruction *InsertBefore=nullptr)
~TerminatorInst() override
const DebugLoc & getDebugLoc() const
Return the debug location for this node as a DebugLoc.
static bool isBitCastable(Type *SrcTy, Type *DestTy)
Check whether a bitcast between these types is valid.
bool hasAllZeroIndices() const
Return true if all of the indices of this GEP are zeros.
static Type * getVoidTy(LLVMContext &C)
const InstListType & getInstList() const
Return the underlying instruction list container.
bool isFalseWhenEqual() const
This is just a convenience.
bool isUsedWithInAlloca() const
Return true if this alloca is used as an inalloca argument to a call.
This instruction compares its operands according to the predicate given to the constructor.
Predicate
This enumeration lists the possible predicates for CmpInst subclasses.
void removeAttribute(unsigned i, Attribute::AttrKind Kind)
removes the attribute from the list of attributes.
uint64_t getNumElements() const
void addClause(Constant *ClauseVal)
Add a catch or filter clause to the landing pad.
Value * getReturnedArgOperand() const
If one of the arguments has the 'returned' attribute, return its operand value.
Value * getOperand(unsigned i) const
0 1 1 1 True if ordered (no nans)
static CastInst * CreatePointerBitCastOrAddrSpaceCast(Value *S, Type *Ty, const Twine &Name, BasicBlock *InsertAtEnd)
Create a BitCast or an AddrSpaceCast cast instruction.
bool isCommutative() const
Return true if the instruction is commutative:
CatchSwitchInst * cloneImpl() const
static bool isNot(const Value *V)
op_iterator arg_end()
Return the iterator pointing to the end of the argument list.
Constant Vector Declarations.
Predicate getPredicate() const
Return the predicate for this instruction.
static CastInst * CreatePointerCast(Value *S, Type *Ty, const Twine &Name, BasicBlock *InsertAtEnd)
Create a BitCast AddrSpaceCast, or a PtrToInt cast instruction.
bool dataOperandHasImpliedAttr(unsigned i, Attribute::AttrKind Kind) const
Return true if the data operand at index i has the attribute A.
bool empty() const
empty - Check if the array is empty.
void setTailCallKind(TailCallKind TCK)
Constant * getAggregateElement(unsigned Elt) const
For aggregates (struct/array/vector) return the constant that corresponds to the specified element if...
void setAlignment(unsigned Align)
This class represents a cast from an integer to a pointer.
static Constant * getAllOnesValue(Type *Ty)
Get the all ones value.
1 1 1 1 Always true (always folded)
bool hasConstantOrUndefValue() const
Whether the specified PHI node always merges together the same value, assuming undefs are equal to a ...
NUW NUW NUW NUW Exact static Exact BinaryOperator * CreateNeg(Value *Op, const Twine &Name="", Instruction *InsertBefore=nullptr)
Helper functions to construct and inspect unary operations (NEG and NOT) via binary operators SUB and...
op_iterator arg_begin()
Return the iterator pointing to the beginning of the argument list.
void append(in_iter in_start, in_iter in_end)
Add the specified range to the end of the SmallVector.
ShuffleVectorInst(Value *V1, Value *V2, Value *Mask, const Twine &NameStr="", Instruction *InsertBefor=nullptr)
void setTailCall(bool isTC=true)
bool isPointerTy() const
True if this is an instance of PointerType.
static UndefValue * get(Type *T)
Static factory methods - Return an 'undef' object of the specified type.
bool isCommutative() const
This is just a convenience that dispatches to the subclasses.
This class represents the va_arg llvm instruction, which returns an argument of the specified type gi...
FPToUIInst(Value *S, Type *Ty, const Twine &NameStr="", Instruction *InsertBefore=nullptr)
Constructor with insert-before-instruction semantics.
void setAtomic(AtomicOrdering Ordering, SynchronizationScope SynchScope=CrossThread)
~UnaryInstruction() override
bool hasAllConstantIndices() const
Return true if all of the indices of this GEP are constant integers.
LLVMContext & getContext() const
All values hold a context through their type.
static CastInst * CreateZExtOrBitCast(Value *S, Type *Ty, const Twine &Name="", Instruction *InsertBefore=nullptr)
Create a ZExt or BitCast cast instruction.
bool isFPOrFPVectorTy() const
Return true if this is a FP type or a vector of FP.
void setSuccessor(unsigned Idx, BasicBlock *NewSucc)
static PointerType * getInt8PtrTy(LLVMContext &C, unsigned AS=0)
1 1 0 1 True if unordered, less than, or equal
void swapProfMetadata()
If the instruction has "branch_weights" MD_prof metadata and the MDNode has three operands (including...
#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.
OpIteratorTy populateBundleOperandInfos(ArrayRef< OperandBundleDef > Bundles, const unsigned BeginIndex)
Populate the BundleOpInfo instances and the Use& vector from Bundles.
BasicBlock * getSuccessor(unsigned Idx) const
unsigned char SubclassOptionalData
Hold subclass data that can be dropped.
unsigned getNumSuccessors() const
float getFPAccuracy() const
Get the maximum error permitted by this operation in ULPs.
CallingConv::ID getCallingConv() const
getCallingConv/setCallingConv - Get or set the calling convention of this function call...
void setSuccessor(unsigned idx, BasicBlock *NewSucc)
BasicBlock * getSuccessor(unsigned i) const
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.
BasicBlock * getUnwindDest() const
bool isConditional() const
static InvokeInst * Create(Value *Func, BasicBlock *IfNormal, BasicBlock *IfException, ArrayRef< Value * > Args, const Twine &NameStr, Instruction *InsertBefore=nullptr)
static Instruction * createMalloc(Instruction *InsertBefore, BasicBlock *InsertAtEnd, Type *IntPtrTy, Type *AllocTy, Value *AllocSize, Value *ArraySize, ArrayRef< OperandBundleDef > OpB, Function *MallocF, const Twine &Name)
IntegerType * getIntPtrType(LLVMContext &C, unsigned AddressSpace=0) const
Returns an integer type with size at least as big as that of a pointer in the given address space...
BasicBlock * getUnwindDest() const
0 0 1 0 True if ordered and greater than
BinaryOps getOpcode() const
static BinaryOperator * CreateFNeg(Value *Op, const Twine &Name="", Instruction *InsertBefore=nullptr)
const MDOperand & getOperand(unsigned I) const
static CastInst * CreateIntegerCast(Value *S, Type *Ty, bool isSigned, const Twine &Name="", Instruction *InsertBefore=nullptr)
Create a ZExt, BitCast, or Trunc for int -> int casts.
BasicBlock * getUnwindDest() const
AtomicOrdering getOrdering() const
Returns the ordering effect of this store.
bool isSwiftError() const
Return true if this alloca is used as a swifterror argument to a call.
static PointerType * getUnqual(Type *ElementType)
This constructs a pointer to an object of the specified type in the generic address space (address sp...
This is the shared class of boolean and integer constants.
Instruction * getInstruction() const
Value * getIncomingValue(unsigned i) const
Return incoming value number x.
AtomicCmpXchgInst * cloneImpl() const
unsigned getScalarSizeInBits() const LLVM_READONLY
If this is a vector type, return the getPrimitiveSizeInBits value for the element type...
AddrSpaceCastInst(Value *S, Type *Ty, const Twine &NameStr="", Instruction *InsertBefore=nullptr)
Constructor with insert-before-instruction semantics.
ICmpInst * cloneImpl() const
Clone an identical ICmpInst.
unsigned getNumSuccessors() const
ReturnInst * cloneImpl() const
static CallInst * Create(Value *Func, ArrayRef< Value * > Args, ArrayRef< OperandBundleDef > Bundles=None, const Twine &NameStr="", Instruction *InsertBefore=nullptr)
1 1 0 0 True if unordered or less than
bool isStaticAlloca() const
Return true if this alloca is in the entry block of the function and is a constant size...
Module.h This file contains the declarations for the Module class.
Type * getType() const
All values are typed, get the type of this value.
static bool isCastable(Type *SrcTy, Type *DestTy)
Check whether it is valid to call getCastOpcode for these types.
LoadInst(Value *Ptr, const Twine &NameStr, Instruction *InsertBefore)
TailCallKind getTailCallKind() const
op_iterator arg_end()
Return the iterator pointing to the end of the argument list.
InvokeInst * cloneImpl() const
bool isVolatile() const
Return true if this is a load from a volatile memory location.
unsigned getBundleOperandsStartIndex() const
Return the index of the first bundle operand in the Use array.
bool isTrueWhenEqual() const
This is just a convenience.
This class represents a cast from floating point to unsigned integer.
static CastInst * CreateFPCast(Value *S, Type *Ty, const Twine &Name="", Instruction *InsertBefore=nullptr)
Create an FPExt, BitCast, or FPTrunc for fp -> fp casts.
bundle_op_iterator bundle_op_info_end()
Return the end of the list of BundleOpInfo instances associated with this OperandBundleUser.
Value * getParentPad() const
Convenience accessors.
static unsigned isEliminableCastPair(Instruction::CastOps firstOpcode, Instruction::CastOps secondOpcode, Type *SrcTy, Type *MidTy, Type *DstTy, Type *SrcIntPtrTy, Type *MidIntPtrTy, Type *DstIntPtrTy)
Determine how a pair of casts can be eliminated, if they can be at all.
ShuffleVectorInst * cloneImpl() const
Predicate getSwappedPredicate() const
For example, EQ->EQ, SLE->SGE, ULT->UGT, OEQ->OEQ, ULE->UGE, OLT->OGT, etc.
VAArgInst * cloneImpl() const
static Constant * get(Type *Ty, uint64_t V, bool isSigned=false)
If Ty is a vector type, return a Constant with a splat of the given value.
Function * getCalledFunction() const
Return the function called, or null if this is an indirect function invocation.
AtomicOrdering getOrdering() const
Returns the ordering effect of this fence.
SExtInst(Value *S, Type *Ty, const Twine &NameStr="", Instruction *InsertBefore=nullptr)
Constructor with insert-before-instruction semantics.
ZExtInst * cloneImpl() const
Clone an identical ZExtInst.
void setSuccessor(unsigned idx, BasicBlock *NewSucc)
BinOp getOperation() const
void setPredicate(Predicate P)
Set the predicate for this instruction to the specified value.
static GCRegistry::Add< ShadowStackGC > C("shadow-stack","Very portable GC for uncooperative code generators")
unsigned Log2_32(uint32_t Value)
Log2_32 - This function returns the floor log base 2 of the specified value, -1 if the value is zero...
void swap(llvm::BitVector &LHS, llvm::BitVector &RHS)
Implement std::swap in terms of BitVector swap.
bool accumulateConstantOffset(const DataLayout &DL, APInt &Offset) const
Accumulate the constant address offset of this GEP if possible.
SynchronizationScope getSynchScope() const
Value * getArgOperand(unsigned i) const
getArgOperand/setArgOperand - Return/set the i-th call argument.
Class to represent vector types.
void setVolatile(bool V)
Specify whether this is a volatile store or not.
static bool isNeg(const Value *V)
Check if the given Value is a NEG, FNeg, or NOT instruction.
Class for arbitrary precision integers.
BinaryOperator(BinaryOps iType, Value *S1, Value *S2, Type *Ty, const Twine &Name, Instruction *InsertBefore)
void push_back(pointer val)
Value * getReturnedArgOperand() const
If one of the arguments has the 'returned' attribute, return its operand value.
VAArgInst(Value *List, Type *Ty, const Twine &NameStr="", Instruction *InsertBefore=nullptr)
bool isIntegerTy() const
True if this is an instance of IntegerType.
static BinaryOperator * Create(BinaryOps Op, Value *S1, Value *S2, const Twine &Name=Twine(), Instruction *InsertBefore=nullptr)
Construct a binary instruction, given the opcode and the two operands.
void setWeak(bool IsWeak)
unsigned getVectorNumElements() const
ZExtInst(Value *S, Type *Ty, const Twine &NameStr="", Instruction *InsertBefore=nullptr)
Constructor with insert-before-instruction semantics.
FCmpInst(Instruction *InsertBefore, Predicate pred, Value *LHS, Value *RHS, const Twine &NameStr="")
Constructor with insert-before-instruction semantics.
Value * getCondition() const
BitCastInst(Value *S, Type *Ty, const Twine &NameStr="", Instruction *InsertBefore=nullptr)
Constructor with insert-before-instruction semantics.
static bool isConstantAllOnes(const Value *V)
AttributeSet removeAttribute(LLVMContext &C, unsigned Index, Attribute::AttrKind Kind) const
Remove the specified attribute at the specified index from this attribute list.
Common super class of ArrayType, StructType and VectorType.
void setSwiftError(bool V)
Specify whether this alloca is used to represent a swifterror.
APInt And(const APInt &LHS, const APInt &RHS)
Bitwise AND function for APInt.
static Instruction * CreateMalloc(Instruction *InsertBefore, Type *IntPtrTy, Type *AllocTy, Value *AllocSize, Value *ArraySize=nullptr, Function *MallocF=nullptr, const Twine &Name="")
Generate the IR for a call to malloc:
unsigned getNumSuccessors() const
Value * getParentPad() const
AllocaInst * cloneImpl() const
static Type * getIndexedType(Type *Ty, ArrayRef< Value * > IdxList)
Returns the type of the element that would be loaded with a load instruction with the specified param...
InsertElementInst * cloneImpl() const
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 ...
bool isImpliedFalseByMatchingCmp(Predicate Pred2)
Determine if Pred1 implies Pred2 is false when two compares have matching operands.
static int getMaskValue(Constant *Mask, unsigned Elt)
Return the shuffle mask value for the specified element of the mask.
Value * getArgOperand(unsigned i) const
getArgOperand/setArgOperand - Return/set the i-th invoke argument.
BasicBlock * getSuccessor(unsigned idx) const
Value * getCondition() const
BasicBlock * getDefaultDest() const
const RootIt & getCurrent() const
bool isAggregateType() const
Return true if the type is an aggregate type.
unsigned getNumSuccessors() const
static IntegerType * getInt32Ty(LLVMContext &C)
AtomicOrdering getOrdering() const
Returns the ordering effect of this fence.
CatchReturnInst * cloneImpl() const
static CastInst * CreateTruncOrBitCast(Value *S, Type *Ty, const Twine &Name="", Instruction *InsertBefore=nullptr)
Create a Trunc or BitCast cast instruction.
unsigned greater or equal
static bool isUnordered(Predicate predicate)
Determine if the predicate is an unordered operation.
AttributeSet addDereferenceableOrNullAttr(LLVMContext &C, unsigned Index, uint64_t Bytes) const
Add the dereferenceable_or_null attribute to the attribute set at the given index.
unsigned getAlignment() const
Return the alignment of the access that is being performed.
static bool isFNeg(const Value *V, bool IgnoreZeroSign=false)
void setOperation(BinOp Operation)
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.
void setSuccessor(unsigned idx, BasicBlock *NewSucc)
static Constant * getZeroValueForNegation(Type *Ty)
Floating point negation must be implemented with f(x) = -0.0 - x.
bool hasAttrSomewhere(Attribute::AttrKind Kind, unsigned *Index=nullptr) const
Return true if the specified attribute is set for at least one parameter or for the return value...
This class represents a cast unsigned integer to floating point.
0 1 1 0 True if ordered and operands are unequal
Compile-time customization of User operands.
LLVM_NODISCARD std::enable_if<!is_simple_type< Y >::value, typename cast_retty< X, const Y >::ret_type >::type dyn_cast(const Y &Val)
unsigned getNumSuccessors() const
void removeAttribute(unsigned i, Attribute::AttrKind Kind)
removes the attribute from the list of attributes.
VectorType * getType() const
Overload to return most specific vector type.
IntToPtrInst * cloneImpl() const
Clone an identical IntToPtrInst.
bool dataOperandHasImpliedAttr(unsigned i, Attribute::AttrKind Kind) const
Return true if the data operand at index i has the attribute A.
bool hasNoSignedZeros() const
Determine whether the no-signed-zeros flag is set.
void removeCase(CaseIt i)
This method removes the specified case and its successor from the switch instruction.
1 0 1 0 True if unordered or greater than
unsigned getNumCases() const
Return the number of 'cases' in this switch instruction, excluding the default case.
bool hasUnwindDest() const
void addDestination(BasicBlock *Dest)
Add a destination.
ResumeInst * cloneImpl() const
const APFloat & getValueAPF() const
static CastInst * CreateSExtOrBitCast(Value *S, Type *Ty, const Twine &Name="", Instruction *InsertBefore=nullptr)
Create a SExt or BitCast cast instruction.
This class represents a cast from signed integer to floating point.
bool isUnsigned() const
Determine if this instruction is using an unsigned comparison.
bool isWeak() const
Return true if this cmpxchg may spuriously fail.
GetElementPtrInst * cloneImpl() const
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
const BasicBlock & front() const
This class represents a truncation of floating point types.
unsigned getPrimitiveSizeInBits() const LLVM_READONLY
Return the basic size of this type if it is a primitive type.
void setSuccessOrdering(AtomicOrdering Ordering)
Set the ordering constraint on this cmpxchg.
0 0 0 1 True if ordered and equal
FuncletPadInst * cloneImpl() const
LLVM Value Representation.
void setAlignment(unsigned Align)
FPExtInst(Value *S, Type *Ty, const Twine &NameStr="", Instruction *InsertBefore=nullptr)
Constructor with insert-before-instruction semantics.
FPToSIInst * cloneImpl() const
Clone an identical FPToSIInst.
1 0 1 1 True if unordered, greater than, or equal
void allocHungoffUses(unsigned N, bool IsPhi=false)
Allocate the array of Uses, followed by a pointer (with bottom bit set) to the User.
const Value * getArraySize() const
Get the number of elements allocated.
std::underlying_type< E >::type Mask()
Get a bitmask with 1s in all places up to the high-order bit of E's largest value.
static Value * getAISize(LLVMContext &Context, Value *Amt)
StoreInst(Value *Val, Value *Ptr, Instruction *InsertBefore)
void setCallingConv(CallingConv::ID CC)
bool paramHasAttr(unsigned i, Attribute::AttrKind Kind) const
Determine whether the call or the callee has the given attributes.
void setSynchScope(SynchronizationScope SynchScope)
Specify whether this RMW orders other operations with respect to all concurrently executing threads...
TruncInst * cloneImpl() const
Clone an identical TruncInst.
Predicate getSignedPredicate() const
For example, EQ->EQ, SLE->SLE, UGT->SGT, etc.
bool isCleanup() const
Return 'true' if this landingpad instruction is a cleanup.
StringRef - Represent a constant reference to a string, i.e.
AtomicCmpXchgInst(Value *Ptr, Value *Cmp, Value *NewVal, AtomicOrdering SuccessOrdering, AtomicOrdering FailureOrdering, SynchronizationScope SynchScope, Instruction *InsertBefore=nullptr)
ICmpInst(Instruction *InsertBefore, Predicate pred, Value *LHS, Value *RHS, const Twine &NameStr="")
Constructor with insert-before-instruction semantics.
CallingConv::ID getCallingConv() const
getCallingConv/setCallingConv - Get or set the calling convention of this function call...
void addAttribute(unsigned i, Attribute::AttrKind Kind)
adds the attribute to the list of attributes.
static bool isVolatile(Instruction *Inst)
bool bundleOperandHasAttr(unsigned OpIdx, Attribute::AttrKind A) const
Return true if the bundle operand at index OpIdx has the attribute A.
void setNumHungOffUseOperands(unsigned NumOps)
Subclasses with hung off uses need to manage the operand count themselves.
static Constant * getMul(Constant *C1, Constant *C2, bool HasNUW=false, bool HasNSW=false)
FenceInst * cloneImpl() const
static BinaryOperator * CreateMul(Value *S1, Value *S2, const Twine &Name, Instruction *InsertBefore, Value *FlagsOp)
Type * getAllocatedType() const
Return the type that is being allocated by the instruction.
This class represents an extension of floating point types.
0 0 1 1 True if ordered and greater than or equal
void setVolatile(bool V)
Specify whether this is a volatile load or not.
SynchronizationScope getSynchScope() const
Returns whether this cmpxchg is atomic between threads or only within a single thread.
unsigned getPointerAddressSpace() const
Get the address space of this pointer or pointer vector type.
FPTruncInst * cloneImpl() const
Clone an identical FPTruncInst.
unsigned getNumArgOperands() const
Return the number of invoke arguments.
InsertValueInst * cloneImpl() const
unsigned getNumSuccessors() const
void removeDestination(unsigned i)
This method removes the specified successor from the indirectbr instruction.
const BasicBlock * getParent() const
bool isOne() const
This is just a convenience method to make client code smaller for a common case.
CleanupReturnInst * cloneImpl() const
SmallVector< int, 16 > getShuffleMask() const
FenceInst(LLVMContext &C, AtomicOrdering Ordering, SynchronizationScope SynchScope=CrossThread, Instruction *InsertBefore=nullptr)
void addDereferenceableAttr(unsigned i, uint64_t Bytes)
adds the dereferenceable attribute to the list of attributes.
0 0 0 0 Always false (always folded)
Type * getTypeAtIndex(const Value *V) const
Given an index value into the type, return the type of the element.
AddrSpaceCastInst * cloneImpl() const
Clone an identical AddrSpaceCastInst.
LLVMContext & getContext() const
Get the global data context.
PHINode * cloneImpl() const
bool isVoidTy() const
Return true if this is 'void'.
an instruction to allocate memory on the stack
SelectInst * cloneImpl() const
This instruction inserts a struct field of array element value into an aggregate value.
AttrKind
This enumeration lists the attributes that can be associated with parameters, function results...
bool isVolatile() const
Return true if this is a RMW on a volatile memory location.
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...