scale.score.chords
Class PhiExprChord

java.lang.Object
  extended by scale.common.Root
      extended by scale.score.Note
          extended by scale.score.chords.Chord
              extended by scale.score.chords.SequentialChord
                  extended by scale.score.chords.ExprChord
                      extended by scale.score.chords.PhiExprChord
All Implemented Interfaces:
AnnotationInterface, DisplayNode

public class PhiExprChord
extends ExprChord

This class is used to represent a node in a CFG that contains a PhiExpr expression.

$Id: PhiExprChord.java,v 1.29 2007-10-04 19:58:23 burrill Exp $

Copyright 2007 by the Scale Compiler Group,
Department of Computer Science
University of Massachusetts,
Amherst MA. 01003, USA
All Rights Reserved.

See Also:
PhiExpr

Field Summary
 
Fields inherited from class scale.score.chords.Chord
lineNumber
 
Constructor Summary
PhiExprChord(Expr rhs)
          Create a node that holds a computation.
PhiExprChord(Expr rhs, Chord next)
          Create a node that holds a computation.
PhiExprChord(Expr lhs, Expr rhs)
          Create a node that holds a computation.
PhiExprChord(Expr lhs, Expr rhs, Chord next)
          Create a node that holds a Phi function computation.
 
Method Summary
 Chord copy()
          Make a copy of this CFG node with the same out-going CFG edges.
static int created()
          Return the number of instances of this class that were created.
 DColor getDisplayColorHint()
          Return a String specifying the color to use for coloring this node in a graphical display.
 PhiExpr getPhiFunction()
          Return the Phi function of this Chord.
 boolean isPhiExpr()
          Return true if this chord is a PhiExprChord.
 boolean isSpecial()
          Return true if this is chord was added for the convenience of the compiler and does not correspond to actual source code in the user program.
 void visit(Predicate p)
          Process a node by calling its associated routine.
 
Methods inherited from class scale.score.chords.ExprChord
addDefUse, addMayDef, changeInDataEdge, checkDefUse, deleteInDataEdges, executionCostEstimate, getCall, getDeclList, getDefExpr, getDefUse, getDefUseArray, getExprList, getInDataEdge, getInDataEdgeArray, getLoadExprList, getLValue, getMayDef, getPredicate, getRValue, isAssignChord, isDefined, isExprChord, isVaCopy, numDefUseLinks, numInDataEdges, predicatedOnTrue, printDefUse, pushInDataEdges, recordRefs, removeDefUse, removeDualExprs, removePredication, removeRefs, removeUseDef, replaceDecl, setLValue, setRValue, setVaCopy, sideEffects, singleDefUse, specifyPredicate, toStringSpecial, validate
 
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.chords.Chord
addInCfgEdge, changeParentOutCfgEdge, copySourceLine, deadCFGNodes, deletedCFGNodes, deleteInCfgEdge, executionOrder, expungeFromCfg, extractFromCfg, findLoopExit, findPhiChords, firstInBasicBlock, getDisplayLabel, getDisplayShapeHint, getFirstInCfgEdge, getInCfgEdge, getInCfgEdge, getInCfgEdgeArray, getLabel, getLoopHeader, getLoopHeader, getLoopNumber, getSourceLineNumber, gotoCFGNodes, inBasicBlock, indexOfInCfgEdge, insertAfterOutCfg, insertBeforeInCfg, isBranch, isFirstInBasicBlock, isLoopExit, isLoopHeader, isLoopPreHeader, isLoopTail, isMarker, lastInBasicBlock, loopClean, nextVisit, nthIndexOfInCfgEdge, nullCFGNodes, numInCfgEdges, numOfInCfgEdge, parentsFinished, parentsVisited, pushAllInCfgEdges, pushChordWhenReady, pushChordWhenReady, pushInCfgEdges, pushInCfgEdges, removeDeadCode, removeFromCfg, reorderInCfgEdgesOfCopy, replaceInCfgEdge, setLabel, setSourceLineNumber, setVisited, unlinkChord, visited
 
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

PhiExprChord

public PhiExprChord(Expr lhs,
                    Expr rhs,
                    Chord next)
Create a node that holds a Phi function computation.

Parameters:
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 null

PhiExprChord

public PhiExprChord(Expr rhs,
                    Chord next)
Create a node that holds a computation.

Parameters:
rhs - is the source expression or null
next - is the out-going CFG edge and may be null

PhiExprChord

public PhiExprChord(Expr rhs)
Create a node that holds a computation.

Parameters:
rhs - is the source expression or null

PhiExprChord

public PhiExprChord(Expr lhs,
                    Expr rhs)
Create a node that holds a computation.

Parameters:
lhs - is the target of the assignment or null
rhs - is the source expression for the assignment or null
Method Detail

created

public static int created()
Return the number of instances of this class that were created.


copy

public Chord copy()
Description copied from class: Chord
Make a copy of this CFG node with the same out-going CFG edges. The validity of the CFG graph is maintained.

Overrides:
copy in class ExprChord
Returns:
a copy of this node

getPhiFunction

public PhiExpr getPhiFunction()
Return the Phi function of this Chord.


isSpecial

public boolean isSpecial()
Return true if this is chord was added for the convenience of the compiler and does not correspond to actual source code in the user program.

Overrides:
isSpecial in class Chord

isPhiExpr

public final boolean isPhiExpr()
Return true if this chord is a PhiExprChord.

Overrides:
isPhiExpr in class Chord

visit

public void visit(Predicate p)
Description copied from class: Note
Process a node by calling its associated routine. See the "visitor" design pattern in Design Patterns: Elements of Reusable Object-Oriented Software by E. Gamma, et al, Addison Wesley, ISBN 0-201-63361-2.

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.

Overrides:
visit in class ExprChord
See Also:
Predicate

getDisplayColorHint

public DColor getDisplayColorHint()
Return a String specifying the color to use for coloring this node in a graphical display.

Specified by:
getDisplayColorHint in interface DisplayNode
Overrides:
getDisplayColorHint in class Chord
See Also:
DColor