|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectscale.common.Root
scale.score.Note
scale.score.chords.Chord
scale.score.chords.SequentialChord
scale.score.chords.LoopInitChord
public class LoopInitChord
This class is used to mark the beginning of the initialization for a loop.
$Id: LoopInitChord.java,v 1.7 2006-02-28 16:37:08 burrill Exp $
Copyright 2005 by the Scale Compiler Group,
Department of Computer Science
University of Massachusetts,
Amherst MA. 01003, USA
All Rights Reserved.
This class represents a non-action. No code is generated for this node.
We need to mark the beginning of the loop initialization in order to perform operations such as loop interchange. Using the actual initialization operations is unreliable because they may be eliminated by optimizations such as copy propagation.
The LoopInitChord is inserted for explicit loops (e.g., do
and for loops) and implicit loops (created by goto
statements). For implicit loops, the initializations will be before
the LoopInitChord instance. Even for explicit loops there
is still a problem. Consider
k = 0;
for (; k < n; k++) { ... }
In this case the LoopInitChord instance will be inserted
before the actual loop induction variable initialization. Thus, the loop
transformation optimizations must also check to see that everything, upon
which the initialization of every induction variable depends, occurs after the
LoopInitChord instance.
LoopHeaderChord,
LoopPreHeaderChord,
LoopExitChord,
LoopTailChord| Field Summary |
|---|
| Fields inherited from class scale.score.chords.Chord |
|---|
lineNumber |
| Constructor Summary | |
|---|---|
LoopInitChord()
|
|
LoopInitChord(Chord next)
|
|
| Method Summary | |
|---|---|
Chord |
copy()
Make a copy of this CFG node with the same out-going CFG edges. |
DColor |
getDisplayColorHint()
Return a String specifying the color to use for coloring this node in a graphical display. |
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.Note |
|---|
getChord, getEssentialUse, setAnnotationLevel, setReportLevel, toString, validate |
| 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 LoopInitChord(Chord next)
public LoopInitChord()
| Method Detail |
|---|
public Chord copy()
Chord
copy in class Chordpublic boolean isSpecial()
isSpecial in class Chordpublic 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 NotePredicatepublic DColor getDisplayColorHint()
getDisplayColorHint in interface DisplayNodegetDisplayColorHint in class ChordDColor
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||