Lines Matching refs:Constant

62 static Constant *foldConstVectorToAPInt(APInt &Result, Type *DestTy,  in foldConstVectorToAPInt()
63 Constant *C, Type *SrcEltTy, in foldConstVectorToAPInt()
70 Constant *Element; in foldConstVectorToAPInt()
95 Constant *FoldBitCast(Constant *C, Type *DestTy, const DataLayout &DL) { in FoldBitCast()
98 return Constant::getNullValue(DestTy); in FoldBitCast()
101 return Constant::getAllOnesValue(DestTy); in FoldBitCast()
120 if (Constant *CE = foldConstVectorToAPInt(Result, DestTy, C, in FoldBitCast()
140 Constant *Ops = C; // don't take the address of C! in FoldBitCast()
199 SmallVector<Constant*, 32> Result; in FoldBitCast()
202 Constant *Zero = Constant::getNullValue(DstEltTy); in FoldBitCast()
208 Constant *Elt = Zero; in FoldBitCast()
211 Constant *Src = C->getAggregateElement(SrcElt++); in FoldBitCast()
213 Src = Constant::getNullValue(C->getType()->getVectorElementType()); in FoldBitCast()
260 Constant *Elt = ConstantExpr::getLShr(Src, in FoldBitCast()
268 Constant *CE = ConstantExpr::getTrunc(Elt, DstIntTy); in FoldBitCast()
285 bool llvm::IsConstantOffsetFromGlobal(Constant *C, GlobalValue *&GV, in IsConstantOffsetFromGlobal()
323 Constant *llvm::ConstantFoldLoadThroughBitcast(Constant *C, Type *DestTy, in ConstantFoldLoadThroughBitcast()
356 Constant *ElemC; in ConstantFoldLoadThroughBitcast()
375 bool ReadDataFromGlobal(Constant *C, uint64_t ByteOffset, unsigned char *CurPtr, in ReadDataFromGlobal()
497 Constant *FoldReinterpretLoadFromConstPtr(Constant *C, Type *LoadTy, in FoldReinterpretLoadFromConstPtr()
524 if (Constant *Res = FoldReinterpretLoadFromConstPtr(C, MapTy, DL)) in FoldReinterpretLoadFromConstPtr()
586 Constant *ConstantFoldLoadThroughBitcastExpr(ConstantExpr *CE, Type *DestTy, in ConstantFoldLoadThroughBitcastExpr()
594 Constant *C = ConstantFoldLoadFromConstPtr(SrcPtr, SrcTy, DL); in ConstantFoldLoadThroughBitcastExpr()
603 Constant *llvm::ConstantFoldLoadFromConstPtr(Constant *C, Type *Ty, in ConstantFoldLoadFromConstPtr()
622 if (Constant *V = in ConstantFoldLoadFromConstPtr()
630 if (Constant *LoadedC = ConstantFoldLoadThroughBitcastExpr(CE, Ty, DL)) in ConstantFoldLoadFromConstPtr()
660 Constant *Res = ConstantInt::get(CE->getContext(), StrVal); in ConstantFoldLoadFromConstPtr()
672 return Constant::getNullValue(Ty); in ConstantFoldLoadFromConstPtr()
684 Constant *ConstantFoldLoadInst(const LoadInst *LI, const DataLayout &DL) { in ConstantFoldLoadInst()
687 if (auto *C = dyn_cast<Constant>(LI->getOperand(0))) in ConstantFoldLoadInst()
697 Constant *SymbolicallyEvaluateBinop(unsigned Opc, Constant *Op0, Constant *Op1, in SymbolicallyEvaluateBinop()
746 Constant *CastGEPIndices(Type *SrcElemTy, ArrayRef<Constant *> Ops, in CastGEPIndices()
753 SmallVector<Constant*, 32> NewIdxs; in CastGEPIndices()
775 Constant *C = ConstantExpr::getGetElementPtr( in CastGEPIndices()
777 if (Constant *Folded = ConstantFoldConstant(C, DL, TLI)) in CastGEPIndices()
784 Constant* StripPtrCastKeepAS(Constant* Ptr, Type *&ElemTy) { in StripPtrCastKeepAS()
801 Constant *SymbolicallyEvaluateGEP(const GEPOperator *GEP, in SymbolicallyEvaluateGEP()
802 ArrayRef<Constant *> Ops, in SymbolicallyEvaluateGEP()
814 if (Constant *C = CastGEPIndices(SrcElemTy, Ops, ResTy, in SymbolicallyEvaluateGEP()
818 Constant *Ptr = Ops[0]; in SymbolicallyEvaluateGEP()
837 Constant *Res = ConstantExpr::getPtrToInt(Ptr, CE->getType()); in SymbolicallyEvaluateGEP()
873 Ptr = cast<Constant>(GEP->getOperand(0)); in SymbolicallyEvaluateGEP()
892 Constant *C = ConstantInt::get(Ptr->getContext(), Offset + BasePtr); in SymbolicallyEvaluateGEP()
901 SmallVector<Constant *, 32> NewIdxs; in SymbolicallyEvaluateGEP()
979 Constant *C = ConstantExpr::getGetElementPtr(SrcElemTy, Ptr, NewIdxs, in SymbolicallyEvaluateGEP()
997 Constant *ConstantFoldInstOperandsImpl(const Value *InstOrCE, unsigned Opcode, in ConstantFoldInstOperandsImpl()
998 ArrayRef<Constant *> Ops, in ConstantFoldInstOperandsImpl()
1011 if (Constant *C = SymbolicallyEvaluateGEP(GEP, Ops, DL, TLI)) in ConstantFoldInstOperandsImpl()
1052 Constant *
1053 ConstantFoldConstantImpl(const Constant *C, const DataLayout &DL, in ConstantFoldConstantImpl()
1055 SmallDenseMap<Constant *, Constant *> &FoldedOps) { in ConstantFoldConstantImpl() argument
1059 SmallVector<Constant *, 8> Ops; in ConstantFoldConstantImpl()
1061 auto *NewC = cast<Constant>(&NewU); in ConstantFoldConstantImpl()
1095 Constant *llvm::ConstantFoldInstruction(Instruction *I, const DataLayout &DL, in ConstantFoldInstruction()
1099 Constant *CommonValue = nullptr; in ConstantFoldInstruction()
1101 SmallDenseMap<Constant *, Constant *> FoldedOps; in ConstantFoldInstruction()
1110 auto *C = dyn_cast<Constant>(Incoming); in ConstantFoldInstruction()
1129 if (!all_of(I->operands(), [](Use &U) { return isa<Constant>(U); })) in ConstantFoldInstruction()
1132 SmallDenseMap<Constant *, Constant *> FoldedOps; in ConstantFoldInstruction()
1133 SmallVector<Constant *, 8> Ops; in ConstantFoldInstruction()
1135 auto *Op = cast<Constant>(&OpU); in ConstantFoldInstruction()
1152 cast<Constant>(IVI->getAggregateOperand()), in ConstantFoldInstruction()
1153 cast<Constant>(IVI->getInsertedValueOperand()), in ConstantFoldInstruction()
1159 cast<Constant>(EVI->getAggregateOperand()), in ConstantFoldInstruction()
1166 Constant *llvm::ConstantFoldConstant(const Constant *C, const DataLayout &DL, in ConstantFoldConstant()
1168 SmallDenseMap<Constant *, Constant *> FoldedOps; in ConstantFoldConstant()
1172 Constant *llvm::ConstantFoldInstOperands(Instruction *I, in ConstantFoldInstOperands()
1173 ArrayRef<Constant *> Ops, in ConstantFoldInstOperands()
1179 Constant *llvm::ConstantFoldCompareInstOperands(unsigned Predicate, in ConstantFoldCompareInstOperands()
1180 Constant *Ops0, Constant *Ops1, in ConstantFoldCompareInstOperands()
1199 Constant *C = ConstantExpr::getIntegerCast(CE0->getOperand(0), in ConstantFoldCompareInstOperands()
1201 Constant *Null = Constant::getNullValue(C->getType()); in ConstantFoldCompareInstOperands()
1210 Constant *C = CE0->getOperand(0); in ConstantFoldCompareInstOperands()
1211 Constant *Null = Constant::getNullValue(C->getType()); in ConstantFoldCompareInstOperands()
1224 Constant *C0 = ConstantExpr::getIntegerCast(CE0->getOperand(0), in ConstantFoldCompareInstOperands()
1226 Constant *C1 = ConstantExpr::getIntegerCast(CE1->getOperand(0), in ConstantFoldCompareInstOperands()
1248 Constant *LHS = ConstantFoldCompareInstOperands( in ConstantFoldCompareInstOperands()
1250 Constant *RHS = ConstantFoldCompareInstOperands( in ConstantFoldCompareInstOperands()
1266 Constant *llvm::ConstantFoldBinaryOpOperands(unsigned Opcode, Constant *LHS, in ConstantFoldBinaryOpOperands()
1267 Constant *RHS, in ConstantFoldBinaryOpOperands()
1271 if (Constant *C = SymbolicallyEvaluateBinop(Opcode, LHS, RHS, DL)) in ConstantFoldBinaryOpOperands()
1277 Constant *llvm::ConstantFoldCastOperand(unsigned Opcode, Constant *C, in ConstantFoldCastOperand()
1288 Constant *Input = CE->getOperand(0); in ConstantFoldCastOperand()
1292 Constant *Mask = in ConstantFoldCastOperand()
1309 Constant *SrcPtr = CE->getOperand(0); in ConstantFoldCastOperand()
1338 Constant *llvm::ConstantFoldLoadThroughGEPConstantExpr(Constant *C, in ConstantFoldLoadThroughGEPConstantExpr()
1353 Constant *
1354 llvm::ConstantFoldLoadThroughGEPIndices(Constant *C, in ConstantFoldLoadThroughGEPIndices()
1355 ArrayRef<Constant *> Indices) { in ConstantFoldLoadThroughGEPIndices()
1358 for (Constant *Index : Indices) { in ConstantFoldLoadThroughGEPIndices()
1520 Constant *GetConstantFoldFPValue(double V, Type *Ty) { in GetConstantFoldFPValue()
1554 Constant *ConstantFoldFP(double (*NativeFP)(double), double V, Type *Ty) { in ConstantFoldFP()
1565 Constant *ConstantFoldBinaryFP(double (*NativeFP)(double, double), double V, in ConstantFoldBinaryFP()
1584 Constant *ConstantFoldSSEConvertToInt(const APFloat &Val, bool roundTowardZero, in ConstantFoldSSEConvertToInt()
1619 static bool isManifestConstant(const Constant *c) { in isManifestConstant()
1624 if (!isManifestConstant(cast<Constant>(subc))) in isManifestConstant()
1644 Constant *ConstantFoldScalarCall(StringRef Name, unsigned IntrinsicID, Type *Ty, in ConstantFoldScalarCall()
1645 ArrayRef<Constant *> Operands, in ConstantFoldScalarCall()
1662 return Constant::getNullValue(Ty); in ConstantFoldScalarCall()
1906 auto *Op = cast<Constant>(Operands[0]); in ConstantFoldScalarCall()
2027 return Constant::getNullValue(Ty); in ConstantFoldScalarCall()
2059 Constant *Ops[] = { in ConstantFoldScalarCall()
2070 return Constant::getAllOnesValue(Ty); in ConstantFoldScalarCall()
2080 return Constant::getNullValue(Ty); in ConstantFoldScalarCall()
2093 return Constant::getNullValue(Ty); in ConstantFoldScalarCall()
2110 auto *Op = cast<Constant>(Operands[0]); in ConstantFoldScalarCall()
2215 Constant *ConstantFoldVectorCall(StringRef Name, unsigned IntrinsicID, in ConstantFoldVectorCall()
2216 VectorType *VTy, ArrayRef<Constant *> Operands, in ConstantFoldVectorCall()
2220 SmallVector<Constant *, 4> Result(VTy->getNumElements()); in ConstantFoldVectorCall()
2221 SmallVector<Constant *, 4> Lane(Operands.size()); in ConstantFoldVectorCall()
2229 Constant *VecData = ConstantFoldLoadFromConstPtr(SrcPtr, VTy, DL); in ConstantFoldVectorCall()
2231 SmallVector<Constant *, 32> NewElements; in ConstantFoldVectorCall()
2274 Constant *Agg = Operands[J]->getAggregateElement(I); in ConstantFoldVectorCall()
2282 Constant *Folded = ConstantFoldScalarCall(Name, IntrinsicID, Ty, Lane, TLI, CS); in ConstantFoldVectorCall()
2293 Constant *
2295 ArrayRef<Constant *> Operands, in ConstantFoldCall()