|
||||||||||
前のクラス 次のクラス | フレームあり フレームなし | |||||||||
概要: 入れ子 | フィールド | コンストラクタ | メソッド | 詳細: フィールド | コンストラクタ | メソッド |
IR
Intermediate Representation (IR) interface Intermediate representation of programs consists of following kinds of information: High level intermediate representation (HIR) Abstract representation of the logical structure of source programs. Low level intermediate representation (LIR) Abstract representation of computer operations corresponding to the source program. Symbol table Inforamtion of symbols used in the source program and symbols generated by the compiler such as registers, temporals, internal labels. Flow information Control flow, data flow information, loop information, and parallelization information. These components are linked with each other so that various information can be get quickly for optimization and parallelization of the program. The IR interface declares methods that are common between HIR and LIR. By using them, we can make modules that are applicable both to HIR and LIR which implement IR interface. HIR class implements HIR interface and IR interface. LIR class implements LIR interface and IR interface. In HIR, operation is represented by a tree where each of its subtree represents some logical construct of source program mostly language-independent and machine-independent mannar. In LIR, operation is represented by a tree each node of which either represents abstract machine instruction or control information. The abstract machine instructions may represent information specific to a target machine but they take common format so that LIR processing routines can be made common to various target machines. Each subtree has a root node to which other nodes are connected directly or indirectly. A node having one or more children is called nonleaf. A node having no child is called leaf. Each subtree is represented by its root node. A child of the root node (node connected directly to the root node) in a subtree is a source operand of the root node and the root node itself represents the result of the expression represented by the subtree. A subtree can be changed to a sequence of nodes by traversing it in depth-first order from left to right. An LIR subtree representing a machine operation is sometimes called an instruction. Operands of the LIR instruction may be an abstract register or a symbol (such as variable or constant or label) or other instruction subtree. Each node of HIR or LIR has index number to identify it if it represents an executable operation. The index number may be used in procedures analyzing or transforming the program represented either in HIR or LIR for optimization and parallelization. The analysis/transformation procedures can be coded to be applicable both to HIR and LIR by using methods described in this interface. Each node of HIR is attached with HIR type that represents the type of expression represented by the node. The HIR type may be base type defined in this compiler system, or a type defined in the input program or class introduced by input language or defined by the input program. If the node is such one as having no value (neither r-value nore l-value), then null is attached as its data type. Each node of LIR is attached with basic type such as I8, I32, F32, F64, etc. representing the type of the value or address represented by the node. Aggregate data type or class are decomposed into basic types when HIR is transformed into LIR by decomposing aggregates into its elements. Creation of HIR tree can be done by using HIR factory methods (as shown in HIR.java). Creation of LIR instruction sequence can be done by using LIR factory methods.
フィールドの概要 | |
static java.lang.String[] |
OP_CODE_NAME
OP_CODE_NAME Operation code name corresonding to the above operation code. |
static int |
OP_INF
Operation codes for IR node . |
static int |
OP_LIST
Operation codes for IR node . |
static int |
OP_PROG
Operation codes for IR node . |
static int |
OP_SUBP_DEF
Operation codes for IR node . |
メソッドの概要 | |
void |
addInf(java.lang.String pInfnKindInterned,
java.lang.Object pInfObject)
addInf Add (attach) information pInfObject to this IR node. |
IR |
getChild1()
getChild1 Get the first child of this node. |
IR |
getChild2()
getChild2 Get the second child of this node. |
java.lang.Object |
getInf(java.lang.String pInfIdInterned)
getInf Get the information of the kind pInfKindInterned. |
IrList |
getInfList()
getInfList Get the information list attached to this node. |
IR |
getParent()
getParent Get the parent of this node. |
Sym |
getSym()
getSym Get the symbol represented by "this" node if this is a node representing a symbol (simple variable, element/field name, subprogram, label, constant, etc.). |
void |
print(int pIndent)
print Print this subtree in text format traversing all children of this node. |
void |
print(int pIndent,
boolean pDetail)
print Print this subtree in text format traversing all children of this node. |
void |
removeInf(java.lang.String pInfIdInterned)
removeInf Remove the information of the kind pInfKindInterned. |
java.lang.String |
toStringShort()
setChild Set pHir as pNumber-th child of this node. |
インタフェース coins.ir.IR0 から継承したメソッド |
getChild, getChildCount, getIndex, getOperator, setChild |
フィールドの詳細 |
public static final int OP_PROG
public static final int OP_SUBP_DEF
public static final int OP_INF
public static final int OP_LIST
public static final java.lang.String[] OP_CODE_NAME
メソッドの詳細 |
public void addInf(java.lang.String pInfnKindInterned, java.lang.Object pInfObject)
pInfObject
- Object to be added as information.
It may be String, Sym, IR, List, and so on,
hence they may be non-IR elements.public java.lang.Object getInf(java.lang.String pInfIdInterned)
public void removeInf(java.lang.String pInfIdInterned)
public IrList getInfList()
public Sym getSym()
public IR getParent()
public void print(int pIndent)
pIndent
- number of heading spaces for indentation.public void print(int pIndent, boolean pDetail)
pIndent
- number of heading spaces for indentation.pDetail
- true if detail print is requested, false otherwise.public IR getChild1()
public IR getChild2()
public java.lang.String toStringShort()
|
||||||||||
前のクラス 次のクラス | フレームあり フレームなし | |||||||||
概要: 入れ子 | フィールド | コンストラクタ | メソッド | 詳細: フィールド | コンストラクタ | メソッド |