Lines Matching full:constant

1 //===-- Constants.cpp - Implement Constant nodes --------------------------===//
9 // This file implements the Constant* classes.
40 "use-constant-int-for-fixed-length-splat", cl::init(false), cl::Hidden,
43 "use-constant-fp-for-fixed-length-splat", cl::init(false), cl::Hidden,
46 "use-constant-int-for-scalable-splat", cl::init(false), cl::Hidden,
49 "use-constant-fp-for-scalable-splat", cl::init(false), cl::Hidden,
53 // Constant Class
56 bool Constant::isNegativeZeroValue() const { in isNegativeZeroValue()
74 // Return true iff this constant is positive zero (floating point), negative
76 bool Constant::isZeroValue() const { in isZeroValue()
81 // Check for constant splat vectors of 1 values. in isZeroValue()
90 bool Constant::isNullValue() const { in isNullValue()
101 // constant zero is zero for aggregates, cpnull is null for pointers, none for in isNullValue()
107 bool Constant::isAllOnesValue() const { in isAllOnesValue()
116 // Check for constant splat vectors of 1 values. in isAllOnesValue()
124 bool Constant::isOneValue() const { in isOneValue()
133 // Check for constant splat vectors of 1 values. in isOneValue()
141 bool Constant::isNotOneValue() const { in isNotOneValue()
153 Constant *Elt = getAggregateElement(I); in isNotOneValue()
169 bool Constant::isMinSignedValue() const { in isMinSignedValue()
186 bool Constant::isNotMinSignedValue() const { in isNotMinSignedValue()
198 Constant *Elt = getAggregateElement(I); in isNotMinSignedValue()
214 bool Constant::isFiniteNonZeroFP() const { in isFiniteNonZeroFP()
235 bool Constant::isNormalFP() const { in isNormalFP()
256 bool Constant::hasExactInverseFP() const { in hasExactInverseFP()
277 bool Constant::isNaN() const { in isNaN()
298 bool Constant::isElementWiseEqual(Value *Y) const { in isElementWiseEqual()
303 // The input value must be a vector constant with the same type. in isElementWiseEqual()
305 if (!isa<Constant>(Y) || !VTy || VTy != Y->getType()) in isElementWiseEqual()
316 Constant *C0 = ConstantExpr::getBitCast(const_cast<Constant *>(this), IntTy); in isElementWiseEqual()
317 Constant *C1 = ConstantExpr::getBitCast(cast<Constant>(Y), IntTy); in isElementWiseEqual()
318 Constant *CmpEq = ConstantFoldCompareInstruction(ICmpInst::ICMP_EQ, C0, C1); in isElementWiseEqual()
323 containsUndefinedElement(const Constant *C, in containsUndefinedElement()
324 function_ref<bool(const Constant *)> HasFn) { in containsUndefinedElement()
335 if (Constant *Elem = C->getAggregateElement(i)) in containsUndefinedElement()
344 bool Constant::containsUndefOrPoisonElement() const { in containsUndefOrPoisonElement()
349 bool Constant::containsPoisonElement() const { in containsPoisonElement()
354 bool Constant::containsUndefElement() const { in containsUndefElement()
360 bool Constant::containsConstantExpression() const { in containsConstantExpression()
369 /// Constructor to create a '0' constant of arbitrary type.
370 Constant *Constant::getNullValue(Type *Ty) { in getNullValue()
396 llvm_unreachable("Cannot create a null constant of that type!"); in getNullValue()
400 Constant *Constant::getIntegerValue(Type *Ty, const APInt &V) { in getIntegerValue()
403 // Create the base integer constant. in getIntegerValue()
404 Constant *C = ConstantInt::get(Ty->getContext(), V); in getIntegerValue()
417 Constant *Constant::getAllOnesValue(Type *Ty) { in getAllOnesValue()
432 Constant *Constant::getAggregateElement(unsigned Elt) const { in getAggregateElement()
434 "Must be an aggregate/vector constant"); in getAggregateElement()
461 Constant *Constant::getAggregateElement(Constant *Elt) const { in getAggregateElement()
464 // Check if the constant fits into an uint64_t. in getAggregateElement()
472 void Constant::destroyConstant() { in destroyConstant()
474 /// a chance to remove the constant from any maps/pools it's contained in. in destroyConstant()
477 llvm_unreachable("Not a constant!"); in destroyConstant()
485 // When a Constant is destroyed, there may be lingering in destroyConstant()
486 // references to the constant by other constants in the constant pool. These in destroyConstant()
495 if (!isa<Constant>(V)) { in destroyConstant()
501 assert(isa<Constant>(V) && "References remain to Constant being destroyed"); in destroyConstant()
502 cast<Constant>(V)->destroyConstant(); in destroyConstant()
504 // The constant should remove itself from our use list... in destroyConstant()
505 assert((use_empty() || user_back() != V) && "Constant not removed!"); in destroyConstant()
512 void llvm::deleteConstant(Constant *C) { in deleteConstant()
514 case Constant::ConstantIntVal: in deleteConstant()
517 case Constant::ConstantFPVal: in deleteConstant()
520 case Constant::ConstantAggregateZeroVal: in deleteConstant()
523 case Constant::ConstantArrayVal: in deleteConstant()
526 case Constant::ConstantStructVal: in deleteConstant()
529 case Constant::ConstantVectorVal: in deleteConstant()
532 case Constant::ConstantPointerNullVal: in deleteConstant()
535 case Constant::ConstantDataArrayVal: in deleteConstant()
538 case Constant::ConstantDataVectorVal: in deleteConstant()
541 case Constant::ConstantTokenNoneVal: in deleteConstant()
544 case Constant::BlockAddressVal: in deleteConstant()
547 case Constant::DSOLocalEquivalentVal: in deleteConstant()
550 case Constant::NoCFIValueVal: in deleteConstant()
553 case Constant::ConstantPtrAuthVal: in deleteConstant()
556 case Constant::UndefValueVal: in deleteConstant()
559 case Constant::PoisonValueVal: in deleteConstant()
562 case Constant::ConstantExprVal: in deleteConstant()
576 llvm_unreachable("Unexpected constant expr"); in deleteConstant()
579 llvm_unreachable("Unexpected constant"); in deleteConstant()
585 ConstHasGlobalValuePredicate(const Constant *C, in ConstHasGlobalValuePredicate()
587 SmallPtrSet<const Constant *, 8> Visited; in ConstHasGlobalValuePredicate()
588 SmallVector<const Constant *, 8> WorkList; in ConstHasGlobalValuePredicate()
593 const Constant *WorkItem = WorkList.pop_back_val(); in ConstHasGlobalValuePredicate()
598 const Constant *ConstOp = dyn_cast<Constant>(Op); in ConstHasGlobalValuePredicate()
608 bool Constant::isThreadDependent() const { in isThreadDependent()
615 bool Constant::isDLLImportDependent() const { in isDLLImportDependent()
622 bool Constant::isConstantUsed() const { in isConstantUsed()
624 const Constant *UC = dyn_cast<Constant>(U); in isConstantUsed()
634 bool Constant::needsDynamicRelocation() const { in needsDynamicRelocation()
638 bool Constant::needsRelocation() const { in needsRelocation()
642 Constant::PossibleRelocationsTy Constant::getRelocationInfo() const { in getRelocationInfo()
655 Constant *LHSOp0 = LHS->getOperand(0); in getRelocationInfo()
656 Constant *RHSOp0 = RHS->getOperand(0); in getRelocationInfo()
686 std::max(cast<Constant>(getOperand(i))->getRelocationInfo(), Result); in getRelocationInfo()
694 static bool constantIsDead(const Constant *C, bool RemoveDeadUsers) { in constantIsDead()
699 const Constant *User = dyn_cast<Constant>(*I); in constantIsDead()
700 if (!User) return false; // Non-constant usage; in constantIsDead()
702 return false; // Constant wasn't dead in constantIsDead()
717 const_cast<Constant *>(C)->destroyConstant(); in constantIsDead()
723 void Constant::removeDeadConstantUsers() const { in removeDeadConstantUsers()
727 const Constant *User = dyn_cast<Constant>(*I); in removeDeadConstantUsers()
735 // If the constant wasn't dead, remember that this was the last live use in removeDeadConstantUsers()
736 // and move on to the next constant. in removeDeadConstantUsers()
742 // If the constant was dead, then the iterator is invalidated. in removeDeadConstantUsers()
750 bool Constant::hasOneLiveUse() const { return hasNLiveUses(1); } in hasOneLiveUse()
752 bool Constant::hasZeroLiveUses() const { return hasNLiveUses(0); } in hasZeroLiveUses()
754 bool Constant::hasNLiveUses(unsigned N) const { in hasNLiveUses()
757 const Constant *User = dyn_cast<Constant>(U.getUser()); in hasNLiveUses()
768 Constant *Constant::replaceUndefsWith(Constant *C, Constant *Replacement) { in replaceUndefsWith()
769 assert(C && Replacement && "Expected non-nullptr constant arguments"); in replaceUndefsWith()
776 // Don't know how to deal with this constant. in replaceUndefsWith()
782 SmallVector<Constant *, 32> NewC(NumElts); in replaceUndefsWith()
784 Constant *EltC = C->getAggregateElement(i); in replaceUndefsWith()
792 Constant *Constant::mergeUndefsWith(Constant *C, Constant *Other) { in mergeUndefsWith()
793 assert(C && Other && "Expected non-nullptr constant arguments"); in mergeUndefsWith()
812 SmallVector<Constant *, 32> NewC(NumElts); in mergeUndefsWith()
815 Constant *OtherEltC = Other->getAggregateElement(I); in mergeUndefsWith()
827 bool Constant::isManifestConstant() const { in isManifestConstant()
832 if (!cast<Constant>(Op)->isManifestConstant()) in isManifestConstant()
847 "Invalid constant for type"); in ConstantInt()
868 Constant *ConstantInt::getTrue(Type *Ty) { in getTrue()
876 Constant *ConstantInt::getFalse(Type *Ty) { in getFalse()
884 Constant *ConstantInt::getBool(Type *Ty, bool V) { in getBool()
925 Constant *ConstantInt::get(Type *Ty, uint64_t V, bool isSigned) { in get()
926 Constant *C = get(cast<IntegerType>(Ty->getScalarType()), V, isSigned); in get()
939 Constant *ConstantInt::get(Type *Ty, const APInt& V) { in get()
955 /// Remove the constant from the constant table.
964 Constant *ConstantFP::get(Type *Ty, double V) { in get()
971 Constant *C = get(Context, FV); in get()
980 Constant *ConstantFP::get(Type *Ty, const APFloat &V) { in get()
992 Constant *ConstantFP::get(Type *Ty, StringRef Str) { in get()
996 Constant *C = get(Context, FV); in get()
1005 Constant *ConstantFP::getNaN(Type *Ty, bool Negative, uint64_t Payload) { in getNaN()
1008 Constant *C = get(Ty->getContext(), NaN); in getNaN()
1016 Constant *ConstantFP::getQNaN(Type *Ty, bool Negative, APInt *Payload) { in getQNaN()
1019 Constant *C = get(Ty->getContext(), NaN); in getQNaN()
1027 Constant *ConstantFP::getSNaN(Type *Ty, bool Negative, APInt *Payload) { in getSNaN()
1030 Constant *C = get(Ty->getContext(), NaN); in getSNaN()
1038 Constant *ConstantFP::getZero(Type *Ty, bool Negative) { in getZero()
1041 Constant *C = get(Ty->getContext(), NegZero); in getZero()
1084 Constant *ConstantFP::getInfinity(Type *Ty, bool Negative) { in getInfinity()
1086 Constant *C = get(Ty->getContext(), APFloat::getInf(Semantics, Negative)); in getInfinity()
1104 /// Remove the constant from the constant table.
1113 Constant *ConstantAggregateZero::getSequentialElement() const { in getSequentialElement()
1115 return Constant::getNullValue(AT->getElementType()); in getSequentialElement()
1116 return Constant::getNullValue(cast<VectorType>(getType())->getElementType()); in getSequentialElement()
1119 Constant *ConstantAggregateZero::getStructElement(unsigned Elt) const { in getStructElement()
1120 return Constant::getNullValue(getType()->getStructElementType(Elt)); in getStructElement()
1123 Constant *ConstantAggregateZero::getElementValue(Constant *C) const { in getElementValue()
1129 Constant *ConstantAggregateZero::getElementValue(unsigned Idx) const { in getElementValue()
1158 UndefValue *UndefValue::getElementValue(Constant *C) const { in getElementValue()
1193 PoisonValue *PoisonValue::getElementValue(Constant *C) const { in getElementValue()
1218 static Constant *getIntSequenceIfElementsMatch(ArrayRef<Constant *> V) { in getIntSequenceIfElementsMatch()
1222 for (Constant *C : V) in getIntSequenceIfElementsMatch()
1231 static Constant *getFPSequenceIfElementsMatch(ArrayRef<Constant *> V) { in getFPSequenceIfElementsMatch()
1235 for (Constant *C : V) in getFPSequenceIfElementsMatch()
1244 static Constant *getSequenceIfElementsMatch(Constant *C, in getSequenceIfElementsMatch()
1245 ArrayRef<Constant *> V) { in getSequenceIfElementsMatch()
1271 ArrayRef<Constant *> V) in ConstantAggregate()
1272 : Constant(T, VT, OperandTraits<ConstantAggregate>::op_end(this) - V.size(), in ConstantAggregate()
1286 ConstantArray::ConstantArray(ArrayType *T, ArrayRef<Constant *> V) in ConstantArray()
1289 "Invalid initializer for constant array"); in ConstantArray()
1292 Constant *ConstantArray::get(ArrayType *Ty, ArrayRef<Constant*> V) { in get()
1293 if (Constant *C = getImpl(Ty, V)) in get()
1298 Constant *ConstantArray::getImpl(ArrayType *Ty, ArrayRef<Constant*> V) { in getImpl()
1303 for (Constant *C : V) { in getImpl()
1312 Constant *C = V[0]; in getImpl()
1332 ArrayRef<Constant*> V, in getTypeForElements()
1343 StructType *ConstantStruct::getTypeForElements(ArrayRef<Constant*> V, in getTypeForElements()
1350 ConstantStruct::ConstantStruct(StructType *T, ArrayRef<Constant *> V) in ConstantStruct()
1353 "Invalid initializer for constant struct"); in ConstantStruct()
1357 Constant *ConstantStruct::get(StructType *ST, ArrayRef<Constant*> V) { in get()
1372 for (Constant *C : V) { in get()
1392 ConstantVector::ConstantVector(VectorType *T, ArrayRef<Constant *> V) in ConstantVector()
1395 "Invalid initializer for constant vector"); in ConstantVector()
1399 Constant *ConstantVector::get(ArrayRef<Constant*> V) { in get()
1400 if (Constant *C = getImpl(V)) in get()
1406 Constant *ConstantVector::getImpl(ArrayRef<Constant*> V) { in getImpl()
1412 Constant *C = V[0]; in getImpl()
1450 Constant *ConstantVector::getSplat(ElementCount EC, Constant *V) { in getSplat()
1468 SmallVector<Constant *, 32> Elts(EC.getKnownMinValue(), V); in getSplat()
1492 Constant *PoisonV = PoisonValue::get(VTy); in getSplat()
1507 /// Remove the constant from the constant table.
1514 // Constant.h
1521 Constant *ConstantExpr::getShuffleMaskForBitcode() const { in getShuffleMaskForBitcode()
1525 Constant *ConstantExpr::getWithOperands(ArrayRef<Constant *> Ops, Type *Ty, in getWithOperands()
1662 /// Remove the constant from the constant table.
1667 /// Remove the constant from the constant table.
1676 /// Remove the constant from the constant table.
1681 /// Remove the constant from the constant table.
1686 Constant *Constant::getSplatValue(bool AllowPoison) const { in getSplatValue()
1695 // Check if this is a constant expression splat of the form returned by in getSplatValue()
1706 Constant *SplatVal = IElt->getOperand(1); in getSplatValue()
1718 Constant *ConstantVector::getSplatValue(bool AllowPoison) const { in getSplatValue()
1720 Constant *Elt = getOperand(0); in getSplatValue()
1723 Constant *OpC = getOperand(I); in getSplatValue()
1745 const APInt &Constant::getUniqueInteger() const { in getUniqueInteger()
1754 const Constant *C = this->getAggregateElement(0U); in getUniqueInteger()
1759 ConstantRange Constant::toConstantRange() const { in toConstantRange()
1781 Constant *Elem = CV->getOperand(I); in toConstantRange()
1809 /// Remove the constant from the constant table.
1828 /// Remove the constant from the constant table.
1841 /// Remove the constant from the constant table.
1843 // Free the constant and any dangling references to it. in destroyConstantImpl()
1860 /// Remove the constant from the constant table.
1862 // Free the constant and any dangling references to it. in destroyConstantImpl()
1882 : Constant(PointerType::get(F->getContext(), F->getAddressSpace()), in BlockAddress()
1901 /// Remove the constant from the constant table.
1955 : Constant(GV->getType(), Value::DSOLocalEquivalentVal, &Op<0>(), 1) { in DSOLocalEquivalent()
1959 /// Remove the constant from the constant table.
1967 assert(isa<Constant>(To) && "Can only replace the operands with a constant"); in handleOperandChangeImpl()
1977 // If the argument is replaced with a null value, just replace this constant in handleOperandChangeImpl()
1979 if (cast<Constant>(To)->isNullValue()) in handleOperandChangeImpl()
1995 // It is ok to mutate the type here because this constant should always in handleOperandChangeImpl()
2013 : Constant(GV->getType(), Value::NoCFIValueVal, &Op<0>(), 1) { in NoCFIValue()
2017 /// Remove the constant from the constant table.
2046 ConstantPtrAuth *ConstantPtrAuth::get(Constant *Ptr, ConstantInt *Key, in get()
2047 ConstantInt *Disc, Constant *AddrDisc) { in get()
2048 Constant *ArgVec[] = {Ptr, Key, Disc, AddrDisc}; in get()
2054 ConstantPtrAuth *ConstantPtrAuth::getWithSameSchema(Constant *Pointer) const { in getWithSameSchema()
2058 ConstantPtrAuth::ConstantPtrAuth(Constant *Ptr, ConstantInt *Key, in ConstantPtrAuth()
2059 ConstantInt *Disc, Constant *AddrDisc) in ConstantPtrAuth()
2060 : Constant(Ptr->getType(), Value::ConstantPtrAuthVal, &Op<0>(), 4) { in ConstantPtrAuth()
2071 /// Remove the constant from the constant table.
2077 assert(isa<Constant>(ToV) && "Cannot make Constant refer to non-constant!"); in handleOperandChangeImpl()
2078 Constant *To = cast<Constant>(ToV); in handleOperandChangeImpl()
2080 SmallVector<Constant *, 4> Values; in handleOperandChangeImpl()
2088 Constant *Val = cast<Constant>(O->get()); in handleOperandChangeImpl()
2113 // If this constant has a simple discriminator (integer, no address), easy: in isKnownCompatibleWith()
2122 // This constant may or may not have an integer discriminator (instead of 0). in isKnownCompatibleWith()
2145 // These are often the same constant GEP, making them trivially equivalent. in isKnownCompatibleWith()
2166 static Constant *getFoldedCast(Instruction::CastOps opc, Constant *C, Type *Ty, in getFoldedCast()
2170 if (Constant *FC = ConstantFoldCastInstruction(opc, C, Ty)) in getFoldedCast()
2178 // Look up the constant in the table first to ensure uniqueness. in getFoldedCast()
2184 Constant *ConstantExpr::getCast(unsigned oc, Constant *C, Type *Ty, in getCast()
2189 "Cast opcode not supported as constant expression"); in getCast()
2209 Constant *ConstantExpr::getTruncOrBitCast(Constant *C, Type *Ty) { in getTruncOrBitCast()
2215 Constant *ConstantExpr::getPointerCast(Constant *S, Type *Ty) { in getPointerCast()
2230 Constant *ConstantExpr::getPointerBitCastOrAddrSpaceCast(Constant *S, in getPointerBitCastOrAddrSpaceCast()
2241 Constant *ConstantExpr::getTrunc(Constant *C, Type *Ty, bool OnlyIfReduced) { in getTrunc()
2255 Constant *ConstantExpr::getPtrToInt(Constant *C, Type *DstTy, in getPtrToInt()
2269 Constant *ConstantExpr::getIntToPtr(Constant *C, Type *DstTy, in getIntToPtr()
2283 Constant *ConstantExpr::getBitCast(Constant *C, Type *DstTy, in getBitCast()
2295 Constant *ConstantExpr::getAddrSpaceCast(Constant *C, Type *DstTy, in getAddrSpaceCast()
2302 Constant *ConstantExpr::get(unsigned Opcode, Constant *C1, Constant *C2, in get()
2306 "Invalid opcode in binary constant expression"); in get()
2308 "Binop not supported as constant expression"); in get()
2310 "Operand types in binary constant expression should match"); in get()
2331 if (Constant *FC = ConstantFoldBinaryInstruction(Opcode, C1, C2)) in get()
2337 Constant *ArgVec[] = {C1, C2}; in get()
2442 Constant *ConstantExpr::getSizeOf(Type* Ty) { in getSizeOf()
2445 Constant *GEPIdx = ConstantInt::get(Type::getInt32Ty(Ty->getContext()), 1); in getSizeOf()
2446 Constant *GEP = getGetElementPtr( in getSizeOf()
2447 Ty, Constant::getNullValue(PointerType::getUnqual(Ty)), GEPIdx); in getSizeOf()
2452 Constant *ConstantExpr::getAlignOf(Type* Ty) { in getAlignOf()
2456 Constant *NullPtr = in getAlignOf()
2457 Constant::getNullValue(PointerType::getUnqual(AligningTy->getContext())); in getAlignOf()
2458 Constant *Zero = ConstantInt::get(Type::getInt64Ty(Ty->getContext()), 0); in getAlignOf()
2459 Constant *One = ConstantInt::get(Type::getInt32Ty(Ty->getContext()), 1); in getAlignOf()
2460 Constant *Indices[2] = {Zero, One}; in getAlignOf()
2461 Constant *GEP = getGetElementPtr(AligningTy, NullPtr, Indices); in getAlignOf()
2465 Constant *ConstantExpr::getGetElementPtr(Type *Ty, Constant *C, in getGetElementPtr()
2473 if (Constant *FC = ConstantFoldGetElementPtr(Ty, C, InRange, Idxs)) in getGetElementPtr()
2488 // Look up the constant in the table first to ensure uniqueness in getGetElementPtr()
2489 std::vector<Constant*> ArgVec; in getGetElementPtr()
2494 auto *Idx = cast<Constant>(GTI.getOperand()); in getGetElementPtr()
2516 Constant *ConstantExpr::getExtractElement(Constant *Val, Constant *Idx, in getExtractElement()
2523 if (Constant *FC = ConstantFoldExtractElementInstruction(Val, Idx)) in getExtractElement()
2530 // Look up the constant in the table first to ensure uniqueness in getExtractElement()
2531 Constant *ArgVec[] = { Val, Idx }; in getExtractElement()
2538 Constant *ConstantExpr::getInsertElement(Constant *Val, Constant *Elt, in getInsertElement()
2539 Constant *Idx, Type *OnlyIfReducedTy) { in getInsertElement()
2547 if (Constant *FC = ConstantFoldInsertElementInstruction(Val, Elt, Idx)) in getInsertElement()
2553 // Look up the constant in the table first to ensure uniqueness in getInsertElement()
2554 Constant *ArgVec[] = { Val, Elt, Idx }; in getInsertElement()
2561 Constant *ConstantExpr::getShuffleVector(Constant *V1, Constant *V2, in getShuffleVector()
2565 "Invalid shuffle vector constant expr operands!"); in getShuffleVector()
2567 if (Constant *FC = ConstantFoldShuffleVectorInstruction(V1, V2, Mask)) in getShuffleVector()
2579 // Look up the constant in the table first to ensure uniqueness in getShuffleVector()
2580 Constant *ArgVec[] = {V1, V2}; in getShuffleVector()
2587 Constant *ConstantExpr::getNeg(Constant *C, bool HasNSW) { in getNeg()
2593 Constant *ConstantExpr::getNot(Constant *C) { in getNot()
2596 return get(Instruction::Xor, C, Constant::getAllOnesValue(C->getType())); in getNot()
2599 Constant *ConstantExpr::getAdd(Constant *C1, Constant *C2, in getAdd()
2606 Constant *ConstantExpr::getSub(Constant *C1, Constant *C2, in getSub()
2613 Constant *ConstantExpr::getMul(Constant *C1, Constant *C2, in getMul()
2620 Constant *ConstantExpr::getXor(Constant *C1, Constant *C2) { in getXor()
2624 Constant *ConstantExpr::getExactLogBase2(Constant *C) { in getExactLogBase2()
2630 // FIXME: We can extract pow of 2 of splat constant for scalable vectors. in getExactLogBase2()
2635 SmallVector<Constant *, 4> Elts; in getExactLogBase2()
2637 Constant *Elt = C->getAggregateElement(I); in getExactLogBase2()
2642 Elts.push_back(Constant::getNullValue(Ty->getScalarType())); in getExactLogBase2()
2653 Constant *ConstantExpr::getBinOpIdentity(unsigned Opcode, Type *Ty, in getBinOpIdentity()
2663 return Constant::getNullValue(Ty); in getBinOpIdentity()
2667 return Constant::getAllOnesValue(Ty); in getBinOpIdentity()
2673 llvm_unreachable("Every commutative binop has an identity constant"); in getBinOpIdentity()
2687 return Constant::getNullValue(Ty); in getBinOpIdentity()
2698 Constant *ConstantExpr::getIntrinsicIdentity(Intrinsic::ID ID, Type *Ty) { in getIntrinsicIdentity()
2701 return Constant::getNullValue(Ty); in getIntrinsicIdentity()
2703 return Constant::getAllOnesValue(Ty); in getIntrinsicIdentity()
2705 return Constant::getIntegerValue( in getIntrinsicIdentity()
2708 return Constant::getIntegerValue( in getIntrinsicIdentity()
2715 Constant *ConstantExpr::getIdentity(Instruction *I, Type *Ty, in getIdentity()
2724 Constant *ConstantExpr::getBinOpAbsorber(unsigned Opcode, Type *Ty) { in getBinOpAbsorber()
2731 return Constant::getAllOnesValue(Ty); in getBinOpAbsorber()
2735 return Constant::getNullValue(Ty); in getBinOpAbsorber()
2739 /// Remove the constant from the constant table.
2749 Type *SrcElementTy, Constant *C, ArrayRef<Constant *> IdxList, Type *DestTy, in GetElementPtrConstantExpr()
2835 Constant *ConstantDataSequential::getImpl(StringRef Elements, Type *Ty) { in getImpl()
2877 // Remove the constant from the StringMap. in destroyConstantImpl()
2911 /// getFP() constructors - Return a constant of array type with a float
2917 Constant *ConstantDataArray::getFP(Type *ElementType, ArrayRef<uint16_t> Elts) { in getFP()
2924 Constant *ConstantDataArray::getFP(Type *ElementType, ArrayRef<uint32_t> Elts) { in getFP()
2930 Constant *ConstantDataArray::getFP(Type *ElementType, ArrayRef<uint64_t> Elts) { in getFP()
2938 Constant *ConstantDataArray::getString(LLVMContext &Context, in getString()
2951 /// get() constructors - Return a constant with vector type with an element
2954 Constant *ConstantDataVector::get(LLVMContext &Context, ArrayRef<uint8_t> Elts){ in get()
2959 Constant *ConstantDataVector::get(LLVMContext &Context, ArrayRef<uint16_t> Elts){ in get()
2964 Constant *ConstantDataVector::get(LLVMContext &Context, ArrayRef<uint32_t> Elts){ in get()
2969 Constant *ConstantDataVector::get(LLVMContext &Context, ArrayRef<uint64_t> Elts){ in get()
2974 Constant *ConstantDataVector::get(LLVMContext &Context, ArrayRef<float> Elts) { in get()
2979 Constant *ConstantDataVector::get(LLVMContext &Context, ArrayRef<double> Elts) { in get()
2985 /// getFP() constructors - Return a constant of vector type with a float
2991 Constant *ConstantDataVector::getFP(Type *ElementType, in getFP()
2999 Constant *ConstantDataVector::getFP(Type *ElementType, in getFP()
3006 Constant *ConstantDataVector::getFP(Type *ElementType, in getFP()
3015 Constant *ConstantDataVector::getSplat(unsigned NumElts, Constant *V) { in getSplat()
3147 Constant *ConstantDataSequential::getElementAsConstant(unsigned Elt) const { in getElementAsConstant()
3192 Constant *ConstantDataVector::getSplatValue() const { in getSplatValue()
3200 /// Update this constant array to change uses of
3211 void Constant::handleOperandChange(Value *From, Value *To) { in handleOperandChange()
3215 llvm_unreachable("Not a constant!"); in handleOperandChange()
3234 // Delete the old constant! in handleOperandChange()
3239 assert(isa<Constant>(To) && "Cannot make Constant refer to non-constant!"); in handleOperandChangeImpl()
3240 Constant *ToC = cast<Constant>(To); in handleOperandChangeImpl()
3242 SmallVector<Constant*, 8> Values; in handleOperandChangeImpl()
3245 // Fill values with the modified operands of the constant array. Also, in handleOperandChangeImpl()
3254 Constant *Val = cast<Constant>(O->get()); in handleOperandChangeImpl()
3270 // Check for any other type of constant-folding. in handleOperandChangeImpl()
3271 if (Constant *C = getImpl(getType(), Values)) in handleOperandChangeImpl()
3280 assert(isa<Constant>(To) && "Cannot make Constant refer to non-constant!"); in handleOperandChangeImpl()
3281 Constant *ToC = cast<Constant>(To); in handleOperandChangeImpl()
3285 SmallVector<Constant*, 8> Values; in handleOperandChangeImpl()
3288 // Fill values with the modified operands of the constant struct. Also, in handleOperandChangeImpl()
3294 Constant *Val = cast<Constant>(O->get()); in handleOperandChangeImpl()
3316 assert(isa<Constant>(To) && "Cannot make Constant refer to non-constant!"); in handleOperandChangeImpl()
3317 Constant *ToC = cast<Constant>(To); in handleOperandChangeImpl()
3319 SmallVector<Constant*, 8> Values; in handleOperandChangeImpl()
3324 Constant *Val = getOperand(i); in handleOperandChangeImpl()
3333 if (Constant *C = getImpl(Values)) in handleOperandChangeImpl()
3342 assert(isa<Constant>(ToV) && "Cannot make Constant refer to non-constant!"); in handleOperandChangeImpl()
3343 Constant *To = cast<Constant>(ToV); in handleOperandChangeImpl()
3345 SmallVector<Constant*, 8> NewOps; in handleOperandChangeImpl()
3349 Constant *Op = getOperand(i); in handleOperandChangeImpl()
3359 if (Constant *C = getWithOperands(NewOps, getType(), true)) in handleOperandChangeImpl()