|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object scale.score.dependence.AffineExpr
public final class AffineExpr
A class to represent affine expressions used by the data dependence tester.
$Id: AffineExpr.java,v 1.25 2007-05-03 18:00:57 burrill Exp $
Copyright 2006 by the Scale Compiler Group,
Department of Computer Science
University of Massachusetts,
Amherst MA. 01003, USA
All Rights Reserved.
An expression is an affine function of variables
X1, X2, ..., Xn
if it
can be expressed as k + Σ
aiXi
where k,
ai
are constants. Note, we do not handle the
cases where ai
or k
are loop
invariant expressions; they must be integer constants.
Field Summary | |
---|---|
static AffineExpr |
marker
A token used to represent the affine representation for a Phi functions during determination of its affine representation. |
static AffineExpr |
notAffine
A token used to represent the affine representation for non-affine expressions. |
Constructor Summary | |
---|---|
AffineExpr()
Create a new affine expression. |
|
AffineExpr(long coefficient)
Create a new affine expression. |
|
AffineExpr(VariableDecl vd,
long coefficient,
LoopHeaderChord loop)
Create a new affine expression with one term. |
|
AffineExpr(VariableDecl vd,
LoopHeaderChord loop)
Create a new affine expression with one term. |
Method Summary | |
---|---|
AffineExpr |
add(AffineExpr a2)
Return this affine expression which is the addition of two affine expressions. |
static AffineExpr |
add(AffineExpr a1,
AffineExpr a2)
Return this affine expression which is the addition of two affine expressions. |
void |
addConst(long constant)
Add constant to the affine expression. |
void |
addTerm(long coefficient)
Add a constant value to the affine expression. |
void |
addTerm(VariableDecl var,
long coefficient,
LoopHeaderChord loop)
Add a variable to the affine expression. |
void |
addTerm(VariableDecl var,
LoopHeaderChord loop)
Add a variable to the affine expression. |
AffineExpr |
copy()
Create a copy of the AffineExpr. |
boolean |
differenceWithin(AffineExpr ae,
int offset)
Return true if the difference of two affine expressions are within in a range. |
static AffineExpr |
divide(AffineExpr a1,
AffineExpr a2)
Return this affine expression which is the division of two affine expressions. |
boolean |
equivalent(AffineExpr ae)
Return true if this affine expression is equivalent to the argument. |
void |
gcd(AffineExpr e)
Set the constant term to the greatest common denominator of this expression's constant term and the specified expression's constant term. |
long |
getCoefficient(int term)
Return the coefficient of the specified term of the affine expression. |
long |
getConstant()
Return the constant term from the affine expression. |
LoopHeaderChord |
getLoop(int term)
Return the loop associated with the specified term of the affine expression. |
int |
getTermIndex(VariableDecl term)
Return the index of the term if the affine expression contains a reference to the variable and -1 otherwise. |
int |
getTermIndexOrig(VariableDecl term)
Return the index of the term if the affine expression contains a reference to the variable or a renamed version of the variable and -1 otherwise. |
VariableDecl |
getVariable(int term)
Return the variable of the specified term of the affine expression. |
boolean |
greater(AffineExpr ae)
Return true if this affine expression is definitely greater than the argument. |
boolean |
greaterEqual(AffineExpr ae)
Return true if this affine expression is definitely greater than or equal to the argument. |
boolean |
hasLoopIndex(LoopHeaderChord loop)
Return true if one of the terms is a loop index variable |
boolean |
hasTerm(VariableDecl term)
Return true if the affine expression contains the parameter term. |
boolean |
isConst()
Return true if this affine expression is constant. |
boolean |
lessEqual(AffineExpr ae)
Return true if this affine expression is definitely less than or equal the argument. |
void |
lower(AffineExpr e)
Set the constant term to the smaller of this expression's constant term and the specified expression's constant term. |
void |
merge(AffineExpr ae)
Merge two affine expressions. |
void |
multConst(long c)
Multiply the affine expression by a constant. |
AffineExpr |
multiply(AffineExpr a2)
Return this affine expression which is the product of two affine expressions. |
static AffineExpr |
multiply(AffineExpr a1,
AffineExpr a2)
Return this affine expression which is the product of two affine expressions. |
static AffineExpr |
negate(AffineExpr a1)
Return this affine expression which is the division of two affine expressions. |
int |
numTerms()
Return the number of terms in the affine expression. |
boolean |
possiblyGreater(AffineExpr ae)
Return true if this affine expression is possibly greater than the argument. |
boolean |
possiblyLess(AffineExpr ae)
Return true if this affine expression is possibly less than the argument. |
void |
setCoefficient(int term,
long coefficient)
Set the coefficient of the specified term of the affine expression. |
void |
setConstant(long c)
Set the constant term of the affine expression. |
AffineExpr |
subtract(AffineExpr a2)
Return this affine expression which is the difference of two affine expressions. |
static AffineExpr |
subtract(AffineExpr a1,
AffineExpr a2)
Return this affine expression which is the difference of two affine expressions. |
java.lang.String |
toString()
|
void |
upper(AffineExpr e)
Set the constant term to the larger of this expression's constant term and the specified expression's constant term. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final AffineExpr notAffine
public static final AffineExpr marker
Constructor Detail |
---|
public AffineExpr()
public AffineExpr(long coefficient)
public AffineExpr(VariableDecl vd, LoopHeaderChord loop)
public AffineExpr(VariableDecl vd, long coefficient, LoopHeaderChord loop)
Method Detail |
---|
public void addTerm(VariableDecl var, LoopHeaderChord loop)
var
- the variableloop
- is the loop in which the variable is definedpublic void addTerm(VariableDecl var, long coefficient, LoopHeaderChord loop)
var
- the variablecoefficient
- is the coefficient of the variableloop
- is the loop in which the variable is definedpublic void addTerm(long coefficient)
coefficient
- is the constant valuepublic boolean hasTerm(VariableDecl term)
public int getTermIndex(VariableDecl term)
public int getTermIndexOrig(VariableDecl term)
public long getConstant()
public void setConstant(long c)
public void setCoefficient(int term, long coefficient)
public long getCoefficient(int term)
public boolean hasLoopIndex(LoopHeaderChord loop)
public int numTerms()
public VariableDecl getVariable(int term)
public LoopHeaderChord getLoop(int term)
public void addConst(long constant)
public void multConst(long c)
public void merge(AffineExpr ae)
public boolean equivalent(AffineExpr ae)
ae
- affine expression to comparepublic boolean possiblyGreater(AffineExpr ae)
ae
- affine expression to comparepublic boolean greaterEqual(AffineExpr ae)
ae
- affine expression to comparepublic boolean greater(AffineExpr ae)
ae
- affine expression to comparepublic boolean possiblyLess(AffineExpr ae)
ae
- affine expression to comparepublic boolean lessEqual(AffineExpr ae)
ae
- affine expression to comparepublic boolean differenceWithin(AffineExpr ae, int offset)
ae
- affine expression to comparepublic boolean isConst()
public void lower(AffineExpr e)
public void upper(AffineExpr e)
public void gcd(AffineExpr e)
public AffineExpr copy()
public java.lang.String toString()
toString
in class java.lang.Object
public AffineExpr add(AffineExpr a2)
public static AffineExpr add(AffineExpr a1, AffineExpr a2)
public AffineExpr subtract(AffineExpr a2)
public static AffineExpr subtract(AffineExpr a1, AffineExpr a2)
public AffineExpr multiply(AffineExpr a2)
public static AffineExpr multiply(AffineExpr a1, AffineExpr a2)
public static AffineExpr divide(AffineExpr a1, AffineExpr a2)
public static AffineExpr negate(AffineExpr a1)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |