|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectharpoon.ClassFile.HCode<Instr>
harpoon.IR.Assem.Code
public abstract class Code
IR.Assem.Code
is an abstract superclass of codeviews
which use Instr
s.
Nested Class Summary |
---|
Nested classes/interfaces inherited from class harpoon.ClassFile.HCode |
---|
HCode.PrintCallback<HCE extends HCodeElement> |
Nested classes/interfaces inherited from interface harpoon.Util.Collections.Graph |
---|
Graph.Edge<N extends Graph.Node<N,E>,E extends Graph.Edge<N,E>>, Graph.Node<N extends Graph.Node<N,E>,E extends Graph.Edge<N,E>> |
Field Summary | |
---|---|
protected Frame |
frame
The Frame associated with this codeview. |
protected InstrFactory |
inf
Instruction factory. |
protected Instr |
instrs
The root Instr of the Instrs composing this code view. |
protected HMethod |
parent
The method that this code view represents. |
Constructor Summary | |
---|---|
protected |
Code(HMethod parent,
Frame frame)
constructor. |
protected |
Code(HMethod parent,
Frame frame,
String codeName)
constructor. |
Method Summary | |
---|---|
ArrayFactory<Instr> |
elementArrayFactory()
Returns an array factory to create the instruction elements of this codeview. |
static String |
formatCommentedInstr(String exec,
String orig)
Returns an assembly code String version of exec
with orig in the comments for exec . |
Derivation |
getDerivation()
Returns the Derivation associated with
this . |
Iterator<Instr> |
getElementsI()
Returns an Iterator over the instructions in this
codeview. |
Frame |
getFrame()
|
InstrFactory |
getInstrFactory()
Allows access to the InstrFactory used by this codeview. |
Instr[] |
getLeafElements()
Return the 'leaves' of this code view; that is, the elements with no successors. |
HMethod |
getMethod()
Return the HMethod to which this HCode
belongs. |
abstract String |
getRegisterName(Instr i,
Temp val,
String suffix)
Returns an assembly code identifier for the register that val will be stored into. |
Instr |
getRootElement()
Return the 'root' element of this code view. |
void |
myPrint(PrintWriter apw,
boolean assem)
Simple wrapper around myPrint passing a nop PrintCallback. |
protected void |
myPrint(PrintWriter apw,
boolean assem,
boolean annotateID,
HCode.PrintCallback<Instr> callback)
Deprecated. Use Code#myPrint(PrintWriter,boolean,PrintCallback) |
protected void |
myPrint(PrintWriter pw,
boolean assem,
HCode.PrintCallback<Instr> callback)
Displays the assembly instructions of this codeview. |
Set<Instr> |
nodes()
Return the set of nodes comprising this Graph. |
void |
print()
Prints the assembly instructions of this to
System.out. |
void |
print(PrintWriter pw,
HCode.PrintCallback<Instr> callback)
Prints the assembly instructions of this to
pw . |
String |
toAssem(Instr instr)
Produces an assembly code string for instr . |
Methods inherited from class harpoon.ClassFile.HCode |
---|
clone, clone, elementIndexer, getElements, getElementsL, getName, print, toString |
Methods inherited from class java.lang.Object |
---|
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
protected HMethod parent
protected Instr instrs
protected final InstrFactory inf
protected final Frame frame
Constructor Detail |
---|
protected Code(HMethod parent, Frame frame, String codeName)
protected Code(HMethod parent, Frame frame)
Method Detail |
---|
public HMethod getMethod()
HCode
HMethod
to which this HCode
belongs.
getMethod
in class HCode<Instr>
public Instr getRootElement()
HCode
getRootElement
in class HCode<Instr>
null
if this notion
is not applicable.public Instr[] getLeafElements()
HCode
getLeafElements
in class HCode<Instr>
null
if this notion
is not applicable.public Iterator<Instr> getElementsI()
Iterator
over the instructions in this
codeview.
getElementsI
in class HCode<Instr>
Instr
s
making up this code view. The root Instr is
the first element in the iteration.public ArrayFactory<Instr> elementArrayFactory()
elementArrayFactory
in class HCode<Instr>
public Set<Instr> nodes()
Graph
nodes
in interface Graph<Instr,InstrEdge>
public InstrFactory getInstrFactory()
public Frame getFrame()
public void print()
this
to
System.out.
HCode.print(java.io.PrintWriter)
public void print(PrintWriter pw, HCode.PrintCallback<Instr> callback)
this
to
pw
. Default implementation is just a wrapper
call to myPrint(pw, true, false)
, which turns
each Instr into its architecture specific assembly format and
omits Instr ID number information.
print
in class HCode<Instr>
public final void myPrint(PrintWriter apw, boolean assem)
protected final void myPrint(PrintWriter apw, boolean assem, boolean annotateID, HCode.PrintCallback<Instr> callback)
pw
- The PrintWriter to send the formatted output to.assem
- If true, uses toAssem(Instr)
to
convert Instrs to assembly form. Else just calls
Instr.toString()
.annotateID
- If true, prints out the ID for each Instr
before printing the Instr itself.toAssem(harpoon.IR.Assem.Instr)
protected final void myPrint(PrintWriter pw, boolean assem, HCode.PrintCallback<Instr> callback)
pw
- The PrintWriter to send the formatted output to.assem
- If true, uses toAssem(Instr)
to
convert Instrs to assembly form. Else just calls
Instr.toString()
.toAssem(harpoon.IR.Assem.Instr)
public String toAssem(Instr instr)
instr
.
Uses getRegisterName() to do register name string mapping.
public Derivation getDerivation()
Derivation
associated with
this
. Returns null
if
Derivation
information is not available.
public abstract String getRegisterName(Instr i, Temp val, String suffix)
val
will be stored into.
public static String formatCommentedInstr(String exec, String orig)
exec
with orig
in the comments for exec
.
exec
and orig
have the same number of lines
exec
,
let lo be the next line of orig
;
s += (le + " @" + lo)
return s
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |