41 if (
const ConstantFP *CFP = dyn_cast<ConstantFP>(
this))
42 return CFP->isZero() && CFP->isNegative();
46 if (CV->getElementType()->isFloatingPointTy() && CV->isSplat())
47 if (CV->getElementAsAPFloat(0).isNegZero())
51 if (
ConstantFP *SplatCFP = dyn_cast_or_null<ConstantFP>(CV->getSplatValue()))
52 if (SplatCFP && SplatCFP->isZero() && SplatCFP->isNegative())
67 if (
const ConstantFP *CFP = dyn_cast<ConstantFP>(
this))
72 if (CV->getElementType()->isFloatingPointTy() && CV->isSplat())
73 if (CV->getElementAsAPFloat(0).isZero())
77 if (
ConstantFP *SplatCFP = dyn_cast_or_null<ConstantFP>(CV->getSplatValue()))
78 if (SplatCFP && SplatCFP->isZero())
87 if (
const ConstantInt *CI = dyn_cast<ConstantInt>(
this))
91 if (
const ConstantFP *CFP = dyn_cast<ConstantFP>(
this))
92 return CFP->isZero() && !CFP->isNegative();
96 return isa<ConstantAggregateZero>(
this) || isa<ConstantPointerNull>(
this) ||
97 isa<ConstantTokenNone>(
this);
102 if (
const ConstantInt *CI = dyn_cast<ConstantInt>(
this))
103 return CI->isMinusOne();
106 if (
const ConstantFP *CFP = dyn_cast<ConstantFP>(
this))
107 return CFP->getValueAPF().bitcastToAPInt().isAllOnesValue();
112 return Splat->isAllOnesValue();
117 if (CV->getElementType()->isFloatingPointTy())
118 return CV->getElementAsAPFloat(0).bitcastToAPInt().isAllOnesValue();
119 return CV->getElementAsAPInt(0).isAllOnesValue();
128 if (
const ConstantInt *CI = dyn_cast<ConstantInt>(
this))
132 if (
const ConstantFP *CFP = dyn_cast<ConstantFP>(
this))
133 return CFP->getValueAPF().bitcastToAPInt().isOneValue();
138 return Splat->isOneValue();
143 if (CV->getElementType()->isFloatingPointTy())
144 return CV->getElementAsAPFloat(0).bitcastToAPInt().isOneValue();
145 return CV->getElementAsAPInt(0).isOneValue();
154 if (
const ConstantInt *CI = dyn_cast<ConstantInt>(
this))
155 return CI->isMinValue(
true);
158 if (
const ConstantFP *CFP = dyn_cast<ConstantFP>(
this))
159 return CFP->getValueAPF().bitcastToAPInt().isMinSignedValue();
164 return Splat->isMinSignedValue();
169 if (CV->getElementType()->isFloatingPointTy())
170 return CV->getElementAsAPFloat(0).bitcastToAPInt().isMinSignedValue();
171 return CV->getElementAsAPInt(0).isMinSignedValue();
180 if (
const ConstantInt *CI = dyn_cast<ConstantInt>(
this))
181 return !CI->isMinValue(
true);
184 if (
const ConstantFP *CFP = dyn_cast<ConstantFP>(
this))
185 return !CFP->getValueAPF().bitcastToAPInt().isMinSignedValue();
188 if (this->
getType()->isVectorTy()) {
190 for (
unsigned i = 0; i != NumElts; ++i) {
203 if (
auto *CFP = dyn_cast<ConstantFP>(
this))
204 return CFP->getValueAPF().isFiniteNonZero();
207 for (
unsigned i = 0, e =
getType()->getVectorNumElements(); i != e; ++i) {
209 if (!CFP || !CFP->getValueAPF().isFiniteNonZero())
216 if (
auto *CFP = dyn_cast<ConstantFP>(
this))
217 return CFP->getValueAPF().isNormal();
220 for (
unsigned i = 0, e =
getType()->getVectorNumElements(); i != e; ++i) {
222 if (!CFP || !CFP->getValueAPF().isNormal())
229 if (
auto *CFP = dyn_cast<ConstantFP>(
this))
230 return CFP->getValueAPF().getExactInverse(
nullptr);
233 for (
unsigned i = 0, e =
getType()->getVectorNumElements(); i != e; ++i) {
235 if (!CFP || !CFP->getValueAPF().getExactInverse(
nullptr))
242 if (
auto *CFP = dyn_cast<ConstantFP>(
this))
246 for (
unsigned i = 0, e =
getType()->getVectorNumElements(); i != e; ++i) {
248 if (!CFP || !CFP->isNaN())
257 for (
unsigned i = 0, e =
getType()->getVectorNumElements(); i != e; ++i)
309 if (
PointerType *PTy = dyn_cast<PointerType>(ScalarTy))
313 if (
VectorType *VTy = dyn_cast<VectorType>(Ty))
337 return Elt < CC->getNumOperands() ? CC->getOperand(Elt) :
nullptr;
340 return Elt < CAZ->getNumElements() ? CAZ->getElementValue(Elt) :
nullptr;
342 if (
const UndefValue *UV = dyn_cast<UndefValue>(
this))
343 return Elt < UV->getNumElements() ? UV->getElementValue(Elt) :
nullptr;
346 return Elt < CDS->getNumElements() ? CDS->getElementAsConstant(Elt)
352 assert(isa<IntegerType>(Elt->
getType()) &&
"Index must be an integer");
353 if (
ConstantInt *CI = dyn_cast<ConstantInt>(Elt)) {
355 if (CI->getValue().getActiveBits() > 64)
368 #define HANDLE_CONSTANT(Name) \ 369 case Value::Name##Val: \ 370 cast<Name>(this)->destroyConstantImpl(); \ 372 #include "llvm/IR/Value.def" 384 #ifndef NDEBUG // Only in -g mode... 385 if (!isa<Constant>(V)) {
386 dbgs() <<
"While deleting: " << *
this 387 <<
"\n\nUse still stuck around after Def is destroyed: " << *V
391 assert(isa<Constant>(V) &&
"References remain to Constant being destroyed");
412 if (
ConstantExpr *
Op = dyn_cast<ConstantExpr>(CE->getOperand(i))) {
419 switch (CE->getOpcode()) {
422 case Instruction::UDiv:
423 case Instruction::SDiv:
424 case Instruction::URem:
425 case Instruction::SRem:
427 if (!isa<ConstantInt>(CE->getOperand(1)) ||CE->getOperand(1)->isNullValue())
447 while (!WorkList.
empty()) {
449 if (
const auto *GV = dyn_cast<GlobalValue>(WorkItem))
456 if (Visited.
insert(ConstOp).second)
464 auto DLLImportPredicate = [](
const GlobalValue *GV) {
465 return GV->isThreadLocal();
471 auto DLLImportPredicate = [](
const GlobalValue *GV) {
472 return GV->hasDLLImportStorageClass();
480 if (!UC || isa<GlobalValue>(UC))
490 if (isa<GlobalValue>(
this))
493 if (
const BlockAddress *BA = dyn_cast<BlockAddress>(
this))
494 return BA->getFunction()->needsRelocation();
500 if (
const ConstantExpr *CE = dyn_cast<ConstantExpr>(
this))
501 if (CE->getOpcode() == Instruction::Sub) {
504 if (LHS && RHS && LHS->
getOpcode() == Instruction::PtrToInt &&
505 RHS->getOpcode() == Instruction::PtrToInt &&
507 isa<BlockAddress>(RHS->getOperand(0)) &&
509 cast<BlockAddress>(RHS->getOperand(0))->
getFunction())
523 if (isa<GlobalValue>(C))
return false;
527 if (!User)
return false;
557 if (LastNonDeadUser ==
E) {
595 if (
auto *VTy = dyn_cast<VectorType>(Ty))
603 if (
auto *VTy = dyn_cast<VectorType>(Ty))
612 std::unique_ptr<ConstantInt> &Slot = pImpl->
IntConstants[V];
626 if (
VectorType *VTy = dyn_cast<VectorType>(Ty))
637 return get(Ty, V,
true);
641 return get(Ty, V,
true);
647 "ConstantInt type doesn't match the type implied by its value!");
650 if (
VectorType *VTy = dyn_cast<VectorType>(Ty))
661 void ConstantInt::destroyConstantImpl() {
695 if (
VectorType *VTy = dyn_cast<VectorType>(Ty))
704 "ConstantFP type doesn't match the type implied by its value!");
707 if (
auto *VTy = dyn_cast<VectorType>(Ty))
720 if (
VectorType *VTy = dyn_cast<VectorType>(Ty))
731 if (
VectorType *VTy = dyn_cast<VectorType>(Ty))
742 if (
VectorType *VTy = dyn_cast<VectorType>(Ty))
753 if (
VectorType *VTy = dyn_cast<VectorType>(Ty))
764 if (
VectorType *VTy = dyn_cast<VectorType>(Ty))
773 return getNegativeZero(Ty);
783 std::unique_ptr<ConstantFP> &Slot = pImpl->
FPConstants[V];
799 "Unknown FP format");
812 if (
VectorType *VTy = dyn_cast<VectorType>(Ty))
825 return Val.bitwiseIsEqual(V);
829 void ConstantFP::destroyConstantImpl() {
846 if (isa<SequentialType>(
getType()))
847 return getSequentialElement();
848 return getStructElement(cast<ConstantInt>(C)->getZExtValue());
852 if (isa<SequentialType>(
getType()))
853 return getSequentialElement();
854 return getStructElement(Idx);
859 if (
auto *AT = dyn_cast<ArrayType>(Ty))
860 return AT->getNumElements();
861 if (
auto *VT = dyn_cast<VectorType>(Ty))
862 return VT->getNumElements();
879 if (isa<SequentialType>(
getType()))
880 return getSequentialElement();
881 return getStructElement(cast<ConstantInt>(C)->getZExtValue());
885 if (isa<SequentialType>(
getType()))
886 return getSequentialElement();
887 return getStructElement(Idx);
892 if (
auto *
ST = dyn_cast<SequentialType>(Ty))
893 return ST->getNumElements();
901 template <
typename ItTy,
typename EltTy>
903 for (; Start != End; ++Start)
909 template <
typename SequentialTy,
typename ElementTy>
911 assert(!V.
empty() &&
"Cannot get empty int sequence.");
915 if (
auto *CI = dyn_cast<ConstantInt>(C))
919 return SequentialTy::get(V[0]->
getContext(), Elts);
922 template <
typename SequentialTy,
typename ElementTy>
924 assert(!V.
empty() &&
"Cannot get empty FP sequence.");
928 if (
auto *CFP = dyn_cast<ConstantFP>(C))
929 Elts.
push_back(CFP->getValueAPF().bitcastToAPInt().getLimitedValue());
932 return SequentialTy::getFP(V[0]->
getContext(), Elts);
935 template <
typename SequenceTy>
942 if (CI->getType()->isIntegerTy(8))
943 return getIntSequenceIfElementsMatch<SequenceTy, uint8_t>(V);
944 else if (CI->getType()->isIntegerTy(16))
945 return getIntSequenceIfElementsMatch<SequenceTy, uint16_t>(V);
946 else if (CI->getType()->isIntegerTy(32))
947 return getIntSequenceIfElementsMatch<SequenceTy, uint32_t>(V);
948 else if (CI->getType()->isIntegerTy(64))
949 return getIntSequenceIfElementsMatch<SequenceTy, uint64_t>(V);
950 }
else if (
ConstantFP *CFP = dyn_cast<ConstantFP>(C)) {
951 if (CFP->getType()->isHalfTy())
952 return getFPSequenceIfElementsMatch<SequenceTy, uint16_t>(V);
953 else if (CFP->getType()->isFloatTy())
954 return getFPSequenceIfElementsMatch<SequenceTy, uint32_t>(V);
955 else if (CFP->getType()->isDoubleTy())
956 return getFPSequenceIfElementsMatch<SequenceTy, uint64_t>(V);
969 if (
auto *
ST = dyn_cast<StructType>(T))
972 for (
unsigned I = 0,
E = V.
size();
I !=
E; ++
I)
974 "Initializer for composite element doesn't match!");
980 "Invalid initializer for constant array");
994 for (
unsigned i = 0, e = V.
size(); i != e; ++i) {
996 "Wrong type in array element initializer");
1012 return getSequenceIfElementsMatch<ConstantDataArray>(
C, V);
1021 unsigned VecSize = V.
size();
1023 for (
unsigned i = 0; i != VecSize; ++i)
1024 EltTypes[i] = V[i]->
getType();
1033 "ConstantStruct::getTypeForElements cannot be called on empty list");
1034 return getTypeForElements(V[0]->
getContext(), V, Packed);
1040 "Invalid initializer for constant struct");
1046 "Incorrect # elements specified to ConstantStruct::get");
1053 isUndef = isa<UndefValue>(V[0]);
1054 isZero = V[0]->isNullValue();
1055 if (isUndef || isZero) {
1056 for (
unsigned i = 0, e = V.
size(); i != e; ++i) {
1059 if (!isa<UndefValue>(V[i]))
1075 "Invalid initializer for constant vector");
1093 bool isZero = C->isNullValue();
1096 if (isZero || isUndef) {
1097 for (
unsigned i = 1, e = V.
size(); i != e; ++i)
1099 isZero = isUndef =
false;
1112 return getSequenceIfElementsMatch<ConstantDataVector>(
C, V);
1122 if ((isa<ConstantFP>(V) || isa<ConstantInt>(V)) &&
1138 void ConstantTokenNone::destroyConstantImpl() {
1154 if (
getOpcode() != Instruction::GetElementPtr)
return false;
1161 for (; GEPI !=
E; ++GEPI, ++OI) {
1162 if (isa<UndefValue>(*OI))
1166 (CI->getValue().getActiveBits() > 64 ||
1176 return getOpcode() == Instruction::ExtractValue ||
1177 getOpcode() == Instruction::InsertValue;
1182 dyn_cast<ExtractValueConstantExpr>(
this))
1183 return EVCE->Indices;
1185 return cast<InsertValueConstantExpr>(
this)->Indices;
1189 return cast<CompareConstantExpr>(
this)->predicate;
1195 "Replacing operand with value of different type!");
1197 return const_cast<ConstantExpr*>(
this);
1203 return getWithOperands(NewOps);
1207 bool OnlyIfReduced,
Type *SrcTy)
const {
1214 Type *OnlyIfReducedTy = OnlyIfReduced ? Ty :
nullptr;
1216 case Instruction::Trunc:
1217 case Instruction::ZExt:
1218 case Instruction::SExt:
1219 case Instruction::FPTrunc:
1220 case Instruction::FPExt:
1221 case Instruction::UIToFP:
1222 case Instruction::SIToFP:
1223 case Instruction::FPToUI:
1224 case Instruction::FPToSI:
1225 case Instruction::PtrToInt:
1226 case Instruction::IntToPtr:
1227 case Instruction::BitCast:
1228 case Instruction::AddrSpaceCast:
1232 case Instruction::InsertElement:
1235 case Instruction::ExtractElement:
1237 case Instruction::InsertValue:
1240 case Instruction::ExtractValue:
1242 case Instruction::ShuffleVector:
1245 case Instruction::GetElementPtr: {
1246 auto *GEPO = cast<GEPOperator>(
this);
1249 SrcTy ? SrcTy : GEPO->getSourceElementType(), Ops[0], Ops.
slice(1),
1250 GEPO->isInBounds(), GEPO->getInRangeIndex(), OnlyIfReducedTy);
1252 case Instruction::ICmp:
1253 case Instruction::FCmp:
1270 return Val == 0 || Val == 1;
1277 return Val == 0 || Val == 1 || Val == -1;
1278 return isIntN(NumBits, Val);
1334 "Cannot create an aggregate zero of non-aggregate type!");
1336 std::unique_ptr<ConstantAggregateZero> &Entry =
1345 void ConstantAggregateZero::destroyConstantImpl() {
1350 void ConstantArray::destroyConstantImpl() {
1359 void ConstantStruct::destroyConstantImpl() {
1364 void ConstantVector::destroyConstantImpl() {
1369 assert(this->
getType()->isVectorTy() &&
"Only valid for vectors!");
1370 if (isa<ConstantAggregateZero>(
this))
1373 return CV->getSplatValue();
1375 return CV->getSplatValue();
1390 if (
const ConstantInt *CI = dyn_cast<ConstantInt>(
this))
1391 return CI->getValue();
1394 assert(C && isa<ConstantInt>(C) &&
"Not a vector of numbers!");
1395 return cast<ConstantInt>(
C)->getValue();
1402 std::unique_ptr<ConstantPointerNull> &Entry =
1411 void ConstantPointerNull::destroyConstantImpl() {
1424 void UndefValue::destroyConstantImpl() {
1449 BB->AdjustBlockAddressRefCount(1);
1457 assert(F &&
"Block must have a parent");
1460 assert(BA &&
"Refcount and block address map disagree!");
1465 void BlockAddress::destroyConstantImpl() {
1468 getBasicBlock()->AdjustBlockAddressRefCount(-1);
1480 assert(From == NewBB &&
"From does not match any operand");
1481 NewBB = cast<BasicBlock>(To);
1491 getBasicBlock()->AdjustBlockAddressRefCount(-1);
1500 getBasicBlock()->AdjustBlockAddressRefCount(1);
1513 bool OnlyIfReduced =
false) {
1531 bool OnlyIfReduced) {
1534 assert(C && Ty &&
"Null arguments to getCast");
1540 case Instruction::Trunc:
1541 return getTrunc(C, Ty, OnlyIfReduced);
1542 case Instruction::ZExt:
1543 return getZExt(C, Ty, OnlyIfReduced);
1544 case Instruction::SExt:
1545 return getSExt(C, Ty, OnlyIfReduced);
1546 case Instruction::FPTrunc:
1547 return getFPTrunc(C, Ty, OnlyIfReduced);
1548 case Instruction::FPExt:
1549 return getFPExtend(C, Ty, OnlyIfReduced);
1550 case Instruction::UIToFP:
1551 return getUIToFP(C, Ty, OnlyIfReduced);
1552 case Instruction::SIToFP:
1553 return getSIToFP(C, Ty, OnlyIfReduced);
1554 case Instruction::FPToUI:
1555 return getFPToUI(C, Ty, OnlyIfReduced);
1556 case Instruction::FPToSI:
1557 return getFPToSI(C, Ty, OnlyIfReduced);
1558 case Instruction::PtrToInt:
1559 return getPtrToInt(C, Ty, OnlyIfReduced);
1560 case Instruction::IntToPtr:
1561 return getIntToPtr(C, Ty, OnlyIfReduced);
1562 case Instruction::BitCast:
1563 return getBitCast(C, Ty, OnlyIfReduced);
1564 case Instruction::AddrSpaceCast:
1565 return getAddrSpaceCast(C, Ty, OnlyIfReduced);
1571 return getBitCast(C, Ty);
1572 return getZExt(C, Ty);
1577 return getBitCast(C, Ty);
1578 return getSExt(C, Ty);
1583 return getBitCast(C, Ty);
1584 return getTrunc(C, Ty);
1593 return getPtrToInt(S, Ty);
1597 return getAddrSpaceCast(S, Ty);
1599 return getBitCast(S, Ty);
1608 return getAddrSpaceCast(S, Ty);
1610 return getBitCast(S, Ty);
1619 (SrcBits == DstBits ? Instruction::BitCast :
1620 (SrcBits > DstBits ? Instruction::Trunc :
1621 (isSigned ? Instruction::SExt : Instruction::ZExt)));
1622 return getCast(opcode, C, Ty);
1630 if (SrcBits == DstBits)
1633 (SrcBits > DstBits ? Instruction::FPTrunc : Instruction::FPExt);
1634 return getCast(opcode, C, Ty);
1642 assert((fromVec == toVec) &&
"Cannot convert from scalar to/from vector");
1646 "SrcTy must be larger than DestTy for Trunc!");
1648 return getFoldedCast(Instruction::Trunc, C, Ty, OnlyIfReduced);
1656 assert((fromVec == toVec) &&
"Cannot convert from scalar to/from vector");
1660 "SrcTy must be smaller than DestTy for SExt!");
1662 return getFoldedCast(Instruction::SExt, C, Ty, OnlyIfReduced);
1670 assert((fromVec == toVec) &&
"Cannot convert from scalar to/from vector");
1674 "SrcTy must be smaller than DestTy for ZExt!");
1676 return getFoldedCast(Instruction::ZExt, C, Ty, OnlyIfReduced);
1684 assert((fromVec == toVec) &&
"Cannot convert from scalar to/from vector");
1687 "This is an illegal floating point truncation!");
1688 return getFoldedCast(Instruction::FPTrunc, C, Ty, OnlyIfReduced);
1696 assert((fromVec == toVec) &&
"Cannot convert from scalar to/from vector");
1699 "This is an illegal floating point extension!");
1700 return getFoldedCast(Instruction::FPExt, C, Ty, OnlyIfReduced);
1708 assert((fromVec == toVec) &&
"Cannot convert from scalar to/from vector");
1710 "This is an illegal uint to floating point cast!");
1711 return getFoldedCast(Instruction::UIToFP, C, Ty, OnlyIfReduced);
1719 assert((fromVec == toVec) &&
"Cannot convert from scalar to/from vector");
1721 "This is an illegal sint to floating point cast!");
1722 return getFoldedCast(Instruction::SIToFP, C, Ty, OnlyIfReduced);
1730 assert((fromVec == toVec) &&
"Cannot convert from scalar to/from vector");
1732 "This is an illegal floating point to uint cast!");
1733 return getFoldedCast(Instruction::FPToUI, C, Ty, OnlyIfReduced);
1741 assert((fromVec == toVec) &&
"Cannot convert from scalar to/from vector");
1743 "This is an illegal floating point to sint cast!");
1744 return getFoldedCast(Instruction::FPToSI, C, Ty, OnlyIfReduced);
1748 bool OnlyIfReduced) {
1750 "PtrToInt source must be pointer or pointer vector");
1752 "PtrToInt destination must be integer or integer vector");
1753 assert(isa<VectorType>(C->
getType()) == isa<VectorType>(DstTy));
1754 if (isa<VectorType>(C->
getType()))
1756 "Invalid cast between a different number of vector elements");
1757 return getFoldedCast(Instruction::PtrToInt, C, DstTy, OnlyIfReduced);
1761 bool OnlyIfReduced) {
1763 "IntToPtr source must be integer or integer vector");
1765 "IntToPtr destination must be a pointer or pointer vector");
1766 assert(isa<VectorType>(C->
getType()) == isa<VectorType>(DstTy));
1767 if (isa<VectorType>(C->
getType()))
1769 "Invalid cast between a different number of vector elements");
1770 return getFoldedCast(Instruction::IntToPtr, C, DstTy, OnlyIfReduced);
1774 bool OnlyIfReduced) {
1776 "Invalid constantexpr bitcast!");
1780 if (C->
getType() == DstTy)
return C;
1782 return getFoldedCast(Instruction::BitCast, C, DstTy, OnlyIfReduced);
1786 bool OnlyIfReduced) {
1788 "Invalid constantexpr addrspacecast!");
1794 Type *DstElemTy = DstScalarTy->getElementType();
1797 if (
VectorType *VT = dyn_cast<VectorType>(DstTy)) {
1801 C = getBitCast(C, MidTy);
1803 return getFoldedCast(Instruction::AddrSpaceCast, C, DstTy, OnlyIfReduced);
1807 Type *OnlyIfReducedTy) {
1810 "Invalid opcode in unary constant expression");
1814 case Instruction::FNeg:
1816 "Tried to create a floating-point operation on a " 1817 "non-floating-point type!");
1826 if (OnlyIfReducedTy == C->
getType())
1837 unsigned Flags,
Type *OnlyIfReducedTy) {
1840 "Invalid opcode in binary constant expression");
1842 "Operand types in binary constant expression should match");
1847 case Instruction::Sub:
1848 case Instruction::Mul:
1851 "Tried to create an integer operation on a non-integer type!");
1853 case Instruction::FAdd:
1854 case Instruction::FSub:
1855 case Instruction::FMul:
1858 "Tried to create a floating-point operation on a " 1859 "non-floating-point type!");
1861 case Instruction::UDiv:
1862 case Instruction::SDiv:
1865 "Tried to create an arithmetic operation on a non-arithmetic type!");
1867 case Instruction::FDiv:
1870 "Tried to create an arithmetic operation on a non-arithmetic type!");
1872 case Instruction::URem:
1873 case Instruction::SRem:
1876 "Tried to create an arithmetic operation on a non-arithmetic type!");
1878 case Instruction::FRem:
1881 "Tried to create an arithmetic operation on a non-arithmetic type!");
1883 case Instruction::And:
1884 case Instruction::Or:
1885 case Instruction::Xor:
1888 "Tried to create a logical operation on a non-integral type!");
1890 case Instruction::Shl:
1891 case Instruction::LShr:
1892 case Instruction::AShr:
1895 "Tried to create a shift operation on a non-integer type!");
1905 if (OnlyIfReducedTy == C1->
getType())
1921 return getPtrToInt(GEP,
1932 Constant *Indices[2] = { Zero, One };
1933 Constant *
GEP = getGetElementPtr(AligningTy, NullPtr, Indices);
1934 return getPtrToInt(GEP,
1952 return getPtrToInt(GEP,
1957 Constant *C2,
bool OnlyIfReduced) {
1960 switch (Predicate) {
1968 return getFCmp(Predicate, C1, C2, OnlyIfReduced);
1974 return getICmp(Predicate, C1, C2, OnlyIfReduced);
1979 Type *OnlyIfReducedTy) {
1985 if (OnlyIfReducedTy == V1->
getType())
1998 Type *OnlyIfReducedTy) {
2011 assert(DestTy &&
"GEP indices invalid!");
2015 unsigned NumVecElts = 0;
2018 else for (
auto Idx : Idxs)
2019 if (Idx->getType()->isVectorTy())
2020 NumVecElts = Idx->getType()->getVectorNumElements();
2025 if (OnlyIfReducedTy == ReqTy)
2029 std::vector<Constant*> ArgVec;
2030 ArgVec.reserve(1 + Idxs.size());
2031 ArgVec.push_back(C);
2032 for (
unsigned i = 0, e = Idxs.size(); i != e; ++i) {
2034 Idxs[i]->
getType()->getVectorNumElements() == NumVecElts) &&
2035 "getelementptr index type missmatch");
2037 Constant *Idx = cast<Constant>(Idxs[i]);
2040 ArgVec.push_back(Idx);
2043 unsigned SubClassOptionalData = InBounds ? GEPOperator::IsInBounds : 0;
2044 if (InRangeIndex && *InRangeIndex < 63)
2045 SubClassOptionalData |= (*InRangeIndex + 1) << 1;
2047 SubClassOptionalData,
None, Ty);
2054 Constant *RHS,
bool OnlyIfReduced) {
2057 "Invalid ICmp Predicate");
2079 Constant *RHS,
bool OnlyIfReduced) {
2082 "Invalid FCmp Predicate");
2104 Type *OnlyIfReducedTy) {
2106 "Tried to create extractelement operation on non-vector type!");
2108 "Extractelement index must be an integer type!");
2114 if (OnlyIfReducedTy == ReqTy)
2128 "Tried to create insertelement operation on non-vector type!");
2130 "Insertelement types must match!");
2132 "Insertelement index must be i32 type!");
2137 if (OnlyIfReducedTy == Val->
getType())
2141 Constant *ArgVec[] = { Val, Elt, Idx };
2151 "Invalid shuffle vector constant expr operands!");
2160 if (OnlyIfReducedTy == ShufTy)
2173 Type *OnlyIfReducedTy) {
2175 "Non-first-class type for constant insertvalue expression");
2179 "insertvalue indices invalid!");
2185 if (OnlyIfReducedTy == ReqTy)
2196 Type *OnlyIfReducedTy) {
2198 "Tried to create extractelement operation on non-first-class type!");
2202 assert(ReqTy &&
"extractvalue indices invalid!");
2205 "Non-first-class type for constant extractvalue expression");
2209 if (OnlyIfReducedTy == ReqTy)
2221 "Cannot NEG a nonintegral value!");
2228 "Cannot FNEG a non-floating-point value!");
2234 "Cannot NOT a nonintegral value!");
2239 bool HasNUW,
bool HasNSW) {
2246 return get(Instruction::FAdd, C1, C2);
2250 bool HasNUW,
bool HasNSW) {
2253 return get(Instruction::Sub, C1, C2, Flags);
2257 return get(Instruction::FSub, C1, C2);
2261 bool HasNUW,
bool HasNSW) {
2264 return get(Instruction::Mul, C1, C2, Flags);
2268 return get(Instruction::FMul, C1, C2);
2272 return get(Instruction::UDiv, C1, C2,
2277 return get(Instruction::SDiv, C1, C2,
2282 return get(Instruction::FDiv, C1, C2);
2286 return get(Instruction::URem, C1, C2);
2290 return get(Instruction::SRem, C1, C2);
2294 return get(Instruction::FRem, C1, C2);
2298 return get(Instruction::And, C1, C2);
2302 return get(Instruction::Or, C1, C2);
2306 return get(Instruction::Xor, C1, C2);
2310 bool HasNUW,
bool HasNSW) {
2313 return get(Instruction::Shl, C1, C2, Flags);
2317 return get(Instruction::LShr, C1, C2,
2322 return get(Instruction::AShr, C1, C2,
2327 bool AllowRHSConstant) {
2334 case Instruction::Or:
2335 case Instruction::Xor:
2337 case Instruction::Mul:
2339 case Instruction::And:
2341 case Instruction::FAdd:
2344 case Instruction::FMul:
2352 if (!AllowRHSConstant)
2356 case Instruction::Sub:
2357 case Instruction::Shl:
2358 case Instruction::LShr:
2359 case Instruction::AShr:
2360 case Instruction::FSub:
2362 case Instruction::SDiv:
2363 case Instruction::UDiv:
2365 case Instruction::FDiv:
2378 case Instruction::Or:
2381 case Instruction::And:
2382 case Instruction::Mul:
2388 void ConstantExpr::destroyConstantImpl() {
2396 GetElementPtrConstantExpr::GetElementPtrConstantExpr(
2400 (IdxList.
size() + 1),
2401 IdxList.
size() + 1),
2402 SrcElementTy(SrcElementTy),
2406 for (
unsigned i = 0,
E = IdxList.
size(); i !=
E; ++i)
2407 OperandList[i+1] = IdxList[i];
2411 return SrcElementTy;
2415 return ResElementTy;
2422 return getType()->getElementType();
2426 return StringRef(DataElements, getNumElements()*getElementByteSize());
2431 if (
auto *
IT = dyn_cast<IntegerType>(Ty)) {
2432 switch (
IT->getBitWidth()) {
2446 return AT->getNumElements();
2452 return getElementType()->getPrimitiveSizeInBits()/8;
2456 const char *ConstantDataSequential::getElementPointer(
unsigned Elt)
const {
2457 assert(Elt < getNumElements() &&
"Invalid Elt");
2458 return DataElements+Elt*getElementByteSize();
2493 Entry = &Node->Next, Node = *Entry)
2494 if (Node->getType() == Ty)
2499 if (isa<ArrayType>(Ty))
2502 assert(isa<VectorType>(Ty));
2506 void ConstantDataSequential::destroyConstantImpl() {
2512 CDSConstants.
find(getRawDataValues());
2514 assert(Slot != CDSConstants.
end() &&
"CDS not found in uniquing table");
2519 if (!(*Entry)->Next) {
2522 assert((*Entry) ==
this &&
"Hash mismatch in ConstantDataSequential");
2528 Entry = &Node->Next, Node = *Entry) {
2529 assert(Node &&
"Didn't find entry in its uniquing hash table!");
2532 *Entry = Node->Next;
2551 const char *
Data =
reinterpret_cast<const char *
>(Elts.
data());
2557 const char *
Data =
reinterpret_cast<const char *
>(Elts.
data());
2563 const char *
Data =
reinterpret_cast<const char *
>(Elts.
data());
2570 const uint8_t *
Data =
reinterpret_cast<const uint8_t *
>(Str.
data());
2577 return get(
Context, ElementVals);
2585 const char *
Data =
reinterpret_cast<const char *
>(Elts.
data());
2590 const char *
Data =
reinterpret_cast<const char *
>(Elts.
data());
2595 const char *
Data =
reinterpret_cast<const char *
>(Elts.
data());
2600 const char *
Data =
reinterpret_cast<const char *
>(Elts.
data());
2605 const char *
Data =
reinterpret_cast<const char *
>(Elts.
data());
2610 const char *
Data =
reinterpret_cast<const char *
>(Elts.
data());
2622 const char *
Data =
reinterpret_cast<const char *
>(Elts.
data());
2628 const char *
Data =
reinterpret_cast<const char *
>(Elts.
data());
2634 const char *
Data =
reinterpret_cast<const char *
>(Elts.
data());
2640 "Element type not compatible with ConstantData");
2642 if (CI->getType()->isIntegerTy(8)) {
2646 if (CI->getType()->isIntegerTy(16)) {
2650 if (CI->getType()->isIntegerTy(32)) {
2654 assert(CI->getType()->isIntegerTy(64) &&
"Unsupported ConstantData type");
2659 if (
ConstantFP *CFP = dyn_cast<ConstantFP>(V)) {
2660 if (CFP->getType()->isHalfTy()) {
2662 NumElts, CFP->getValueAPF().bitcastToAPInt().getLimitedValue());
2665 if (CFP->getType()->isFloatTy()) {
2667 NumElts, CFP->getValueAPF().bitcastToAPInt().getLimitedValue());
2670 if (CFP->getType()->isDoubleTy()) {
2672 NumElts, CFP->getValueAPF().bitcastToAPInt().getLimitedValue());
2681 assert(isa<IntegerType>(getElementType()) &&
2682 "Accessor can only be used when element is an integer");
2683 const char *EltPtr = getElementPointer(Elt);
2687 switch (getElementType()->getIntegerBitWidth()) {
2690 return *
reinterpret_cast<const uint8_t *
>(EltPtr);
2692 return *
reinterpret_cast<const uint16_t *
>(EltPtr);
2694 return *
reinterpret_cast<const uint32_t *
>(EltPtr);
2696 return *
reinterpret_cast<const uint64_t *
>(EltPtr);
2701 assert(isa<IntegerType>(getElementType()) &&
2702 "Accessor can only be used when element is an integer");
2703 const char *EltPtr = getElementPointer(Elt);
2707 switch (getElementType()->getIntegerBitWidth()) {
2710 auto EltVal = *
reinterpret_cast<const uint8_t *
>(EltPtr);
2711 return APInt(8, EltVal);
2714 auto EltVal = *
reinterpret_cast<const uint16_t *
>(EltPtr);
2715 return APInt(16, EltVal);
2718 auto EltVal = *
reinterpret_cast<const uint32_t *
>(EltPtr);
2719 return APInt(32, EltVal);
2722 auto EltVal = *
reinterpret_cast<const uint64_t *
>(EltPtr);
2723 return APInt(64, EltVal);
2729 const char *EltPtr = getElementPointer(Elt);
2731 switch (getElementType()->
getTypeID()) {
2733 llvm_unreachable(
"Accessor can only be used when element is float/double!");
2735 auto EltVal = *
reinterpret_cast<const uint16_t *
>(EltPtr);
2739 auto EltVal = *
reinterpret_cast<const uint32_t *
>(EltPtr);
2743 auto EltVal = *
reinterpret_cast<const uint64_t *
>(EltPtr);
2750 assert(getElementType()->isFloatTy() &&
2751 "Accessor can only be used when element is a 'float'");
2752 return *
reinterpret_cast<const float *
>(getElementPointer(Elt));
2756 assert(getElementType()->isDoubleTy() &&
2757 "Accessor can only be used when element is a 'float'");
2758 return *
reinterpret_cast<const double *
>(getElementPointer(Elt));
2762 if (getElementType()->isHalfTy() || getElementType()->isFloatTy() ||
2763 getElementType()->isDoubleTy())
2770 return isa<ArrayType>(
getType()) && getElementType()->isIntegerTy(CharSize);
2780 if (Str.
back() != 0)
return false;
2787 const char *
Base = getRawDataValues().data();
2790 unsigned EltSize = getElementByteSize();
2791 for (
unsigned i = 1, e = getNumElements(); i != e; ++i)
2792 if (
memcmp(Base, Base+i*EltSize, EltSize))
2800 return isSplat() ? getElementAsConstant(0) :
nullptr;
2818 Value *Replacement =
nullptr;
2822 #define HANDLE_CONSTANT(Name) \ 2823 case Value::Name##Val: \ 2824 Replacement = cast<Name>(this)->handleOperandChangeImpl(From, To); \ 2826 #include "llvm/IR/Value.def" 2835 assert(Replacement !=
this &&
"I didn't contain From!");
2844 Value *ConstantArray::handleOperandChangeImpl(
Value *From,
Value *To) {
2845 assert(isa<Constant>(To) &&
"Cannot make Constant refer to non-constant!");
2846 Constant *ToC = cast<Constant>(To);
2853 unsigned NumUpdated = 0;
2856 bool AllSame =
true;
2858 unsigned OperandNo = 0;
2860 Constant *Val = cast<Constant>(
O->get());
2862 OperandNo = (
O - OperandList);
2866 Values.push_back(Val);
2867 AllSame &= Val == ToC;
2873 if (AllSame && isa<UndefValue>(ToC))
2882 Values,
this, From, ToC, NumUpdated, OperandNo);
2885 Value *ConstantStruct::handleOperandChangeImpl(
Value *From,
Value *To) {
2886 assert(isa<Constant>(To) &&
"Cannot make Constant refer to non-constant!");
2887 Constant *ToC = cast<Constant>(To);
2896 unsigned NumUpdated = 0;
2897 bool AllSame =
true;
2898 unsigned OperandNo = 0;
2900 Constant *Val = cast<Constant>(
O->get());
2902 OperandNo = (
O - OperandList);
2907 AllSame &= Val == ToC;
2913 if (AllSame && isa<UndefValue>(ToC))
2918 Values,
this, From, ToC, NumUpdated, OperandNo);
2921 Value *ConstantVector::handleOperandChangeImpl(
Value *From,
Value *To) {
2922 assert(isa<Constant>(To) &&
"Cannot make Constant refer to non-constant!");
2923 Constant *ToC = cast<Constant>(To);
2927 unsigned NumUpdated = 0;
2928 unsigned OperandNo = 0;
2936 Values.push_back(Val);
2944 Values,
this, From, ToC, NumUpdated, OperandNo);
2947 Value *ConstantExpr::handleOperandChangeImpl(
Value *From,
Value *ToV) {
2948 assert(isa<Constant>(ToV) &&
"Cannot make Constant refer to non-constant!");
2949 Constant *To = cast<Constant>(ToV);
2952 unsigned NumUpdated = 0;
2953 unsigned OperandNo = 0;
2961 NewOps.push_back(Op);
2963 assert(NumUpdated &&
"I didn't contain From!");
2970 NewOps,
this, From, To, NumUpdated, OperandNo);
2978 case Instruction::Trunc:
2979 case Instruction::ZExt:
2980 case Instruction::SExt:
2981 case Instruction::FPTrunc:
2982 case Instruction::FPExt:
2983 case Instruction::UIToFP:
2984 case Instruction::SIToFP:
2985 case Instruction::FPToUI:
2986 case Instruction::FPToSI:
2987 case Instruction::PtrToInt:
2988 case Instruction::IntToPtr:
2989 case Instruction::BitCast:
2990 case Instruction::AddrSpaceCast:
2995 case Instruction::InsertElement:
2997 case Instruction::ExtractElement:
2999 case Instruction::InsertValue:
3001 case Instruction::ExtractValue:
3003 case Instruction::ShuffleVector:
3006 case Instruction::GetElementPtr: {
3007 const auto *GO = cast<GEPOperator>(
this);
3008 if (GO->isInBounds())
3010 Ops[0], Ops.
slice(1));
3014 case Instruction::ICmp:
3015 case Instruction::FCmp:
3024 if (isa<OverflowingBinaryOperator>(BO)) {
3030 if (isa<PossiblyExactOperator>(BO))
bool isBoundedSequential() const
bool isFPPredicate() const
const T & front() const
front - Get the first element.
static Constant * getFPTrunc(Constant *C, Type *Ty, bool OnlyIfReduced=false)
Type * getVectorElementType() const
static bool isValueValidForType(Type *Ty, uint64_t V)
This static method returns true if the type Ty is big enough to represent the value V...
A vector constant whose element type is a simple 1/2/4/8-byte integer or float/double, and whose elements are just simple data values (i.e.
static APFloat getNaN(const fltSemantics &Sem, bool Negative=false, uint64_t payload=0)
Factory for NaN values.
static const fltSemantics & IEEEquad() LLVM_READNONE
IntegerType * getType() const
getType - Specialize the getType() method to always return an IntegerType, which reduces the amount o...
static ConstantInt * getFalse(LLVMContext &Context)
static Constant * getString(LLVMContext &Context, StringRef Initializer, bool AddNull=true)
This method constructs a CDS and initializes it with a text string.
static bool rangeOnlyContains(ItTy Start, ItTy End, EltTy Elt)
static Type * getDoubleTy(LLVMContext &C)
bool isAllOnesValue() const
Return true if this is the value that would be returned by getAllOnesValue.
static IntegerType * getInt1Ty(LLVMContext &C)
static Constant * getFAdd(Constant *C1, Constant *C2)
unsigned getOpcode() const
Return the opcode at the root of this constant expression.
unsigned getNumElements() const
Return the number of elements in the array, vector, or struct.
static APInt getAllOnesValue(unsigned numBits)
Get the all-ones value.
unsigned getValueID() const
Return an ID for the concrete type of this object.
bool isNaN() const
Return true if this is a floating-point NaN constant or a vector floating-point constant with all NaN...
static Constant * getPointerBitCastOrAddrSpaceCast(Constant *C, Type *Ty)
Create a BitCast or AddrSpaceCast for a pointer type depending on the address space.
This class represents lattice values for constants.
Constant * getElementAsConstant(unsigned i) const
Return a Constant for a specified index's element.
DenseMap< std::pair< const Function *, const BasicBlock * >, BlockAddress * > BlockAddresses
static Constant * getGetElementPtr(Type *Ty, Constant *C, ArrayRef< Constant *> IdxList, bool InBounds=false, Optional< unsigned > InRangeIndex=None, Type *OnlyIfReducedTy=nullptr)
Getelementptr form.
static Constant * getInfinity(Type *Ty, bool Negative=false)
2: 32-bit floating point type
bool needsRelocation() const
This method classifies the entry according to whether or not it may generate a relocation entry...
bool isConstantUsed() const
Return true if the constant has users other than constant expressions and other dangling things...
unsigned getNumElements() const
Random access to the elements.
void push_back(const T &Elt)
static Constant * getAddrSpaceCast(Constant *C, Type *Ty, bool OnlyIfReduced=false)
static ConstantAggregateZero * get(Type *Ty)
APInt getElementAsAPInt(unsigned i) const
If this is a sequential container of integers (of any size), return the specified element as an APInt...
LLVM_NODISCARD LLVM_ATTRIBUTE_ALWAYS_INLINE size_t size() const
size - Get the string size.
bool isFP128Ty() const
Return true if this is 'fp128'.
static GetElementPtrInst * Create(Type *PointeeType, Value *Ptr, ArrayRef< Value *> IdxList, const Twine &NameStr="", Instruction *InsertBefore=nullptr)
Constant * ConstantFoldExtractElementInstruction(Constant *Val, Constant *Idx)
Attempt to constant fold an extractelement instruction with the specified operands and indices...
static PointerType * get(Type *ElementType, unsigned AddressSpace)
This constructs a pointer to an object of the specified type in a numbered address space...
gep_type_iterator gep_type_end(const User *GEP)
Constant * ConstantFoldCastInstruction(unsigned opcode, Constant *V, Type *DestTy)
static Constant * getIntToPtr(Constant *C, Type *Ty, bool OnlyIfReduced=false)
uint64_t getElementByteSize() const
Return the size (in bytes) of each element in the array/vector.
static Constant * getExtractElement(Constant *Vec, Constant *Idx, Type *OnlyIfReducedTy=nullptr)
0 1 0 0 True if ordered and less than
iterator find(StringRef Key)
static Constant * getFoldedCast(Instruction::CastOps opc, Constant *C, Type *Ty, bool OnlyIfReduced=false)
This is a utility function to handle folding of casts and lookup of the cast in the ExprConstants map...
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.
ConstantInt * TheFalseVal
1 1 1 0 True if unordered or not equal
const APInt & getUniqueInteger() const
If C is a constant integer then return its value, otherwise C must be a vector of constant integers...
4: 80-bit floating point type (X87)
const fltSemantics & getSemantics() const
unsigned getPointerAddressSpace() const
Get the address space of this pointer or pointer vector type.
static APFloat getZero(const fltSemantics &Sem, bool Negative=false)
Factory for Positive and Negative Zero.
1: 16-bit floating point type
static IntegerType * getInt64Ty(LLVMContext &C)
bool isOpaque() const
Return true if this is a type with an identity that has no body specified yet.
static Constant * getCompare(unsigned short pred, Constant *C1, Constant *C2, bool OnlyIfReduced=false)
Return an ICmp or FCmp comparison operator constant expression.
static Constant * getSub(Constant *C1, Constant *C2, bool HasNUW=false, bool HasNSW=false)
bool isVectorTy() const
True if this is an instance of VectorType.
void reserve(size_type N)
static IntegerType * getInt16Ty(LLVMContext &C)
unsigned getPredicate() const
Return the ICMP or FCMP predicate value.
bool isPPC_FP128Ty() const
Return true if this is powerpc long double.
static Type * getX86_FP80Ty(LLVMContext &C)
LLVM_NODISCARD LLVM_ATTRIBUTE_ALWAYS_INLINE const char * data() const
data - Get a pointer to the start of the string (which may not be null terminated).
static Constant * get(ArrayType *T, ArrayRef< Constant *> V)
unsigned getBitWidth() const
Return the number of bits in the APInt.
Constant * getElementValue(Constant *C) const
Return a zero of the right value for the specified GEP index if we can, otherwise return null (e...
static Constant * getInsertElement(Constant *Vec, Constant *Elt, Constant *Idx, Type *OnlyIfReducedTy=nullptr)
LLVMContext & getContext() const
Return the LLVMContext in which this type was uniqued.
static Constant * getNullValue(Type *Ty)
Constructor to create a '0' constant of arbitrary type.
A templated base class for SmallPtrSet which provides the typesafe interface that is common across al...
static Constant * getAdd(Constant *C1, Constant *C2, bool HasNUW=false, bool HasNSW=false)
static Constant * getFMul(Constant *C1, Constant *C2)
static Constant * getFPSequenceIfElementsMatch(ArrayRef< Constant *> V)
Function * getFunction() const
ConstantClass * replaceOperandsInPlace(ArrayRef< Constant *> Operands, ConstantClass *CP, Value *From, Constant *To, unsigned NumUpdated=0, unsigned OperandNo=~0u)
1 0 0 1 True if unordered or equal
The address of a basic block.
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 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...
static Type * getFloatTy(LLVMContext &C)
static Constant * getNegativeZero(Type *Ty)
ArrayRef< T > makeArrayRef(const T &OneElt)
Construct an ArrayRef from a single element.
TypeID getTypeID() const
Return the type id for the type.
bool isFloatingPointTy() const
Return true if this is one of the six floating-point types.
'undef' values are things that do not have specified contents.
static APFloat getAllOnesValue(unsigned BitWidth, bool isIEEE=false)
Returns a float which is bitcasted from an all one value int.
StringRef getRawDataValues() const
Return the raw, underlying, bytes of this data.
Class to represent struct types.
A Use represents the edge between a Value definition and its users.
static Constant * getLShr(Constant *C1, Constant *C2, bool isExact=false)
PointerType * getPointerTo(unsigned AddrSpace=0) const
Return a pointer to the current type.
static Optional< unsigned > getOpcode(ArrayRef< VPValue *> Values)
Returns the opcode of Values or ~0 if they do not all agree.
bool isIntegerTy() const
True if this is an instance of IntegerType.
0 1 0 1 True if ordered and less than or equal
static Constant * getSExt(Constant *C, Type *Ty, bool OnlyIfReduced=false)
Instruction * getAsInstruction()
Returns an Instruction which implements the same operation as this ConstantExpr.
UndefValue * getElementValue(Constant *C) const
Return an undef of the right value for the specified GEP index if we can, otherwise return null (e...
uint64_t getNumElements() const
void remove(ConstantClass *CP)
Remove this constant from the map.
static Type * getPPC_FP128Ty(LLVMContext &C)
static StructType * get(LLVMContext &Context, ArrayRef< Type *> Elements, bool isPacked=false)
This static method is the primary way to create a literal StructType.
All zero aggregate value.
static Constant * getSequenceIfElementsMatch(Constant *C, ArrayRef< Constant *> V)
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.
static Constant * getZExt(Constant *C, Type *Ty, bool OnlyIfReduced=false)
Type * getResultElementType() const
static Constant * getSizeOf(Type *Ty)
getSizeOf constant expr - computes the (alloc) size of a type (in address-units, not bits) in a targe...
bool isNullValue() const
Return true if this is the value that would be returned by getNullValue.
A constant value that is initialized with an expression using other constant values.
void setIsExact(bool b=true)
Set or clear the exact flag on this instruction, which must be an operator which supports this flag...
Type * getType() const
All values are typed, get the type of this value.
bool canTrap() const
Return true if evaluation of this constant could trap.
bool isFirstClassType() const
Return true if the type is "first class", meaning it is a valid type for a Value. ...
opStatus convert(const fltSemantics &ToSemantics, roundingMode RM, bool *losesInfo)
static Constant * getFPCast(Constant *C, Type *Ty)
Create a FPExt, Bitcast or FPTrunc for fp -> fp casts.
ConstantDataSequential - A vector or array constant whose element type is a simple 1/2/4/8-byte integ...
static Constant * getAShr(Constant *C1, Constant *C2, bool isExact=false)
Class to represent array types.
static Constant * getSelect(Constant *C, Constant *V1, Constant *V2, Type *OnlyIfReducedTy=nullptr)
Select constant expr.
std::unique_ptr< ConstantTokenNone > TheNoneToken
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)...
bool isGEPWithNoNotionalOverIndexing() const
Return true if this is a getelementptr expression and all the index operands are compile-time known i...
ArrayConstantsTy ArrayConstants
bool isFiniteNonZeroFP() const
Return true if this is a finite and non-zero floating-point scalar constant or a vector constant with...
Constant * ConstantFoldInsertValueInstruction(Constant *Agg, Constant *Val, ArrayRef< unsigned > Idxs)
ConstantFoldInsertValueInstruction - Attempt to constant fold an insertvalue instruction with the spe...
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.
static const fltSemantics & IEEEdouble() LLVM_READNONE
static Constant * getUDiv(Constant *C1, Constant *C2, bool isExact=false)
static Function * getFunction(Constant *C)
unsigned getBitWidth() const
Get the number of bits in this IntegerType.
Constant(Type *ty, ValueTy vty, Use *Ops, unsigned NumOps)
bool isMinSignedValue() const
Return true if the value is the smallest signed value.
static Constant * getFDiv(Constant *C1, Constant *C2)
static APFloat getInf(const fltSemantics &Sem, bool Negative=false)
Factory for Positive and Negative Infinity.
Type * getElementType() const
Return the element type of the array/vector.
Value * getOperand(unsigned i) const
void removeDeadConstantUsers() const
If there are any dead constant users dangling off of this constant, remove them.
Class to represent pointers.
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'.
bool isZeroValue() const
Return true if the value is negative zero or null value.
11: Arbitrary bit width integers
static Constant * getBitCast(Constant *C, Type *Ty, bool OnlyIfReduced=false)
static bool removeDeadUsersOfConstant(const Constant *C)
If the specified constantexpr is dead, remove it.
bool isFloatTy() const
Return true if this is 'float', a 32-bit IEEE fp type.
bool isThreadDependent() const
Return true if the value can vary between threads.
DenseMap< PointerType *, std::unique_ptr< ConstantPointerNull > > CPNConstants
static Constant * getInsertValue(Constant *Agg, Constant *Val, ArrayRef< unsigned > Idxs, Type *OnlyIfReducedTy=nullptr)
static bool ConstHasGlobalValuePredicate(const Constant *C, bool(*Predicate)(const GlobalValue *))
Check if C contains a GlobalValue for which Predicate is true.
Constant * ConstantFoldShuffleVectorInstruction(Constant *V1, Constant *V2, Constant *Mask)
Attempt to constant fold a shufflevector instruction with the specified operands and indices...
static Constant * getFNeg(Constant *C)
static Constant * getFRem(Constant *C1, Constant *C2)
const Use * getOperandList() const
static Constant * getImpl(StringRef Bytes, Type *Ty)
This is the underlying implementation of all of the ConstantDataSequential::get methods.
static ConstantPointerNull * get(PointerType *T)
Static factory methods - Return objects of the specified value.
An array constant whose element type is a simple 1/2/4/8-byte integer or float/double, and whose elements are just simple data values (i.e.
LLVM Basic Block Representation.
Constant * getSplatValue() const
If this is a splat constant, meaning that all of the elements have the same value, return that value.
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.
static Constant * getFP(LLVMContext &Context, ArrayRef< uint16_t > Elts)
getFP() constructors - Return a constant with array type with an element count and element type of fl...
A constant token which is empty.
Constant * getWithOperandReplaced(unsigned OpNo, Constant *Op) const
Return a constant expression identical to this one, but with the specified operand set to the specifi...
static BlockAddress * get(Function *F, BasicBlock *BB)
Return a BlockAddress for the specified function and basic block.
size_t size() const
size - Get the array size.
const char * getOpcodeName() const
static GCRegistry::Add< CoreCLRGC > E("coreclr", "CoreCLR-compatible GC")
This is an important base class in LLVM.
This file contains the declarations for the subclasses of Constant, which represent the different fla...
static Constant * getFP(LLVMContext &Context, ArrayRef< uint16_t > Elts)
getFP() constructors - Return a constant with vector type with an element count and element type of f...
static Constant * getAnd(Constant *C1, Constant *C2)
bool hasIndices() const
Return true if this is an insertvalue or extractvalue expression, and the getIndices() method may be ...
ConstantFP - Floating Point Values [float, double].
std::pair< iterator, bool > insert(PtrType Ptr)
Inserts Ptr if and only if there is no element in the container equal to Ptr.
static Constant * getSExtOrBitCast(Constant *C, Type *Ty)
float getElementAsFloat(unsigned i) const
If this is an sequential container of floats, return the specified element as a float.
bool isDLLImportDependent() const
Return true if the value is dependent on a dllimport variable.
static Constant * getShuffleVector(Constant *V1, Constant *V2, Constant *Mask, Type *OnlyIfReducedTy=nullptr)
const char * getOpcodeName() const
Return a string representation for an opcode.
bool isHalfTy() const
Return true if this is 'half', a 16-bit IEEE fp type.
Predicate
This enumeration lists the possible predicates for CmpInst subclasses.
static Constant * getBinOpIdentity(unsigned Opcode, Type *Ty, bool AllowRHSConstant=false)
Return the identity constant for a binary opcode.
6: 128-bit floating point type (two 64-bits, PowerPC)
static Constant * get(StructType *T, ArrayRef< Constant *> V)
0 1 1 1 True if ordered (no nans)
unsigned getStructNumElements() const
static bool isValueValidForType(Type *Ty, const APFloat &V)
Return true if Ty is big enough to represent V.
unsigned getAddressSpace() const
Return the address space of the Pointer type.
static Constant * getICmp(unsigned short pred, Constant *LHS, Constant *RHS, bool OnlyIfReduced=false)
get* - Return some common constants without having to specify the full Instruction::OPCODE identifier...
static const fltSemantics & x87DoubleExtended() LLVM_READNONE
Class to represent integer types.
Constant Vector Declarations.
bool isNegativeZeroValue() const
Return true if the value is what would be returned by getZeroValueForNegation.
static Constant * getQNaN(Type *Ty, bool Negative=false, APInt *Payload=nullptr)
static Constant * getSplat(unsigned NumElts, Constant *Elt)
Return a ConstantVector with the specified constant in each element.
static Constant * getNot(Constant *C)
static Constant * getAllOnesValue(Type *Ty)
1 1 1 1 Always true (always folded)
LLVMContext & getContext() const
getContext - Return a reference to the LLVMContext associated with this function. ...
static bool isElementTypeCompatible(Type *Ty)
Return true if a ConstantDataSequential can be formed with a vector or array of the specified element...
bool isIntN(unsigned N, int64_t x)
Checks if an signed integer fits into the given (dynamic) bit width.
static const fltSemantics * TypeToFloatSemantics(Type *Ty)
static UndefValue * get(Type *T)
Static factory methods - Return an 'undef' object of the specified type.
const Value * stripPointerCasts() const
Strip off pointer casts, all-zero GEPs, and aliases.
LLVM_NODISCARD char back() const
back - Get the last character in the string.
static PointerType * getInt8PtrTy(LLVMContext &C, unsigned AS=0)
Constant * getWithOperands(ArrayRef< Constant *> Ops) const
This returns the current constant expression with the operands replaced with the specified values...
Constant * ConstantFoldBinaryInstruction(unsigned Opcode, Constant *V1, Constant *V2)
Constant * getSplatValue() const
If this is a splat vector constant, meaning that all of the elements have the same value...
1 1 0 1 True if unordered, less than, or equal
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
VectorConstantsTy VectorConstants
unsigned char SubclassOptionalData
Hold subclass data that can be dropped.
LLVMContextImpl *const pImpl
static Type * getFP128Ty(LLVMContext &C)
static Constant * getIntegerValue(Type *Ty, const APInt &V)
Return the value for an integer or pointer constant, or a vector thereof, with the given scalar value...
LLVM_NODISCARD LLVM_ATTRIBUTE_ALWAYS_INLINE StringRef drop_back(size_t N=1) const
Return a StringRef equal to 'this' but with the last N elements dropped.
bool isNormalFP() const
Return true if this is a normal (as opposed to denormal) floating-point scalar constant or a vector c...
static Constant * getFCmp(unsigned short pred, Constant *LHS, Constant *RHS, bool OnlyIfReduced=false)
0 0 1 0 True if ordered and greater than
static Constant * getPointerCast(Constant *C, Type *Ty)
Create a BitCast, AddrSpaceCast, or a PtrToInt cast constant expression.
bool hasAddressTaken() const
Returns true if there are any uses of this basic block other than direct branches, switches, etc.
static bool isUndef(ArrayRef< int > Mask)
static Constant * getSIToFP(Constant *C, Type *Ty, bool OnlyIfReduced=false)
static Type * getHalfTy(LLVMContext &C)
bool isPtrOrPtrVectorTy() const
Return true if this is a pointer type or a vector of pointer types.
static Constant * getSplat(unsigned NumElts, Constant *Elt)
Return a ConstantVector with the specified constant in each element.
static IntegerType * get(LLVMContext &C, unsigned NumBits)
This static method is the primary way of constructing an IntegerType.
Type * getSequentialElementType() const
void setHasNoSignedWrap(bool b=true)
Set or clear the nsw flag on this instruction, which must be an operator which supports this flag...
static const fltSemantics & IEEEsingle() LLVM_READNONE
static bool isAllZeros(StringRef Arr)
Return true if the array is empty or all zeros.
Predicate getPredicate(unsigned Condition, unsigned Hint)
Return predicate consisting of specified condition and hint bits.
unsigned getNumOperands() const
SmallPtrSet - This class implements a set which is optimized for holding SmallSize or less elements...
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.
auto size(R &&Range, typename std::enable_if< std::is_same< typename std::iterator_traits< decltype(Range.begin())>::iterator_category, std::random_access_iterator_tag >::value, void >::type *=nullptr) -> decltype(std::distance(Range.begin(), Range.end()))
Get the size of a range.
BlockVerifier::State From
static const fltSemantics & IEEEhalf() LLVM_READNONE
Type * getSourceElementType() const
16: SIMD 'packed' format, or other vector type
static Constant * getSDiv(Constant *C1, Constant *C2, bool isExact=false)
unsigned getScalarSizeInBits() const LLVM_READONLY
If this is a vector type, return the getPrimitiveSizeInBits value for the element type...
bool containsUndefElement() const
Return true if this is a vector constant that includes any undefined elements.
1 1 0 0 True if unordered or less than
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small...
uint64_t getElementAsInteger(unsigned i) const
If this is a sequential container of integers (of any size), return the specified element in the low ...
Module.h This file contains the declarations for the Module class.
bool isCString() const
This method returns true if the array "isString", ends with a null byte, and does not contains any ot...
A constant pointer value that points to null.
Predicate
Predicate - These are "(BI << 5) | BO" for various predicates.
LLVM_NODISCARD T pop_back_val()
CHAIN = SC CHAIN, Imm128 - System call.
static Constant * getTrunc(Constant *C, Type *Ty, bool OnlyIfReduced=false)
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.
static ConstantInt * getSigned(IntegerType *Ty, int64_t V)
Return a ConstantInt with the specified value for the specified type.
static Constant * get(Type *Ty, double V)
This returns a ConstantFP, or a vector containing a splat of a ConstantFP, for the specified value in...
static ConstantInt * getTrue(LLVMContext &Context)
ValueTy
Concrete subclass of this.
bool isCommutative() const
Return true if the instruction is commutative:
void handleOperandChange(Value *, Value *)
This method is a special form of User::replaceUsesOfWith (which does not work on constants) that does...
void setOperand(unsigned i, Value *Val)
static BlockAddress * lookup(const BasicBlock *BB)
Lookup an existing BlockAddress constant for the given BasicBlock.
raw_ostream & dbgs()
dbgs() - This returns a reference to a raw_ostream for debugging messages.
unsigned getVectorNumElements() const
bool isIntPredicate() const
StringMap - This is an unconventional map that is specialized for handling keys that are "strings"...
Class to represent vector types.
Class for arbitrary precision integers.
Constant * getSplatValue() const
If this is a splat constant, meaning that all of the elements have the same value, return that value.
static APFloat getSNaN(const fltSemantics &Sem, bool Negative=false, const APInt *payload=nullptr)
Factory for SNaN values.
bool isSplat() const
Returns true if this is a splat constant, meaning that all elements have the same value...
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.
iterator_range< user_iterator > users()
static Constant * getFPToUI(Constant *C, Type *Ty, bool OnlyIfReduced=false)
static Constant * getCast(unsigned ops, Constant *C, Type *Ty, bool OnlyIfReduced=false)
Convenience function for getting a Cast operation.
static char getTypeID(Type *Ty)
ArrayRef< T > slice(size_t N, size_t M) const
slice(n, m) - Chop off the first N elements of the array, and keep M elements in the array...
static Constant * getZExtOrBitCast(Constant *C, Type *Ty)
void append(in_iter in_start, in_iter in_end)
Add the specified range to the end of the SmallVector.
Common super class of ArrayType, StructType and VectorType.
bool isX86_FP80Ty() const
Return true if this is x86 long double.
user_iterator_impl< const User > const_user_iterator
static Constant * getFSub(Constant *C1, Constant *C2)
static Constant * getTruncOrBitCast(Constant *C, Type *Ty)
static cl::opt< ITMode > IT(cl::desc("IT block support"), cl::Hidden, cl::init(DefaultIT), cl::ZeroOrMore, cl::values(clEnumValN(DefaultIT, "arm-default-it", "Generate IT block based on arch"), clEnumValN(RestrictedIT, "arm-restrict-it", "Disallow deprecated IT based on ARMv8"), clEnumValN(NoRestrictedIT, "arm-no-restrict-it", "Allow IT blocks based on ARMv7")))
static Constant * getIntSequenceIfElementsMatch(ArrayRef< Constant *> V)
static const fltSemantics & PPCDoubleDouble() LLVM_READNONE
static Constant * getNeg(Constant *C, bool HasNUW=false, bool HasNSW=false)
Constant * ConstantFoldCompareInstruction(unsigned short predicate, Constant *C1, Constant *C2)
static CastInst * Create(Instruction::CastOps, Value *S, Type *Ty, const Twine &Name="", Instruction *InsertBefore=nullptr)
Provides a way to construct any of the CastInst subclasses using an opcode instead of the subclass's ...
static bool isZero(Value *V, const DataLayout &DL, DominatorTree *DT, AssumptionCache *AC)
Constant * ConstantFoldSelectInstruction(Constant *Cond, Constant *V1, Constant *V2)
Attempt to constant fold a select instruction with the specified operands.
static Constant * getNaN(Type *Ty, bool Negative=false, uint64_t Payload=0)
Merge contiguous icmps into a memcmp
APFloat getElementAsAPFloat(unsigned i) const
If this is a sequential container of floating point type, return the specified element as an APFloat...
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)
unsigned getIntegerBitWidth() const
uint64_t getSequentialNumElements() const
LLVM_NODISCARD bool empty() const
static Constant * getOffsetOf(StructType *STy, unsigned FieldNo)
getOffsetOf constant expr - computes the offset of a struct field in a target independent way (Note: ...
unsigned greater or equal
static InsertValueInst * Create(Value *Agg, Value *Val, ArrayRef< unsigned > Idxs, const Twine &NameStr="", Instruction *InsertBefore=nullptr)
double getElementAsDouble(unsigned i) const
If this is an sequential container of doubles, return the specified element as a double.
const Function * getParent() const
Return the enclosing method, or null if none.
static Constant * getPtrToInt(Constant *C, Type *Ty, bool OnlyIfReduced=false)
static Constant * getOr(Constant *C1, Constant *C2)
static Constant * getZeroValueForNegation(Type *Ty)
Floating point negation must be implemented with f(x) = -0.0 - x.
Constant * ConstantFoldInsertElementInstruction(Constant *Val, Constant *Elt, Constant *Idx)
Attempt to constant fold an insertelement instruction with the specified operands and indices...
bool isCompare() const
Return true if this is a compare constant expression.
0 1 1 0 True if ordered and operands are unequal
static ArrayType * get(Type *ElementType, uint64_t NumElements)
This static method is the primary way to construct an ArrayType.
Compile-time customization of User operands.
DenseMap< Type *, std::unique_ptr< ConstantAggregateZero > > CAZConstants
LLVM_NODISCARD std::enable_if<!is_simple_type< Y >::value, typename cast_retty< X, const Y >::ret_type >::type dyn_cast(const Y &Val)
static Constant * getShl(Constant *C1, Constant *C2, bool HasNUW=false, bool HasNSW=false)
void destroyConstant()
Called if some element of this constant is no longer valid.
static ConstantTokenNone * get(LLVMContext &Context)
Return the ConstantTokenNone.
ConstantUniqueMap< ConstantExpr > ExprConstants
1 0 1 0 True if unordered or greater than
Constant * ConstantFoldGetElementPtr(Type *Ty, Constant *C, bool InBounds, Optional< unsigned > InRangeIndex, ArrayRef< Value *> Idxs)
Constant * getStructElement(unsigned Elt) const
If this CAZ has struct type, return a zero with the right element type for the specified element...
ArrayRef< unsigned > getIndices() const
Assert that this is an insertvalue or exactvalue expression and return the list of indices...
bool isFPOrFPVectorTy() const
Return true if this is a FP type or a vector of FP.
bool isOneValue() const
Returns true if the value is one.
void setHasNoUnsignedWrap(bool b=true)
Set or clear the nuw flag on this instruction, which must be an operator which supports this flag...
3: 64-bit floating point type
static GetElementPtrInst * CreateInBounds(Value *Ptr, ArrayRef< Value *> IdxList, const Twine &NameStr="", Instruction *InsertBefore=nullptr)
Create an "inbounds" getelementptr.
static Constant * getSNaN(Type *Ty, bool Negative=false, APInt *Payload=nullptr)
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
user_iterator user_begin()
static Constant * getSRem(Constant *C1, Constant *C2)
Base class for aggregate constants (with operands).
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
StructConstantsTy StructConstants
LLVM Value Representation.
1 0 1 1 True if unordered, greater than, or equal
DenseMap< Type *, std::unique_ptr< UndefValue > > UVConstants
static Constant * getURem(Constant *C1, Constant *C2)
static VectorType * get(Type *ElementType, unsigned NumElements)
This static method is the primary way to construct an VectorType.
static StructType * getTypeForElements(ArrayRef< Constant *> V, bool Packed=false)
Return an anonymous struct type to use for a constant with the specified set of elements.
bool hasExactInverseFP() const
Return true if this scalar has an exact multiplicative inverse or this vector has an exact multiplica...
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 Constant * getUIToFP(Constant *C, Type *Ty, bool OnlyIfReduced=false)
static Constant * getFPToSI(Constant *C, Type *Ty, bool OnlyIfReduced=false)
bool isCast() const
Return true if this is a convert constant expression.
ConstantClass * getOrCreate(TypeClass *Ty, ValType V)
Return the specified constant from the map, creating it if necessary.
unsigned getNumElements() const
Return the number of elements in the array, vector, or struct.
Type * getElementType() const
bool isExactlyValue(const APFloat &V) const
We don't rely on operator== working on double values, as it returns true for things that are clearly ...
bool isNotMinSignedValue() const
Return true if the value is not the smallest signed value.
static Constant * getExtractValue(Constant *Agg, ArrayRef< unsigned > Idxs, Type *OnlyIfReducedTy=nullptr)
StringRef - Represent a constant reference to a string, i.e.
Constant * ConstantFoldExtractValueInstruction(Constant *Agg, ArrayRef< unsigned > Idxs)
Attempt to constant fold an extractvalue instruction with the specified operands and indices...
static bool isSplat(ArrayRef< Value *> VL)
unsigned getNumElements() const
Return the number of elements in the array or vector.
static APInt getNullValue(unsigned numBits)
Get the '0' value.
static Constant * getAlignOf(Type *Ty)
getAlignOf constant expr - computes the alignment of a type in a target independent way (Note: the re...
static Constant * getMul(Constant *C1, Constant *C2, bool HasNUW=false, bool HasNSW=false)
static Constant * get(LLVMContext &Context, ArrayRef< uint8_t > Elts)
get() constructors - Return a constant with vector type with an element count and element type matchi...
static LazyValueInfoImpl & getImpl(void *&PImpl, AssumptionCache *AC, const DataLayout *DL, DominatorTree *DT=nullptr)
This lazily constructs the LazyValueInfoImpl.
static bool canTrapImpl(const Constant *C, SmallPtrSetImpl< const ConstantExpr *> &NonTrappingOps)
bool isUIntN(unsigned N, uint64_t x)
Checks if an unsigned integer fits into the given (dynamic) bit width.
LLVM_NODISCARD LLVM_ATTRIBUTE_ALWAYS_INLINE size_t find(char C, size_t From=0) const
Search for the first character C in the string.
OutputIt copy(R &&Range, OutputIt Out)
0 0 1 1 True if ordered and greater than or equal
static Constant * getFPExtend(Constant *C, Type *Ty, bool OnlyIfReduced=false)
UndefValue * getStructElement(unsigned Elt) const
If this undef has struct type, return a undef with the right element type for the specified element...
Constant * getSequentialElement() const
If this CAZ has array or vector type, return a zero with the right element type.
bool isDoubleTy() const
Return true if this is 'double', a 64-bit IEEE fp type.
StringMap< ConstantDataSequential * > CDSConstants
Base class for constants with no operands.
ConstantAggregate(CompositeType *T, ValueTy VT, ArrayRef< Constant *> V)
static Constant * getBinOpAbsorber(unsigned Opcode, Type *Ty)
Return the absorbing element for the given binary operation, i.e.
static IntegerType * getInt8Ty(LLVMContext &C)
static Constant * get(ArrayRef< Constant *> V)
static APFloat getQNaN(const fltSemantics &Sem, bool Negative=false, const APInt *payload=nullptr)
Factory for QNaN values.
Type * getElementType() const
UndefValue * getSequentialElement() const
If this Undef has array or vector type, return a undef with the right element type.
PointerType * getType() const
Global values are always pointers.
0 0 0 0 Always false (always folded)
bool isStructTy() const
True if this is an instance of StructType.
bool empty() const
empty - Check if the array is empty.
bool isArrayTy() const
True if this is an instance of ArrayType.
Type * getTypeAtIndex(const Value *V) const
Given an index value into the type, return the type of the element.
static Constant * getXor(Constant *C1, Constant *C2)
5: 128-bit floating point type (112-bit mantissa)
gep_type_iterator gep_type_begin(const User *GEP)
bool isString(unsigned CharSize=8) const
This method returns true if this is an array of CharSize integers.
static Constant * get(unsigned Opcode, Constant *C1, unsigned Flags=0, Type *OnlyIfReducedTy=nullptr)
get - Return a unary operator constant expression, folding if possible.
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...