diff options
author | Owen Anderson <resistor@mac.com> | 2009-07-06 22:37:39 +0000 |
---|---|---|
committer | Owen Anderson <resistor@mac.com> | 2009-07-06 22:37:39 +0000 |
commit | 76f600b205606a055ec35e7d3fd1a99602329d67 (patch) | |
tree | 87ac4612f76908198ed9aa0d68ae97b1d733614e /lib/Analysis/ScalarEvolutionExpander.cpp | |
parent | 3147fb2cff9ca0d258f8ab20ff23b9c447024df1 (diff) |
Finish LLVMContext-ing lib/Analysis. This required pushing LLVMContext's through the ValueTracking API.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74873 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Analysis/ScalarEvolutionExpander.cpp')
-rw-r--r-- | lib/Analysis/ScalarEvolutionExpander.cpp | 22 |
1 files changed, 12 insertions, 10 deletions
diff --git a/lib/Analysis/ScalarEvolutionExpander.cpp b/lib/Analysis/ScalarEvolutionExpander.cpp index 729a0c3254..fbb5326950 100644 --- a/lib/Analysis/ScalarEvolutionExpander.cpp +++ b/lib/Analysis/ScalarEvolutionExpander.cpp @@ -15,6 +15,7 @@ #include "llvm/Analysis/ScalarEvolutionExpander.h" #include "llvm/Analysis/LoopInfo.h" +#include "llvm/LLVMContext.h" #include "llvm/Target/TargetData.h" #include "llvm/ADT/STLExtras.h" using namespace llvm; @@ -54,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 ConstantExpr::getCast(Op, C, Ty); + return getContext()->getConstantExprCast(Op, C, Ty); if (Argument *A = dyn_cast<Argument>(V)) { // Check to see if there is already a cast! @@ -125,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 ConstantExpr::get(Opcode, CLHS, CRHS); + return getContext()->getConstantExpr(Opcode, CLHS, CRHS); // Do a quick scan to see if we have this binop nearby. If so, reuse it. unsigned ScanLimit = 6; @@ -166,7 +167,7 @@ static bool FactorOutConstant(const SCEV* &S, // For a Constant, check for a multiple of the given factor. if (const SCEVConstant *C = dyn_cast<SCEVConstant>(S)) { ConstantInt *CI = - ConstantInt::get(C->getValue()->getValue().sdiv(Factor)); + SE.getContext()->getConstantInt(C->getValue()->getValue().sdiv(Factor)); // If the quotient is zero and the remainder is non-zero, reject // the value at this scale. It will be considered for subsequent // smaller scales. @@ -286,7 +287,7 @@ Value *SCEVExpander::expandAddToGEP(const SCEV* const *op_begin, Ops = NewOps; AnyNonZeroIndices |= !ScaledOps.empty(); Value *Scaled = ScaledOps.empty() ? - Constant::getNullValue(Ty) : + getContext()->getNullValue(Ty) : expandCodeFor(SE.getAddExpr(ScaledOps), Ty); GepIndices.push_back(Scaled); @@ -299,7 +300,8 @@ Value *SCEVExpander::expandAddToGEP(const SCEV* const *op_begin, uint64_t FullOffset = C->getValue()->getZExtValue(); if (FullOffset < SL.getSizeInBytes()) { unsigned ElIdx = SL.getElementContainingOffset(FullOffset); - GepIndices.push_back(ConstantInt::get(Type::Int32Ty, ElIdx)); + GepIndices.push_back( + getContext()->getConstantInt(Type::Int32Ty, ElIdx)); ElTy = STy->getTypeAtIndex(ElIdx); Ops[0] = SE.getConstant(Ty, FullOffset - SL.getElementOffset(ElIdx)); @@ -328,7 +330,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 ConstantExpr::getGetElementPtr(CLHS, &CRHS, 1); + return getContext()->getConstantExprGetElementPtr(CLHS, &CRHS, 1); // Do a quick scan to see if we have this GEP nearby. If so, reuse it. unsigned ScanLimit = 6; @@ -400,7 +402,7 @@ Value *SCEVExpander::visitMulExpr(const SCEVMulExpr *S) { // -1 * ... ---> 0 - ... if (FirstOp == 1) - V = InsertBinop(Instruction::Sub, Constant::getNullValue(Ty), V); + V = InsertBinop(Instruction::Sub, getContext()->getNullValue(Ty), V); return V; } @@ -412,7 +414,7 @@ Value *SCEVExpander::visitUDivExpr(const SCEVUDivExpr *S) { const APInt &RHS = SC->getValue()->getValue(); if (RHS.isPowerOf2()) return InsertBinop(Instruction::LShr, LHS, - ConstantInt::get(Ty, RHS.logBase2())); + getContext()->getConstantInt(Ty, RHS.logBase2())); } Value *RHS = expandCodeFor(S->getRHS(), Ty); @@ -522,7 +524,7 @@ Value *SCEVExpander::visitAddRecExpr(const SCEVAddRecExpr *S) { BasicBlock *Preheader = L->getLoopPreheader(); PHINode *PN = PHINode::Create(Ty, "indvar", Header->begin()); InsertedValues.insert(PN); - PN->addIncoming(Constant::getNullValue(Ty), Preheader); + PN->addIncoming(getContext()->getNullValue(Ty), Preheader); pred_iterator HPI = pred_begin(Header); assert(HPI != pred_end(Header) && "Loop with zero preds???"); @@ -532,7 +534,7 @@ Value *SCEVExpander::visitAddRecExpr(const SCEVAddRecExpr *S) { // Insert a unit add instruction right before the terminator corresponding // to the back-edge. - Constant *One = ConstantInt::get(Ty, 1); + Constant *One = getContext()->getConstantInt(Ty, 1); Instruction *Add = BinaryOperator::CreateAdd(PN, One, "indvar.next", (*HPI)->getTerminator()); InsertedValues.insert(Add); |