coins.backend
Class Function

java.lang.Object
  extended bycoins.backend.ModuleElement
      extended bycoins.backend.Function

public class Function
extends ModuleElement

Represent a function.


Field Summary
static int FORM_NORMAL
          Form Status: FORM_NORMAL, FORM_SSA, FORM_SSA2
static int FORM_SSA
           
static int FORM_SSA2
           
 SymTab localSymtab
          Local symbol table
 LirFactory newLir
          Factory object for creating LirNode
 LirNode origEpilogue
          Original epilogue instruction.
 LirNode origPrologue
          Original prologue instruction.
static coins.backend.Function.ToCFG toCFG
          Launcher object for CFG transformation.
static coins.backend.Function.ToLinear toLinear
          Transform to linear (non-CFG).
static LocalTransformer toMachineCodeTrig
          Transformer which converts a function to machine instructions.
 
Fields inherited from class coins.backend.ModuleElement
module, root, sourceLineNo, symbol
 
Constructor Summary
Function(Module module, ImList ptr)
          Parse S-expression function description and convert to internal form
 
Method Summary
 Symbol addSymbol(java.lang.String name, int storage, int type, int boundary, int offset, ImList opt)
          Add local symbol
 Symbol addSymbol(Symbol original, int type)
          Add temporary symbol
 boolean apply(BiList transList)
          Apply transformations listed in the transList.
 boolean apply(ImList transList)
          Apply transformations listed in the transList.
 LocalAnalysis apply(LocalAnalyzer analyzer)
          Apply some analysis
 boolean apply(LocalTransformer xformer)
          Apply some transformation/optimization.
 boolean apply(LocalTransformer xformer, ImList args)
          Apply some transformation/optimization with argument.
 boolean apply(java.lang.Object trans)
          Apply transformation (generic form).
 boolean apply(java.lang.Object[] transVector)
          Apply transformations listed in the transVector.
 boolean apply(java.lang.String hook)
          Apply transformation assigned to Hook.
 BiList firstInstrList()
          Return first instruction block.
 FlowGraph flowGraph()
          Return Control flow graph of this L-function.
 int form()
          Get form
 int frameSize()
          Return frame size of this function (value is positive).
 Symbol getSymbol(java.lang.String name)
          Find symbol whose name is name.
 Label internLabel(java.lang.String name)
          Install new label whose name is name to this function.
 BiList lirList()
          Return Instruction list of this L-function.
 LirNode newFrame(java.lang.String name, int type)
          Create new frame variable.
 Label newLabel()
          Generate new label and return it.
 LirNode newReg(java.lang.String name, int type)
          Create new named register variable.
 LirNode newTemp(int type)
          Create new temporary register variable.
 void printIt(java.io.PrintWriter out)
          Print for debugging.
 void printIt(java.io.PrintWriter out, LocalAnalysis[] anals)
          Dump internal data structure of the Function with some analyses.
 void printIt(java.io.PrintWriter out, LocalAnalyzer[] anals)
          Dump internal data structure of the Function with some analyses.
 void printStandardForm(java.io.PrintWriter out)
          Print L-function in standard form.
 void purgeAnalysis()
          Purge former analysis
 void reload(ImList ptr)
          Reload new L-function description from sexp.
 LocalAnalysis require(LocalAnalyzer analyzer)
          Require analysis.
 void reserveLabelVariantNo(int variant)
          Reserve label variant number variant.
 void setForm(int form)
          Set form
 Symbol[] symVector()
          Return vector of symbols visible from this function.
 int timeStamp()
          Return this function's version number.
 java.lang.Object toSexp()
          Convert to external LIR format.
 java.lang.String toString()
           
 void touch()
          Notify this function having been modified.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

newLir

public final LirFactory newLir
Factory object for creating LirNode


localSymtab

public final SymTab localSymtab
Local symbol table


origPrologue

public final LirNode origPrologue
Original prologue instruction.


origEpilogue

public final LirNode origEpilogue
Original epilogue instruction.


FORM_NORMAL

public static final int FORM_NORMAL
Form Status: FORM_NORMAL, FORM_SSA, FORM_SSA2

See Also:
Constant Field Values

FORM_SSA

public static final int FORM_SSA
See Also:
Constant Field Values

FORM_SSA2

public static final int FORM_SSA2
See Also:
Constant Field Values

toCFG

public static coins.backend.Function.ToCFG toCFG
Launcher object for CFG transformation.


toLinear

public static coins.backend.Function.ToLinear toLinear
Transform to linear (non-CFG).


toMachineCodeTrig

public static final LocalTransformer toMachineCodeTrig
Transformer which converts a function to machine instructions.

Constructor Detail

Function

public Function(Module module,
                ImList ptr)
         throws SyntaxError
Parse S-expression function description and convert to internal form

Method Detail

firstInstrList

public BiList firstInstrList()
Return first instruction block.


reload

public void reload(ImList ptr)
            throws SyntaxError
Reload new L-function description from sexp.

Throws:
SyntaxError

flowGraph

public FlowGraph flowGraph()
Return Control flow graph of this L-function. If L-function is not in CFG, changed to CFG automatically.


lirList

public BiList lirList()
Return Instruction list of this L-function. If L-function is in CFG mode, changed to non-CFG automatically.


newLabel

public Label newLabel()
Generate new label and return it.


internLabel

public Label internLabel(java.lang.String name)
                  throws SyntaxError
Install new label whose name is name to this function. If null is given, generate new unique label.

Throws:
SyntaxError

reserveLabelVariantNo

public void reserveLabelVariantNo(int variant)
Reserve label variant number variant.


addSymbol

public Symbol addSymbol(java.lang.String name,
                        int storage,
                        int type,
                        int boundary,
                        int offset,
                        ImList opt)
Add local symbol


addSymbol

public Symbol addSymbol(Symbol original,
                        int type)
Add temporary symbol


getSymbol

public Symbol getSymbol(java.lang.String name)
Find symbol whose name is name.


symVector

public Symbol[] symVector()
Return vector of symbols visible from this function.


frameSize

public int frameSize()
Return frame size of this function (value is positive).


newTemp

public LirNode newTemp(int type)
Create new temporary register variable.


newReg

public LirNode newReg(java.lang.String name,
                      int type)
Create new named register variable.


newFrame

public LirNode newFrame(java.lang.String name,
                        int type)
Create new frame variable.


setForm

public void setForm(int form)
Set form


form

public int form()
Get form


timeStamp

public int timeStamp()
Return this function's version number.


touch

public void touch()
Notify this function having been modified.


purgeAnalysis

public void purgeAnalysis()
Purge former analysis


apply

public LocalAnalysis apply(LocalAnalyzer analyzer)
Apply some analysis


require

public LocalAnalysis require(LocalAnalyzer analyzer)
Require analysis.


apply

public boolean apply(java.lang.Object trans)
Apply transformation (generic form).


apply

public boolean apply(java.lang.String hook)
Apply transformation assigned to Hook.


apply

public boolean apply(ImList transList)
Apply transformations listed in the transList.


apply

public boolean apply(BiList transList)
Apply transformations listed in the transList.


apply

public boolean apply(java.lang.Object[] transVector)
Apply transformations listed in the transVector.


apply

public boolean apply(LocalTransformer xformer)
Apply some transformation/optimization.


apply

public boolean apply(LocalTransformer xformer,
                     ImList args)
Apply some transformation/optimization with argument.


toSexp

public java.lang.Object toSexp()
Convert to external LIR format.

Specified by:
toSexp in class ModuleElement

printStandardForm

public void printStandardForm(java.io.PrintWriter out)
Print L-function in standard form.

Specified by:
printStandardForm in class ModuleElement

printIt

public void printIt(java.io.PrintWriter out)
Description copied from class: ModuleElement
Print for debugging.

Specified by:
printIt in class ModuleElement

printIt

public void printIt(java.io.PrintWriter out,
                    LocalAnalyzer[] anals)
Dump internal data structure of the Function with some analyses.

Specified by:
printIt in class ModuleElement

printIt

public void printIt(java.io.PrintWriter out,
                    LocalAnalysis[] anals)
Dump internal data structure of the Function with some analyses.


toString

public java.lang.String toString()