Lines Matching refs:DL
53 static Constant *FoldBitCast(Constant *C, Type *DestTy, const DataLayout &DL) { in FoldBitCast() argument
86 unsigned BitShift = DL.getTypeAllocSizeInBits(SrcEltTy); in FoldBitCast()
90 if (DL.isLittleEndian()) in FoldBitCast()
108 return FoldBitCast(ConstantVector::get(Ops), DestTy, DL); in FoldBitCast()
140 C = FoldBitCast(C, DestIVTy, DL); in FoldBitCast()
164 bool isLittleEndian = DL.isLittleEndian(); in FoldBitCast()
200 unsigned DstBitSize = DL.getTypeSizeInBits(DstEltTy); in FoldBitCast()
237 APInt &Offset, const DataLayout &DL) { in IsConstantOffsetFromGlobal() argument
240 unsigned BitWidth = DL.getPointerTypeSizeInBits(GV->getType()); in IsConstantOffsetFromGlobal()
253 return IsConstantOffsetFromGlobal(CE->getOperand(0), GV, Offset, DL); in IsConstantOffsetFromGlobal()
260 unsigned BitWidth = DL.getPointerTypeSizeInBits(GEP->getType()); in IsConstantOffsetFromGlobal()
264 if (!IsConstantOffsetFromGlobal(CE->getOperand(0), GV, TmpOffset, DL)) in IsConstantOffsetFromGlobal()
268 if (!GEP->accumulateConstantOffset(DL, TmpOffset)) in IsConstantOffsetFromGlobal()
281 const DataLayout &DL) { in ReadDataFromGlobal() argument
282 assert(ByteOffset <= DL.getTypeAllocSize(C->getType()) && in ReadDataFromGlobal()
300 if (!DL.isLittleEndian()) in ReadDataFromGlobal()
310 C = FoldBitCast(C, Type::getInt64Ty(C->getContext()), DL); in ReadDataFromGlobal()
311 return ReadDataFromGlobal(C, ByteOffset, CurPtr, BytesLeft, DL); in ReadDataFromGlobal()
314 C = FoldBitCast(C, Type::getInt32Ty(C->getContext()), DL); in ReadDataFromGlobal()
315 return ReadDataFromGlobal(C, ByteOffset, CurPtr, BytesLeft, DL); in ReadDataFromGlobal()
318 C = FoldBitCast(C, Type::getInt16Ty(C->getContext()), DL); in ReadDataFromGlobal()
319 return ReadDataFromGlobal(C, ByteOffset, CurPtr, BytesLeft, DL); in ReadDataFromGlobal()
325 const StructLayout *SL = DL.getStructLayout(CS->getType()); in ReadDataFromGlobal()
333 uint64_t EltSize = DL.getTypeAllocSize(CS->getOperand(Index)->getType()); in ReadDataFromGlobal()
337 BytesLeft, DL)) in ReadDataFromGlobal()
364 uint64_t EltSize = DL.getTypeAllocSize(EltTy); in ReadDataFromGlobal()
375 BytesLeft, DL)) in ReadDataFromGlobal()
392 CE->getOperand(0)->getType() == DL.getIntPtrType(CE->getType())) { in ReadDataFromGlobal()
394 BytesLeft, DL); in ReadDataFromGlobal()
403 const DataLayout &DL) { in FoldReinterpretLoadFromConstPtr() argument
425 DL.getTypeAllocSizeInBits(LoadTy), AS); in FoldReinterpretLoadFromConstPtr()
429 C = FoldBitCast(C, MapTy, DL); in FoldReinterpretLoadFromConstPtr()
430 if (Constant *Res = FoldReinterpretLoadFromConstPtr(C, DL)) in FoldReinterpretLoadFromConstPtr()
431 return FoldBitCast(Res, LoadTy, DL); in FoldReinterpretLoadFromConstPtr()
441 if (!IsConstantOffsetFromGlobal(C, GVal, Offset, DL)) in FoldReinterpretLoadFromConstPtr()
456 DL.getTypeAllocSize(GV->getInitializer()->getType())) in FoldReinterpretLoadFromConstPtr()
461 BytesLoaded, DL)) in FoldReinterpretLoadFromConstPtr()
465 if (DL.isLittleEndian()) { in FoldReinterpretLoadFromConstPtr()
483 const DataLayout &DL) { in ConstantFoldLoadThroughBitcast() argument
489 Constant *C = ConstantFoldLoadFromConstPtr(CE->getOperand(0), DL); in ConstantFoldLoadThroughBitcast()
498 if (DL.getTypeSizeInBits(DestTy) == DL.getTypeSizeInBits(SrcTy)) { in ConstantFoldLoadThroughBitcast()
529 const DataLayout &DL) { in ConstantFoldLoadFromConstPtr() argument
551 if (Constant *LoadedC = ConstantFoldLoadThroughBitcast(CE, DL)) in ConstantFoldLoadFromConstPtr()
567 if (DL.isLittleEndian()) { in ConstantFoldLoadFromConstPtr()
592 dyn_cast<GlobalVariable>(GetUnderlyingObject(CE, DL))) { in ConstantFoldLoadFromConstPtr()
603 return FoldReinterpretLoadFromConstPtr(CE, DL); in ConstantFoldLoadFromConstPtr()
607 const DataLayout &DL) { in ConstantFoldLoadInst() argument
611 return ConstantFoldLoadFromConstPtr(C, DL); in ConstantFoldLoadInst()
622 const DataLayout &DL) { in SymbolicallyEvaluateBinop() argument
630 unsigned BitWidth = DL.getTypeSizeInBits(Op0->getType()->getScalarType()); in SymbolicallyEvaluateBinop()
633 computeKnownBits(Op0, KnownZero0, KnownOne0, DL); in SymbolicallyEvaluateBinop()
634 computeKnownBits(Op1, KnownZero1, KnownOne1, DL); in SymbolicallyEvaluateBinop()
657 if (IsConstantOffsetFromGlobal(Op0, GV1, Offs1, DL)) in SymbolicallyEvaluateBinop()
658 if (IsConstantOffsetFromGlobal(Op1, GV2, Offs2, DL) && GV1 == GV2) { in SymbolicallyEvaluateBinop()
659 unsigned OpSize = DL.getTypeSizeInBits(Op0->getType()); in SymbolicallyEvaluateBinop()
675 Type *ResultTy, const DataLayout &DL, in CastGEPIndices() argument
677 Type *IntPtrTy = DL.getIntPtrType(ResultTy); in CastGEPIndices()
703 if (Constant *Folded = ConstantFoldConstantExpression(CE, DL, TLI)) in CastGEPIndices()
728 Type *ResultTy, const DataLayout &DL, in SymbolicallyEvaluateGEP() argument
735 Type *IntPtrTy = DL.getIntPtrType(Ptr->getType()); in SymbolicallyEvaluateGEP()
755 Res = ConstantFoldConstantExpression(ResCE, DL, TLI); in SymbolicallyEvaluateGEP()
762 unsigned BitWidth = DL.getTypeSizeInBits(IntPtrTy); in SymbolicallyEvaluateGEP()
765 DL.getIndexedOffset( in SymbolicallyEvaluateGEP()
785 Offset += APInt(BitWidth, DL.getIndexedOffset(Ptr->getType(), NestedOps)); in SymbolicallyEvaluateGEP()
825 APInt ElemSize(BitWidth, DL.getTypeAllocSize(ATy->getElementType())); in SymbolicallyEvaluateGEP()
844 const StructLayout &SL = *DL.getStructLayout(STy); in SymbolicallyEvaluateGEP()
876 C = FoldBitCast(C, ResultTy, DL); in SymbolicallyEvaluateGEP()
892 Constant *llvm::ConstantFoldInstruction(Instruction *I, const DataLayout &DL, in ConstantFoldInstruction() argument
912 C = ConstantFoldConstantExpression(NewC, DL, TLI); in ConstantFoldInstruction()
935 Op = ConstantFoldConstantExpression(NewCE, DL, TLI); in ConstantFoldInstruction()
942 DL, TLI); in ConstantFoldInstruction()
945 return ConstantFoldLoadInst(LI, DL); in ConstantFoldInstruction()
960 return ConstantFoldInstOperands(I->getOpcode(), I->getType(), Ops, DL, TLI); in ConstantFoldInstruction()
964 ConstantFoldConstantExpressionImpl(const ConstantExpr *CE, const DataLayout &DL, in ConstantFoldConstantExpressionImpl() argument
975 NewC = ConstantFoldConstantExpressionImpl(NewCE, DL, TLI, FoldedOps); in ConstantFoldConstantExpressionImpl()
982 DL, TLI); in ConstantFoldConstantExpressionImpl()
983 return ConstantFoldInstOperands(CE->getOpcode(), CE->getType(), Ops, DL, TLI); in ConstantFoldConstantExpressionImpl()
990 const DataLayout &DL, in ConstantFoldConstantExpression() argument
993 return ConstantFoldConstantExpressionImpl(CE, DL, TLI, FoldedOps); in ConstantFoldConstantExpression()
1008 const DataLayout &DL, in ConstantFoldInstOperands() argument
1013 if (Constant *C = SymbolicallyEvaluateBinop(Opcode, Ops[0], Ops[1], DL)) in ConstantFoldInstOperands()
1036 unsigned PtrWidth = DL.getPointerTypeSizeInBits(CE->getType()); in ConstantFoldInstOperands()
1056 unsigned SrcPtrSize = DL.getPointerTypeSizeInBits(SrcPtr->getType()); in ConstantFoldInstOperands()
1062 return FoldBitCast(CE->getOperand(0), DestTy, DL); in ConstantFoldInstOperands()
1080 return FoldBitCast(Ops[0], DestTy, DL); in ConstantFoldInstOperands()
1091 if (Constant *C = CastGEPIndices(SrcTy, Ops, DestTy, DL, TLI)) in ConstantFoldInstOperands()
1093 if (Constant *C = SymbolicallyEvaluateGEP(SrcTy, Ops, DestTy, DL, TLI)) in ConstantFoldInstOperands()
1106 const DataLayout &DL, in ConstantFoldCompareInstOperands() argument
1119 Type *IntPtrTy = DL.getIntPtrType(CE0->getType()); in ConstantFoldCompareInstOperands()
1125 return ConstantFoldCompareInstOperands(Predicate, C, Null, DL, TLI); in ConstantFoldCompareInstOperands()
1131 Type *IntPtrTy = DL.getIntPtrType(CE0->getOperand(0)->getType()); in ConstantFoldCompareInstOperands()
1135 return ConstantFoldCompareInstOperands(Predicate, C, Null, DL, TLI); in ConstantFoldCompareInstOperands()
1143 Type *IntPtrTy = DL.getIntPtrType(CE0->getType()); in ConstantFoldCompareInstOperands()
1151 return ConstantFoldCompareInstOperands(Predicate, C0, C1, DL, TLI); in ConstantFoldCompareInstOperands()
1157 Type *IntPtrTy = DL.getIntPtrType(CE0->getOperand(0)->getType()); in ConstantFoldCompareInstOperands()
1161 Predicate, CE0->getOperand(0), CE1->getOperand(0), DL, TLI); in ConstantFoldCompareInstOperands()
1172 Predicate, CE0->getOperand(0), Ops1, DL, TLI); in ConstantFoldCompareInstOperands()
1174 Predicate, CE0->getOperand(1), Ops1, DL, TLI); in ConstantFoldCompareInstOperands()
1178 return ConstantFoldInstOperands(OpC, LHS->getType(), Ops, DL, TLI); in ConstantFoldCompareInstOperands()