aboutsummaryrefslogtreecommitdiff
path: root/lib/Analysis/ScalarEvolutionExpander.cpp
diff options
context:
space:
mode:
authorDan Gohman <gohman@apple.com>2009-04-18 17:56:28 +0000
committerDan Gohman <gohman@apple.com>2009-04-18 17:56:28 +0000
commit890f92b744fb074465bc2b7006ee753a181f62a4 (patch)
tree0300a386e2f78a01341f5351e32841c9f4349db0 /lib/Analysis/ScalarEvolutionExpander.cpp
parentf34c921713111fb327623400cf8c23d322513790 (diff)
Use more const qualifiers with SCEV interfaces.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@69450 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Analysis/ScalarEvolutionExpander.cpp')
-rw-r--r--lib/Analysis/ScalarEvolutionExpander.cpp24
1 files changed, 12 insertions, 12 deletions
diff --git a/lib/Analysis/ScalarEvolutionExpander.cpp b/lib/Analysis/ScalarEvolutionExpander.cpp
index c27bbdc9b1..560441f0c5 100644
--- a/lib/Analysis/ScalarEvolutionExpander.cpp
+++ b/lib/Analysis/ScalarEvolutionExpander.cpp
@@ -112,7 +112,7 @@ Value *SCEVExpander::InsertBinop(Instruction::BinaryOps Opcode, Value *LHS,
return BinaryOperator::Create(Opcode, LHS, RHS, "tmp", InsertPt);
}
-Value *SCEVExpander::visitAddExpr(SCEVAddExpr *S) {
+Value *SCEVExpander::visitAddExpr(const SCEVAddExpr *S) {
const Type *Ty = S->getType();
if (isa<PointerType>(Ty)) Ty = TD.getIntPtrType();
Value *V = expand(S->getOperand(S->getNumOperands()-1));
@@ -127,11 +127,11 @@ Value *SCEVExpander::visitAddExpr(SCEVAddExpr *S) {
return V;
}
-Value *SCEVExpander::visitMulExpr(SCEVMulExpr *S) {
+Value *SCEVExpander::visitMulExpr(const SCEVMulExpr *S) {
const Type *Ty = S->getType();
if (isa<PointerType>(Ty)) Ty = TD.getIntPtrType();
int FirstOp = 0; // Set if we should emit a subtract.
- if (SCEVConstant *SC = dyn_cast<SCEVConstant>(S->getOperand(0)))
+ if (const SCEVConstant *SC = dyn_cast<SCEVConstant>(S->getOperand(0)))
if (SC->getValue()->isAllOnesValue())
FirstOp = 1;
@@ -152,13 +152,13 @@ Value *SCEVExpander::visitMulExpr(SCEVMulExpr *S) {
return V;
}
-Value *SCEVExpander::visitUDivExpr(SCEVUDivExpr *S) {
+Value *SCEVExpander::visitUDivExpr(const SCEVUDivExpr *S) {
const Type *Ty = S->getType();
if (isa<PointerType>(Ty)) Ty = TD.getIntPtrType();
Value *LHS = expand(S->getLHS());
LHS = InsertCastOfTo(CastInst::getCastOpcode(LHS, false, Ty, false), LHS, Ty);
- if (SCEVConstant *SC = dyn_cast<SCEVConstant>(S->getRHS())) {
+ if (const SCEVConstant *SC = dyn_cast<SCEVConstant>(S->getRHS())) {
const APInt &RHS = SC->getValue()->getValue();
if (RHS.isPowerOf2())
return InsertBinop(Instruction::LShr, LHS,
@@ -171,7 +171,7 @@ Value *SCEVExpander::visitUDivExpr(SCEVUDivExpr *S) {
return InsertBinop(Instruction::UDiv, LHS, RHS, InsertPt);
}
-Value *SCEVExpander::visitAddRecExpr(SCEVAddRecExpr *S) {
+Value *SCEVExpander::visitAddRecExpr(const SCEVAddRecExpr *S) {
const Type *Ty = S->getType();
const Loop *L = S->getLoop();
// We cannot yet do fp recurrences, e.g. the xform of {X,+,F} --> X+{0,+,F}
@@ -275,14 +275,14 @@ Value *SCEVExpander::visitAddRecExpr(SCEVAddRecExpr *S) {
return expand(V);
}
-Value *SCEVExpander::visitTruncateExpr(SCEVTruncateExpr *S) {
+Value *SCEVExpander::visitTruncateExpr(const SCEVTruncateExpr *S) {
Value *V = expand(S->getOperand());
if (isa<PointerType>(V->getType()))
V = InsertCastOfTo(Instruction::PtrToInt, V, TD.getIntPtrType());
return CastInst::CreateTruncOrBitCast(V, S->getType(), "tmp.", InsertPt);
}
-Value *SCEVExpander::visitZeroExtendExpr(SCEVZeroExtendExpr *S) {
+Value *SCEVExpander::visitZeroExtendExpr(const SCEVZeroExtendExpr *S) {
const Type *Ty = S->getType();
if (isa<PointerType>(Ty)) Ty = TD.getIntPtrType();
Value *V = expand(S->getOperand());
@@ -291,7 +291,7 @@ Value *SCEVExpander::visitZeroExtendExpr(SCEVZeroExtendExpr *S) {
return CastInst::CreateZExtOrBitCast(V, Ty, "tmp.", InsertPt);
}
-Value *SCEVExpander::visitSignExtendExpr(SCEVSignExtendExpr *S) {
+Value *SCEVExpander::visitSignExtendExpr(const SCEVSignExtendExpr *S) {
const Type *Ty = S->getType();
if (isa<PointerType>(Ty)) Ty = TD.getIntPtrType();
Value *V = expand(S->getOperand());
@@ -300,7 +300,7 @@ Value *SCEVExpander::visitSignExtendExpr(SCEVSignExtendExpr *S) {
return CastInst::CreateSExtOrBitCast(V, Ty, "tmp.", InsertPt);
}
-Value *SCEVExpander::visitSMaxExpr(SCEVSMaxExpr *S) {
+Value *SCEVExpander::visitSMaxExpr(const SCEVSMaxExpr *S) {
const Type *Ty = S->getType();
Value *LHS = expand(S->getOperand(0));
LHS = InsertCastOfTo(CastInst::getCastOpcode(LHS, false, Ty, false), LHS, Ty);
@@ -314,7 +314,7 @@ Value *SCEVExpander::visitSMaxExpr(SCEVSMaxExpr *S) {
return LHS;
}
-Value *SCEVExpander::visitUMaxExpr(SCEVUMaxExpr *S) {
+Value *SCEVExpander::visitUMaxExpr(const SCEVUMaxExpr *S) {
const Type *Ty = S->getType();
Value *LHS = expand(S->getOperand(0));
LHS = InsertCastOfTo(CastInst::getCastOpcode(LHS, false, Ty, false), LHS, Ty);
@@ -338,7 +338,7 @@ Value *SCEVExpander::expandCodeFor(SCEVHandle SH, const Type *Ty,
return InsertCastOfTo(CastInst::getCastOpcode(V, false, Ty, false), V, Ty);
}
-Value *SCEVExpander::expand(SCEV *S) {
+Value *SCEVExpander::expand(const SCEV *S) {
// Check to see if we already expanded this.
std::map<SCEVHandle, Value*>::iterator I = InsertedExpressions.find(S);
if (I != InsertedExpressions.end())