coins.backend.gen
Class CodeGenerator.Match

java.lang.Object
  extended bycoins.backend.gen.CodeGenerator.Match
Enclosing class:
CodeGenerator

class CodeGenerator.Match
extends java.lang.Object

Node of matching tree (or DAG)


Field Summary
(package private)  int cost1
          cost
(package private)  int cost2
          cost
(package private)  LirNode dest
          Destination register variable node.
(package private)  java.util.Map genLabelTbl
          Label table.
(package private)  CodeGenerator.Match[] kid
          Direct children of this operator.
(package private)  int[] order
          Code generation order.
(package private)  LirNode orig
          Original LIR operator being matched.
(package private)  CodeGenerator.Match[] rLeaf
          Place of leaf nodes in the rule.
(package private)  int[] rLeafIndex
           
(package private)  Rule rule
          The rule best-matched.
(package private)  LirNode[] src
          Source register variable nodes.
(package private)  CodeGenerator.Match[] subtrees
          Root of subinstruction tree.
(package private)  int suNumber
          Sethi-Ullman number.
(package private)  CodeGenerator.Match[] tLeaf
          Place of leaf node in the output instruction tree.
(package private)  int[] tLeafIndex
           
 
Constructor Summary
(package private) CodeGenerator.Match(LirNode orig, CodeGenerator.Match[] kid, Rule rule, int cost1, int cost2)
          Create match object.
 
Method Summary
(package private)  void allocTemp(LirNode required, java.lang.String regset)
          Assign destination register variable.
(package private)  void decompLir(BiList list)
          Generate decomposed LIR from match tree.
(package private)  void generateDecomposed(BiList list)
          Decompose original LIR tree.
(package private)  boolean hasCode()
          Return true if this node has assembler code to be generated.
(package private)  boolean isCheaperThan(CodeGenerator.Match x)
          Return true if this match is cheaper than x
(package private)  boolean isCore()
          Return true if this node is the root of a instruction tree.
(package private)  boolean isDerived()
          Return true if this node is derived rule.
(package private)  void printIt(java.io.PrintWriter out)
          Print contents of Match instance on Stream out for debugging.
(package private)  ImList quiltCode()
          Generate assembler in ImList form.
(package private)  CodeGenerator.Match removeSet(boolean pass1)
          Remove SET operation if possible.
(package private)  void scheduleBySuNumber()
          Compute Sethi-Ullman number and reorder instructions.
(package private)  CodeGenerator.Match skipNonOpRules()
          Skip non-operational rules at root.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

orig

LirNode orig
Original LIR operator being matched.


rule

Rule rule
The rule best-matched.


cost1

int cost1
cost


cost2

int cost2
cost


dest

LirNode dest
Destination register variable node.


src

LirNode[] src
Source register variable nodes.


kid

CodeGenerator.Match[] kid
Direct children of this operator. e.g. (SUB I32 kid[0] kid[1])


rLeaf

CodeGenerator.Match[] rLeaf
Place of leaf nodes in the rule. e.g. at rule (SUB I32 _ (MEM I32 _)), rLeaf[0]=this, rLeafIndex[0]=0, rLeaf[1]=kid[1], rLeafIndex[1]=0


rLeafIndex

int[] rLeafIndex

tLeaf

CodeGenerator.Match[] tLeaf
Place of leaf node in the output instruction tree. e.g. at tree (SUB I32 _ (MEM I32 (ADD I32 _ _))), tLeaf[0]=this, tLeafIndex[0]=0, tLeaf[1]=kid[1].kid[0], tLeafIndex[1]=0 tLeaf[2]=kid[1].kid[0], tLeafIndex[2]=1


tLeafIndex

int[] tLeafIndex

subtrees

CodeGenerator.Match[] subtrees
Root of subinstruction tree.


suNumber

int suNumber
Sethi-Ullman number.


order

int[] order
Code generation order.


genLabelTbl

java.util.Map genLabelTbl
Label table.

Constructor Detail

CodeGenerator.Match

CodeGenerator.Match(LirNode orig,
                    CodeGenerator.Match[] kid,
                    Rule rule,
                    int cost1,
                    int cost2)
Create match object.

Method Detail

printIt

void printIt(java.io.PrintWriter out)
Print contents of Match instance on Stream out for debugging.


hasCode

boolean hasCode()
Return true if this node has assembler code to be generated.


isCore

boolean isCore()
Return true if this node is the root of a instruction tree.


isDerived

boolean isDerived()
Return true if this node is derived rule.


isCheaperThan

boolean isCheaperThan(CodeGenerator.Match x)
Return true if this match is cheaper than x


removeSet

CodeGenerator.Match removeSet(boolean pass1)
Remove SET operation if possible.


allocTemp

void allocTemp(LirNode required,
               java.lang.String regset)
Assign destination register variable.


scheduleBySuNumber

void scheduleBySuNumber()
Compute Sethi-Ullman number and reorder instructions.


generateDecomposed

void generateDecomposed(BiList list)
Decompose original LIR tree.


decompLir

void decompLir(BiList list)
Generate decomposed LIR from match tree.


skipNonOpRules

CodeGenerator.Match skipNonOpRules()
Skip non-operational rules at root.


quiltCode

ImList quiltCode()
Generate assembler in ImList form.