coins.lir2c
Class Convert

java.lang.Object
  extended bycoins.lir2c.Convert

public class Convert
extends java.lang.Object

Convert: converts LirNode to C code. a node of LirNode is converted to a line of C code (excepts "switch" sentence).


Constructor Summary
Convert()
          Constructor(with no arg)
 
Method Summary
(package private)  java.lang.String biOpToStr(LirNode node, LirNode child1, LirNode child2, java.lang.String Ope, boolean inMEM, LirNode parent)
          biOpToStr: get the expression of C code for bi Operator node(ADD,etc).
(package private)  java.lang.String dump(LirNode node, boolean inMEM, LirNode parent)
          dump: main method of the convertion.
 java.lang.String invoke(LirNode node)
          invoke: the method that you should call it first.
(package private)  java.lang.String lirToTypeStr(LirNode node)
          lirToTypeStr: get type string of the variable, expression, etc by calling coins.backend.Type@toString() method.
(package private)  java.lang.String lirToTypeStr2(LirNode node)
          lirToTypeStr2: get type string of the variable, expression, etc by calling coins.backend.Type@toString() method.
(package private)  java.lang.String lirToTypeStr3(LirNode node)
          lirToTypeStr3: get type string and parenthes of the variable, expression, etc by calling coins.backend.Type@toString() method.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Convert

public Convert()
Constructor(with no arg)

Method Detail

invoke

public java.lang.String invoke(LirNode node)
invoke: the method that you should call it first.

Parameters:
node - the root node that will convert to C code.
Returns:
the C string of lir nodes.

dump

java.lang.String dump(LirNode node,
                      boolean inMEM,
                      LirNode parent)
dump: main method of the convertion. it called by invoke method and dump method(dump method calls dump method recursively).

Parameters:
node - the node that will convert to a part of C code.
inMEM - the boolean value which node are in MEM expression.
parent - the node that is a parent of the node.
Returns:
the string that is a part of C code.

lirToTypeStr

java.lang.String lirToTypeStr(LirNode node)
lirToTypeStr: get type string of the variable, expression, etc by calling coins.backend.Type@toString() method. note: aggregate objects do not support.

Parameters:
node - the node to get the type string.
Returns:
the type string of LirNode.

lirToTypeStr2

java.lang.String lirToTypeStr2(LirNode node)
lirToTypeStr2: get type string of the variable, expression, etc by calling coins.backend.Type@toString() method. note: aggregate objects do not support(return "").

Parameters:
node - the node to get the type string.
Returns:
the type string of LirNode.

lirToTypeStr3

java.lang.String lirToTypeStr3(LirNode node)
lirToTypeStr3: get type string and parenthes of the variable, expression, etc by calling coins.backend.Type@toString() method. note: if the node is aggregate object, return "".

Parameters:
node - the node to get the type string.
Returns:
the type string and parenthes of LirNode.

biOpToStr

java.lang.String biOpToStr(LirNode node,
                           LirNode child1,
                           LirNode child2,
                           java.lang.String Ope,
                           boolean inMEM,
                           LirNode parent)
biOpToStr: get the expression of C code for bi Operator node(ADD,etc).

Parameters:
node - the node to convert.
child1 - the node of first child node.
child2 - the node of second child node.
inMEM - the node that is in the MEM expression is true, or false.
parent - the node that is a parent of the node.
Returns:
the C code for the node.