coins.backend.lir
Class LirFactory

java.lang.Object
  extended bycoins.backend.lir.LirFactory

public class LirFactory
extends java.lang.Object

Generate LIR nodes.


Field Summary
static ImList optUntagged
          &untagged option
 
Constructor Summary
LirFactory(Module module)
           
 
Method Summary
 LirNode decodeDataCompo(ImList node, Module module)
          Parse (DATA) component.
 LirNode decodeLir(java.lang.Object node, Function func, Module mod)
          Convert LIR in ImList to LirNode.
 LirNode evalTree(LirNode tree)
          Fold all constant-expressions in tree.
 LirNode fconst(int type, double value)
          Create FLOATCONST node (short form).
 LirNode fconst(int type, double value, ImList opt)
          Create FLOATCONST node
 LirNode foldConstant(LirNode node)
          Fold constant-expression in a L-exp.
 int getLabelVariant()
          Return new LABEL variant number.
 LirNode iconst(int type, long value)
          Create INTCONST node (short form)
 LirNode iconst(int type, long value, ImList opt)
          Create INTCONST node
 int idBound()
          Return upper bound of LirNode id numbers.
 LirNode labelRef(int opCode, int type, Label label, ImList opt)
          Create LABEL node
 LirNode labelRef(int opCode, int type, Label label, int variant, ImList opt)
          Create LABEL node with variant
 LirNode labelRef(Label label)
          Create LABEL node, short form
 LirNode labelRefVariant(Label label)
          Create LABEL node with variant, short form
 LirNode makeCopy(LirNode inst)
          Make a deep copy of node.
 LirNode makeShallowCopy(LirNode inst)
          Make a shallow copy of node.
 LirNode node(int opCode, int type)
          Create empty operator LirNode (generic name)
 LirNode node(int opCode, int type, double value)
          Create floating point constant LirNode (generic name)
 LirNode node(int opCode, int type, Label label)
          Create label reference LirNode (generic name)
 LirNode node(int opCode, int type, LirNode operand)
          Create unary operator LirNode (generic name)
 LirNode node(int opCode, int type, LirNode[] operands)
          Create n-ary operator LirNode (generic name)
 LirNode node(int opCode, int type, LirNode operand0, LirNode operand1)
          Create binary operator LirNode (generic name)
 LirNode node(int opCode, int type, LirNode operand0, LirNode operand1, LirNode operand2)
          Create ternary operator LirNode (generic name)
 LirNode node(int opCode, int type, long value)
          Create integer constant LirNode (generic name)
 LirNode node(int opCode, int type, Symbol symbol)
          Create symbol reference LirNode (generic name)
 LirNode operator(int opCode, int type, LirNode[] operands, ImList opt)
          Create n-ary operator node
 LirNode operator(int opCode, int type, LirNode operand, ImList opt)
          Create unary operator node
 LirNode operator(int opCode, int type, LirNode operand0, LirNode operand1, ImList opt)
          Create binary operator node
 LirNode operator(int opCode, int type, LirNode operand0, LirNode operand1, LirNode operand2, ImList opt)
          Create ternary operator node
 LirNode operator0(int opCode, int type, LirNode operand)
          Deprecated. use node() instead.
 LirNode operator0(int opCode, int type, LirNode[] operands)
          Deprecated. use node() instead.
 LirNode operator0(int opCode, int type, LirNode operand0, LirNode operand1)
          Deprecated. use node() instead.
 LirNode operator0(int opCode, int type, LirNode operand0, LirNode operand1, LirNode operand2)
          Deprecated. use node() instead.
 LirNode replaceOptions(LirNode inst, ImList newOpt)
          Replace options of LIR node.
 LirNode stringconst(java.lang.String string)
          Create STRING node
 LirNode symRef(int opCode, int type, Symbol symbol, ImList opt)
          Create STATIC/FRAME/REG node
 LirNode symRef(Symbol symbol)
          Create STATIC/FRAME/REG node, short form
 LirNode untaggedIconst(int type, long value)
          Create hidden INTCONST node
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

optUntagged

public static final ImList optUntagged
&untagged option

Constructor Detail

LirFactory

public LirFactory(Module module)
Method Detail

idBound

public int idBound()
Return upper bound of LirNode id numbers.


getLabelVariant

public int getLabelVariant()
Return new LABEL variant number.


stringconst

public LirNode stringconst(java.lang.String string)
Create STRING node


fconst

public LirNode fconst(int type,
                      double value,
                      ImList opt)
Create FLOATCONST node


fconst

public LirNode fconst(int type,
                      double value)
Create FLOATCONST node (short form).


iconst

public LirNode iconst(int type,
                      long value,
                      ImList opt)
Create INTCONST node


iconst

public LirNode iconst(int type,
                      long value)
Create INTCONST node (short form)


untaggedIconst

public LirNode untaggedIconst(int type,
                              long value)
Create hidden INTCONST node


symRef

public LirNode symRef(int opCode,
                      int type,
                      Symbol symbol,
                      ImList opt)
Create STATIC/FRAME/REG node


symRef

public LirNode symRef(Symbol symbol)
Create STATIC/FRAME/REG node, short form


labelRef

public LirNode labelRef(int opCode,
                        int type,
                        Label label,
                        ImList opt)
Create LABEL node


labelRef

public LirNode labelRef(int opCode,
                        int type,
                        Label label,
                        int variant,
                        ImList opt)
Create LABEL node with variant


labelRef

public LirNode labelRef(Label label)
Create LABEL node, short form


labelRefVariant

public LirNode labelRefVariant(Label label)
Create LABEL node with variant, short form


operator

public LirNode operator(int opCode,
                        int type,
                        LirNode operand,
                        ImList opt)
Create unary operator node


operator0

public LirNode operator0(int opCode,
                         int type,
                         LirNode operand)
Deprecated. use node() instead.

Create unary operator node (short form)


operator

public LirNode operator(int opCode,
                        int type,
                        LirNode operand0,
                        LirNode operand1,
                        ImList opt)
Create binary operator node


operator0

public LirNode operator0(int opCode,
                         int type,
                         LirNode operand0,
                         LirNode operand1)
Deprecated. use node() instead.

Create binary operator node (short form)


operator

public LirNode operator(int opCode,
                        int type,
                        LirNode operand0,
                        LirNode operand1,
                        LirNode operand2,
                        ImList opt)
Create ternary operator node


operator0

public LirNode operator0(int opCode,
                         int type,
                         LirNode operand0,
                         LirNode operand1,
                         LirNode operand2)
Deprecated. use node() instead.

Create ternary operator node (short form)


operator

public LirNode operator(int opCode,
                        int type,
                        LirNode[] operands,
                        ImList opt)
Create n-ary operator node


operator0

public LirNode operator0(int opCode,
                         int type,
                         LirNode[] operands)
Deprecated. use node() instead.

Create n-ary operator node (short form)


node

public LirNode node(int opCode,
                    int type,
                    double value)
Create floating point constant LirNode (generic name)


node

public LirNode node(int opCode,
                    int type,
                    long value)
Create integer constant LirNode (generic name)


node

public LirNode node(int opCode,
                    int type,
                    Symbol symbol)
Create symbol reference LirNode (generic name)


node

public LirNode node(int opCode,
                    int type,
                    Label label)
Create label reference LirNode (generic name)


node

public LirNode node(int opCode,
                    int type)
Create empty operator LirNode (generic name)


node

public LirNode node(int opCode,
                    int type,
                    LirNode operand)
Create unary operator LirNode (generic name)


node

public LirNode node(int opCode,
                    int type,
                    LirNode operand0,
                    LirNode operand1)
Create binary operator LirNode (generic name)


node

public LirNode node(int opCode,
                    int type,
                    LirNode operand0,
                    LirNode operand1,
                    LirNode operand2)
Create ternary operator LirNode (generic name)


node

public LirNode node(int opCode,
                    int type,
                    LirNode[] operands)
Create n-ary operator LirNode (generic name)


makeCopy

public LirNode makeCopy(LirNode inst)
Make a deep copy of node. All descendants are copied.


makeShallowCopy

public LirNode makeShallowCopy(LirNode inst)
Make a shallow copy of node. Only top-level node is copyied.


replaceOptions

public LirNode replaceOptions(LirNode inst,
                              ImList newOpt)
Replace options of LIR node.


decodeLir

public LirNode decodeLir(java.lang.Object node,
                         Function func,
                         Module mod)
                  throws SyntaxError
Convert LIR in ImList to LirNode.

Throws:
SyntaxError

decodeDataCompo

public LirNode decodeDataCompo(ImList node,
                               Module module)
                        throws SyntaxError
Parse (DATA) component.

Throws:
SyntaxError

evalTree

public LirNode evalTree(LirNode tree)
Fold all constant-expressions in tree.


foldConstant

public LirNode foldConstant(LirNode node)
Fold constant-expression in a L-exp. node.