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();
190 return Splat->isNotMinSignedValue();
195 if (CV->getElementType()->isFloatingPointTy())
196 return !CV->getElementAsAPFloat(0).bitcastToAPInt().isMinSignedValue();
197 return !CV->getElementAsAPInt(0).isMinSignedValue();
206 if (
auto *CFP = dyn_cast<ConstantFP>(
this))
207 return CFP->getValueAPF().isFiniteNonZero();
210 for (
unsigned i = 0, e =
getType()->getVectorNumElements(); i != e; ++i) {
212 if (!CFP || !CFP->getValueAPF().isFiniteNonZero())
219 if (
auto *CFP = dyn_cast<ConstantFP>(
this))
220 return CFP->getValueAPF().isNormal();
223 for (
unsigned i = 0, e =
getType()->getVectorNumElements(); i != e; ++i) {
225 if (!CFP || !CFP->getValueAPF().isNormal())
232 if (
auto *CFP = dyn_cast<ConstantFP>(
this))
233 return CFP->getValueAPF().getExactInverse(
nullptr);
236 for (
unsigned i = 0, e =
getType()->getVectorNumElements(); i != e; ++i) {
238 if (!CFP || !CFP->getValueAPF().getExactInverse(
nullptr))
245 if (
auto *CFP = dyn_cast<ConstantFP>(
this))
249 for (
unsigned i = 0, e =
getType()->getVectorNumElements(); i != e; ++i) {
251 if (!CFP || !CFP->isNaN())
260 for (
unsigned i = 0, e =
getType()->getVectorNumElements(); i != e; ++i)
312 if (
PointerType *PTy = dyn_cast<PointerType>(ScalarTy))
316 if (
VectorType *VTy = dyn_cast<VectorType>(Ty))
340 return Elt < CC->getNumOperands() ? CC->getOperand(Elt) :
nullptr;
343 return Elt < CAZ->getNumElements() ? CAZ->getElementValue(Elt) :
nullptr;
345 if (
const UndefValue *UV = dyn_cast<UndefValue>(
this))
346 return Elt < UV->getNumElements() ? UV->getElementValue(Elt) :
nullptr;
349 return Elt < CDS->getNumElements() ? CDS->getElementAsConstant(Elt)
355 assert(isa<IntegerType>(Elt->
getType()) &&
"Index must be an integer");
367 #define HANDLE_CONSTANT(Name) \ 368 case Value::Name##Val: \ 369 cast<Name>(this)->destroyConstantImpl(); \ 371 #include "llvm/IR/Value.def" 383 #ifndef NDEBUG // Only in -g mode... 384 if (!isa<Constant>(V)) {
385 dbgs() <<
"While deleting: " << *
this 386 <<
"\n\nUse still stuck around after Def is destroyed: " << *V
390 assert(isa<Constant>(V) &&
"References remain to Constant being destroyed");
411 if (
ConstantExpr *
Op = dyn_cast<ConstantExpr>(CE->getOperand(i))) {
418 switch (CE->getOpcode()) {
421 case Instruction::UDiv:
422 case Instruction::SDiv:
423 case Instruction::URem:
424 case Instruction::SRem:
426 if (!isa<ConstantInt>(CE->getOperand(1)) ||CE->getOperand(1)->isNullValue())
446 while (!WorkList.
empty()) {
448 if (
const auto *GV = dyn_cast<GlobalValue>(WorkItem))
455 if (Visited.
insert(ConstOp).second)
463 auto DLLImportPredicate = [](
const GlobalValue *GV) {
464 return GV->isThreadLocal();
470 auto DLLImportPredicate = [](
const GlobalValue *GV) {
471 return GV->hasDLLImportStorageClass();
479 if (!UC || isa<GlobalValue>(UC))
489 if (isa<GlobalValue>(
this))
492 if (
const BlockAddress *BA = dyn_cast<BlockAddress>(
this))
493 return BA->getFunction()->needsRelocation();
499 if (
const ConstantExpr *CE = dyn_cast<ConstantExpr>(
this))
500 if (CE->getOpcode() == Instruction::Sub) {
503 if (LHS && RHS && LHS->
getOpcode() == Instruction::PtrToInt &&
504 RHS->getOpcode() == Instruction::PtrToInt &&
506 isa<BlockAddress>(RHS->getOperand(0)) &&
508 cast<BlockAddress>(RHS->getOperand(0))->
getFunction())
522 if (isa<GlobalValue>(C))
return false;
526 if (!User)
return false;
556 if (LastNonDeadUser ==
E) {
594 if (
auto *VTy = dyn_cast<VectorType>(Ty))
602 if (
auto *VTy = dyn_cast<VectorType>(Ty))
611 std::unique_ptr<ConstantInt> &Slot = pImpl->
IntConstants[V];
625 if (
VectorType *VTy = dyn_cast<VectorType>(Ty))
636 return get(Ty, V,
true);
640 return get(Ty, V,
true);
646 "ConstantInt type doesn't match the type implied by its value!");
649 if (
VectorType *VTy = dyn_cast<VectorType>(Ty))
660 void ConstantInt::destroyConstantImpl() {
694 if (
VectorType *VTy = dyn_cast<VectorType>(Ty))
703 "ConstantFP type doesn't match the type implied by its value!");
706 if (
auto *VTy = dyn_cast<VectorType>(Ty))
719 if (
VectorType *VTy = dyn_cast<VectorType>(Ty))
730 if (
VectorType *VTy = dyn_cast<VectorType>(Ty))
741 if (
VectorType *VTy = dyn_cast<VectorType>(Ty))
750 return getNegativeZero(Ty);
760 std::unique_ptr<ConstantFP> &Slot = pImpl->
FPConstants[V];
776 "Unknown FP format");
789 if (
VectorType *VTy = dyn_cast<VectorType>(Ty))
802 return Val.bitwiseIsEqual(V);
806 void ConstantFP::destroyConstantImpl() {
823 if (isa<SequentialType>(
getType()))
824 return getSequentialElement();
825 return getStructElement(cast<ConstantInt>(C)->getZExtValue());
829 if (isa<SequentialType>(
getType()))
830 return getSequentialElement();
831 return getStructElement(Idx);
836 if (
auto *AT = dyn_cast<ArrayType>(Ty))
837 return AT->getNumElements();
838 if (
auto *VT = dyn_cast<VectorType>(Ty))
839 return VT->getNumElements();
856 if (isa<SequentialType>(
getType()))
857 return getSequentialElement();
858 return getStructElement(cast<ConstantInt>(C)->getZExtValue());
862 if (isa<SequentialType>(
getType()))
863 return getSequentialElement();
864 return getStructElement(Idx);
869 if (
auto *
ST = dyn_cast<SequentialType>(Ty))
870 return ST->getNumElements();
878 template <
typename ItTy,
typename EltTy>
880 for (; Start != End; ++Start)
886 template <
typename SequentialTy,
typename ElementTy>
888 assert(!V.
empty() &&
"Cannot get empty int sequence.");
892 if (
auto *CI = dyn_cast<ConstantInt>(C))
896 return SequentialTy::get(V[0]->
getContext(), Elts);
899 template <
typename SequentialTy,
typename ElementTy>
901 assert(!V.
empty() &&
"Cannot get empty FP sequence.");
905 if (
auto *CFP = dyn_cast<ConstantFP>(C))
906 Elts.
push_back(CFP->getValueAPF().bitcastToAPInt().getLimitedValue());
909 return SequentialTy::getFP(V[0]->
getContext(), Elts);
912 template <
typename SequenceTy>
919 if (CI->getType()->isIntegerTy(8))
920 return getIntSequenceIfElementsMatch<SequenceTy, uint8_t>(V);
921 else if (CI->getType()->isIntegerTy(16))
922 return getIntSequenceIfElementsMatch<SequenceTy, uint16_t>(V);
923 else if (CI->getType()->isIntegerTy(32))
924 return getIntSequenceIfElementsMatch<SequenceTy, uint32_t>(V);
925 else if (CI->getType()->isIntegerTy(64))
926 return getIntSequenceIfElementsMatch<SequenceTy, uint64_t>(V);
927 }
else if (
ConstantFP *CFP = dyn_cast<ConstantFP>(C)) {
928 if (CFP->getType()->isHalfTy())
929 return getFPSequenceIfElementsMatch<SequenceTy, uint16_t>(V);
930 else if (CFP->getType()->isFloatTy())
931 return getFPSequenceIfElementsMatch<SequenceTy, uint32_t>(V);
932 else if (CFP->getType()->isDoubleTy())
933 return getFPSequenceIfElementsMatch<SequenceTy, uint64_t>(V);
946 if (
auto *
ST = dyn_cast<StructType>(T))
949 for (
unsigned I = 0,
E = V.
size();
I !=
E; ++
I)
951 "Initializer for composite element doesn't match!");
957 "Invalid initializer for constant array");
971 for (
unsigned i = 0, e = V.
size(); i != e; ++i) {
973 "Wrong type in array element initializer");
989 return getSequenceIfElementsMatch<ConstantDataArray>(
C, V);
998 unsigned VecSize = V.
size();
1000 for (
unsigned i = 0; i != VecSize; ++i)
1001 EltTypes[i] = V[i]->
getType();
1010 "ConstantStruct::getTypeForElements cannot be called on empty list");
1011 return getTypeForElements(V[0]->
getContext(), V, Packed);
1017 "Invalid initializer for constant struct");
1023 "Incorrect # elements specified to ConstantStruct::get");
1030 isUndef = isa<UndefValue>(V[0]);
1031 isZero = V[0]->isNullValue();
1032 if (isUndef || isZero) {
1033 for (
unsigned i = 0, e = V.
size(); i != e; ++i) {
1036 if (!isa<UndefValue>(V[i]))
1052 "Invalid initializer for constant vector");
1070 bool isZero = C->isNullValue();
1073 if (isZero || isUndef) {
1074 for (
unsigned i = 1, e = V.
size(); i != e; ++i)
1076 isZero = isUndef =
false;
1089 return getSequenceIfElementsMatch<ConstantDataVector>(
C, V);
1099 if ((isa<ConstantFP>(V) || isa<ConstantInt>(V)) &&
1115 void ConstantTokenNone::destroyConstantImpl() {
1127 return getOpcode() == Instruction::ICmp || getOpcode() == Instruction::FCmp;
1131 if (getOpcode() != Instruction::GetElementPtr)
return false;
1138 for (; GEPI !=
E; ++GEPI, ++OI) {
1139 if (isa<UndefValue>(*OI))
1143 (CI->getValue().getActiveBits() > 64 ||
1153 return getOpcode() == Instruction::ExtractValue ||
1154 getOpcode() == Instruction::InsertValue;
1159 dyn_cast<ExtractValueConstantExpr>(
this))
1160 return EVCE->Indices;
1162 return cast<InsertValueConstantExpr>(
this)->Indices;
1166 return cast<CompareConstantExpr>(
this)->predicate;
1172 "Replacing operand with value of different type!");
1174 return const_cast<ConstantExpr*>(
this);
1180 return getWithOperands(NewOps);
1184 bool OnlyIfReduced,
Type *SrcTy)
const {
1191 Type *OnlyIfReducedTy = OnlyIfReduced ? Ty :
nullptr;
1192 switch (getOpcode()) {
1193 case Instruction::Trunc:
1194 case Instruction::ZExt:
1195 case Instruction::SExt:
1196 case Instruction::FPTrunc:
1197 case Instruction::FPExt:
1198 case Instruction::UIToFP:
1199 case Instruction::SIToFP:
1200 case Instruction::FPToUI:
1201 case Instruction::FPToSI:
1202 case Instruction::PtrToInt:
1203 case Instruction::IntToPtr:
1204 case Instruction::BitCast:
1205 case Instruction::AddrSpaceCast:
1209 case Instruction::InsertElement:
1212 case Instruction::ExtractElement:
1214 case Instruction::InsertValue:
1217 case Instruction::ExtractValue:
1219 case Instruction::ShuffleVector:
1222 case Instruction::GetElementPtr: {
1223 auto *GEPO = cast<GEPOperator>(
this);
1226 SrcTy ? SrcTy : GEPO->getSourceElementType(), Ops[0], Ops.
slice(1),
1227 GEPO->isInBounds(), GEPO->getInRangeIndex(), OnlyIfReducedTy);
1229 case Instruction::ICmp:
1230 case Instruction::FCmp:
1247 return Val == 0 || Val == 1;
1254 return Val == 0 || Val == 1 || Val == -1;
1255 return isIntN(NumBits, Val);
1311 "Cannot create an aggregate zero of non-aggregate type!");
1313 std::unique_ptr<ConstantAggregateZero> &Entry =
1322 void ConstantAggregateZero::destroyConstantImpl() {
1327 void ConstantArray::destroyConstantImpl() {
1336 void ConstantStruct::destroyConstantImpl() {
1341 void ConstantVector::destroyConstantImpl() {
1346 assert(this->
getType()->isVectorTy() &&
"Only valid for vectors!");
1347 if (isa<ConstantAggregateZero>(
this))
1350 return CV->getSplatValue();
1352 return CV->getSplatValue();
1367 if (
const ConstantInt *CI = dyn_cast<ConstantInt>(
this))
1368 return CI->getValue();
1371 assert(C && isa<ConstantInt>(C) &&
"Not a vector of numbers!");
1372 return cast<ConstantInt>(
C)->getValue();
1379 std::unique_ptr<ConstantPointerNull> &Entry =
1388 void ConstantPointerNull::destroyConstantImpl() {
1401 void UndefValue::destroyConstantImpl() {
1426 BB->AdjustBlockAddressRefCount(1);
1434 assert(F &&
"Block must have a parent");
1437 assert(BA &&
"Refcount and block address map disagree!");
1442 void BlockAddress::destroyConstantImpl() {
1445 getBasicBlock()->AdjustBlockAddressRefCount(-1);
1448 Value *BlockAddress::handleOperandChangeImpl(
Value *From,
Value *To) {
1457 assert(From == NewBB &&
"From does not match any operand");
1458 NewBB = cast<BasicBlock>(To);
1468 getBasicBlock()->AdjustBlockAddressRefCount(-1);
1477 getBasicBlock()->AdjustBlockAddressRefCount(1);
1490 bool OnlyIfReduced =
false) {
1508 bool OnlyIfReduced) {
1511 assert(C && Ty &&
"Null arguments to getCast");
1517 case Instruction::Trunc:
1518 return getTrunc(C, Ty, OnlyIfReduced);
1519 case Instruction::ZExt:
1520 return getZExt(C, Ty, OnlyIfReduced);
1521 case Instruction::SExt:
1522 return getSExt(C, Ty, OnlyIfReduced);
1523 case Instruction::FPTrunc:
1524 return getFPTrunc(C, Ty, OnlyIfReduced);
1525 case Instruction::FPExt:
1526 return getFPExtend(C, Ty, OnlyIfReduced);
1527 case Instruction::UIToFP:
1528 return getUIToFP(C, Ty, OnlyIfReduced);
1529 case Instruction::SIToFP:
1530 return getSIToFP(C, Ty, OnlyIfReduced);
1531 case Instruction::FPToUI:
1532 return getFPToUI(C, Ty, OnlyIfReduced);
1533 case Instruction::FPToSI:
1534 return getFPToSI(C, Ty, OnlyIfReduced);
1535 case Instruction::PtrToInt:
1536 return getPtrToInt(C, Ty, OnlyIfReduced);
1537 case Instruction::IntToPtr:
1538 return getIntToPtr(C, Ty, OnlyIfReduced);
1539 case Instruction::BitCast:
1540 return getBitCast(C, Ty, OnlyIfReduced);
1541 case Instruction::AddrSpaceCast:
1542 return getAddrSpaceCast(C, Ty, OnlyIfReduced);
1548 return getBitCast(C, Ty);
1549 return getZExt(C, Ty);
1554 return getBitCast(C, Ty);
1555 return getSExt(C, Ty);
1560 return getBitCast(C, Ty);
1561 return getTrunc(C, Ty);
1570 return getPtrToInt(S, Ty);
1574 return getAddrSpaceCast(S, Ty);
1576 return getBitCast(S, Ty);
1585 return getAddrSpaceCast(S, Ty);
1587 return getBitCast(S, Ty);
1596 (SrcBits == DstBits ? Instruction::BitCast :
1597 (SrcBits > DstBits ? Instruction::Trunc :
1598 (isSigned ? Instruction::SExt : Instruction::ZExt)));
1599 return getCast(opcode, C, Ty);
1607 if (SrcBits == DstBits)
1610 (SrcBits > DstBits ? Instruction::FPTrunc : Instruction::FPExt);
1611 return getCast(opcode, C, Ty);
1619 assert((fromVec == toVec) &&
"Cannot convert from scalar to/from vector");
1623 "SrcTy must be larger than DestTy for Trunc!");
1625 return getFoldedCast(Instruction::Trunc, C, Ty, OnlyIfReduced);
1633 assert((fromVec == toVec) &&
"Cannot convert from scalar to/from vector");
1637 "SrcTy must be smaller than DestTy for SExt!");
1639 return getFoldedCast(Instruction::SExt, C, Ty, OnlyIfReduced);
1647 assert((fromVec == toVec) &&
"Cannot convert from scalar to/from vector");
1651 "SrcTy must be smaller than DestTy for ZExt!");
1653 return getFoldedCast(Instruction::ZExt, C, Ty, OnlyIfReduced);
1661 assert((fromVec == toVec) &&
"Cannot convert from scalar to/from vector");
1664 "This is an illegal floating point truncation!");
1665 return getFoldedCast(Instruction::FPTrunc, C, Ty, OnlyIfReduced);
1673 assert((fromVec == toVec) &&
"Cannot convert from scalar to/from vector");
1676 "This is an illegal floating point extension!");
1677 return getFoldedCast(Instruction::FPExt, C, Ty, OnlyIfReduced);
1685 assert((fromVec == toVec) &&
"Cannot convert from scalar to/from vector");
1687 "This is an illegal uint to floating point cast!");
1688 return getFoldedCast(Instruction::UIToFP, C, Ty, OnlyIfReduced);
1696 assert((fromVec == toVec) &&
"Cannot convert from scalar to/from vector");
1698 "This is an illegal sint to floating point cast!");
1699 return getFoldedCast(Instruction::SIToFP, C, Ty, OnlyIfReduced);
1707 assert((fromVec == toVec) &&
"Cannot convert from scalar to/from vector");
1709 "This is an illegal floating point to uint cast!");
1710 return getFoldedCast(Instruction::FPToUI, C, Ty, OnlyIfReduced);
1718 assert((fromVec == toVec) &&
"Cannot convert from scalar to/from vector");
1720 "This is an illegal floating point to sint cast!");
1721 return getFoldedCast(Instruction::FPToSI, C, Ty, OnlyIfReduced);
1725 bool OnlyIfReduced) {
1727 "PtrToInt source must be pointer or pointer vector");
1729 "PtrToInt destination must be integer or integer vector");
1730 assert(isa<VectorType>(C->
getType()) == isa<VectorType>(DstTy));
1731 if (isa<VectorType>(C->
getType()))
1733 "Invalid cast between a different number of vector elements");
1734 return getFoldedCast(Instruction::PtrToInt, C, DstTy, OnlyIfReduced);
1738 bool OnlyIfReduced) {
1740 "IntToPtr source must be integer or integer vector");
1742 "IntToPtr destination must be a pointer or pointer vector");
1743 assert(isa<VectorType>(C->
getType()) == isa<VectorType>(DstTy));
1744 if (isa<VectorType>(C->
getType()))
1746 "Invalid cast between a different number of vector elements");
1747 return getFoldedCast(Instruction::IntToPtr, C, DstTy, OnlyIfReduced);
1751 bool OnlyIfReduced) {
1753 "Invalid constantexpr bitcast!");
1757 if (C->
getType() == DstTy)
return C;
1759 return getFoldedCast(Instruction::BitCast, C, DstTy, OnlyIfReduced);
1763 bool OnlyIfReduced) {
1765 "Invalid constantexpr addrspacecast!");
1771 Type *DstElemTy = DstScalarTy->getElementType();
1774 if (
VectorType *VT = dyn_cast<VectorType>(DstTy)) {
1778 C = getBitCast(C, MidTy);
1780 return getFoldedCast(Instruction::AddrSpaceCast, C, DstTy, OnlyIfReduced);
1784 unsigned Flags,
Type *OnlyIfReducedTy) {
1787 "Invalid opcode in binary constant expression");
1789 "Operand types in binary constant expression should match");
1794 case Instruction::Sub:
1795 case Instruction::Mul:
1798 "Tried to create an integer operation on a non-integer type!");
1800 case Instruction::FAdd:
1801 case Instruction::FSub:
1802 case Instruction::FMul:
1805 "Tried to create a floating-point operation on a " 1806 "non-floating-point type!");
1808 case Instruction::UDiv:
1809 case Instruction::SDiv:
1812 "Tried to create an arithmetic operation on a non-arithmetic type!");
1814 case Instruction::FDiv:
1817 "Tried to create an arithmetic operation on a non-arithmetic type!");
1819 case Instruction::URem:
1820 case Instruction::SRem:
1823 "Tried to create an arithmetic operation on a non-arithmetic type!");
1825 case Instruction::FRem:
1828 "Tried to create an arithmetic operation on a non-arithmetic type!");
1830 case Instruction::And:
1831 case Instruction::Or:
1832 case Instruction::Xor:
1835 "Tried to create a logical operation on a non-integral type!");
1837 case Instruction::Shl:
1838 case Instruction::LShr:
1839 case Instruction::AShr:
1842 "Tried to create a shift operation on a non-integer type!");
1852 if (OnlyIfReducedTy == C1->
getType())
1868 return getPtrToInt(GEP,
1879 Constant *Indices[2] = { Zero, One };
1880 Constant *
GEP = getGetElementPtr(AligningTy, NullPtr, Indices);
1881 return getPtrToInt(GEP,
1899 return getPtrToInt(GEP,
1904 Constant *C2,
bool OnlyIfReduced) {
1907 switch (Predicate) {
1915 return getFCmp(Predicate, C1, C2, OnlyIfReduced);
1921 return getICmp(Predicate, C1, C2, OnlyIfReduced);
1926 Type *OnlyIfReducedTy) {
1932 if (OnlyIfReducedTy == V1->
getType())
1945 Type *OnlyIfReducedTy) {
1959 assert(DestTy &&
"GEP indices invalid!");
1963 unsigned NumVecElts = 0;
1966 else for (
auto Idx : Idxs)
1967 if (Idx->getType()->isVectorTy())
1968 NumVecElts = Idx->getType()->getVectorNumElements();
1973 if (OnlyIfReducedTy == ReqTy)
1977 std::vector<Constant*> ArgVec;
1978 ArgVec.reserve(1 + Idxs.size());
1979 ArgVec.push_back(C);
1980 for (
unsigned i = 0, e = Idxs.size(); i != e; ++i) {
1982 Idxs[i]->
getType()->getVectorNumElements() == NumVecElts) &&
1983 "getelementptr index type missmatch");
1985 Constant *Idx = cast<Constant>(Idxs[i]);
1988 ArgVec.push_back(Idx);
1991 unsigned SubClassOptionalData = InBounds ? GEPOperator::IsInBounds : 0;
1992 if (InRangeIndex && *InRangeIndex < 63)
1993 SubClassOptionalData |= (*InRangeIndex + 1) << 1;
1995 SubClassOptionalData,
None, Ty);
2002 Constant *RHS,
bool OnlyIfReduced) {
2005 "Invalid ICmp Predicate");
2027 Constant *RHS,
bool OnlyIfReduced) {
2030 "Invalid FCmp Predicate");
2052 Type *OnlyIfReducedTy) {
2054 "Tried to create extractelement operation on non-vector type!");
2056 "Extractelement index must be an integer type!");
2062 if (OnlyIfReducedTy == ReqTy)
2076 "Tried to create insertelement operation on non-vector type!");
2078 "Insertelement types must match!");
2080 "Insertelement index must be i32 type!");
2085 if (OnlyIfReducedTy == Val->
getType())
2089 Constant *ArgVec[] = { Val, Elt, Idx };
2099 "Invalid shuffle vector constant expr operands!");
2108 if (OnlyIfReducedTy == ShufTy)
2121 Type *OnlyIfReducedTy) {
2123 "Non-first-class type for constant insertvalue expression");
2127 "insertvalue indices invalid!");
2133 if (OnlyIfReducedTy == ReqTy)
2144 Type *OnlyIfReducedTy) {
2146 "Tried to create extractelement operation on non-first-class type!");
2150 assert(ReqTy &&
"extractvalue indices invalid!");
2153 "Non-first-class type for constant extractvalue expression");
2157 if (OnlyIfReducedTy == ReqTy)
2169 "Cannot NEG a nonintegral value!");
2176 "Cannot FNEG a non-floating-point value!");
2182 "Cannot NOT a nonintegral value!");
2187 bool HasNUW,
bool HasNSW) {
2194 return get(Instruction::FAdd, C1, C2);
2198 bool HasNUW,
bool HasNSW) {
2201 return get(Instruction::Sub, C1, C2, Flags);
2205 return get(Instruction::FSub, C1, C2);
2209 bool HasNUW,
bool HasNSW) {
2212 return get(Instruction::Mul, C1, C2, Flags);
2216 return get(Instruction::FMul, C1, C2);
2220 return get(Instruction::UDiv, C1, C2,
2225 return get(Instruction::SDiv, C1, C2,
2230 return get(Instruction::FDiv, C1, C2);
2234 return get(Instruction::URem, C1, C2);
2238 return get(Instruction::SRem, C1, C2);
2242 return get(Instruction::FRem, C1, C2);
2246 return get(Instruction::And, C1, C2);
2250 return get(Instruction::Or, C1, C2);
2254 return get(Instruction::Xor, C1, C2);
2258 bool HasNUW,
bool HasNSW) {
2261 return get(Instruction::Shl, C1, C2, Flags);
2265 return get(Instruction::LShr, C1, C2,
2270 return get(Instruction::AShr, C1, C2,
2275 bool AllowRHSConstant) {
2282 case Instruction::Or:
2283 case Instruction::Xor:
2285 case Instruction::Mul:
2287 case Instruction::And:
2289 case Instruction::FAdd:
2292 case Instruction::FMul:
2300 if (!AllowRHSConstant)
2304 case Instruction::Sub:
2305 case Instruction::Shl:
2306 case Instruction::LShr:
2307 case Instruction::AShr:
2308 case Instruction::FSub:
2310 case Instruction::SDiv:
2311 case Instruction::UDiv:
2313 case Instruction::FDiv:
2326 case Instruction::Or:
2329 case Instruction::And:
2330 case Instruction::Mul:
2336 void ConstantExpr::destroyConstantImpl() {
2344 GetElementPtrConstantExpr::GetElementPtrConstantExpr(
2348 (IdxList.
size() + 1),
2349 IdxList.
size() + 1),
2350 SrcElementTy(SrcElementTy),
2354 for (
unsigned i = 0,
E = IdxList.
size(); i !=
E; ++i)
2355 OperandList[i+1] = IdxList[i];
2359 return SrcElementTy;
2363 return ResElementTy;
2370 return getType()->getElementType();
2374 return StringRef(DataElements, getNumElements()*getElementByteSize());
2379 if (
auto *
IT = dyn_cast<IntegerType>(Ty)) {
2380 switch (
IT->getBitWidth()) {
2394 return AT->getNumElements();
2400 return getElementType()->getPrimitiveSizeInBits()/8;
2404 const char *ConstantDataSequential::getElementPointer(
unsigned Elt)
const {
2405 assert(Elt < getNumElements() &&
"Invalid Elt");
2406 return DataElements+Elt*getElementByteSize();
2441 Entry = &Node->Next, Node = *Entry)
2442 if (Node->getType() == Ty)
2447 if (isa<ArrayType>(Ty))
2450 assert(isa<VectorType>(Ty));
2454 void ConstantDataSequential::destroyConstantImpl() {
2460 CDSConstants.
find(getRawDataValues());
2462 assert(Slot != CDSConstants.
end() &&
"CDS not found in uniquing table");
2467 if (!(*Entry)->Next) {
2470 assert((*Entry) ==
this &&
"Hash mismatch in ConstantDataSequential");
2476 Entry = &Node->Next, Node = *Entry) {
2477 assert(Node &&
"Didn't find entry in its uniquing hash table!");
2480 *Entry = Node->Next;
2499 const char *
Data =
reinterpret_cast<const char *
>(Elts.
data());
2505 const char *
Data =
reinterpret_cast<const char *
>(Elts.
data());
2511 const char *
Data =
reinterpret_cast<const char *
>(Elts.
data());
2518 const uint8_t *
Data =
reinterpret_cast<const uint8_t *
>(Str.
data());
2525 return get(
Context, ElementVals);
2533 const char *
Data =
reinterpret_cast<const char *
>(Elts.
data());
2538 const char *
Data =
reinterpret_cast<const char *
>(Elts.
data());
2543 const char *
Data =
reinterpret_cast<const char *
>(Elts.
data());
2548 const char *
Data =
reinterpret_cast<const char *
>(Elts.
data());
2553 const char *
Data =
reinterpret_cast<const char *
>(Elts.
data());
2558 const char *
Data =
reinterpret_cast<const char *
>(Elts.
data());
2570 const char *
Data =
reinterpret_cast<const char *
>(Elts.
data());
2576 const char *
Data =
reinterpret_cast<const char *
>(Elts.
data());
2582 const char *
Data =
reinterpret_cast<const char *
>(Elts.
data());
2588 "Element type not compatible with ConstantData");
2590 if (CI->getType()->isIntegerTy(8)) {
2594 if (CI->getType()->isIntegerTy(16)) {
2598 if (CI->getType()->isIntegerTy(32)) {
2602 assert(CI->getType()->isIntegerTy(64) &&
"Unsupported ConstantData type");
2607 if (
ConstantFP *CFP = dyn_cast<ConstantFP>(V)) {
2608 if (CFP->getType()->isHalfTy()) {
2610 NumElts, CFP->getValueAPF().bitcastToAPInt().getLimitedValue());
2613 if (CFP->getType()->isFloatTy()) {
2615 NumElts, CFP->getValueAPF().bitcastToAPInt().getLimitedValue());
2618 if (CFP->getType()->isDoubleTy()) {
2620 NumElts, CFP->getValueAPF().bitcastToAPInt().getLimitedValue());
2629 assert(isa<IntegerType>(getElementType()) &&
2630 "Accessor can only be used when element is an integer");
2631 const char *EltPtr = getElementPointer(Elt);
2635 switch (getElementType()->getIntegerBitWidth()) {
2638 return *
reinterpret_cast<const uint8_t *
>(EltPtr);
2640 return *
reinterpret_cast<const uint16_t *
>(EltPtr);
2642 return *
reinterpret_cast<const uint32_t *
>(EltPtr);
2644 return *
reinterpret_cast<const uint64_t *
>(EltPtr);
2649 assert(isa<IntegerType>(getElementType()) &&
2650 "Accessor can only be used when element is an integer");
2651 const char *EltPtr = getElementPointer(Elt);
2655 switch (getElementType()->getIntegerBitWidth()) {
2658 auto EltVal = *
reinterpret_cast<const uint8_t *
>(EltPtr);
2659 return APInt(8, EltVal);
2662 auto EltVal = *
reinterpret_cast<const uint16_t *
>(EltPtr);
2663 return APInt(16, EltVal);
2666 auto EltVal = *
reinterpret_cast<const uint32_t *
>(EltPtr);
2667 return APInt(32, EltVal);
2670 auto EltVal = *
reinterpret_cast<const uint64_t *
>(EltPtr);
2671 return APInt(64, EltVal);
2677 const char *EltPtr = getElementPointer(Elt);
2679 switch (getElementType()->
getTypeID()) {
2681 llvm_unreachable(
"Accessor can only be used when element is float/double!");
2683 auto EltVal = *
reinterpret_cast<const uint16_t *
>(EltPtr);
2687 auto EltVal = *
reinterpret_cast<const uint32_t *
>(EltPtr);
2691 auto EltVal = *
reinterpret_cast<const uint64_t *
>(EltPtr);
2698 assert(getElementType()->isFloatTy() &&
2699 "Accessor can only be used when element is a 'float'");
2700 return *
reinterpret_cast<const float *
>(getElementPointer(Elt));
2704 assert(getElementType()->isDoubleTy() &&
2705 "Accessor can only be used when element is a 'float'");
2706 return *
reinterpret_cast<const double *
>(getElementPointer(Elt));
2710 if (getElementType()->isHalfTy() || getElementType()->isFloatTy() ||
2711 getElementType()->isDoubleTy())
2718 return isa<ArrayType>(
getType()) && getElementType()->isIntegerTy(CharSize);
2728 if (Str.
back() != 0)
return false;
2735 const char *
Base = getRawDataValues().data();
2738 unsigned EltSize = getElementByteSize();
2739 for (
unsigned i = 1, e = getNumElements(); i != e; ++i)
2740 if (
memcmp(Base, Base+i*EltSize, EltSize))
2748 return isSplat() ? getElementAsConstant(0) :
nullptr;
2766 Value *Replacement =
nullptr;
2770 #define HANDLE_CONSTANT(Name) \ 2771 case Value::Name##Val: \ 2772 Replacement = cast<Name>(this)->handleOperandChangeImpl(From, To); \ 2774 #include "llvm/IR/Value.def" 2783 assert(Replacement !=
this &&
"I didn't contain From!");
2792 Value *ConstantArray::handleOperandChangeImpl(
Value *From,
Value *To) {
2793 assert(isa<Constant>(To) &&
"Cannot make Constant refer to non-constant!");
2794 Constant *ToC = cast<Constant>(To);
2801 unsigned NumUpdated = 0;
2804 bool AllSame =
true;
2806 unsigned OperandNo = 0;
2808 Constant *Val = cast<Constant>(
O->get());
2810 OperandNo = (
O - OperandList);
2814 Values.push_back(Val);
2815 AllSame &= Val == ToC;
2821 if (AllSame && isa<UndefValue>(ToC))
2830 Values,
this, From, ToC, NumUpdated, OperandNo);
2833 Value *ConstantStruct::handleOperandChangeImpl(
Value *From,
Value *To) {
2834 assert(isa<Constant>(To) &&
"Cannot make Constant refer to non-constant!");
2835 Constant *ToC = cast<Constant>(To);
2844 unsigned NumUpdated = 0;
2845 bool AllSame =
true;
2846 unsigned OperandNo = 0;
2848 Constant *Val = cast<Constant>(
O->get());
2850 OperandNo = (
O - OperandList);
2855 AllSame &= Val == ToC;
2861 if (AllSame && isa<UndefValue>(ToC))
2866 Values,
this, From, ToC, NumUpdated, OperandNo);
2869 Value *ConstantVector::handleOperandChangeImpl(
Value *From,
Value *To) {
2870 assert(isa<Constant>(To) &&
"Cannot make Constant refer to non-constant!");
2871 Constant *ToC = cast<Constant>(To);
2875 unsigned NumUpdated = 0;
2876 unsigned OperandNo = 0;
2884 Values.push_back(Val);
2892 Values,
this, From, ToC, NumUpdated, OperandNo);
2895 Value *ConstantExpr::handleOperandChangeImpl(
Value *From,
Value *ToV) {
2896 assert(isa<Constant>(ToV) &&
"Cannot make Constant refer to non-constant!");
2897 Constant *To = cast<Constant>(ToV);
2900 unsigned NumUpdated = 0;
2901 unsigned OperandNo = 0;
2909 NewOps.push_back(Op);
2911 assert(NumUpdated &&
"I didn't contain From!");
2918 NewOps,
this, From, To, NumUpdated, OperandNo);
2925 switch (getOpcode()) {
2926 case Instruction::Trunc:
2927 case Instruction::ZExt:
2928 case Instruction::SExt:
2929 case Instruction::FPTrunc:
2930 case Instruction::FPExt:
2931 case Instruction::UIToFP:
2932 case Instruction::SIToFP:
2933 case Instruction::FPToUI:
2934 case Instruction::FPToSI:
2935 case Instruction::PtrToInt:
2936 case Instruction::IntToPtr:
2937 case Instruction::BitCast:
2938 case Instruction::AddrSpaceCast:
2943 case Instruction::InsertElement:
2945 case Instruction::ExtractElement:
2947 case Instruction::InsertValue:
2949 case Instruction::ExtractValue:
2951 case Instruction::ShuffleVector:
2954 case Instruction::GetElementPtr: {
2955 const auto *GO = cast<GEPOperator>(
this);
2956 if (GO->isInBounds())
2958 Ops[0], Ops.
slice(1));
2962 case Instruction::ICmp:
2963 case Instruction::FCmp:
2972 if (isa<OverflowingBinaryOperator>(BO)) {
2978 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 const fltSemantics & IEEEquad() LLVM_READNONE
IntegerType * getType() const
getType - Specialize the getType() method to always return an IntegerType, which reduces the amount o...
void push_back(const T &Elt)
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.
Compute iterated dominance frontiers using a linear time algorithm.
Constant * getElementAsConstant(unsigned i) const
Return a Constant for a specified index's element.
static Constant * getNaN(Type *Ty, bool Negative=false, unsigned type=0)
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.
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.
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)
static Constant * get(unsigned Opcode, Constant *C1, Constant *C2, unsigned Flags=0, Type *OnlyIfReducedTy=nullptr)
get - Return a binary or shift operator constant expression, folding if possible. ...
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 * 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.
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.
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)
static APFloat getNaN(const fltSemantics &Sem, bool Negative=false, unsigned type=0)
Factory for NaN values.
Constant * ConstantFoldSelectInstruction(Constant *Cond, Constant *V1, Constant *V2)
Attempt to constant fold a select instruction with the specified operands.
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.
static bool isSigned(Value *V)
Can the given value generate sign bits.
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.
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)
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 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...