Lines Matching refs:Constant

45 static Constant *BitCastConstantVector(Constant *CV, VectorType *DstTy) {  in BitCastConstantVector()
47 if (CV->isAllOnesValue()) return Constant::getAllOnesValue(DstTy); in BitCastConstantVector()
48 if (CV->isNullValue()) return Constant::getNullValue(DstTy); in BitCastConstantVector()
59 SmallVector<Constant*, 16> Result; in BitCastConstantVector()
62 Constant *C = in BitCastConstantVector()
101 static Constant *FoldBitCast(Constant *V, Type *DestTy) { in FoldBitCast()
114 Constant::getNullValue(Type::getInt32Ty(DPTy->getContext())); in FoldBitCast()
146 return Constant::getNullValue(DestTy); in FoldBitCast()
212 static Constant *ExtractConstantBytes(Constant *C, unsigned ByteStart, in ExtractConstantBytes()
239 Constant *RHS = ExtractConstantBytes(CE->getOperand(1), ByteStart,ByteSize); in ExtractConstantBytes()
248 Constant *LHS = ExtractConstantBytes(CE->getOperand(0), ByteStart,ByteSize); in ExtractConstantBytes()
254 Constant *RHS = ExtractConstantBytes(CE->getOperand(1), ByteStart,ByteSize); in ExtractConstantBytes()
262 Constant *LHS = ExtractConstantBytes(CE->getOperand(0), ByteStart,ByteSize); in ExtractConstantBytes()
279 return Constant::getNullValue(IntegerType::get(CE->getContext(), in ExtractConstantBytes()
301 return Constant::getNullValue(IntegerType::get(CE->getContext(), in ExtractConstantBytes()
317 return Constant::getNullValue(IntegerType::get(CE->getContext(), in ExtractConstantBytes()
333 Constant *Res = CE->getOperand(0); in ExtractConstantBytes()
351 static Constant *getFoldedSizeOf(Type *Ty, Type *DestTy, bool Folded) { in getFoldedSizeOf()
353 Constant *N = ConstantInt::get(DestTy, ATy->getNumElements()); in getFoldedSizeOf()
354 Constant *E = getFoldedSizeOf(ATy->getElementType(), DestTy, true); in getFoldedSizeOf()
365 Constant *MemberSize = in getFoldedSizeOf()
375 Constant *N = ConstantInt::get(DestTy, NumElems); in getFoldedSizeOf()
395 Constant *C = ConstantExpr::getSizeOf(Ty); in getFoldedSizeOf()
406 static Constant *getFoldedAlignOf(Type *Ty, Type *DestTy, bool Folded) { in getFoldedAlignOf()
410 Constant *C = ConstantExpr::getAlignOf(ATy->getElementType()); in getFoldedAlignOf()
431 Constant *MemberAlign = in getFoldedAlignOf()
459 Constant *C = ConstantExpr::getAlignOf(Ty); in getFoldedAlignOf()
470 static Constant *getFoldedOffsetOf(Type *Ty, Constant *FieldNo, Type *DestTy, in getFoldedOffsetOf()
473 Constant *N = ConstantExpr::getCast(CastInst::getCastOpcode(FieldNo, false, in getFoldedOffsetOf()
476 Constant *E = getFoldedSizeOf(ATy->getElementType(), DestTy, true); in getFoldedOffsetOf()
487 Constant *MemberSize = in getFoldedOffsetOf()
497 Constant *N = ConstantExpr::getCast(CastInst::getCastOpcode(FieldNo, in getFoldedOffsetOf()
512 Constant *C = ConstantExpr::getOffsetOf(Ty, FieldNo); in getFoldedOffsetOf()
519 Constant *llvm::ConstantFoldCastInstruction(unsigned opc, Constant *V, in ConstantFoldCastInstruction()
527 return Constant::getNullValue(DestTy); in ConstantFoldCastInstruction()
533 return Constant::getNullValue(DestTy); in ConstantFoldCastInstruction()
573 SmallVector<Constant*, 16> res; in ConstantFoldCastInstruction()
578 Constant *C = in ConstantFoldCastInstruction()
649 Constant *Idx = CE->getOperand(1); in ConstantFoldCastInstruction()
651 if (Constant *C = getFoldedSizeOf(Ty, DestTy, !isOne)) { in ConstantFoldCastInstruction()
671 if (Constant *C = getFoldedOffsetOf(Ty, CE->getOperand(2), in ConstantFoldCastInstruction()
719 if (Constant *Res = ExtractConstantBytes(V, 0, DestBitWidth / 8)) in ConstantFoldCastInstruction()
731 Constant *llvm::ConstantFoldSelectInstruction(Constant *Cond, in ConstantFoldSelectInstruction()
732 Constant *V1, Constant *V2) { in ConstantFoldSelectInstruction()
739 SmallVector<Constant*, 16> Result; in ConstantFoldSelectInstruction()
742 Constant *V; in ConstantFoldSelectInstruction()
743 Constant *V1Element = ConstantExpr::getExtractElement(V1, in ConstantFoldSelectInstruction()
745 Constant *V2Element = ConstantExpr::getExtractElement(V2, in ConstantFoldSelectInstruction()
747 Constant *Cond = dyn_cast<Constant>(CondV->getOperand(i)); in ConstantFoldSelectInstruction()
786 Constant *llvm::ConstantFoldExtractElementInstruction(Constant *Val, in ConstantFoldExtractElementInstruction()
787 Constant *Idx) { in ConstantFoldExtractElementInstruction()
791 return Constant::getNullValue(Val->getType()->getVectorElementType()); in ConstantFoldExtractElementInstruction()
805 Constant *llvm::ConstantFoldInsertElementInstruction(Constant *Val, in ConstantFoldInsertElementInstruction()
806 Constant *Elt, in ConstantFoldInsertElementInstruction()
807 Constant *Idx) { in ConstantFoldInsertElementInstruction()
818 SmallVector<Constant*, 16> Result; in ConstantFoldInsertElementInstruction()
828 Constant *C = ConstantExpr::getExtractElement(Val, ConstantInt::get(Ty, i)); in ConstantFoldInsertElementInstruction()
835 Constant *llvm::ConstantFoldShuffleVectorInstruction(Constant *V1, in ConstantFoldShuffleVectorInstruction()
836 Constant *V2, in ConstantFoldShuffleVectorInstruction()
837 Constant *Mask) { in ConstantFoldShuffleVectorInstruction()
851 SmallVector<Constant*, 32> Result; in ConstantFoldShuffleVectorInstruction()
858 Constant *InElt; in ConstantFoldShuffleVectorInstruction()
876 Constant *llvm::ConstantFoldExtractValueInstruction(Constant *Agg, in ConstantFoldExtractValueInstruction()
882 if (Constant *C = Agg->getAggregateElement(Idxs[0])) in ConstantFoldExtractValueInstruction()
888 Constant *llvm::ConstantFoldInsertValueInstruction(Constant *Agg, in ConstantFoldInsertValueInstruction()
889 Constant *Val, in ConstantFoldInsertValueInstruction()
901 SmallVector<Constant*, 32> Result; in ConstantFoldInsertValueInstruction()
903 Constant *C = Agg->getAggregateElement(i); in ConstantFoldInsertValueInstruction()
919 Constant *llvm::ConstantFoldBinaryInstruction(unsigned Opcode, Constant *C1, in ConstantFoldBinaryInstruction()
920 Constant *C2) { in ConstantFoldBinaryInstruction()
932 return Constant::getNullValue(C1->getType()); in ConstantFoldBinaryInstruction()
940 return Constant::getNullValue(C1->getType()); // undef & X -> 0 in ConstantFoldBinaryInstruction()
952 return Constant::getNullValue(C1->getType()); in ConstantFoldBinaryInstruction()
964 return Constant::getNullValue(C1->getType()); in ConstantFoldBinaryInstruction()
974 return Constant::getNullValue(C1->getType()); in ConstantFoldBinaryInstruction()
978 return Constant::getAllOnesValue(C1->getType()); // undef | X -> ~0 in ConstantFoldBinaryInstruction()
987 return Constant::getNullValue(C1->getType()); in ConstantFoldBinaryInstruction()
997 return Constant::getNullValue(C1->getType()); in ConstantFoldBinaryInstruction()
1006 return Constant::getNullValue(C1->getType()); in ConstantFoldBinaryInstruction()
1055 return Constant::getNullValue(CI2->getType()); // X % 1 == 0 in ConstantFoldBinaryInstruction()
1092 return Constant::getNullValue(CI2->getType()); in ConstantFoldBinaryInstruction()
1222 SmallVector<Constant*, 16> Result; in ConstantFoldBinaryInstruction()
1225 Constant *ExtractIdx = ConstantInt::get(Ty, i); in ConstantFoldBinaryInstruction()
1226 Constant *LHS = ConstantExpr::getExtractElement(C1, ExtractIdx); in ConstantFoldBinaryInstruction()
1227 Constant *RHS = ConstantExpr::getExtractElement(C2, ExtractIdx); in ConstantFoldBinaryInstruction()
1247 Constant *T = ConstantExpr::get(Opcode, CE1->getOperand(1), C2); in ConstantFoldBinaryInstruction()
1315 static int IdxCompare(Constant *C1, Constant *C2, Type *ElTy) { in IdxCompare()
1359 static FCmpInst::Predicate evaluateFCmpRelation(Constant *V1, Constant *V2) { in evaluateFCmpRelation()
1447 static ICmpInst::Predicate evaluateICmpRelation(Constant *V1, Constant *V2, in evaluateICmpRelation()
1539 Constant *CE1Op0 = CE1->getOperand(0); in evaluateICmpRelation()
1564 Constant::getNullValue(CE1Op0->getType()), in evaluateICmpRelation()
1624 Constant *CE2Op0 = CE2->getOperand(0); in evaluateICmpRelation()
1697 Constant *llvm::ConstantFoldCompareInstruction(unsigned short pred, in ConstantFoldCompareInstruction()
1698 Constant *C1, Constant *C2) { in ConstantFoldCompareInstruction()
1708 return Constant::getNullValue(ResultTy); in ConstantFoldCompareInstruction()
1711 return Constant::getAllOnesValue(ResultTy); in ConstantFoldCompareInstruction()
1795 case FCmpInst::FCMP_FALSE: return Constant::getNullValue(ResultTy); in ConstantFoldCompareInstruction()
1796 case FCmpInst::FCMP_TRUE: return Constant::getAllOnesValue(ResultTy); in ConstantFoldCompareInstruction()
1835 SmallVector<Constant*, 4> ResElts; in ConstantFoldCompareInstruction()
1839 Constant *C1E = in ConstantFoldCompareInstruction()
1841 Constant *C2E = in ConstantFoldCompareInstruction()
1986 Constant *CE2Op0 = CE2->getOperand(0); in ConstantFoldCompareInstruction()
1989 Constant *Inverse = ConstantExpr::getBitCast(C1, CE2Op0->getType()); in ConstantFoldCompareInstruction()
2000 Constant *CE1Op0 = CE1->getOperand(0); in ConstantFoldCompareInstruction()
2001 Constant *CE1Inverse = ConstantExpr::getTrunc(CE1, CE1Op0->getType()); in ConstantFoldCompareInstruction()
2004 Constant *C2Inverse = ConstantExpr::getTrunc(C2, CE1Op0->getType()); in ConstantFoldCompareInstruction()
2031 if (cast<Constant>(Idxs[0])->isNullValue()) return true; in isInBoundsIndices()
2046 if (!cast<Constant>(Idxs[i])->isNullValue()) in isInBoundsIndices()
2068 Constant *llvm::ConstantFoldGetElementPtr(Type *PointeeTy, Constant *C, in ConstantFoldGetElementPtr()
2080 Constant *Idx0 = cast<Constant>(Idxs[0]); in ConstantFoldGetElementPtr()
2091 !cast<Constant>(Idxs[i])->isNullValue()) { in ConstantFoldGetElementPtr()
2114 return Constant::getNullValue(GEPTy); in ConstantFoldGetElementPtr()
2167 Constant *Combined = CE->getOperand(CE->getNumOperands()-1); in ConstantFoldGetElementPtr()
2179 Constant *C1 = ConstantExpr::getSExtOrBitCast(Idx0, CommonTy); in ConstantFoldGetElementPtr()
2180 Constant *C2 = ConstantExpr::getSExtOrBitCast(Combined, CommonTy); in ConstantFoldGetElementPtr()
2227 (Constant *)CE->getOperand(0), in ConstantFoldGetElementPtr()
2236 SmallVector<Constant *, 8> NewIdxs; in ConstantFoldGetElementPtr()
2306 Constant *CurrIdx = cast<Constant>(Idxs[i]); in ConstantFoldGetElementPtr()
2308 NewIdxs[i - 1] ? NewIdxs[i - 1] : cast<Constant>(Idxs[i - 1]); in ConstantFoldGetElementPtr()
2321 Constant *Factor = in ConstantFoldGetElementPtr()
2331 Constant *Div = ConstantExpr::getSDiv(CurrIdx, Factor); in ConstantFoldGetElementPtr()
2359 if (!NewIdxs[i]) NewIdxs[i] = cast<Constant>(Idxs[i]); in ConstantFoldGetElementPtr()