• Home
  • History
  • Annotate
  • Raw
  • Download
  • only in /macosx-10.10.1/llvmCore-3425.0.34/lib/VMCore/

Lines Matching refs:Constant

1 //===-- Constants.cpp - Implement Constant nodes --------------------------===//
10 // This file implements the Constant* classes.
40 // Constant Class
43 void Constant::anchor() { }
45 bool Constant::isNegativeZeroValue() const {
54 bool Constant::isNullValue() const {
67 bool Constant::isAllOnesValue() const {
78 if (Constant *Splat = CV->getSplatValue())
83 if (Constant *Splat = CV->getSplatValue())
90 Constant *Constant::getNullValue(Type *Ty) {
124 Constant *Constant::getIntegerValue(Type *Ty, const APInt &V) {
128 Constant *C = ConstantInt::get(Ty->getContext(), V);
141 Constant *Constant::getAllOnesValue(Type *Ty) {
161 Constant *Constant::getAggregateElement(unsigned Elt) const {
182 Constant *Constant::getAggregateElement(Constant *Elt) const {
190 void Constant::destroyConstantImpl() {
191 // When a Constant is destroyed, there may be lingering
201 if (!isa<Constant>(V)) {
207 assert(isa<Constant>(V) && "References remain to Constant being destroyed");
208 cast<Constant>(V)->destroyConstant();
211 assert((use_empty() || use_back() != V) && "Constant not removed!");
220 bool Constant::canTrap() const {
250 bool Constant::isConstantUsed() const {
252 const Constant *UC = dyn_cast<Constant>(*UI);
278 Constant::PossibleRelocationsTy Constant::getRelocationInfo() const {
309 cast<Constant>(getOperand(i))->getRelocationInfo());
317 static bool removeDeadUsersOfConstant(const Constant *C) {
321 const Constant *User = dyn_cast<Constant>(C->use_back());
324 return false; // Constant wasn't dead
327 const_cast<Constant*>(C)->destroyConstant();
336 void Constant::removeDeadConstantUsers() const {
340 const Constant *User = dyn_cast<Constant>(*I);
375 : Constant(Ty, ConstantIntVal, 0, 0), Val(V) {
393 Constant *ConstantInt::getTrue(Type *Ty) {
405 Constant *ConstantInt::getFalse(Type *Ty) {
433 Constant *ConstantInt::get(Type *Ty, uint64_t V, bool isSigned) {
434 Constant *C = get(cast<IntegerType>(Ty->getScalarType()), V, isSigned);
452 Constant *ConstantInt::getSigned(Type *Ty, int64_t V) {
456 Constant *ConstantInt::get(Type *Ty, const APInt& V) {
498 Constant *ConstantFP::get(Type *Ty, double V) {
505 Constant *C = get(Context, FV);
515 Constant *ConstantFP::get(Type *Ty, StringRef Str) {
519 Constant *C = get(Context, FV);
531 APFloat apf = cast<ConstantFP>(Constant::getNullValue(Ty))->getValueAPF();
537 Constant *ConstantFP::getZeroValueForNegation(Type *Ty) {
540 Constant *C = getNegativeZero(ScalarTy);
546 return Constant::getNullValue(Ty);
588 : Constant(Ty, ConstantFPVal, 0, 0), Val(V) {
603 Constant *ConstantAggregateZero::getSequentialElement() const {
604 return Constant::getNullValue(getType()->getSequentialElementType());
609 Constant *ConstantAggregateZero::getStructElement(unsigned Elt) const {
610 return Constant::getNullValue(getType()->getStructElementType(Elt));
615 Constant *ConstantAggregateZero::getElementValue(Constant *C) const {
623 Constant *ConstantAggregateZero::getElementValue(unsigned Idx) const {
648 UndefValue *UndefValue::getElementValue(Constant *C) const {
676 ConstantArray::ConstantArray(ArrayType *T, ArrayRef<Constant *> V)
677 : Constant(T, ConstantArrayVal,
688 Constant *ConstantArray::get(ArrayType *Ty, ArrayRef<Constant*> V) {
702 Constant *C = V[0];
785 ArrayRef<Constant*> V,
796 StructType *ConstantStruct::getTypeForElements(ArrayRef<Constant*> V,
804 ConstantStruct::ConstantStruct(StructType *T, ArrayRef<Constant *> V)
805 : Constant(T, ConstantStructVal,
817 Constant *ConstantStruct::get(StructType *ST, ArrayRef<Constant*> V) {
845 Constant *ConstantStruct::get(StructType *T, ...) {
847 SmallVector<Constant*, 8> Values;
849 while (Constant *Val = va_arg(ap, llvm::Constant*))
855 ConstantVector::ConstantVector(VectorType *T, ArrayRef<Constant *> V)
856 : Constant(T, ConstantVectorVal,
866 Constant *ConstantVector::get(ArrayRef<Constant*> V) {
873 Constant *C = V[0];
964 Constant *ConstantVector::getSplat(unsigned NumElts, Constant *V) {
971 SmallVector<Constant*, 32> Elts(NumElts, V);
978 // Constant.h
1032 Constant *
1033 ConstantExpr::getWithOperandReplaced(unsigned OpNo, Constant *Op) const {
1039 SmallVector<Constant*, 8> NewOps;
1049 Constant *ConstantExpr::
1050 getWithOperands(ArrayRef<Constant*> Ops, Type *Ty) const {
1218 Constant *ConstantVector::getSplatValue() const {
1220 Constant *Elt = getOperand(0);
1286 : Constant(Type::getInt8PtrTy(F->getContext()), Value::BlockAddressVal,
1346 static inline Constant *getFoldedCast(
1347 Instruction::CastOps opc, Constant *C, Type *Ty) {
1350 if (Constant *FC = ConstantFoldCastInstruction(opc, C, Ty))
1356 std::vector<Constant*> argVec(1, C);
1362 Constant *ConstantExpr::getCast(unsigned oc, Constant *C, Type *Ty) {
1386 Constant *ConstantExpr::getZExtOrBitCast(Constant *C, Type *Ty) {
1392 Constant *ConstantExpr::getSExtOrBitCast(Constant *C, Type *Ty) {
1398 Constant *ConstantExpr::getTruncOrBitCast(Constant *C, Type *Ty) {
1404 Constant *ConstantExpr::getPointerCast(Constant *S, Type *Ty) {
1413 Constant *ConstantExpr::getIntegerCast(Constant *C, Type *Ty,
1426 Constant *ConstantExpr::getFPCast(Constant *C, Type *Ty) {
1438 Constant *ConstantExpr::getTrunc(Constant *C, Type *Ty) {
1452 Constant *ConstantExpr::getSExt(Constant *C, Type *Ty) {
1466 Constant *ConstantExpr::getZExt(Constant *C, Type *Ty) {
1480 Constant *ConstantExpr::getFPTrunc(Constant *C, Type *Ty) {
1492 Constant *ConstantExpr::getFPExtend(Constant *C, Type *Ty) {
1504 Constant *ConstantExpr::getUIToFP(Constant *C, Type *Ty) {
1515 Constant *ConstantExpr::getSIToFP(Constant *C, Type *Ty) {
1526 Constant *ConstantExpr::getFPToUI(Constant *C, Type *Ty) {
1537 Constant *ConstantExpr::getFPToSI(Constant *C, Type *Ty) {
1548 Constant *ConstantExpr::getPtrToInt(Constant *C, Type *DstTy) {
1560 Constant *ConstantExpr::getIntToPtr(Constant *C, Type *DstTy) {
1572 Constant *ConstantExpr::getBitCast(Constant *C, Type *DstTy) {
1583 Constant *ConstantExpr::get(unsigned Opcode, Constant *C1, Constant *C2,
1650 if (Constant *FC = ConstantFoldBinaryInstruction(Opcode, C1, C2))
1653 std::vector<Constant*> argVec(1, C1);
1661 Constant *ConstantExpr::getSizeOf(Type* Ty) {
1664 Constant *GEPIdx = ConstantInt::get(Type::getInt32Ty(Ty->getContext()), 1);
1665 Constant *GEP = getGetElementPtr(
1666 Constant::getNullValue(PointerType::getUnqual(Ty)), GEPIdx);
1671 Constant *ConstantExpr::getAlignOf(Type* Ty) {
1676 Constant *NullPtr = Constant::getNullValue(AligningTy->getPointerTo());
1677 Constant *Zero = ConstantInt::get(Type::getInt64Ty(Ty->getContext()), 0);
1678 Constant *One = ConstantInt::get(Type::getInt32Ty(Ty->getContext()), 1);
1679 Constant *Indices[2] = { Zero, One };
1680 Constant *GEP = getGetElementPtr(NullPtr, Indices);
1685 Constant *ConstantExpr::getOffsetOf(StructType* STy, unsigned FieldNo) {
1690 Constant *ConstantExpr::getOffsetOf(Type* Ty, Constant *FieldNo) {
1693 Constant *GEPIdx[] = {
1697 Constant *GEP = getGetElementPtr(
1698 Constant::getNullValue(PointerType::getUnqual(Ty)), GEPIdx);
1703 Constant *ConstantExpr::getCompare(unsigned short Predicate,
1704 Constant *C1, Constant *C2) {
1725 Constant *ConstantExpr::getSelect(Constant *C, Constant *V1, Constant *V2) {
1728 if (Constant *SC = ConstantFoldSelectInstruction(C, V1, V2))
1731 std::vector<Constant*> argVec(3, C);
1740 Constant *ConstantExpr::getGetElementPtr(Constant *C, ArrayRef<Value *> Idxs,
1742 if (Constant *FC = ConstantFoldGetElementPtr(C, InBounds, Idxs))
1754 std::vector<Constant*> ArgVec;
1758 ArgVec.push_back(cast<Constant>(Idxs[i]));
1766 Constant *
1767 ConstantExpr::getICmp(unsigned short pred, Constant *LHS, Constant *RHS) {
1772 if (Constant *FC = ConstantFoldCompareInstruction(pred, LHS, RHS))
1776 std::vector<Constant*> ArgVec;
1790 Constant *
1791 ConstantExpr::getFCmp(unsigned short pred, Constant *LHS, Constant *RHS) {
1795 if (Constant *FC = ConstantFoldCompareInstruction(pred, LHS, RHS))
1799 std::vector<Constant*> ArgVec;
1813 Constant *ConstantExpr::getExtractElement(Constant *Val, Constant *Idx) {
1819 if (Constant *FC = ConstantFoldExtractElementInstruction(Val, Idx))
1823 std::vector<Constant*> ArgVec(1, Val);
1832 Constant *ConstantExpr::getInsertElement(Constant *Val, Constant *Elt,
1833 Constant *Idx) {
1841 if (Constant *FC = ConstantFoldInsertElementInstruction(Val, Elt, Idx))
1844 std::vector<Constant*> ArgVec(1, Val);
1853 Constant *ConstantExpr::getShuffleVector(Constant *V1, Constant *V2,
1854 Constant *Mask) {
1858 if (Constant *FC = ConstantFoldShuffleVectorInstruction(V1, V2, Mask))
1866 std::vector<Constant*> ArgVec(1, V1);
1875 Constant *ConstantExpr::getInsertValue(Constant *Agg, Constant *Val,
1882 Constant *FC = ConstantFoldInsertValueInstruction(Agg, Val, Idxs);
1887 Constant *ConstantExpr::getExtractValue(Constant *Agg,
1898 Constant *FC = ConstantFoldExtractValueInstruction(Agg, Idxs);
1903 Constant *ConstantExpr::getNeg(Constant *C, bool HasNUW, bool HasNSW) {
1910 Constant *ConstantExpr::getFNeg(Constant *C) {
1916 Constant *ConstantExpr::getNot(Constant *C) {
1919 return get(Instruction::Xor, C, Constant::getAllOnesValue(C->getType()));
1922 Constant *ConstantExpr::getAdd(Constant *C1, Constant *C2,
1929 Constant *ConstantExpr::getFAdd(Constant *C1, Constant *C2) {
1933 Constant *ConstantExpr::getSub(Constant *C1, Constant *C2,
1940 Constant *ConstantExpr::getFSub(Constant *C1, Constant *C2) {
1944 Constant *ConstantExpr::getMul(Constant *C1, Constant *C2,
1951 Constant *ConstantExpr::getFMul(Constant *C1, Constant *C2) {
1955 Constant *ConstantExpr::getUDiv(Constant *C1, Constant *C2, bool isExact) {
1960 Constant *ConstantExpr::getSDiv(Constant *C1, Constant *C2, bool isExact) {
1965 Constant *ConstantExpr::getFDiv(Constant *C1, Constant *C2) {
1969 Constant *ConstantExpr::getURem(Constant *C1, Constant *C2) {
1973 Constant *ConstantExpr::getSRem(Constant *C1, Constant *C2) {
1977 Constant *ConstantExpr::getFRem(Constant *C1, Constant *C2) {
1981 Constant *ConstantExpr::getAnd(Constant *C1, Constant *C2) {
1985 Constant *ConstantExpr::getOr(Constant *C1, Constant *C2) {
1989 Constant *ConstantExpr::getXor(Constant *C1, Constant *C2) {
1993 Constant *ConstantExpr::getShl(Constant *C1, Constant *C2,
2000 Constant *ConstantExpr::getLShr(Constant *C1, Constant *C2, bool isExact) {
2005 Constant *ConstantExpr::getAShr(Constant *C1, Constant *C2, bool isExact) {
2013 Constant *ConstantExpr::getBinOpIdentity(unsigned Opcode, Type *Ty) {
2022 return Constant::getNullValue(Ty);
2028 return Constant::getAllOnesValue(Ty);
2036 Constant *ConstantExpr::getBinOpAbsorber(unsigned Opcode, Type *Ty) {
2043 return Constant::getAllOnesValue(Ty);
2047 return Constant::getNullValue(Ty);
2065 GetElementPtrConstantExpr(Constant *C, ArrayRef<Constant*> IdxList,
2141 Constant *ConstantDataSequential::getImpl(StringRef Elements, Type *Ty) {
2214 Constant *ConstantDataArray::get(LLVMContext &Context, ArrayRef<uint8_t> Elts) {
2219 Constant *ConstantDataArray::get(LLVMContext &Context, ArrayRef<uint16_t> Elts){
2224 Constant *ConstantDataArray::get(LLVMContext &Context, ArrayRef<uint32_t> Elts){
2229 Constant *ConstantDataArray::get(LLVMContext &Context, ArrayRef<uint64_t> Elts){
2234 Constant *ConstantDataArray::get(LLVMContext &Context, ArrayRef<float> Elts) {
2239 Constant *ConstantDataArray::get(LLVMContext &Context, ArrayRef<double> Elts) {
2250 Constant *ConstantDataArray::getString(LLVMContext &Context,
2267 Constant *ConstantDataVector::get(LLVMContext &Context, ArrayRef<uint8_t> Elts){
2272 Constant *ConstantDataVector::get(LLVMContext &Context, ArrayRef<uint16_t> Elts){
2277 Constant *ConstantDataVector::get(LLVMContext &Context, ArrayRef<uint32_t> Elts){
2282 Constant *ConstantDataVector::get(LLVMContext &Context, ArrayRef<uint64_t> Elts){
2287 Constant *ConstantDataVector::get(LLVMContext &Context, ArrayRef<float> Elts) {
2292 Constant *ConstantDataVector::get(LLVMContext &Context, ArrayRef<double> Elts) {
2298 Constant *ConstantDataVector::getSplat(unsigned NumElts, Constant *V) {
2394 /// getElementAsConstant - Return a Constant for a specified index's element.
2397 Constant *ConstantDataSequential::getElementAsConstant(unsigned Elt) const {
2426 Constant *ConstantDataVector::getSplatValue() const {
2455 assert(isa<Constant>(To) && "Cannot make Constant refer to non-constant!");
2456 Constant *ToC = cast<Constant>(To);
2460 SmallVector<Constant*, 8> Values;
2472 Constant *Val = cast<Constant>(O->get());
2481 Constant *Replacement = 0;
2530 assert(isa<Constant>(To) && "Cannot make Constant refer to non-constant!");
2531 Constant *ToC = cast<Constant>(To);
2536 SmallVector<Constant*, 8> Values;
2548 Constant *Val = cast<Constant>(O->get());
2555 Constant *Val = cast<Constant>(O->get());
2561 Values.push_back(cast<Constant>(O->get()));
2567 Constant *Replacement = 0;
2605 assert(isa<Constant>(To) && "Cannot make Constant refer to non-constant!");
2607 SmallVector<Constant*, 8> Values;
2610 Constant *Val = getOperand(i);
2611 if (Val == From) Val = cast<Constant>(To);
2615 Constant *Replacement = get(Values);
2627 assert(isa<Constant>(ToV) && "Cannot make Constant refer to non-constant!");
2628 Constant *To = cast<Constant>(ToV);
2630 SmallVector<Constant*, 8> NewOps;
2632 Constant *Op = getOperand(i);
2636 Constant *Replacement = getWithOperands(NewOps);