|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object scale.common.Root scale.score.Note scale.score.expr.Expr scale.score.expr.UnaryExpr scale.score.expr.LoadValueIndirectExpr
public class LoadValueIndirectExpr
This class represents the indirect load operator.
$Id: LoadValueIndirectExpr.java,v 1.91 2007-10-04 19:58:31 burrill Exp $
Copyright 2008 by the
Scale Compiler Group,
Department of Computer Science
University of Massachusetts,
Amherst MA. 01003, USA
All Rights Reserved.
Other loads are handled by other nodes. Load immediate is handled
by LiteralExpr
, load address is handled by
LoadDeclAddressExpr
, load of a value is
handled by LoadDeclValueExpr
, and load
value from address is handled by LoadValueIndirectExpr
.
LoadDeclAddressExpr
,
LoadDeclValueExpr
,
LoadValueIndirectExpr
,
LiteralExpr
Field Summary |
---|
Fields inherited from class scale.score.expr.Expr |
---|
fpReorder, SE_DOMAIN, SE_NONE, SE_OVERFLOW, SE_STATE |
Constructor Summary | |
---|---|
LoadValueIndirectExpr(Expr addr)
This method builds a load indirect operation. |
Method Summary | |
---|---|
void |
addMayUse(MayUse mayUse)
Add may use information to the load expression. |
Expr |
copy()
Make a copy of this load expression. |
Expr |
copyNoUD()
Make a copy of this load expression without the use - def information. |
static Expr |
create(Expr addr)
Create an expression representing the load from the specified address. |
int |
executionCostEstimate()
Return a relative cost estimate for executing the expression. |
protected Chord |
findCriticalChord(HashMap<Expr,Chord> lMap,
Chord independent)
Return the Chord with the highest label value from the set of Chords that must be executed before this expression. |
SubscriptExpr |
findSubscriptExpr()
Return the SubscriptExpr that this load
uses or null if none is found. |
Expr |
getAddr()
Return the Expr representing the address loaded by this expression. |
Literal |
getConstantValue()
Return the constant value of the expression. |
Literal |
getConstantValue(HashMap<Expr,Literal> cvMap)
Return the constant value of the expression. |
java.lang.String |
getDisplayLabel()
Return a String suitable for labeling this node in a graphical display. |
MayUse |
getMayUse()
Return the may use information assocaited with the load. |
Expr |
getObject()
Given a load expression, return the object expression for the load. |
Expr |
getReference()
Return the variable reference for the expression. |
int |
getReuseLevel()
|
boolean |
isLoopInvariant(LoopHeaderChord loop)
Return true if this expression is loop invariant. |
boolean |
isMemRefExpr()
Return true if the expression loads a value from memory. |
void |
loopClean()
Clean up any loop related information. |
boolean |
optimizationCandidate()
Return true if the expression can be moved without problems. |
void |
removeUseDef()
Remove any inormation such as use - def links, may use links, etc. |
void |
setCrossloopReuse(int level)
|
void |
setSpatialReuse(int level)
|
void |
setStep(int step)
|
void |
setTemporalReuse(int level)
|
int |
sideEffects()
Return an indication of the side effects execution of this expression may cause. |
void |
visit(Predicate p)
Process a node by calling its associated routine. |
Methods inherited from class scale.score.expr.UnaryExpr |
---|
containsDeclaration, dependsOnDeclaration, equivalent, getAliasAnnote, getArg, getDeclList, getExprList, getLoadExprList, getOperand, getOperandArray, numOperands, pushOperands, recordRefs, removeRefs, replaceDecl, setArg, setOperand, unlinkExpression, validate |
Methods inherited from class scale.score.Note |
---|
getChord, getEssentialUse, setAnnotationLevel, setReportLevel, toString |
Methods inherited from class scale.common.Root |
---|
addAnnotation, allAnnotations, allMatchingAnnotations, getAnnotation, getDisplayName, getDisplayString, getNodeCount, getNodeID, hasAnnotation, hasEqualAnnotation, hashCode, removeAnnotation, removeAnnotations, toStringAnnotations, toStringClass, trace, trace, trace |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public LoadValueIndirectExpr(Expr addr)
addr
- address of value to be loadedMethod Detail |
---|
public static Expr create(Expr addr)
public final Expr getAddr()
public Expr copy()
copy
in class Expr
public Expr copyNoUD()
public void visit(Predicate p)
Note
Each class has a visit(Predicate p)
method. For
example, in class ABC
:
public void visit(Predicate p) { p.visitABC(this); }and the class that implements
Predicate
has a method
public void visitABC(Note n) { ABC a = (ABC) n; ... }Thus, the class that implements
Predicate
can call
n.visit(this);where
n
is a Note
sub-class without
determining which specific sub-class n
is.
The visit pattern basically avoids implementing a large
switch
statement or defining different methods
in each class for some purpose.
visit
in class Note
Predicate
public java.lang.String getDisplayLabel()
Expr
getDisplayLabel
in interface DisplayNode
getDisplayLabel
in class Expr
public Expr getReference()
getReference
in class Expr
public void addMayUse(MayUse mayUse)
mayUse
- the expresion representing the may usepublic MayUse getMayUse()
public void removeUseDef()
removeUseDef
in class UnaryExpr
public Expr getObject()
public boolean isMemRefExpr()
isMemRefExpr
in class Expr
protected Chord findCriticalChord(HashMap<Expr,Chord> lMap, Chord independent)
findCriticalChord
in class Expr
lMap
- is used to memoize the expression to critical Chord
informationindependent
- is returned if the expression is not dependent
on anythingpublic boolean isLoopInvariant(LoopHeaderChord loop)
isLoopInvariant
in class Expr
loop
- is the looppublic SubscriptExpr findSubscriptExpr()
SubscriptExpr
that this load
uses or null
if none is found. This method uses the
use-def link to find an existing SubscriptExpr
findSubscriptExpr
in class Expr
public void loopClean()
loopClean
in class UnaryExpr
public boolean optimizationCandidate()
For a load indirect (e.g., *ptr
), we can treat it as
optimizatible if the restrict
attribute is set as in
int * restrict ptr;This allows global value numbering to change
(*ptr +
*ptr)
to (x = *ptr, (x + x))
.
optimizationCandidate
in class UnaryExpr
public void setTemporalReuse(int level)
setTemporalReuse
in class Expr
public void setCrossloopReuse(int level)
setCrossloopReuse
in class Expr
public void setSpatialReuse(int level)
setSpatialReuse
in class Expr
public void setStep(int step)
setStep
in class Expr
public int getReuseLevel()
getReuseLevel
in class Expr
public int executionCostEstimate()
executionCostEstimate
in class UnaryExpr
public int sideEffects()
sideEffects
in class UnaryExpr
Expr.SE_NONE
public Literal getConstantValue(HashMap<Expr,Literal> cvMap)
getConstantValue
in class Expr
Lattice
,
ValueDecl
public Literal getConstantValue()
getConstantValue
in class Expr
Lattice
,
ValueDecl
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |