Lines Matching refs:Constant

42 bool Constant::isNegativeZeroValue() const {  in isNegativeZeroValue()
62 bool Constant::isZeroValue() const { in isZeroValue()
76 bool Constant::isNullValue() const { in isNullValue()
93 bool Constant::isAllOnesValue() const { in isAllOnesValue()
110 bool Constant::isOneValue() const { in isOneValue()
127 bool Constant::isNotOneValue() const { in isNotOneValue()
139 Constant *Elt = getAggregateElement(I); in isNotOneValue()
155 bool Constant::isMinSignedValue() const { in isMinSignedValue()
172 bool Constant::isNotMinSignedValue() const { in isNotMinSignedValue()
184 Constant *Elt = getAggregateElement(I); in isNotMinSignedValue()
200 bool Constant::isFiniteNonZeroFP() const { in isFiniteNonZeroFP()
221 bool Constant::isNormalFP() const { in isNormalFP()
242 bool Constant::hasExactInverseFP() const { in hasExactInverseFP()
263 bool Constant::isNaN() const { in isNaN()
284 bool Constant::isElementWiseEqual(Value *Y) const { in isElementWiseEqual()
291 if (!isa<Constant>(Y) || !VTy || VTy != Y->getType()) in isElementWiseEqual()
302 Constant *C0 = ConstantExpr::getBitCast(const_cast<Constant *>(this), IntTy); in isElementWiseEqual()
303 Constant *C1 = ConstantExpr::getBitCast(cast<Constant>(Y), IntTy); in isElementWiseEqual()
304 Constant *CmpEq = ConstantExpr::getICmp(ICmpInst::ICMP_EQ, C0, C1); in isElementWiseEqual()
309 containsUndefinedElement(const Constant *C, in containsUndefinedElement()
310 function_ref<bool(const Constant *)> HasFn) { in containsUndefinedElement()
321 if (Constant *Elem = C->getAggregateElement(i)) in containsUndefinedElement()
330 bool Constant::containsUndefOrPoisonElement() const { in containsUndefOrPoisonElement()
335 bool Constant::containsPoisonElement() const { in containsPoisonElement()
340 bool Constant::containsUndefElement() const { in containsUndefElement()
346 bool Constant::containsConstantExpression() const { in containsConstantExpression()
356 Constant *Constant::getNullValue(Type *Ty) { in getNullValue()
386 Constant *Constant::getIntegerValue(Type *Ty, const APInt &V) { in getIntegerValue()
390 Constant *C = ConstantInt::get(Ty->getContext(), V); in getIntegerValue()
403 Constant *Constant::getAllOnesValue(Type *Ty) { in getAllOnesValue()
418 Constant *Constant::getAggregateElement(unsigned Elt) const { in getAggregateElement()
447 Constant *Constant::getAggregateElement(Constant *Elt) const { in getAggregateElement()
458 void Constant::destroyConstant() { in destroyConstant()
481 if (!isa<Constant>(V)) { in destroyConstant()
487 assert(isa<Constant>(V) && "References remain to Constant being destroyed"); in destroyConstant()
488 cast<Constant>(V)->destroyConstant(); in destroyConstant()
498 void llvm::deleteConstant(Constant *C) { in deleteConstant()
500 case Constant::ConstantIntVal: in deleteConstant()
503 case Constant::ConstantFPVal: in deleteConstant()
506 case Constant::ConstantAggregateZeroVal: in deleteConstant()
509 case Constant::ConstantArrayVal: in deleteConstant()
512 case Constant::ConstantStructVal: in deleteConstant()
515 case Constant::ConstantVectorVal: in deleteConstant()
518 case Constant::ConstantPointerNullVal: in deleteConstant()
521 case Constant::ConstantDataArrayVal: in deleteConstant()
524 case Constant::ConstantDataVectorVal: in deleteConstant()
527 case Constant::ConstantTokenNoneVal: in deleteConstant()
530 case Constant::BlockAddressVal: in deleteConstant()
533 case Constant::DSOLocalEquivalentVal: in deleteConstant()
536 case Constant::NoCFIValueVal: in deleteConstant()
539 case Constant::UndefValueVal: in deleteConstant()
542 case Constant::PoisonValueVal: in deleteConstant()
545 case Constant::ConstantExprVal: in deleteConstant()
570 ConstHasGlobalValuePredicate(const Constant *C, in ConstHasGlobalValuePredicate()
572 SmallPtrSet<const Constant *, 8> Visited; in ConstHasGlobalValuePredicate()
573 SmallVector<const Constant *, 8> WorkList; in ConstHasGlobalValuePredicate()
578 const Constant *WorkItem = WorkList.pop_back_val(); in ConstHasGlobalValuePredicate()
583 const Constant *ConstOp = dyn_cast<Constant>(Op); in ConstHasGlobalValuePredicate()
593 bool Constant::isThreadDependent() const { in isThreadDependent()
600 bool Constant::isDLLImportDependent() const { in isDLLImportDependent()
607 bool Constant::isConstantUsed() const { in isConstantUsed()
609 const Constant *UC = dyn_cast<Constant>(U); in isConstantUsed()
619 bool Constant::needsDynamicRelocation() const { in needsDynamicRelocation()
623 bool Constant::needsRelocation() const { in needsRelocation()
627 Constant::PossibleRelocationsTy Constant::getRelocationInfo() const { in getRelocationInfo()
640 Constant *LHSOp0 = LHS->getOperand(0); in getRelocationInfo()
641 Constant *RHSOp0 = RHS->getOperand(0); in getRelocationInfo()
671 std::max(cast<Constant>(getOperand(i))->getRelocationInfo(), Result); in getRelocationInfo()
679 static bool constantIsDead(const Constant *C, bool RemoveDeadUsers) { in constantIsDead()
684 const Constant *User = dyn_cast<Constant>(*I); in constantIsDead()
702 const_cast<Constant *>(C)->destroyConstant(); in constantIsDead()
708 void Constant::removeDeadConstantUsers() const { in removeDeadConstantUsers()
712 const Constant *User = dyn_cast<Constant>(*I); in removeDeadConstantUsers()
735 bool Constant::hasOneLiveUse() const { return hasNLiveUses(1); } in hasOneLiveUse()
737 bool Constant::hasZeroLiveUses() const { return hasNLiveUses(0); } in hasZeroLiveUses()
739 bool Constant::hasNLiveUses(unsigned N) const { in hasNLiveUses()
742 const Constant *User = dyn_cast<Constant>(U.getUser()); in hasNLiveUses()
753 Constant *Constant::replaceUndefsWith(Constant *C, Constant *Replacement) { in replaceUndefsWith()
767 SmallVector<Constant *, 32> NewC(NumElts); in replaceUndefsWith()
769 Constant *EltC = C->getAggregateElement(i); in replaceUndefsWith()
777 Constant *Constant::mergeUndefsWith(Constant *C, Constant *Other) { in mergeUndefsWith()
797 SmallVector<Constant *, 32> NewC(NumElts); in mergeUndefsWith()
800 Constant *OtherEltC = Other->getAggregateElement(I); in mergeUndefsWith()
812 bool Constant::isManifestConstant() const { in isManifestConstant()
817 if (!cast<Constant>(Op)->isManifestConstant()) in isManifestConstant()
851 Constant *ConstantInt::getTrue(Type *Ty) { in getTrue()
859 Constant *ConstantInt::getFalse(Type *Ty) { in getFalse()
867 Constant *ConstantInt::getBool(Type *Ty, bool V) { in getBool()
888 Constant *ConstantInt::get(Type *Ty, uint64_t V, bool isSigned) { in get()
889 Constant *C = get(cast<IntegerType>(Ty->getScalarType()), V, isSigned); in get()
902 Constant *ConstantInt::get(Type *Ty, const APInt& V) { in get()
927 Constant *ConstantFP::get(Type *Ty, double V) { in get()
934 Constant *C = get(Context, FV); in get()
943 Constant *ConstantFP::get(Type *Ty, const APFloat &V) { in get()
955 Constant *ConstantFP::get(Type *Ty, StringRef Str) { in get()
959 Constant *C = get(Context, FV); in get()
968 Constant *ConstantFP::getNaN(Type *Ty, bool Negative, uint64_t Payload) { in getNaN()
971 Constant *C = get(Ty->getContext(), NaN); in getNaN()
979 Constant *ConstantFP::getQNaN(Type *Ty, bool Negative, APInt *Payload) { in getQNaN()
982 Constant *C = get(Ty->getContext(), NaN); in getQNaN()
990 Constant *ConstantFP::getSNaN(Type *Ty, bool Negative, APInt *Payload) { in getSNaN()
993 Constant *C = get(Ty->getContext(), NaN); in getSNaN()
1001 Constant *ConstantFP::getZero(Type *Ty, bool Negative) { in getZero()
1004 Constant *C = get(Ty->getContext(), NegZero); in getZero()
1027 Constant *ConstantFP::getInfinity(Type *Ty, bool Negative) { in getInfinity()
1029 Constant *C = get(Ty->getContext(), APFloat::getInf(Semantics, Negative)); in getInfinity()
1056 Constant *ConstantAggregateZero::getSequentialElement() const { in getSequentialElement()
1058 return Constant::getNullValue(AT->getElementType()); in getSequentialElement()
1059 return Constant::getNullValue(cast<VectorType>(getType())->getElementType()); in getSequentialElement()
1062 Constant *ConstantAggregateZero::getStructElement(unsigned Elt) const { in getStructElement()
1063 return Constant::getNullValue(getType()->getStructElementType(Elt)); in getStructElement()
1066 Constant *ConstantAggregateZero::getElementValue(Constant *C) const { in getElementValue()
1072 Constant *ConstantAggregateZero::getElementValue(unsigned Idx) const { in getElementValue()
1101 UndefValue *UndefValue::getElementValue(Constant *C) const { in getElementValue()
1136 PoisonValue *PoisonValue::getElementValue(Constant *C) const { in getElementValue()
1161 static Constant *getIntSequenceIfElementsMatch(ArrayRef<Constant *> V) { in getIntSequenceIfElementsMatch()
1165 for (Constant *C : V) in getIntSequenceIfElementsMatch()
1174 static Constant *getFPSequenceIfElementsMatch(ArrayRef<Constant *> V) { in getFPSequenceIfElementsMatch()
1178 for (Constant *C : V) in getFPSequenceIfElementsMatch()
1187 static Constant *getSequenceIfElementsMatch(Constant *C, in getSequenceIfElementsMatch()
1188 ArrayRef<Constant *> V) { in getSequenceIfElementsMatch()
1214 ArrayRef<Constant *> V) in ConstantAggregate()
1215 : Constant(T, VT, OperandTraits<ConstantAggregate>::op_end(this) - V.size(), in ConstantAggregate()
1229 ConstantArray::ConstantArray(ArrayType *T, ArrayRef<Constant *> V) in ConstantArray()
1235 Constant *ConstantArray::get(ArrayType *Ty, ArrayRef<Constant*> V) { in get()
1236 if (Constant *C = getImpl(Ty, V)) in get()
1241 Constant *ConstantArray::getImpl(ArrayType *Ty, ArrayRef<Constant*> V) { in getImpl()
1246 for (Constant *C : V) { in getImpl()
1255 Constant *C = V[0]; in getImpl()
1275 ArrayRef<Constant*> V, in getTypeForElements()
1286 StructType *ConstantStruct::getTypeForElements(ArrayRef<Constant*> V, in getTypeForElements()
1293 ConstantStruct::ConstantStruct(StructType *T, ArrayRef<Constant *> V) in ConstantStruct()
1300 Constant *ConstantStruct::get(StructType *ST, ArrayRef<Constant*> V) { in get()
1315 for (Constant *C : V) { in get()
1335 ConstantVector::ConstantVector(VectorType *T, ArrayRef<Constant *> V) in ConstantVector()
1342 Constant *ConstantVector::get(ArrayRef<Constant*> V) { in get()
1343 if (Constant *C = getImpl(V)) in get()
1349 Constant *ConstantVector::getImpl(ArrayRef<Constant*> V) { in getImpl()
1355 Constant *C = V[0]; in getImpl()
1385 Constant *ConstantVector::getSplat(ElementCount EC, Constant *V) { in getSplat()
1393 SmallVector<Constant *, 32> Elts(EC.getKnownMinValue(), V); in getSplat()
1407 Constant *PoisonV = PoisonValue::get(VTy); in getSplat()
1446 Constant *ConstantExpr::getShuffleMaskForBitcode() const { in getShuffleMaskForBitcode()
1450 Constant *ConstantExpr::getWithOperands(ArrayRef<Constant *> Ops, Type *Ty, in getWithOperands()
1615 Constant *Constant::getSplatValue(bool AllowUndefs) const { in getSplatValue()
1635 Constant *SplatVal = IElt->getOperand(1); in getSplatValue()
1647 Constant *ConstantVector::getSplatValue(bool AllowUndefs) const { in getSplatValue()
1649 Constant *Elt = getOperand(0); in getSplatValue()
1652 Constant *OpC = getOperand(I); in getSplatValue()
1674 const APInt &Constant::getUniqueInteger() const { in getUniqueInteger()
1683 const Constant *C = this->getAggregateElement(0U); in getUniqueInteger()
1773 : Constant(PointerType::get(F->getContext(), F->getAddressSpace()), in BlockAddress()
1846 : Constant(GV->getType(), Value::DSOLocalEquivalentVal, &Op<0>(), 1) { in DSOLocalEquivalent()
1858 assert(isa<Constant>(To) && "Can only replace the operands with a constant"); in handleOperandChangeImpl()
1870 if (cast<Constant>(To)->isNullValue()) in handleOperandChangeImpl()
1904 : Constant(GV->getType(), Value::NoCFIValueVal, &Op<0>(), 1) { in NoCFIValue()
1939 static Constant *getFoldedCast(Instruction::CastOps opc, Constant *C, Type *Ty, in getFoldedCast()
1943 if (Constant *FC = ConstantFoldCastInstruction(opc, C, Ty)) in getFoldedCast()
1957 Constant *ConstantExpr::getCast(unsigned oc, Constant *C, Type *Ty, in getCast()
1982 Constant *ConstantExpr::getTruncOrBitCast(Constant *C, Type *Ty) { in getTruncOrBitCast()
1988 Constant *ConstantExpr::getPointerCast(Constant *S, Type *Ty) { in getPointerCast()
2003 Constant *ConstantExpr::getPointerBitCastOrAddrSpaceCast(Constant *S, in getPointerBitCastOrAddrSpaceCast()
2014 Constant *ConstantExpr::getTrunc(Constant *C, Type *Ty, bool OnlyIfReduced) { in getTrunc()
2028 Constant *ConstantExpr::getPtrToInt(Constant *C, Type *DstTy, in getPtrToInt()
2042 Constant *ConstantExpr::getIntToPtr(Constant *C, Type *DstTy, in getIntToPtr()
2056 Constant *ConstantExpr::getBitCast(Constant *C, Type *DstTy, in getBitCast()
2068 Constant *ConstantExpr::getAddrSpaceCast(Constant *C, Type *DstTy, in getAddrSpaceCast()
2075 Constant *ConstantExpr::get(unsigned Opcode, Constant *C1, Constant *C2, in get()
2110 if (Constant *FC = ConstantFoldBinaryInstruction(Opcode, C1, C2)) in get()
2116 Constant *ArgVec[] = { C1, C2 }; in get()
2221 Constant *ConstantExpr::getSizeOf(Type* Ty) { in getSizeOf()
2224 Constant *GEPIdx = ConstantInt::get(Type::getInt32Ty(Ty->getContext()), 1); in getSizeOf()
2225 Constant *GEP = getGetElementPtr( in getSizeOf()
2226 Ty, Constant::getNullValue(PointerType::getUnqual(Ty)), GEPIdx); in getSizeOf()
2231 Constant *ConstantExpr::getAlignOf(Type* Ty) { in getAlignOf()
2235 Constant *NullPtr = Constant::getNullValue(PointerType::getUnqual(AligningTy->getContext())); in getAlignOf()
2236 Constant *Zero = ConstantInt::get(Type::getInt64Ty(Ty->getContext()), 0); in getAlignOf()
2237 Constant *One = ConstantInt::get(Type::getInt32Ty(Ty->getContext()), 1); in getAlignOf()
2238 Constant *Indices[2] = { Zero, One }; in getAlignOf()
2239 Constant *GEP = getGetElementPtr(AligningTy, NullPtr, Indices); in getAlignOf()
2244 Constant *ConstantExpr::getCompare(unsigned short Predicate, Constant *C1, in getCompare()
2245 Constant *C2, bool OnlyIfReduced) { in getCompare()
2266 Constant *ConstantExpr::getGetElementPtr(Type *Ty, Constant *C, in getGetElementPtr()
2273 if (Constant *FC = in getGetElementPtr()
2290 std::vector<Constant*> ArgVec; in getGetElementPtr()
2295 auto *Idx = cast<Constant>(GTI.getOperand()); in getGetElementPtr()
2320 Constant *ConstantExpr::getICmp(unsigned short pred, Constant *LHS, in getICmp()
2321 Constant *RHS, bool OnlyIfReduced) { in getICmp()
2326 if (Constant *FC = ConstantFoldCompareInstruction(Predicate, LHS, RHS)) in getICmp()
2333 Constant *ArgVec[] = { LHS, RHS }; in getICmp()
2345 Constant *ConstantExpr::getFCmp(unsigned short pred, Constant *LHS, in getFCmp()
2346 Constant *RHS, bool OnlyIfReduced) { in getFCmp()
2351 if (Constant *FC = ConstantFoldCompareInstruction(Predicate, LHS, RHS)) in getFCmp()
2358 Constant *ArgVec[] = { LHS, RHS }; in getFCmp()
2370 Constant *ConstantExpr::getExtractElement(Constant *Val, Constant *Idx, in getExtractElement()
2377 if (Constant *FC = ConstantFoldExtractElementInstruction(Val, Idx)) in getExtractElement()
2385 Constant *ArgVec[] = { Val, Idx }; in getExtractElement()
2392 Constant *ConstantExpr::getInsertElement(Constant *Val, Constant *Elt, in getInsertElement()
2393 Constant *Idx, Type *OnlyIfReducedTy) { in getInsertElement()
2401 if (Constant *FC = ConstantFoldInsertElementInstruction(Val, Elt, Idx)) in getInsertElement()
2408 Constant *ArgVec[] = { Val, Elt, Idx }; in getInsertElement()
2415 Constant *ConstantExpr::getShuffleVector(Constant *V1, Constant *V2, in getShuffleVector()
2421 if (Constant *FC = ConstantFoldShuffleVectorInstruction(V1, V2, Mask)) in getShuffleVector()
2434 Constant *ArgVec[] = {V1, V2}; in getShuffleVector()
2441 Constant *ConstantExpr::getNeg(Constant *C, bool HasNUW, bool HasNSW) { in getNeg()
2447 Constant *ConstantExpr::getNot(Constant *C) { in getNot()
2450 return get(Instruction::Xor, C, Constant::getAllOnesValue(C->getType())); in getNot()
2453 Constant *ConstantExpr::getAdd(Constant *C1, Constant *C2, in getAdd()
2460 Constant *ConstantExpr::getSub(Constant *C1, Constant *C2, in getSub()
2467 Constant *ConstantExpr::getMul(Constant *C1, Constant *C2, in getMul()
2474 Constant *ConstantExpr::getXor(Constant *C1, Constant *C2) { in getXor()
2478 Constant *ConstantExpr::getShl(Constant *C1, Constant *C2, in getShl()
2485 Constant *ConstantExpr::getExactLogBase2(Constant *C) { in getExactLogBase2()
2496 SmallVector<Constant *, 4> Elts; in getExactLogBase2()
2498 Constant *Elt = C->getAggregateElement(I); in getExactLogBase2()
2503 Elts.push_back(Constant::getNullValue(Ty->getScalarType())); in getExactLogBase2()
2514 Constant *ConstantExpr::getBinOpIdentity(unsigned Opcode, Type *Ty, in getBinOpIdentity()
2524 return Constant::getNullValue(Ty); in getBinOpIdentity()
2528 return Constant::getAllOnesValue(Ty); in getBinOpIdentity()
2548 return Constant::getNullValue(Ty); in getBinOpIdentity()
2559 Constant *ConstantExpr::getIntrinsicIdentity(Intrinsic::ID ID, Type *Ty) { in getIntrinsicIdentity()
2562 return Constant::getNullValue(Ty); in getIntrinsicIdentity()
2564 return Constant::getAllOnesValue(Ty); in getIntrinsicIdentity()
2566 return Constant::getIntegerValue( in getIntrinsicIdentity()
2569 return Constant::getIntegerValue( in getIntrinsicIdentity()
2576 Constant *ConstantExpr::getIdentity(Instruction *I, Type *Ty, in getIdentity()
2585 Constant *ConstantExpr::getBinOpAbsorber(unsigned Opcode, Type *Ty) { in getBinOpAbsorber()
2592 return Constant::getAllOnesValue(Ty); in getBinOpAbsorber()
2596 return Constant::getNullValue(Ty); in getBinOpAbsorber()
2610 Type *SrcElementTy, Constant *C, ArrayRef<Constant *> IdxList, Type *DestTy) in GetElementPtrConstantExpr()
2690 Constant *ConstantDataSequential::getImpl(StringRef Elements, Type *Ty) { in getImpl()
2772 Constant *ConstantDataArray::getFP(Type *ElementType, ArrayRef<uint16_t> Elts) { in getFP()
2779 Constant *ConstantDataArray::getFP(Type *ElementType, ArrayRef<uint32_t> Elts) { in getFP()
2785 Constant *ConstantDataArray::getFP(Type *ElementType, ArrayRef<uint64_t> Elts) { in getFP()
2793 Constant *ConstantDataArray::getString(LLVMContext &Context, in getString()
2809 Constant *ConstantDataVector::get(LLVMContext &Context, ArrayRef<uint8_t> Elts){ in get()
2814 Constant *ConstantDataVector::get(LLVMContext &Context, ArrayRef<uint16_t> Elts){ in get()
2819 Constant *ConstantDataVector::get(LLVMContext &Context, ArrayRef<uint32_t> Elts){ in get()
2824 Constant *ConstantDataVector::get(LLVMContext &Context, ArrayRef<uint64_t> Elts){ in get()
2829 Constant *ConstantDataVector::get(LLVMContext &Context, ArrayRef<float> Elts) { in get()
2834 Constant *ConstantDataVector::get(LLVMContext &Context, ArrayRef<double> Elts) { in get()
2846 Constant *ConstantDataVector::getFP(Type *ElementType, in getFP()
2854 Constant *ConstantDataVector::getFP(Type *ElementType, in getFP()
2861 Constant *ConstantDataVector::getFP(Type *ElementType, in getFP()
2870 Constant *ConstantDataVector::getSplat(unsigned NumElts, Constant *V) { in getSplat()
3002 Constant *ConstantDataSequential::getElementAsConstant(unsigned Elt) const { in getElementAsConstant()
3047 Constant *ConstantDataVector::getSplatValue() const { in getSplatValue()
3066 void Constant::handleOperandChange(Value *From, Value *To) { in handleOperandChange()
3094 assert(isa<Constant>(To) && "Cannot make Constant refer to non-constant!"); in handleOperandChangeImpl()
3095 Constant *ToC = cast<Constant>(To); in handleOperandChangeImpl()
3097 SmallVector<Constant*, 8> Values; in handleOperandChangeImpl()
3109 Constant *Val = cast<Constant>(O->get()); in handleOperandChangeImpl()
3126 if (Constant *C = getImpl(getType(), Values)) in handleOperandChangeImpl()
3135 assert(isa<Constant>(To) && "Cannot make Constant refer to non-constant!"); in handleOperandChangeImpl()
3136 Constant *ToC = cast<Constant>(To); in handleOperandChangeImpl()
3140 SmallVector<Constant*, 8> Values; in handleOperandChangeImpl()
3149 Constant *Val = cast<Constant>(O->get()); in handleOperandChangeImpl()
3171 assert(isa<Constant>(To) && "Cannot make Constant refer to non-constant!"); in handleOperandChangeImpl()
3172 Constant *ToC = cast<Constant>(To); in handleOperandChangeImpl()
3174 SmallVector<Constant*, 8> Values; in handleOperandChangeImpl()
3179 Constant *Val = getOperand(i); in handleOperandChangeImpl()
3188 if (Constant *C = getImpl(Values)) in handleOperandChangeImpl()
3197 assert(isa<Constant>(ToV) && "Cannot make Constant refer to non-constant!"); in handleOperandChangeImpl()
3198 Constant *To = cast<Constant>(ToV); in handleOperandChangeImpl()
3200 SmallVector<Constant*, 8> NewOps; in handleOperandChangeImpl()
3204 Constant *Op = getOperand(i); in handleOperandChangeImpl()
3214 if (Constant *C = getWithOperands(NewOps, getType(), true)) in handleOperandChangeImpl()