coins.backend
クラス Module

java.lang.Object
  |
  +--coins.backend.Module

public class Module
extends java.lang.Object

Represent module, the whole input of the compiler.


フィールドの概要
(パッケージプライベート) static java.lang.String DEFAULT_CONVENTION
           
(パッケージプライベート) static java.lang.String DEFAULT_TARGET
           
 BiList elements
          List of functions/data
 SymTab globalSymtab
          Global symbol table
 java.lang.String name
          Module name
 LirFactory newLir
          LirNode factory object
 Root root
          Collection of global variables
 TargetMachine targetMachine
          Target Machine
 
コンストラクタの概要
Module(java.lang.Object sexp, Root root)
          Create a module
Module(java.lang.Object sexp, java.lang.String targetName, java.lang.String convention, Root root)
          Create a module
 
メソッドの概要
 void addData(Symbol sym, LirNode value)
          Add new DATA object.
 Symbol addSymbol(java.lang.String name, int storage, int type, int boundary, java.lang.String segment, java.lang.String linkage, ImList opt)
          Add global symbol
 void apply(BiList transList)
          Apply transformations listed in the transList.
 void apply(ImList transList)
          Apply transformations listed in the transList.
 void apply(LocalAnalyzer analyzer)
          Apply some analysis on each function
 void apply(java.lang.Object trans)
          Apply transformation (generic form).
 void apply(java.lang.Object[] transVector)
          Apply transformations listed in the transVector.
 void apply(java.lang.String hook)
          Apply transformation assigned to Hook.
 void apply(Transformer xformer)
          Apply tranformation on module without argument.
 void apply(Transformer xformer, ImList args)
          Do some transform(or optimization) on each function with trace dump.
 void basicOptimization()
          Do basic optimizations.
 Symbol constToData(LirNode value)
          Convert immediate constant (INTCONST/FLOATCONST) to DATA component.
static void doCompile(ImList sexp, java.lang.String targetName, java.lang.String convention, Root root)
          Compile S-expression LIR.
(パッケージプライベート)  void doData(ImList node)
          Parse DATA node
 long elapsedTime()
          Return elapsed time since module created.
 void generateCode()
          Write machine code.
 void generateCode(java.io.OutputStream codeStream)
          Write machine code to codeStream
 void generateCodeWith(java.lang.Object trans)
          Write machine code with specific transformers.
 void generateCodeWith(java.io.OutputStream codeStream, java.lang.Object trans)
          Write machine code to codeStream with specific transformers.
 int genSymbolId()
          Generate new symbol's id
 int getCurrentLineNo()
          Return current line number.
 Symbol getSymbol(java.lang.String name)
          Find symbol whose name is name in this context.
static Module loadSLir(ImList sexp, java.lang.String targetName, java.lang.String convention, Root root)
          Convert LIR S-expression LIR to internal form and convert frame variables into register ones.
 Label lookupLabel(java.lang.String internalName)
          Look up label by final name.
 Label newLabel()
          Create new label instance with final name and return it.
 void printIt(java.io.PrintWriter out)
          Print current module status
 void printIt(java.io.PrintWriter out, LocalAnalyzer[] anals)
          Print current module status with analyses
 void printStandardForm(java.io.PrintWriter out)
          Print L-module in standard form.
 void renameLabelToFinal(Label label)
          Rename existing label to final name.
 void require(LocalAnalyzer analyzer)
          Require some analysis for each function
 void setAsmOut(java.io.OutputStream codeStream)
          Specify assembler output stream.
 int symbolIdBound()
          Return maximum symbol id plus 1.
 java.lang.Object toSexp()
          Convert to S-expression LIR format.
 java.lang.String toString()
          Return string representation of this object.
 
クラス java.lang.Object から継承したメソッド
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

フィールドの詳細

DEFAULT_TARGET

static final java.lang.String DEFAULT_TARGET
関連項目:
定数フィールド値

DEFAULT_CONVENTION

static final java.lang.String DEFAULT_CONVENTION
関連項目:
定数フィールド値

name

public final java.lang.String name
Module name


globalSymtab

public final SymTab globalSymtab
Global symbol table


elements

public final BiList elements
List of functions/data


root

public final Root root
Collection of global variables


targetMachine

public final TargetMachine targetMachine
Target Machine


newLir

public final LirFactory newLir
LirNode factory object

コンストラクタの詳細

Module

public Module(java.lang.Object sexp,
              Root root)
       throws SyntaxErrorException
Create a module


Module

public Module(java.lang.Object sexp,
              java.lang.String targetName,
              java.lang.String convention,
              Root root)
       throws SyntaxErrorException
Create a module

メソッドの詳細

getCurrentLineNo

public int getCurrentLineNo()
Return current line number.


addSymbol

public Symbol addSymbol(java.lang.String name,
                        int storage,
                        int type,
                        int boundary,
                        java.lang.String segment,
                        java.lang.String linkage,
                        ImList opt)
Add global symbol


doData

void doData(ImList node)
      throws SyntaxError
Parse DATA node

SyntaxError

addData

public void addData(Symbol sym,
                    LirNode value)
Add new DATA object.


lookupLabel

public Label lookupLabel(java.lang.String internalName)
Look up label by final name.


newLabel

public Label newLabel()
Create new label instance with final name and return it.


renameLabelToFinal

public void renameLabelToFinal(Label label)
Rename existing label to final name.


genSymbolId

public int genSymbolId()
Generate new symbol's id


symbolIdBound

public int symbolIdBound()
Return maximum symbol id plus 1.


getSymbol

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


apply

public void apply(LocalAnalyzer analyzer)
Apply some analysis on each function


require

public void require(LocalAnalyzer analyzer)
Require some analysis for each function


apply

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


apply

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


apply

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


apply

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


apply

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


apply

public void apply(Transformer xformer)
Apply tranformation on module without argument.


apply

public void apply(Transformer xformer,
                  ImList args)
Do some transform(or optimization) on each function with trace dump.


constToData

public Symbol constToData(LirNode value)
Convert immediate constant (INTCONST/FLOATCONST) to DATA component.

パラメータ:
value - constant node to be converted
戻り値:
Symbol entry

printStandardForm

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


printIt

public void printIt(java.io.PrintWriter out)
Print current module status


printIt

public void printIt(java.io.PrintWriter out,
                    LocalAnalyzer[] anals)
Print current module status with analyses


toString

public java.lang.String toString()
Return string representation of this object.

オーバーライド:
クラス java.lang.Object 内の toString

toSexp

public java.lang.Object toSexp()
Convert to S-expression LIR format.


doCompile

public static void doCompile(ImList sexp,
                             java.lang.String targetName,
                             java.lang.String convention,
                             Root root)
                      throws SyntaxErrorException
Compile S-expression LIR.

SyntaxErrorException

loadSLir

public static Module loadSLir(ImList sexp,
                              java.lang.String targetName,
                              java.lang.String convention,
                              Root root)
                       throws SyntaxErrorException
Convert LIR S-expression LIR to internal form and convert frame variables into register ones.

SyntaxErrorException

basicOptimization

public void basicOptimization()
Do basic optimizations.


setAsmOut

public void setAsmOut(java.io.OutputStream codeStream)
Specify assembler output stream.


generateCode

public void generateCode(java.io.OutputStream codeStream)
Write machine code to codeStream


generateCodeWith

public void generateCodeWith(java.io.OutputStream codeStream,
                             java.lang.Object trans)
Write machine code to codeStream with specific transformers.


generateCode

public void generateCode()
Write machine code.


generateCodeWith

public void generateCodeWith(java.lang.Object trans)
Write machine code with specific transformers.


elapsedTime

public long elapsedTime()
Return elapsed time since module created.