|
|||||||||
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.chords.Chord scale.score.chords.SequentialChord scale.score.chords.ExprChord
public class ExprChord
This class is used to represent an assignment operation in a CFG. The value may be assigned to the bit-bucket.
$Id: ExprChord.java,v 1.66 2007-10-17 13:39:58 burrill Exp $
Copyright 2008 by the
Scale Compiler Group,
Department of Computer Science
University of Massachusetts,
Amherst MA. 01003, USA
All Rights Reserved.
If the left-hand-side of the ExprChord
instance is not
null
it is always an expression that evaluates to an
address. It is usually a LoadDeclAddressExpr
instance
but may be a LoadDeclValueExpr
instance.
Field Summary |
---|
Fields inherited from class scale.score.chords.Chord |
---|
lineNumber |
Constructor Summary | |
---|---|
ExprChord(Expr rhs)
Create a node that holds a computation. |
|
ExprChord(Expr rhs,
Chord next)
Create a node that holds a computation. |
|
ExprChord(Expr lhs,
Expr rhs)
Create a node that holds a computation. |
|
ExprChord(Expr lhs,
Expr rhs,
Chord next)
Create a node that holds a computation. |
|
ExprChord(Expr lhs,
Expr rhs,
Expr predicate,
boolean onTrue)
Create a node that holds a computation. |
Method Summary | |
---|---|
void |
addDefUse(LoadExpr expr)
Add a new link from the definition to the use. |
void |
addMayDef(MayDef mayDef)
Add may definition information to the store. |
void |
changeInDataEdge(Expr oldExpr,
Expr newExpr)
This method changes an incoming data edge to point to a new expression. |
boolean |
checkDefUse(Expr use)
Return true is a def-use link exists. |
Chord |
copy()
Make a copy of this CFG node with the same out-going CFG edges. |
void |
deleteInDataEdges()
Remove all the in-coming data edges. |
int |
executionCostEstimate()
Return a relative cost estimate for executing this CFG node. |
CallExpr |
getCall(boolean ignorePure)
Return the call expression or
null if none. |
Vector<Declaration> |
getDeclList()
Return a vector of all declarations referenced in this CFG node or null . |
Expr |
getDefExpr()
If this CFG node results in a variable being given a new value, return the Expr instance that
specifies the variable. |
LoadExpr |
getDefUse(int i)
Return the i-th def-use link. |
LoadExpr[] |
getDefUseArray()
Return an array of the use-def links. |
Vector<Expr> |
getExprList()
Return a vector of all Expr
instances in this CFG node or null . |
Expr |
getInDataEdge(int i)
Return the specified in-coming data edge. |
Expr[] |
getInDataEdgeArray()
Use this method when you may be modifying an in-coming data edge to this expression while iterating over the in-coming edges. |
Vector<LoadExpr> |
getLoadExprList()
Return a vector of all LoadExpr
instances in this CFG node or null . |
Expr |
getLValue()
Return the lvalue if this node holds an expression that is an assignment statement or null . |
MayDef |
getMayDef()
Return the may definition info assciated with the store. |
Expr |
getPredicate()
Return the predicate expression or null if the store is not predicated. |
Expr |
getRValue()
Return the rvalue or null . |
boolean |
isAssignChord()
Return true if this node holds an expression that represent an assignment statement. |
boolean |
isDefined(Expr lv)
The expression is a defined if it is on the left hand side of the store expression. |
boolean |
isExprChord()
Return true if this is an expression chord. |
boolean |
isVaCopy()
Is this store as a special case - va_copy()? |
int |
numDefUseLinks()
Return the number of def-use links. |
int |
numInDataEdges()
Return the number of in-coming data edges. |
boolean |
predicatedOnTrue()
Return true if the store is enabled when the predicate value is non-zero. |
void |
printDefUse()
Display the def-use links. |
void |
pushInDataEdges(Stack<Expr> wl)
Push all incoming data edges on the stack. |
void |
recordRefs(References refs)
Record any variable references in this CFG node from the table of references . |
void |
removeDefUse(LoadExpr expr)
Remove an existing link from the definition to the use. |
boolean |
removeDualExprs()
Remove all DualExpr instances
from this CFG node. |
Expr |
removePredication()
Change this predicated store into a normal store. |
void |
removeRefs(References refs)
Remove any variable references in this CFG node in the table of references . |
void |
removeUseDef()
Remove any information such as use - def links, may use links, etc. |
boolean |
replaceDecl(Declaration oldDecl,
Declaration newDecl)
Replace all occurrances of a Declaration with another Declaration . |
void |
setLValue(Expr lhs)
Set the lvalue. |
void |
setRValue(Expr rhs)
Set the rvalue. |
void |
setVaCopy()
Mark this store as a special case - va_copy(). |
int |
sideEffects()
Return an indication of the side effects execution of this CFG node may cause. |
Expr |
singleDefUse()
Return the single def-use link or null if there are more than one or none. |
void |
specifyPredicate(Expr predicate,
boolean onTrue)
Specify predicate for this operation. |
java.lang.String |
toStringSpecial()
Return a String containing additional information about this class instance. |
void |
validate()
Check this node for validity. |
void |
visit(Predicate p)
Process a node by calling its associated routine. |
Methods inherited from class scale.score.chords.SequentialChord |
---|
changeOutCfgEdge, clearEdge, clearEdgeMarkers, deleteOutCfgEdges, edgeMarked, getNextChord, getOutCfgEdge, getOutCfgEdgeArray, getTarget, indexOfOutCfgEdge, isLastInBasicBlock, isSequential, linkSubgraph, linkTo, markEdge, numOutCfgEdges, pushAllOutCfgEdges, pushOutCfgEdges, pushOutCfgEdges, pushSortedOutCfgEdges, pushSortedOutCfgEdges, replaceOutCfgEdge, setTarget, setTargetUnsafe |
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 ExprChord(Expr lhs, Expr rhs, Chord next)
lhs
- is the target of the assignment or null
rhs
- is the source expression for the assignment or null
next
- is the out-going CFG edge and may be nullpublic ExprChord(Expr rhs, Chord next)
rhs
- is the source expression or null
next
- is the out-going CFG edge and may be nullpublic ExprChord(Expr rhs)
rhs
- is the source expression or null
public ExprChord(Expr lhs, Expr rhs)
lhs
- is the target of the assignment or null
rhs
- is the source expression for the assignment or null
public ExprChord(Expr lhs, Expr rhs, Expr predicate, boolean onTrue)
lhs
- is the target of the assignment or null
rhs
- is the source expression for the assignment or null
predicate
- pecifies the predicate expressiononTrue
- is true if the operation is enabled if onTrue is true and the
predicate value is non-zero or onTrue is false and the predicate value is zeroMethod Detail |
---|
public final boolean isExprChord()
isExprChord
in class Chord
public final Expr[] getInDataEdgeArray()
getInDataEdgeArray
in class Chord
public final void deleteInDataEdges()
deleteInDataEdges
in class SequentialChord
public final Expr getInDataEdge(int i)
getInDataEdge
in class Chord
public final int numInDataEdges()
numInDataEdges
in class Chord
public void pushInDataEdges(Stack<Expr> wl)
pushInDataEdges
in class Chord
public Chord copy()
Chord
copy
in class Chord
public java.lang.String toStringSpecial()
toStringSpecial
in class Chord
public final boolean isAssignChord()
isAssignChord
in class Chord
public final void setLValue(Expr lhs)
public final void setRValue(Expr rhs)
public final Expr getLValue()
null
.
public final Expr getRValue()
null
.
public final void changeInDataEdge(Expr oldExpr, Expr newExpr)
This method ensures that the node previously pointing to this one is updated properly, as well as, the node which will now point to this node.
Expr and Chord nodes have a fixed number of incoming edges with specific meaning applied to each.
changeInDataEdge
in class Chord
oldExpr
- is the expression to be replacednewExpr
- is the new expressionpublic 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 final Vector<Declaration> getDeclList()
declarations
referenced in this CFG node or null
.
getDeclList
in class SequentialChord
public final Vector<LoadExpr> getLoadExprList()
LoadExpr
instances in this CFG node or null
.
getLoadExprList
in class SequentialChord
public final Vector<Expr> getExprList()
Expr
instances
in this CFG node or null
.
getExprList
in class SequentialChord
public final boolean replaceDecl(Declaration oldDecl, Declaration newDecl)
Declaration
with another Declaration
.
replaceDecl
in class SequentialChord
public final CallExpr getCall(boolean ignorePure)
call expression
or
null
if none.
getCall
in class Chord
ignorePure
- is true if pure function calls are to be ignored.public void validate()
validate
in class Note
public void recordRefs(References refs)
table of references
.
recordRefs
in class Chord
public void removeRefs(References refs)
table of references
.
removeRefs
in class Chord
public int executionCostEstimate()
executionCostEstimate
in class SequentialChord
public int sideEffects()
Expr.SE_NONE
public final void addDefUse(LoadExpr expr)
expr
- the new use-def linkpublic final void removeDefUse(LoadExpr expr)
expr
- the existing use-def linkpublic final Expr singleDefUse()
public int numDefUseLinks()
public final LoadExpr getDefUse(int i)
getDefUseArray
if
the def-use links will be modified while iterating over them.
public final LoadExpr[] getDefUseArray()
public final boolean checkDefUse(Expr use)
public void addMayDef(MayDef mayDef)
mayDef
- the may definition info.public MayDef getMayDef()
public void removeUseDef()
removeUseDef
in class SequentialChord
public boolean isDefined(Expr lv)
lv
- the expression we're checking
public Expr getDefExpr()
Expr
instance that
specifies the variable.
getDefExpr
in class Chord
public void printDefUse()
public final Expr getPredicate()
public final Expr removePredication()
public final void specifyPredicate(Expr predicate, boolean onTrue)
public final boolean predicatedOnTrue()
public final void setVaCopy()
public final boolean isVaCopy()
public boolean removeDualExprs()
DualExpr
instances
from this CFG node. Use the lower form. This eliminates
references to variables that may no longer be needed.
removeDualExprs
in class Chord
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |