coins.backend.lir
Class LirNode

java.lang.Object
  extended bycoins.backend.lir.LirNode
Direct Known Subclasses:
LirBinOp, LirFconst, LirIconst, LirLabelRef, LirNaryOp, LirString, LirSymRef, LirUnaOp

public abstract class LirNode
extends java.lang.Object

New LIR node's basic structure


Nested Class Summary
static class LirNode.Scanner
          Scanner for LIR expression tree.
 
Field Summary
 int id
          Key to bind related information
 int opCode
          Instruction Code
 ImList opt
          Optional arguments list (op opr1 opr2 &hogehoge ...)
 int type
          Type of this node's result
 
Constructor Summary
(package private) LirNode(int id, int opCode, int type, ImList opt)
          Create LIR node
 
Method Summary
abstract  void accept(LirVisitor v)
          Accept visitor v
 boolean equals(java.lang.Object x)
          Return true if this object equals to x
 Label[] getTargets()
          Return jump target labels.
 int hashCode()
          Return hash value of LirNode.
 boolean isBranch()
          Return true if node is a branch instruction.
 boolean isPhysicalRegister()
          Return true if node is a physical register.
 boolean isRegisterOperand()
          Is register operand?
 LirNode kid(int n)
          Return nth operand; Subclass responsibility
abstract  LirNode makeCopy(LirFactory fac)
          Return a deep copy of this node
 LirNode makeShallowCopy(LirFactory fac)
          Return a shallow copy of this node.
 int nKids()
          Return number of operands
 int nSrcs()
          Deprecated. use nKids instead.
 void pickUpDefs(PickUpVariable receiver)
          Pick up definitions of register variables in this L-expression.
 void pickUpUses(PickUpVariable receiver)
          Pick up uses of register variables in this L-expression.
 void replaceLabel(Label x, Label y, LirFactory fac)
          Replace target label y for x.
abstract  LirNode replaceOptions(LirFactory fac, ImList newOpt)
          Return a copy of this node without options.
 void setKid(int n, LirNode kid)
          Set nth operand; Subclass responsibility
 void setSrc(int n, LirNode src)
          Deprecated. use setKid instead.
 LirNode src(int n)
          Deprecated. use kid instead.
 java.lang.Object toSexp()
          Convert to external LIR format.
 java.lang.String toString()
          Visualize
 java.lang.String toStringExp()
          Deprecated.  
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

id

public final int id
Key to bind related information


opCode

public final int opCode
Instruction Code


type

public final int type
Type of this node's result


opt

public final ImList opt
Optional arguments list (op opr1 opr2 &hogehoge ...)

Constructor Detail

LirNode

LirNode(int id,
        int opCode,
        int type,
        ImList opt)
Create LIR node

Method Detail

makeCopy

public abstract LirNode makeCopy(LirFactory fac)
Return a deep copy of this node


makeShallowCopy

public LirNode makeShallowCopy(LirFactory fac)
Return a shallow copy of this node. Default action is same as makeCopy.


replaceOptions

public abstract LirNode replaceOptions(LirFactory fac,
                                       ImList newOpt)
Return a copy of this node without options.


nSrcs

public int nSrcs()
Deprecated. use nKids instead.

Return number of operands


nKids

public int nKids()
Return number of operands


src

public LirNode src(int n)
Deprecated. use kid instead.

Return nth operand


kid

public LirNode kid(int n)
Return nth operand; Subclass responsibility


setSrc

public void setSrc(int n,
                   LirNode src)
Deprecated. use setKid instead.

Set nth operand


setKid

public void setKid(int n,
                   LirNode kid)
Set nth operand; Subclass responsibility


getTargets

public Label[] getTargets()
Return jump target labels. Targets are packed in an array of Label.


replaceLabel

public void replaceLabel(Label x,
                         Label y,
                         LirFactory fac)
Replace target label y for x.


isBranch

public boolean isBranch()
Return true if node is a branch instruction.


isPhysicalRegister

public boolean isPhysicalRegister()
Return true if node is a physical register. (must be overriden by subclasses)


isRegisterOperand

public boolean isRegisterOperand()
Is register operand?


pickUpUses

public final void pickUpUses(PickUpVariable receiver)
Pick up uses of register variables in this L-expression. Picked up variables are passed thru call-back object receiver.


pickUpDefs

public final void pickUpDefs(PickUpVariable receiver)
Pick up definitions of register variables in this L-expression. Picked up variables are passed thru call-back object receiver.


toSexp

public java.lang.Object toSexp()
Convert to external LIR format.


toString

public java.lang.String toString()
Visualize


hashCode

public int hashCode()
Return hash value of LirNode.


equals

public boolean equals(java.lang.Object x)
Return true if this object equals to x


accept

public abstract void accept(LirVisitor v)
Accept visitor v


toStringExp

public java.lang.String toStringExp()
Deprecated.  

Convert integer or address constant to string.