diff options
author | Owen Anderson <resistor@mac.com> | 2009-07-29 18:55:55 +0000 |
---|---|---|
committer | Owen Anderson <resistor@mac.com> | 2009-07-29 18:55:55 +0000 |
commit | baf3c404409d5e47b13984a7f95bfbd6d1f2e79e (patch) | |
tree | c06618ee06936e7f5a1dc3c30b313ee49d5eb09b /lib | |
parent | 26ef510d5d20b89c637d13e2d9169c0458de775c (diff) |
Move ConstantExpr to 2.5 API.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@77494 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
35 files changed, 443 insertions, 590 deletions
diff --git a/lib/Analysis/BasicAliasAnalysis.cpp b/lib/Analysis/BasicAliasAnalysis.cpp index 9f0c138e2f..2badd266c2 100644 --- a/lib/Analysis/BasicAliasAnalysis.cpp +++ b/lib/Analysis/BasicAliasAnalysis.cpp @@ -505,9 +505,9 @@ static bool IndexOperandsEqual(Value *V1, Value *V2, LLVMContext &Context) { if (Constant *C2 = dyn_cast<Constant>(V2)) { // Sign extend the constants to long types, if necessary if (C1->getType() != Type::Int64Ty) - C1 = Context.getConstantExprSExt(C1, Type::Int64Ty); + C1 = ConstantExpr::getSExt(C1, Type::Int64Ty); if (C2->getType() != Type::Int64Ty) - C2 = Context.getConstantExprSExt(C2, Type::Int64Ty); + C2 = ConstantExpr::getSExt(C2, Type::Int64Ty); return C1 == C2; } return false; @@ -603,9 +603,9 @@ BasicAliasAnalysis::CheckGEPInstructions( if (G1OC->getType() != G2OC->getType()) { // Sign extend both operands to long. if (G1OC->getType() != Type::Int64Ty) - G1OC = Context.getConstantExprSExt(G1OC, Type::Int64Ty); + G1OC = ConstantExpr::getSExt(G1OC, Type::Int64Ty); if (G2OC->getType() != Type::Int64Ty) - G2OC = Context.getConstantExprSExt(G2OC, Type::Int64Ty); + G2OC = ConstantExpr::getSExt(G2OC, Type::Int64Ty); GEP1Ops[FirstConstantOper] = G1OC; GEP2Ops[FirstConstantOper] = G2OC; } diff --git a/lib/Analysis/ConstantFolding.cpp b/lib/Analysis/ConstantFolding.cpp index b3c8a771b3..1f034e9862 100644 --- a/lib/Analysis/ConstantFolding.cpp +++ b/lib/Analysis/ConstantFolding.cpp @@ -152,7 +152,7 @@ static Constant *SymbolicallyEvaluateGEP(Constant* const* Ops, unsigned NumOps, uint64_t Offset = TD->getIndexedOffset(Ptr->getType(), (Value**)Ops+1, NumOps-1); Constant *C = ConstantInt::get(TD->getIntPtrType(), Offset+BasePtr); - return Context.getConstantExprIntToPtr(C, ResultTy); + return ConstantExpr::getIntToPtr(C, ResultTy); } /// FoldBitCast - Constant fold bitcast, symbolically evaluating it with @@ -191,7 +191,7 @@ static Constant *FoldBitCast(Constant *C, const Type *DestTy, if (!C) return 0; // Finally, VMCore can handle this now that #elts line up. - return Context.getConstantExprBitCast(C, DestTy); + return ConstantExpr::getBitCast(C, DestTy); } // Okay, we know the destination is integer, if the input is FP, convert @@ -201,7 +201,7 @@ static Constant *FoldBitCast(Constant *C, const Type *DestTy, const Type *SrcIVTy = Context.getVectorType( Context.getIntegerType(FPWidth), NumSrcElt); // Ask VMCore to do the conversion now that #elts line up. - C = Context.getConstantExprBitCast(C, SrcIVTy); + C = ConstantExpr::getBitCast(C, SrcIVTy); CV = dyn_cast<ConstantVector>(C); if (!CV) return 0; // If VMCore wasn't able to fold it, bail out. } @@ -228,15 +228,15 @@ static Constant *FoldBitCast(Constant *C, const Type *DestTy, if (!Src) return 0; // Reject constantexpr elements. // Zero extend the element to the right size. - Src = Context.getConstantExprZExt(Src, Elt->getType()); + Src = ConstantExpr::getZExt(Src, Elt->getType()); // Shift it to the right place, depending on endianness. - Src = Context.getConstantExprShl(Src, + Src = ConstantExpr::getShl(Src, ConstantInt::get(Src->getType(), ShiftAmt)); ShiftAmt += isLittleEndian ? SrcBitSize : -SrcBitSize; // Mix it in. - Elt = Context.getConstantExprOr(Elt, Src); + Elt = ConstantExpr::getOr(Elt, Src); } Result.push_back(Elt); } @@ -254,12 +254,12 @@ static Constant *FoldBitCast(Constant *C, const Type *DestTy, for (unsigned j = 0; j != Ratio; ++j) { // Shift the piece of the value into the right place, depending on // endianness. - Constant *Elt = Context.getConstantExprLShr(Src, + Constant *Elt = ConstantExpr::getLShr(Src, ConstantInt::get(Src->getType(), ShiftAmt)); ShiftAmt += isLittleEndian ? DstBitSize : -DstBitSize; // Truncate and remember this piece. - Result.push_back(Context.getConstantExprTrunc(Elt, DstEltTy)); + Result.push_back(ConstantExpr::getTrunc(Elt, DstEltTy)); } } } @@ -354,7 +354,7 @@ Constant *llvm::ConstantFoldInstOperands(unsigned Opcode, const Type *DestTy, Context)) return C; - return Context.getConstantExpr(Opcode, Ops[0], Ops[1]); + return ConstantExpr::get(Opcode, Ops[0], Ops[1]); } switch (Opcode) { @@ -378,13 +378,13 @@ Constant *llvm::ConstantFoldInstOperands(unsigned Opcode, const Type *DestTy, Constant *Mask = ConstantInt::get(Context, APInt::getLowBitsSet(InWidth, TD->getPointerSizeInBits())); - Input = Context.getConstantExprAnd(Input, Mask); + Input = ConstantExpr::getAnd(Input, Mask); } // Do a zext or trunc to get to the dest size. - return Context.getConstantExprIntegerCast(Input, DestTy, false); + return ConstantExpr::getIntegerCast(Input, DestTy, false); } } - return Context.getConstantExprCast(Opcode, Ops[0], DestTy); + return ConstantExpr::getCast(Opcode, Ops[0], DestTy); case Instruction::IntToPtr: // If the input is a ptrtoint, turn the pair into a ptr to ptr bitcast if // the int size is >= the ptr size. This requires knowing the width of a @@ -396,7 +396,7 @@ Constant *llvm::ConstantFoldInstOperands(unsigned Opcode, const Type *DestTy, if (CE->getOpcode() == Instruction::PtrToInt) { Constant *Input = CE->getOperand(0); Constant *C = FoldBitCast(Input, DestTy, *TD, Context); - return C ? C : Context.getConstantExprBitCast(Input, DestTy); + return C ? C : ConstantExpr::getBitCast(Input, DestTy); } // If there's a constant offset added to the integer value before // it is casted back to a pointer, see if the expression can be @@ -423,14 +423,14 @@ Constant *llvm::ConstantFoldInstOperands(unsigned Opcode, const Type *DestTy, ConstantInt::get(Context, ElemIdx) }; return - Context.getConstantExprGetElementPtr(GV, &Index[0], 2); + ConstantExpr::getGetElementPtr(GV, &Index[0], 2); } } } } } } - return Context.getConstantExprCast(Opcode, Ops[0], DestTy); + return ConstantExpr::getCast(Opcode, Ops[0], DestTy); case Instruction::Trunc: case Instruction::ZExt: case Instruction::SExt: @@ -440,25 +440,25 @@ Constant *llvm::ConstantFoldInstOperands(unsigned Opcode, const Type *DestTy, case Instruction::SIToFP: case Instruction::FPToUI: case Instruction::FPToSI: - return Context.getConstantExprCast(Opcode, Ops[0], DestTy); + return ConstantExpr::getCast(Opcode, Ops[0], DestTy); case Instruction::BitCast: if (TD) if (Constant *C = FoldBitCast(Ops[0], DestTy, *TD, Context)) return C; - return Context.getConstantExprBitCast(Ops[0], DestTy); + return ConstantExpr::getBitCast(Ops[0], DestTy); case Instruction::Select: - return Context.getConstantExprSelect(Ops[0], Ops[1], Ops[2]); + return ConstantExpr::getSelect(Ops[0], Ops[1], Ops[2]); case Instruction::ExtractElement: - return Context.getConstantExprExtractElement(Ops[0], Ops[1]); + return ConstantExpr::getExtractElement(Ops[0], Ops[1]); case Instruction::InsertElement: - return Context.getConstantExprInsertElement(Ops[0], Ops[1], Ops[2]); + return ConstantExpr::getInsertElement(Ops[0], Ops[1], Ops[2]); case Instruction::ShuffleVector: - return Context.getConstantExprShuffleVector(Ops[0], Ops[1], Ops[2]); + return ConstantExpr::getShuffleVector(Ops[0], Ops[1], Ops[2]); case Instruction::GetElementPtr: if (Constant *C = SymbolicallyEvaluateGEP(Ops, NumOps, DestTy, Context, TD)) return C; - return Context.getConstantExprGetElementPtr(Ops[0], Ops+1, NumOps-1); + return ConstantExpr::getGetElementPtr(Ops[0], Ops+1, NumOps-1); } } @@ -484,7 +484,7 @@ Constant *llvm::ConstantFoldCompareInstOperands(unsigned Predicate, if (CE0->getOpcode() == Instruction::IntToPtr) { // Convert the integer value to the right size to ensure we get the // proper extension or truncation. - Constant *C = Context.getConstantExprIntegerCast(CE0->getOperand(0), + Constant *C = ConstantExpr::getIntegerCast(CE0->getOperand(0), IntPtrTy, false); Constant *NewOps[] = { C, Context.getNullValue(C->getType()) }; return ConstantFoldCompareInstOperands(Predicate, NewOps, 2, @@ -510,9 +510,9 @@ Constant *llvm::ConstantFoldCompareInstOperands(unsigned Predicate, if (CE0->getOpcode() == Instruction::IntToPtr) { // Convert the integer value to the right size to ensure we get the // proper extension or truncation. - Constant *C0 = Context.getConstantExprIntegerCast(CE0->getOperand(0), + Constant *C0 = ConstantExpr::getIntegerCast(CE0->getOperand(0), IntPtrTy, false); - Constant *C1 = Context.getConstantExprIntegerCast(CE1->getOperand(0), + Constant *C1 = ConstantExpr::getIntegerCast(CE1->getOperand(0), IntPtrTy, false); Constant *NewOps[] = { C0, C1 }; return ConstantFoldCompareInstOperands(Predicate, NewOps, 2, @@ -533,7 +533,7 @@ Constant *llvm::ConstantFoldCompareInstOperands(unsigned Predicate, } } } - return Context.getConstantExprCompare(Predicate, Ops[0], Ops[1]); + return ConstantExpr::getCompare(Predicate, Ops[0], Ops[1]); } diff --git a/lib/Analysis/DebugInfo.cpp b/lib/Analysis/DebugInfo.cpp index 7ecb1ad8d4..3db7ff964c 100644 --- a/lib/Analysis/DebugInfo.cpp +++ b/lib/Analysis/DebugInfo.cpp @@ -477,7 +477,7 @@ DIFactory::DIFactory(Module &m) /// This is only valid when the descriptor is non-null. Constant *DIFactory::getCastToEmpty(DIDescriptor D) { if (D.isNull()) return VMContext.getNullValue(EmptyStructPtr); - return VMContext.getConstantExprBitCast(D.getGV(), EmptyStructPtr); + return ConstantExpr::getBitCast(D.getGV(), EmptyStructPtr); } Constant *DIFactory::GetTagConstant(unsigned TAG) { @@ -507,7 +507,7 @@ Constant *DIFactory::GetStringConstant(const std::string &String) { GlobalVariable::InternalLinkage, ConstStr, ".str"); StrGV->setSection("llvm.metadata"); - return Slot = VMContext.getConstantExprBitCast(StrGV, DestTy); + return Slot = ConstantExpr::getBitCast(StrGV, DestTy); } //===----------------------------------------------------------------------===// @@ -779,7 +779,7 @@ DIFactory::CreateGlobalVariable(DIDescriptor Context, const std::string &Name, getCastToEmpty(Type), ConstantInt::get(Type::Int1Ty, isLocalToUnit), ConstantInt::get(Type::Int1Ty, isDefinition), - VMContext.getConstantExprBitCast(Val, EmptyStructPtr) + ConstantExpr::getBitCast(Val, EmptyStructPtr) }; Constant *Init = ConstantStruct::get(Elts, sizeof(Elts)/sizeof(Elts[0])); diff --git a/lib/Analysis/ScalarEvolution.cpp b/lib/Analysis/ScalarEvolution.cpp index 721fe934db..3bf5e70cc1 100644 --- a/lib/Analysis/ScalarEvolution.cpp +++ b/lib/Analysis/ScalarEvolution.cpp @@ -1694,7 +1694,7 @@ const SCEV *ScalarEvolution::getUDivExpr(const SCEV *LHS, if (const SCEVConstant *LHSC = dyn_cast<SCEVConstant>(LHS)) { Constant *LHSCV = LHSC->getValue(); Constant *RHSCV = RHSC->getValue(); - return getConstant(cast<ConstantInt>(getContext().getConstantExprUDiv(LHSCV, + return getConstant(cast<ConstantInt>(ConstantExpr::getUDiv(LHSCV, RHSCV))); } } @@ -2095,7 +2095,7 @@ const SCEV *ScalarEvolution::getIntegerSCEV(int Val, const Type *Ty) { const SCEV *ScalarEvolution::getNegativeSCEV(const SCEV *V) { if (const SCEVConstant *VC = dyn_cast<SCEVConstant>(V)) return getConstant( - cast<ConstantInt>(getContext().getConstantExprNeg(VC->getValue()))); + cast<ConstantInt>(ConstantExpr::getNeg(VC->getValue()))); const Type *Ty = V->getType(); Ty = getEffectiveSCEVType(Ty); @@ -2107,7 +2107,7 @@ const SCEV *ScalarEvolution::getNegativeSCEV(const SCEV *V) { const SCEV *ScalarEvolution::getNotSCEV(const SCEV *V) { if (const SCEVConstant *VC = dyn_cast<SCEVConstant>(V)) return getConstant( - cast<ConstantInt>(getContext().getConstantExprNot(VC->getValue()))); + cast<ConstantInt>(ConstantExpr::getNot(VC->getValue()))); const Type *Ty = V->getType(); Ty = getEffectiveSCEVType(Ty); @@ -4130,7 +4130,7 @@ const SCEV *ScalarEvolution::HowFarToZero(const SCEV *V, const Loop *L) { #endif // Pick the smallest positive root value. if (ConstantInt *CB = - dyn_cast<ConstantInt>(getContext().getConstantExprICmp(ICmpInst::ICMP_ULT, + dyn_cast<ConstantInt>(ConstantExpr::getICmp(ICmpInst::ICMP_ULT, R1->getValue(), R2->getValue()))) { if (CB->getZExtValue() == false) std::swap(R1, R2); // R1 is the minimum root now. @@ -4856,8 +4856,7 @@ const SCEV *SCEVAddRecExpr::getNumIterationsInRange(ConstantRange Range, if (R1) { // Pick the smallest positive root value. if (ConstantInt *CB = - dyn_cast<ConstantInt>( - SE.getContext().getConstantExprICmp(ICmpInst::ICMP_ULT, + dyn_cast<ConstantInt>(ConstantExpr::getICmp(ICmpInst::ICMP_ULT, R1->getValue(), R2->getValue()))) { if (CB->getZExtValue() == false) std::swap(R1, R2); // R1 is the minimum root now. diff --git a/lib/Analysis/ScalarEvolutionExpander.cpp b/lib/Analysis/ScalarEvolutionExpander.cpp index e098ea256f..b6c30fbc67 100644 --- a/lib/Analysis/ScalarEvolutionExpander.cpp +++ b/lib/Analysis/ScalarEvolutionExpander.cpp @@ -55,7 +55,7 @@ Value *SCEVExpander::InsertNoopCastOfTo(Value *V, const Type *Ty) { // FIXME: keep track of the cast instruction. if (Constant *C = dyn_cast<Constant>(V)) - return getContext().getConstantExprCast(Op, C, Ty); + return ConstantExpr::getCast(Op, C, Ty); if (Argument *A = dyn_cast<Argument>(V)) { // Check to see if there is already a cast! @@ -126,7 +126,7 @@ Value *SCEVExpander::InsertBinop(Instruction::BinaryOps Opcode, // Fold a binop with constant operands. if (Constant *CLHS = dyn_cast<Constant>(LHS)) if (Constant *CRHS = dyn_cast<Constant>(RHS)) - return getContext().getConstantExpr(Opcode, CLHS, CRHS); + return ConstantExpr::get(Opcode, CLHS, CRHS); // Do a quick scan to see if we have this binop nearby. If so, reuse it. unsigned ScanLimit = 6; @@ -327,7 +327,7 @@ Value *SCEVExpander::expandAddToGEP(const SCEV *const *op_begin, // Fold a GEP with constant operands. if (Constant *CLHS = dyn_cast<Constant>(V)) if (Constant *CRHS = dyn_cast<Constant>(Idx)) - return getContext().getConstantExprGetElementPtr(CLHS, &CRHS, 1); + return ConstantExpr::getGetElementPtr(CLHS, &CRHS, 1); // Do a quick scan to see if we have this GEP nearby. If so, reuse it. unsigned ScanLimit = 6; diff --git a/lib/AsmParser/LLParser.cpp b/lib/AsmParser/LLParser.cpp index c96ee9e233..2a2192c2a5 100644 --- a/lib/AsmParser/LLParser.cpp +++ b/lib/AsmParser/LLParser.cpp @@ -1899,7 +1899,7 @@ bool LLParser::ParseValID(ValID &ID) { return Error(ID.Loc, "invalid cast opcode for cast from '" + SrcVal->getType()->getDescription() + "' to '" + DestTy->getDescription() + "'"); - ID.ConstantVal = Context.getConstantExprCast((Instruction::CastOps)Opc, + ID.ConstantVal = ConstantExpr::getCast((Instruction::CastOps)Opc, SrcVal, DestTy); ID.Kind = ValID::t_Constant; return false; @@ -1919,7 +1919,7 @@ bool LLParser::ParseValID(ValID &ID) { Indices.end())) return Error(ID.Loc, "invalid indices for extractvalue"); ID.ConstantVal = - Context.getConstantExprExtractValue(Val, Indices.data(), Indices.size()); + ConstantExpr::getExtractValue(Val, Indices.data(), Indices.size()); ID.Kind = ValID::t_Constant; return false; } @@ -1939,7 +1939,7 @@ bool LLParser::ParseValID(ValID &ID) { if (!ExtractValueInst::getIndexedType(Val0->getType(), Indices.begin(), Indices.end())) return Error(ID.Loc, "invalid indices for insertvalue"); - ID.ConstantVal = Context.getConstantExprInsertValue(Val0, Val1, + ID.ConstantVal = ConstantExpr::getInsertValue(Val0, Val1, Indices.data(), Indices.size()); ID.Kind = ValID::t_Constant; return false; @@ -1965,13 +1965,13 @@ bool LLParser::ParseValID(ValID &ID) { if (Opc == Instruction::FCmp) { if (!Val0->getType()->isFPOrFPVector()) return Error(ID.Loc, "fcmp requires floating point operands"); - ID.ConstantVal = Context.getConstantExprFCmp(Pred, Val0, Val1); + ID.ConstantVal = ConstantExpr::getFCmp(Pred, Val0, Val1); } else { assert(Opc == Instruction::ICmp && "Unexpected opcode for CmpInst!"); if (!Val0->getType()->isIntOrIntVector() && !isa<PointerType>(Val0->getType())) return Error(ID.Loc, "icmp requires pointer or integer operands"); - ID.ConstantVal = Context.getConstantExprICmp(Pred, Val0, Val1); + ID.ConstantVal = ConstantExpr::getICmp(Pred, Val0, Val1); } ID.Kind = ValID::t_Constant; return false; @@ -2030,7 +2030,7 @@ bool LLParser::ParseValID(ValID &ID) { if (!Val0->getType()->isIntOrIntVector() && !Val0->getType()->isFPOrFPVector()) return Error(ID.Loc,"constexpr requires integer, fp, or vector operands"); - Constant *C = Context.getConstantExpr(Opc, Val0, Val1); + Constant *C = ConstantExpr::get(Opc, Val0, Val1); if (NUW) cast<OverflowingBinaryOperator>(C)->setHasNoUnsignedOverflow(true); if (NSW) @@ -2063,7 +2063,7 @@ bool LLParser::ParseValID(ValID &ID) { if (!Val0->getType()->isIntOrIntVector()) return Error(ID.Loc, "constexpr requires integer or integer vector operands"); - ID.ConstantVal = Context.getConstantExpr(Opc, Val0, Val1); + ID.ConstantVal = ConstantExpr::get(Opc, Val0, Val1); ID.Kind = ValID::t_Constant; return false; } @@ -2092,7 +2092,7 @@ bool LLParser::ParseValID(ValID &ID) { (Value**)(Elts.data() + 1), Elts.size() - 1)) return Error(ID.Loc, "invalid indices for getelementptr"); - ID.ConstantVal = Context.getConstantExprGetElementPtr(Elts[0], + ID.ConstantVal = ConstantExpr::getGetElementPtr(Elts[0], Elts.data() + 1, Elts.size() - 1); if (InBounds) cast<GEPOperator>(ID.ConstantVal)->setIsInBounds(true); @@ -2102,20 +2102,20 @@ bool LLParser::ParseValID(ValID &ID) { if (const char *Reason = SelectInst::areInvalidOperands(Elts[0], Elts[1], Elts[2])) return Error(ID.Loc, Reason); - ID.ConstantVal = Context.getConstantExprSelect(Elts[0], Elts[1], Elts[2]); + ID.ConstantVal = ConstantExpr::getSelect(Elts[0], Elts[1], Elts[2]); } else if (Opc == Instruction::ShuffleVector) { if (Elts.size() != 3) return Error(ID.Loc, "expected three operands to shufflevector"); if (!ShuffleVectorInst::isValidOperands(Elts[0], Elts[1], Elts[2])) return Error(ID.Loc, "invalid operands to shufflevector"); ID.ConstantVal = - Context.getConstantExprShuffleVector(Elts[0], Elts[1],Elts[2]); + ConstantExpr::getShuffleVector(Elts[0], Elts[1],Elts[2]); } else if (Opc == Instruction::ExtractElement) { if (Elts.size() != 2) return Error(ID.Loc, "expected two operands to extractelement"); if (!ExtractElementInst::isValidOperands(Elts[0], Elts[1])) return Error(ID.Loc, "invalid extractelement operands"); - ID.ConstantVal = Context.getConstantExprExtractElement(Elts[0], Elts[1]); + ID.ConstantVal = ConstantExpr::getExtractElement(Elts[0], Elts[1]); } else { assert(Opc == Instruction::InsertElement && "Unknown opcode"); if (Elts.size() != 3) @@ -2123,7 +2123,7 @@ bool LLParser::ParseValID(ValID &ID) { if (!InsertElementInst::isValidOperands(Elts[0], Elts[1], Elts[2])) return Error(ID.Loc, "invalid insertelement operands"); ID.ConstantVal = - Context.getConstantExprInsertElement(Elts[0], Elts[1],Elts[2]); + ConstantExpr::getInsertElement(Elts[0], Elts[1],Elts[2]); } ID.Kind = ValID::t_Constant; diff --git a/lib/Bitcode/Reader/BitcodeReader.cpp b/lib/Bitcode/Reader/BitcodeReader.cpp index 21c4e6975a..2b22404086 100644 --- a/lib/Bitcode/Reader/BitcodeReader.cpp +++ b/lib/Bitcode/Reader/BitcodeReader.cpp @@ -978,7 +978,7 @@ bool BitcodeReader::ParseConstants() { } else { Constant *LHS = ValueList.getConstantFwdRef(Record[1], CurTy); Constant *RHS = ValueList.getConstantFwdRef(Record[2], CurTy); - V = Context.getConstantExpr(Opc, LHS, RHS); + V = ConstantExpr::get(Opc, LHS, RHS); } if (Record.size() >= 4) SetOptimizationFlags(V, Record[3]); @@ -993,7 +993,7 @@ bool BitcodeReader::ParseConstants() { const Type *OpTy = getTypeByID(Record[1]); if (!OpTy) return Error("Invalid CE_CAST record"); Constant *Op = ValueList.getConstantFwdRef(Record[2], OpTy); - V = Context.getConstantExprCast(Opc, Op, CurTy); + V = ConstantExpr::getCast(Opc, Op, CurTy); } break; } @@ -1006,7 +1006,7 @@ bool BitcodeReader::ParseConstants() { if (!ElTy) return Error("Invalid CE_GEP record"); Elts.push_back(ValueList.getConstantFwdRef(Record[i+1], ElTy)); } - V = Context.getConstantExprGetElementPtr(Elts[0], &Elts[1], + V = ConstantExpr::getGetElementPtr(Elts[0], &Elts[1], Elts.size()-1); if (BitCode == bitc::CST_CODE_CE_INBOUNDS_GEP) cast<GEPOperator>(V)->setIsInBounds(true); @@ -1014,7 +1014,7 @@ bool BitcodeReader::ParseConstants() { } case bitc::CST_CODE_CE_SELECT: // CE_SELECT: [opval#, opval#, opval#] if (Record.size() < 3) return Error("Invalid CE_SELECT record"); - V = Context.getConstantExprSelect(ValueList.getConstantFwdRef(Record[0], + V = ConstantExpr::getSelect(ValueList.getConstantFwdRef(Record[0], Type::Int1Ty), ValueList.getConstantFwdRef(Record[1],CurTy), ValueList.getConstantFwdRef(Record[2],CurTy)); @@ -1026,7 +1026,7 @@ bool BitcodeReader::ParseConstants() { if (OpTy == 0) return Error("Invalid CE_EXTRACTELT record"); Constant *Op0 = ValueList.getConstantFwdRef(Record[1], OpTy); Constant *Op1 = ValueList.getConstantFwdRef(Record[2], Type::Int32Ty); - V = Context.getConstantExprExtractElement(Op0, Op1); + V = ConstantExpr::getExtractElement(Op0, Op1); break; } case bitc::CST_CODE_CE_INSERTELT: { // CE_INSERTELT: [opval, opval, opval] @@ -1037,7 +1037,7 @@ bool BitcodeReader::ParseConstants() { Constant *Op1 = ValueList.getConstantFwdRef(Record[1], OpTy->getElementType()); Constant *Op2 = ValueList.getConstantFwdRef(Record[2], Type::Int32Ty); - V = Context.getConstantExprInsertElement(Op0, Op1, Op2); + V = ConstantExpr::getInsertElement(Op0, Op1, Op2); break; } case bitc::CST_CODE_CE_SHUFFLEVEC: { // CE_SHUFFLEVEC: [opval, opval, opval] @@ -1049,7 +1049,7 @@ bool BitcodeReader::ParseConstants() { const Type *ShufTy = Context.getVectorType(Type::Int32Ty, OpTy->getNumElements()); Constant *Op2 = ValueList.getConstantFwdRef(Record[2], ShufTy); - V = Context.getConstantExprShuffleVector(Op0, Op1, Op2); + V = ConstantExpr::getShuffleVector(Op0, Op1, Op2); break; } case bitc::CST_CODE_CE_SHUFVEC_EX: { // [opty, opval, opval, opval] @@ -1062,7 +1062,7 @@ bool BitcodeReader::ParseConstants() { const Type *ShufTy = Context.getVectorType(Type::Int32Ty, RTy->getNumElements()); Constant *Op2 = ValueList.getConstantFwdRef(Record[3], ShufTy); - V = Context.getConstantExprShuffleVector(Op0, Op1, Op2); + V = ConstantExpr::getShuffleVector(Op0, Op1, Op2); break; } case bitc::CST_CODE_CE_CMP: { // CE_CMP: [opty, opval, opval, pred] @@ -1073,9 +1073,9 @@ bool BitcodeReader::ParseConstants() { Constant *Op1 = ValueList.getConstantFwdRef(Record[2], OpTy); if (OpTy->isFloatingPoint()) - V = Context.getConstantExprFCmp(Record[3], Op0, Op1); + V = ConstantExpr::getFCmp(Record[3], Op0, Op1); else - V = Context.getConstantExprICmp(Record[3], Op0, Op1); + V = ConstantExpr::getICmp(Record[3], Op0, Op1); break; } case bitc::CST_CODE_INLINEASM: { diff --git a/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp b/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp index 32f70a74ca..e3709a5aae 100644 --- a/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp +++ b/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp @@ -363,7 +363,7 @@ static SDValue ExpandConstantFP(ConstantFPSDNode *CFP, bool UseCP, TLI.isLoadExtLegal(ISD::EXTLOAD, SVT) && TLI.ShouldShrinkFPConstant(OrigVT)) { const Type *SType = SVT.getTypeForMVT(*DAG.getContext()); - LLVMC = cast<ConstantFP>(Context->getConstantExprFPTrunc(LLVMC, SType)); + LLVMC = cast<ConstantFP>(ConstantExpr::getFPTrunc(LLVMC, SType)); VT = SVT; Extend = true; } diff --git a/lib/CodeGen/ShadowStackGC.cpp b/lib/CodeGen/ShadowStackGC.cpp index 801a99bdb0..08d6720701 100644 --- a/lib/CodeGen/ShadowStackGC.cpp +++ b/lib/CodeGen/ShadowStackGC.cpp @@ -238,7 +238,7 @@ Constant *ShadowStackGC::GetFrameMap(Function &F) { Constant *GEPIndices[2] = { ConstantInt::get(Type::Int32Ty, 0), ConstantInt::get(Type::Int32Ty, 0) }; - return Context.getConstantExprGetElementPtr(GV, GEPIndices, 2); + return ConstantExpr::getGetElementPtr(GV, GEPIndices, 2); } const Type* ShadowStackGC::GetConcreteStackEntryType(Function &F) { diff --git a/lib/ExecutionEngine/JIT/JIT.cpp b/lib/ExecutionEngine/JIT/JIT.cpp index 444ef3c3ce..9f60954ba8 100644 --- a/lib/ExecutionEngine/JIT/JIT.cpp +++ b/lib/ExecutionEngine/JIT/JIT.cpp @@ -507,7 +507,7 @@ GenericValue JIT::runFunction(Function *F, else C = ConstantInt::get(Type::Int64Ty, (intptr_t)ArgPtr); // Cast the integer to pointer - C = Context.getConstantExprIntToPtr(C, ArgTy); + C = ConstantExpr::getIntToPtr(C, ArgTy); break; } Args.push_back(C); |