Lines Matching refs:Constant

39 bool Constant::isNegativeZeroValue() const {  in isNegativeZeroValue()
65 bool Constant::isZeroValue() const { in isZeroValue()
85 bool Constant::isNullValue() const { in isNullValue()
100 bool Constant::isAllOnesValue() const { in isAllOnesValue()
111 if (Constant *Splat = CV->getSplatValue()) in isAllOnesValue()
126 bool Constant::isOneValue() const { in isOneValue()
137 if (Constant *Splat = CV->getSplatValue()) in isOneValue()
152 bool Constant::isMinSignedValue() const { in isMinSignedValue()
163 if (Constant *Splat = CV->getSplatValue()) in isMinSignedValue()
178 bool Constant::isNotMinSignedValue() const { in isNotMinSignedValue()
191 Constant *Elt = this->getAggregateElement(i); in isNotMinSignedValue()
202 bool Constant::isFiniteNonZeroFP() const { in isFiniteNonZeroFP()
215 bool Constant::isNormalFP() const { in isNormalFP()
228 bool Constant::hasExactInverseFP() const { in hasExactInverseFP()
241 bool Constant::isNaN() const { in isNaN()
254 bool Constant::containsUndefElement() const { in containsUndefElement()
265 Constant *Constant::getNullValue(Type *Ty) { in getNullValue()
302 Constant *Constant::getIntegerValue(Type *Ty, const APInt &V) { in getIntegerValue()
306 Constant *C = ConstantInt::get(Ty->getContext(), V); in getIntegerValue()
319 Constant *Constant::getAllOnesValue(Type *Ty) { in getAllOnesValue()
335 Constant *Constant::getAggregateElement(unsigned Elt) const { in getAggregateElement()
351 Constant *Constant::getAggregateElement(Constant *Elt) const { in getAggregateElement()
362 void Constant::destroyConstant() { in destroyConstant()
385 if (!isa<Constant>(V)) { in destroyConstant()
391 assert(isa<Constant>(V) && "References remain to Constant being destroyed"); in destroyConstant()
392 cast<Constant>(V)->destroyConstant(); in destroyConstant()
402 static bool canTrapImpl(const Constant *C, in canTrapImpl()
433 bool Constant::canTrap() const { in canTrap()
440 ConstHasGlobalValuePredicate(const Constant *C, in ConstHasGlobalValuePredicate()
442 SmallPtrSet<const Constant *, 8> Visited; in ConstHasGlobalValuePredicate()
443 SmallVector<const Constant *, 8> WorkList; in ConstHasGlobalValuePredicate()
448 const Constant *WorkItem = WorkList.pop_back_val(); in ConstHasGlobalValuePredicate()
453 const Constant *ConstOp = dyn_cast<Constant>(Op); in ConstHasGlobalValuePredicate()
463 bool Constant::isThreadDependent() const { in isThreadDependent()
470 bool Constant::isDLLImportDependent() const { in isDLLImportDependent()
477 bool Constant::isConstantUsed() const { in isConstantUsed()
479 const Constant *UC = dyn_cast<Constant>(U); in isConstantUsed()
489 bool Constant::needsRelocation() const { in needsRelocation()
515 Result |= cast<Constant>(getOperand(i))->needsRelocation(); in needsRelocation()
522 static bool removeDeadUsersOfConstant(const Constant *C) { in removeDeadUsersOfConstant()
526 const Constant *User = dyn_cast<Constant>(C->user_back()); in removeDeadUsersOfConstant()
532 const_cast<Constant*>(C)->destroyConstant(); in removeDeadUsersOfConstant()
537 void Constant::removeDeadConstantUsers() const { in removeDeadConstantUsers()
541 const Constant *User = dyn_cast<Constant>(*I); in removeDeadConstantUsers()
592 Constant *ConstantInt::getTrue(Type *Ty) { in getTrue()
600 Constant *ConstantInt::getFalse(Type *Ty) { in getFalse()
622 Constant *ConstantInt::get(Type *Ty, uint64_t V, bool isSigned) { in get()
623 Constant *C = get(cast<IntegerType>(Ty->getScalarType()), V, isSigned); in get()
640 Constant *ConstantInt::getSigned(Type *Ty, int64_t V) { in getSigned()
644 Constant *ConstantInt::get(Type *Ty, const APInt& V) { in get()
685 Constant *ConstantFP::get(Type *Ty, double V) { in get()
692 Constant *C = get(Context, FV); in get()
701 Constant *ConstantFP::get(Type *Ty, const APFloat &V) { in get()
713 Constant *ConstantFP::get(Type *Ty, StringRef Str) { in get()
717 Constant *C = get(Context, FV); in get()
726 Constant *ConstantFP::getNaN(Type *Ty, bool Negative, uint64_t Payload) { in getNaN()
729 Constant *C = get(Ty->getContext(), NaN); in getNaN()
737 Constant *ConstantFP::getQNaN(Type *Ty, bool Negative, APInt *Payload) { in getQNaN()
740 Constant *C = get(Ty->getContext(), NaN); in getQNaN()
748 Constant *ConstantFP::getSNaN(Type *Ty, bool Negative, APInt *Payload) { in getSNaN()
751 Constant *C = get(Ty->getContext(), NaN); in getSNaN()
759 Constant *ConstantFP::getNegativeZero(Type *Ty) { in getNegativeZero()
762 Constant *C = get(Ty->getContext(), NegZero); in getNegativeZero()
771 Constant *ConstantFP::getZeroValueForNegation(Type *Ty) { in getZeroValueForNegation()
775 return Constant::getNullValue(Ty); in getZeroValueForNegation()
808 Constant *ConstantFP::getInfinity(Type *Ty, bool Negative) { in getInfinity()
810 Constant *C = get(Ty->getContext(), APFloat::getInf(Semantics, Negative)); in getInfinity()
837 Constant *ConstantAggregateZero::getSequentialElement() const { in getSequentialElement()
838 return Constant::getNullValue(getType()->getSequentialElementType()); in getSequentialElement()
841 Constant *ConstantAggregateZero::getStructElement(unsigned Elt) const { in getStructElement()
842 return Constant::getNullValue(getType()->getStructElementType(Elt)); in getStructElement()
845 Constant *ConstantAggregateZero::getElementValue(Constant *C) const { in getElementValue()
851 Constant *ConstantAggregateZero::getElementValue(unsigned Idx) const { in getElementValue()
878 UndefValue *UndefValue::getElementValue(Constant *C) const { in getElementValue()
910 static Constant *getIntSequenceIfElementsMatch(ArrayRef<Constant *> V) { in getIntSequenceIfElementsMatch()
914 for (Constant *C : V) in getIntSequenceIfElementsMatch()
923 static Constant *getFPSequenceIfElementsMatch(ArrayRef<Constant *> V) { in getFPSequenceIfElementsMatch()
927 for (Constant *C : V) in getFPSequenceIfElementsMatch()
936 static Constant *getSequenceIfElementsMatch(Constant *C, in getSequenceIfElementsMatch()
937 ArrayRef<Constant *> V) { in getSequenceIfElementsMatch()
963 ArrayRef<Constant *> V) in ConstantAggregate()
964 : Constant(T, VT, OperandTraits<ConstantAggregate>::op_end(this) - V.size(), in ConstantAggregate()
977 ConstantArray::ConstantArray(ArrayType *T, ArrayRef<Constant *> V) in ConstantArray()
983 Constant *ConstantArray::get(ArrayType *Ty, ArrayRef<Constant*> V) { in get()
984 if (Constant *C = getImpl(Ty, V)) in get()
989 Constant *ConstantArray::getImpl(ArrayType *Ty, ArrayRef<Constant*> V) { in getImpl()
1002 Constant *C = V[0]; in getImpl()
1019 ArrayRef<Constant*> V, in getTypeForElements()
1030 StructType *ConstantStruct::getTypeForElements(ArrayRef<Constant*> V, in getTypeForElements()
1037 ConstantStruct::ConstantStruct(StructType *T, ArrayRef<Constant *> V) in ConstantStruct()
1044 Constant *ConstantStruct::get(StructType *ST, ArrayRef<Constant*> V) { in get()
1072 ConstantVector::ConstantVector(VectorType *T, ArrayRef<Constant *> V) in ConstantVector()
1079 Constant *ConstantVector::get(ArrayRef<Constant*> V) { in get()
1080 if (Constant *C = getImpl(V)) in get()
1086 Constant *ConstantVector::getImpl(ArrayRef<Constant*> V) { in getImpl()
1092 Constant *C = V[0]; in getImpl()
1119 Constant *ConstantVector::getSplat(unsigned NumElts, Constant *V) { in getSplat()
1126 SmallVector<Constant*, 32> Elts(NumElts, V); in getSplat()
1192 Constant *
1193 ConstantExpr::getWithOperandReplaced(unsigned OpNo, Constant *Op) const { in getWithOperandReplaced()
1199 SmallVector<Constant*, 8> NewOps; in getWithOperandReplaced()
1206 Constant *ConstantExpr::getWithOperands(ArrayRef<Constant *> Ops, Type *Ty, in getWithOperands()
1368 Constant *Constant::getSplatValue() const { in getSplatValue()
1379 Constant *ConstantVector::getSplatValue() const { in getSplatValue()
1381 Constant *Elt = getOperand(0); in getSplatValue()
1389 const APInt &Constant::getUniqueInteger() const { in getUniqueInteger()
1393 const Constant *C = this->getAggregateElement(0U); in getUniqueInteger()
1445 : Constant(Type::getInt8PtrTy(F->getContext()), Value::BlockAddressVal, in BlockAddress()
1512 static Constant *getFoldedCast(Instruction::CastOps opc, Constant *C, Type *Ty, in getFoldedCast()
1516 if (Constant *FC = ConstantFoldCastInstruction(opc, C, Ty)) in getFoldedCast()
1530 Constant *ConstantExpr::getCast(unsigned oc, Constant *C, Type *Ty, in getCast()
1569 Constant *ConstantExpr::getZExtOrBitCast(Constant *C, Type *Ty) { in getZExtOrBitCast()
1575 Constant *ConstantExpr::getSExtOrBitCast(Constant *C, Type *Ty) { in getSExtOrBitCast()
1581 Constant *ConstantExpr::getTruncOrBitCast(Constant *C, Type *Ty) { in getTruncOrBitCast()
1587 Constant *ConstantExpr::getPointerCast(Constant *S, Type *Ty) { in getPointerCast()
1602 Constant *ConstantExpr::getPointerBitCastOrAddrSpaceCast(Constant *S, in getPointerBitCastOrAddrSpaceCast()
1613 Constant *ConstantExpr::getIntegerCast(Constant *C, Type *Ty, bool isSigned) { in getIntegerCast()
1625 Constant *ConstantExpr::getFPCast(Constant *C, Type *Ty) { in getFPCast()
1637 Constant *ConstantExpr::getTrunc(Constant *C, Type *Ty, bool OnlyIfReduced) { in getTrunc()
1651 Constant *ConstantExpr::getSExt(Constant *C, Type *Ty, bool OnlyIfReduced) { in getSExt()
1665 Constant *ConstantExpr::getZExt(Constant *C, Type *Ty, bool OnlyIfReduced) { in getZExt()
1679 Constant *ConstantExpr::getFPTrunc(Constant *C, Type *Ty, bool OnlyIfReduced) { in getFPTrunc()
1691 Constant *ConstantExpr::getFPExtend(Constant *C, Type *Ty, bool OnlyIfReduced) { in getFPExtend()
1703 Constant *ConstantExpr::getUIToFP(Constant *C, Type *Ty, bool OnlyIfReduced) { in getUIToFP()
1714 Constant *ConstantExpr::getSIToFP(Constant *C, Type *Ty, bool OnlyIfReduced) { in getSIToFP()
1725 Constant *ConstantExpr::getFPToUI(Constant *C, Type *Ty, bool OnlyIfReduced) { in getFPToUI()
1736 Constant *ConstantExpr::getFPToSI(Constant *C, Type *Ty, bool OnlyIfReduced) { in getFPToSI()
1747 Constant *ConstantExpr::getPtrToInt(Constant *C, Type *DstTy, in getPtrToInt()
1760 Constant *ConstantExpr::getIntToPtr(Constant *C, Type *DstTy, in getIntToPtr()
1773 Constant *ConstantExpr::getBitCast(Constant *C, Type *DstTy, in getBitCast()
1785 Constant *ConstantExpr::getAddrSpaceCast(Constant *C, Type *DstTy, in getAddrSpaceCast()
1806 Constant *ConstantExpr::get(unsigned Opcode, Constant *C, unsigned Flags, in get()
1829 Constant *ArgVec[] = { C }; in get()
1836 Constant *ConstantExpr::get(unsigned Opcode, Constant *C1, Constant *C2, in get()
1902 if (Constant *FC = ConstantFoldBinaryInstruction(Opcode, C1, C2)) in get()
1908 Constant *ArgVec[] = { C1, C2 }; in get()
1915 Constant *ConstantExpr::getSizeOf(Type* Ty) { in getSizeOf()
1918 Constant *GEPIdx = ConstantInt::get(Type::getInt32Ty(Ty->getContext()), 1); in getSizeOf()
1919 Constant *GEP = getGetElementPtr( in getSizeOf()
1920 Ty, Constant::getNullValue(PointerType::getUnqual(Ty)), GEPIdx); in getSizeOf()
1925 Constant *ConstantExpr::getAlignOf(Type* Ty) { in getAlignOf()
1929 Constant *NullPtr = Constant::getNullValue(AligningTy->getPointerTo(0)); in getAlignOf()
1930 Constant *Zero = ConstantInt::get(Type::getInt64Ty(Ty->getContext()), 0); in getAlignOf()
1931 Constant *One = ConstantInt::get(Type::getInt32Ty(Ty->getContext()), 1); in getAlignOf()
1932 Constant *Indices[2] = { Zero, One }; in getAlignOf()
1933 Constant *GEP = getGetElementPtr(AligningTy, NullPtr, Indices); in getAlignOf()
1938 Constant *ConstantExpr::getOffsetOf(StructType* STy, unsigned FieldNo) { in getOffsetOf()
1943 Constant *ConstantExpr::getOffsetOf(Type* Ty, Constant *FieldNo) { in getOffsetOf()
1946 Constant *GEPIdx[] = { in getOffsetOf()
1950 Constant *GEP = getGetElementPtr( in getOffsetOf()
1951 Ty, Constant::getNullValue(PointerType::getUnqual(Ty)), GEPIdx); in getOffsetOf()
1956 Constant *ConstantExpr::getCompare(unsigned short Predicate, Constant *C1, in getCompare()
1957 Constant *C2, bool OnlyIfReduced) { in getCompare()
1978 Constant *ConstantExpr::getSelect(Constant *C, Constant *V1, Constant *V2, in getSelect()
1982 if (Constant *SC = ConstantFoldSelectInstruction(C, V1, V2)) in getSelect()
1988 Constant *ArgVec[] = { C, V1, V2 }; in getSelect()
1995 Constant *ConstantExpr::getGetElementPtr(Type *Ty, Constant *C, in getGetElementPtr()
2005 if (Constant *FC = in getGetElementPtr()
2029 std::vector<Constant*> ArgVec; in getGetElementPtr()
2037 Constant *Idx = cast<Constant>(Idxs[i]); in getGetElementPtr()
2053 Constant *ConstantExpr::getICmp(unsigned short pred, Constant *LHS, in getICmp()
2054 Constant *RHS, bool OnlyIfReduced) { in getICmp()
2059 if (Constant *FC = ConstantFoldCompareInstruction(pred, LHS, RHS)) in getICmp()
2066 Constant *ArgVec[] = { LHS, RHS }; in getICmp()
2078 Constant *ConstantExpr::getFCmp(unsigned short pred, Constant *LHS, in getFCmp()
2079 Constant *RHS, bool OnlyIfReduced) { in getFCmp()
2084 if (Constant *FC = ConstantFoldCompareInstruction(pred, LHS, RHS)) in getFCmp()
2091 Constant *ArgVec[] = { LHS, RHS }; in getFCmp()
2103 Constant *ConstantExpr::getExtractElement(Constant *Val, Constant *Idx, in getExtractElement()
2110 if (Constant *FC = ConstantFoldExtractElementInstruction(Val, Idx)) in getExtractElement()
2118 Constant *ArgVec[] = { Val, Idx }; in getExtractElement()
2125 Constant *ConstantExpr::getInsertElement(Constant *Val, Constant *Elt, in getInsertElement()
2126 Constant *Idx, Type *OnlyIfReducedTy) { in getInsertElement()
2134 if (Constant *FC = ConstantFoldInsertElementInstruction(Val, Elt, Idx)) in getInsertElement()
2141 Constant *ArgVec[] = { Val, Elt, Idx }; in getInsertElement()
2148 Constant *ConstantExpr::getShuffleVector(Constant *V1, Constant *V2, in getShuffleVector()
2149 Constant *Mask, Type *OnlyIfReducedTy) { in getShuffleVector()
2153 if (Constant *FC = ConstantFoldShuffleVectorInstruction(V1, V2, Mask)) in getShuffleVector()
2164 Constant *ArgVec[] = { V1, V2, Mask }; in getShuffleVector()
2171 Constant *ConstantExpr::getInsertValue(Constant *Agg, Constant *Val, in getInsertValue()
2182 if (Constant *FC = ConstantFoldInsertValueInstruction(Agg, Val, Idxs)) in getInsertValue()
2188 Constant *ArgVec[] = { Agg, Val }; in getInsertValue()
2195 Constant *ConstantExpr::getExtractValue(Constant *Agg, ArrayRef<unsigned> Idxs, in getExtractValue()
2206 if (Constant *FC = ConstantFoldExtractValueInstruction(Agg, Idxs)) in getExtractValue()
2212 Constant *ArgVec[] = { Agg }; in getExtractValue()
2219 Constant *ConstantExpr::getNeg(Constant *C, bool HasNUW, bool HasNSW) { in getNeg()
2226 Constant *ConstantExpr::getFNeg(Constant *C) { in getFNeg()
2232 Constant *ConstantExpr::getNot(Constant *C) { in getNot()
2235 return get(Instruction::Xor, C, Constant::getAllOnesValue(C->getType())); in getNot()
2238 Constant *ConstantExpr::getAdd(Constant *C1, Constant *C2, in getAdd()
2245 Constant *ConstantExpr::getFAdd(Constant *C1, Constant *C2) { in getFAdd()
2249 Constant *ConstantExpr::getSub(Constant *C1, Constant *C2, in getSub()
2256 Constant *ConstantExpr::getFSub(Constant *C1, Constant *C2) { in getFSub()
2260 Constant *ConstantExpr::getMul(Constant *C1, Constant *C2, in getMul()
2267 Constant *ConstantExpr::getFMul(Constant *C1, Constant *C2) { in getFMul()
2271 Constant *ConstantExpr::getUDiv(Constant *C1, Constant *C2, bool isExact) { in getUDiv()
2276 Constant *ConstantExpr::getSDiv(Constant *C1, Constant *C2, bool isExact) { in getSDiv()
2281 Constant *ConstantExpr::getFDiv(Constant *C1, Constant *C2) { in getFDiv()
2285 Constant *ConstantExpr::getURem(Constant *C1, Constant *C2) { in getURem()
2289 Constant *ConstantExpr::getSRem(Constant *C1, Constant *C2) { in getSRem()
2293 Constant *ConstantExpr::getFRem(Constant *C1, Constant *C2) { in getFRem()
2297 Constant *ConstantExpr::getAnd(Constant *C1, Constant *C2) { in getAnd()
2301 Constant *ConstantExpr::getOr(Constant *C1, Constant *C2) { in getOr()
2305 Constant *ConstantExpr::getXor(Constant *C1, Constant *C2) { in getXor()
2309 Constant *ConstantExpr::getShl(Constant *C1, Constant *C2, in getShl()
2316 Constant *ConstantExpr::getLShr(Constant *C1, Constant *C2, bool isExact) { in getLShr()
2321 Constant *ConstantExpr::getAShr(Constant *C1, Constant *C2, bool isExact) { in getAShr()
2326 Constant *ConstantExpr::getBinOpIdentity(unsigned Opcode, Type *Ty, in getBinOpIdentity()
2336 return Constant::getNullValue(Ty); in getBinOpIdentity()
2340 return Constant::getAllOnesValue(Ty); in getBinOpIdentity()
2361 return Constant::getNullValue(Ty); in getBinOpIdentity()
2372 Constant *ConstantExpr::getBinOpAbsorber(unsigned Opcode, Type *Ty) { in getBinOpAbsorber()
2379 return Constant::getAllOnesValue(Ty); in getBinOpAbsorber()
2383 return Constant::getNullValue(Ty); in getBinOpAbsorber()
2397 Type *SrcElementTy, Constant *C, ArrayRef<Constant *> IdxList, Type *DestTy) in GetElementPtrConstantExpr()
2474 Constant *ConstantDataSequential::getImpl(StringRef Elements, Type *Ty) { in getImpl()
2548 Constant *ConstantDataArray::getFP(LLVMContext &Context, in getFP()
2554 Constant *ConstantDataArray::getFP(LLVMContext &Context, in getFP()
2560 Constant *ConstantDataArray::getFP(LLVMContext &Context, in getFP()
2567 Constant *ConstantDataArray::getString(LLVMContext &Context, in getString()
2583 Constant *ConstantDataVector::get(LLVMContext &Context, ArrayRef<uint8_t> Elts){ in get()
2588 Constant *ConstantDataVector::get(LLVMContext &Context, ArrayRef<uint16_t> Elts){ in get()
2593 Constant *ConstantDataVector::get(LLVMContext &Context, ArrayRef<uint32_t> Elts){ in get()
2598 Constant *ConstantDataVector::get(LLVMContext &Context, ArrayRef<uint64_t> Elts){ in get()
2603 Constant *ConstantDataVector::get(LLVMContext &Context, ArrayRef<float> Elts) { in get()
2608 Constant *ConstantDataVector::get(LLVMContext &Context, ArrayRef<double> Elts) { in get()
2619 Constant *ConstantDataVector::getFP(LLVMContext &Context, in getFP()
2625 Constant *ConstantDataVector::getFP(LLVMContext &Context, in getFP()
2631 Constant *ConstantDataVector::getFP(LLVMContext &Context, in getFP()
2638 Constant *ConstantDataVector::getSplat(unsigned NumElts, Constant *V) { in getSplat()
2761 Constant *ConstantDataSequential::getElementAsConstant(unsigned Elt) const { in getElementAsConstant()
2798 Constant *ConstantDataVector::getSplatValue() const { in getSplatValue()
2817 void Constant::handleOperandChange(Value *From, Value *To) { in handleOperandChange()
2845 assert(isa<Constant>(To) && "Cannot make Constant refer to non-constant!"); in handleOperandChangeImpl()
2846 Constant *ToC = cast<Constant>(To); in handleOperandChangeImpl()
2848 SmallVector<Constant*, 8> Values; in handleOperandChangeImpl()
2860 Constant *Val = cast<Constant>(O->get()); in handleOperandChangeImpl()
2877 if (Constant *C = getImpl(getType(), Values)) in handleOperandChangeImpl()
2886 assert(isa<Constant>(To) && "Cannot make Constant refer to non-constant!"); in handleOperandChangeImpl()
2887 Constant *ToC = cast<Constant>(To); in handleOperandChangeImpl()
2891 SmallVector<Constant*, 8> Values; in handleOperandChangeImpl()
2900 Constant *Val = cast<Constant>(O->get()); in handleOperandChangeImpl()
2922 assert(isa<Constant>(To) && "Cannot make Constant refer to non-constant!"); in handleOperandChangeImpl()
2923 Constant *ToC = cast<Constant>(To); in handleOperandChangeImpl()
2925 SmallVector<Constant*, 8> Values; in handleOperandChangeImpl()
2930 Constant *Val = getOperand(i); in handleOperandChangeImpl()
2939 if (Constant *C = getImpl(Values)) in handleOperandChangeImpl()
2948 assert(isa<Constant>(ToV) && "Cannot make Constant refer to non-constant!"); in handleOperandChangeImpl()
2949 Constant *To = cast<Constant>(ToV); in handleOperandChangeImpl()
2951 SmallVector<Constant*, 8> NewOps; in handleOperandChangeImpl()
2955 Constant *Op = getOperand(i); in handleOperandChangeImpl()
2965 if (Constant *C = getWithOperands(NewOps, getType(), true)) in handleOperandChangeImpl()