scale.score.chords
Class ExitChord

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.ExitChord
All Implemented Interfaces:
AnnotationInterface, DisplayNode

public class ExitChord
extends ExprChord

This class represents exit statements.

$Id: ExitChord.java,v 1.20 2006-01-25 19:47:58 burrill Exp $

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

Note, Exit statements may have other statements between them and the EndChord if the user writes the original program that way.


Field Summary
 
Fields inherited from class scale.score.chords.Chord
lineNumber
 
Constructor Summary
ExitChord(Chord next)
           
ExitChord(Chord next, Expr exitValue)
           
 
Method Summary
 Chord copy()
          Make a copy of this CFG node with the same out-going CFG edges.
 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, getDisplayColorHint, getDisplayLabel, getDisplayShapeHint, getFirstInCfgEdge, getInCfgEdge, getInCfgEdge, getInCfgEdgeArray, getLabel, getLoopHeader, getLoopHeader, getLoopNumber, getSourceLineNumber, gotoCFGNodes, inBasicBlock, indexOfInCfgEdge, insertAfterOutCfg, insertBeforeInCfg, isBranch, isFirstInBasicBlock, isLoopExit, isLoopHeader, isLoopPreHeader, isLoopTail, isMarker, isPhiExpr, isSpecial, 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

ExitChord

public ExitChord(Chord next)
Parameters:
next - the next node in the CFG

ExitChord

public ExitChord(Chord next,
                 Expr exitValue)
Parameters:
next - the next node in the CFG
exitValue - is the value passed to the exit
Method Detail

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

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