[llvm-commits] CVS: llvm/lib/Analysis/ScalarEvolution.cpp
Chris Lattner
lattner at cs.uiuc.edu
Tue Mar 8 21:34:54 PST 2005
Changes in directory llvm/lib/Analysis:
ScalarEvolution.cpp updated: 1.35 -> 1.36
---
Log message:
Export two methods for getting -X and A-B.
---
Diffs of the changes: (+11 -10)
ScalarEvolution.cpp | 21 +++++++++++----------
1 files changed, 11 insertions(+), 10 deletions(-)
Index: llvm/lib/Analysis/ScalarEvolution.cpp
diff -u llvm/lib/Analysis/ScalarEvolution.cpp:1.35 llvm/lib/Analysis/ScalarEvolution.cpp:1.36
--- llvm/lib/Analysis/ScalarEvolution.cpp:1.35 Sat Feb 26 17:36:45 2005
+++ llvm/lib/Analysis/ScalarEvolution.cpp Tue Mar 8 23:34:41 2005
@@ -480,7 +480,7 @@
/// getNegativeSCEV - Return a SCEV corresponding to -V = -1*V
///
-static SCEVHandle getNegativeSCEV(const SCEVHandle &V) {
+SCEVHandle SCEV::getNegativeSCEV(const SCEVHandle &V) {
if (SCEVConstant *VC = dyn_cast<SCEVConstant>(V))
return SCEVUnknown::get(ConstantExpr::getNeg(VC->getValue()));
@@ -489,9 +489,9 @@
/// getMinusSCEV - Return a SCEV corresponding to LHS - RHS.
///
-static SCEVHandle getMinusSCEV(const SCEVHandle &LHS, const SCEVHandle &RHS) {
+SCEVHandle SCEV::getMinusSCEV(const SCEVHandle &LHS, const SCEVHandle &RHS) {
// X - Y --> X + -Y
- return SCEVAddExpr::get(LHS, getNegativeSCEV(RHS));
+ return SCEVAddExpr::get(LHS, SCEV::getNegativeSCEV(RHS));
}
@@ -514,7 +514,7 @@
SCEVHandle Result = V;
for (unsigned i = 1; i != NumSteps; ++i)
- Result = SCEVMulExpr::get(Result, getMinusSCEV(V,
+ Result = SCEVMulExpr::get(Result, SCEV::getMinusSCEV(V,
SCEVUnknown::getIntegerSCEV(i, Ty)));
return Result;
}
@@ -984,7 +984,7 @@
if (RHSC->getValue()->equalsInt(1))
return LHS; // X /u 1 --> x
if (RHSC->getValue()->isAllOnesValue())
- return getNegativeSCEV(LHS); // X /u -1 --> -x
+ return SCEV::getNegativeSCEV(LHS); // X /u -1 --> -x
if (SCEVConstant *LHSC = dyn_cast<SCEVConstant>(LHS)) {
Constant *LHSCV = LHSC->getValue();
@@ -1340,7 +1340,8 @@
break;
case Instruction::Sub:
- return getMinusSCEV(getSCEV(I->getOperand(0)), getSCEV(I->getOperand(1)));
+ return SCEV::getMinusSCEV(getSCEV(I->getOperand(0)),
+ getSCEV(I->getOperand(1)));
case Instruction::Shl:
// Turn shift left of a constant amount into a multiply.
@@ -1504,14 +1505,14 @@
case Instruction::SetNE: // while (X != Y)
// Convert to: while (X-Y != 0)
if (LHS->getType()->isInteger()) {
- SCEVHandle TC = HowFarToZero(getMinusSCEV(LHS, RHS), L);
+ SCEVHandle TC = HowFarToZero(SCEV::getMinusSCEV(LHS, RHS), L);
if (!isa<SCEVCouldNotCompute>(TC)) return TC;
}
break;
case Instruction::SetEQ:
// Convert to: while (X-Y == 0) // while (X == Y)
if (LHS->getType()->isInteger()) {
- SCEVHandle TC = HowFarToNonZero(getMinusSCEV(LHS, RHS), L);
+ SCEVHandle TC = HowFarToNonZero(SCEV::getMinusSCEV(LHS, RHS), L);
if (!isa<SCEVCouldNotCompute>(TC)) return TC;
}
break;
@@ -2083,7 +2084,7 @@
// FIXME: We should add DivExpr and RemExpr operations to our AST.
if (SCEVConstant *StepC = dyn_cast<SCEVConstant>(Step)) {
if (StepC->getValue()->equalsInt(1)) // N % 1 == 0
- return getNegativeSCEV(Start); // 0 - Start/1 == -Start
+ return SCEV::getNegativeSCEV(Start); // 0 - Start/1 == -Start
if (StepC->getValue()->isAllOnesValue()) // N % -1 == 0
return Start; // 0 - Start/-1 == Start
@@ -2229,7 +2230,7 @@
// terms of figuring out when zero is crossed, instead of when
// Range.getUpper() is crossed.
std::vector<SCEVHandle> NewOps(op_begin(), op_end());
- NewOps[0] = getNegativeSCEV(SCEVUnknown::get(Range.getUpper()));
+ NewOps[0] = SCEV::getNegativeSCEV(SCEVUnknown::get(Range.getUpper()));
SCEVHandle NewAddRec = SCEVAddRecExpr::get(NewOps, getLoop());
// Next, solve the constructed addrec
More information about the llvm-commits
mailing list