harpoon.IR.Quads
Class OPER

java.lang.Object
  extended by harpoon.IR.Quads.Quad
      extended by harpoon.IR.Quads.OPER
All Implemented Interfaces:
HCodeElement, CFGraphable<Quad,Edge>, UseDefable, Graph.Node<Quad,Edge>, Serializable, Cloneable, Comparable<Quad>
Direct Known Subclasses:
POPER

public class OPER
extends Quad

OPER objects represent arithmetic/logical operations, including mathematical operators such as add and subtract, conversion operators such as double-to-int, and comparison operators such as greater than and equals.

OPER quads never throw exceptions. Any exception thrown implicitly by the java bytecode opcode corresponding to an OPER is rewritten as an explicit test and throw in the Quad IR.

Version:
$Id: OPER.java,v 1.5 2002/04/11 04:00:34 cananian Exp $
Author:
C. Scott Ananian <cananian@alumni.princeton.edu>
See Also:
Serialized Form

Field Summary
protected  Temp dst
          The Temp in which to store the result of the operation.
protected  int opcode
          The operation to be performed, from the Qop class.
protected  Temp[] operands
          Operands of the operation, in left-to-right order.
 
Fields inherited from class harpoon.IR.Quads.Quad
arrayFactory
 
Constructor Summary
OPER(QuadFactory qf, HCodeElement source, int opcode, Temp dst, Temp[] operands)
          Creates a OPER.
 
Method Summary
 void accept(OperVisitor v)
           
<T> T
accept(QuadValueVisitor<T> v)
           
 void accept(QuadVisitor v)
          Accept a visitor.
 Temp[] def()
          Returns the Temps defined by this OPER.
 Temp dst()
          Returns the Temp in which to store the result of the operation.
 HClass evalType()
          Determines the result type of an OPER.
 Object evalValue(Object[] opvalues)
          Evaluates a constant value for the result of an OPER, given constant values for the operands.
 int kind()
          Return an integer enumeration of the kind of this Quad.
 int opcode()
          Returns the operation to be performed, as an integer enumeration from the Qop class.
 Temp[] operands()
          Returns an array of Temps which are the operands of the operation.
 Temp operands(int i)
          Returns a specified element of the operands array.
 int operandsLength()
          Returns the length of the operands array.
 Quad rename(QuadFactory qqf, TempMap defMap, TempMap useMap)
          Create a new Quad identical to the receiver, but with all Temps renamed according to a mapping.
 String toString()
          Returns a human-readable representation of this Quad.
 Temp[] use()
          Returns the Temps used by this OPER.
 
Methods inherited from class harpoon.IR.Quads.Quad
addEdge, addEdges, addHandlers, clone, clone, clone, compareTo, defC, edgeC, edges, getFactory, getID, getLineNumber, getSourceFile, handlers, hashCode, isPred, isSucc, map, map, map, next, next, nextEdge, nextEdge, nextLength, pred, predC, prev, prev, prevEdge, prevEdge, prevLength, remove, removeHandlers, rename, replace, succ, succC, toLongString, transferHandlers, useC
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

dst

protected Temp dst
The Temp in which to store the result of the operation.


opcode

protected final int opcode
The operation to be performed, from the Qop class.


operands

protected Temp[] operands
Operands of the operation, in left-to-right order.

Constructor Detail

OPER

public OPER(QuadFactory qf,
            HCodeElement source,
            int opcode,
            Temp dst,
            Temp[] operands)
Creates a OPER.

Method Detail

dst

public Temp dst()
Returns the Temp in which to store the result of the operation.


opcode

public int opcode()
Returns the operation to be performed, as an integer enumeration from the Qop class.


operands

public Temp[] operands()
Returns an array of Temps which are the operands of the operation.


operands

public Temp operands(int i)
Returns a specified element of the operands array.


operandsLength

public int operandsLength()
Returns the length of the operands array.


use

public Temp[] use()
Returns the Temps used by this OPER.

Specified by:
use in interface UseDefable
Overrides:
use in class Quad

def

public Temp[] def()
Returns the Temps defined by this OPER.

Specified by:
def in interface UseDefable
Overrides:
def in class Quad

kind

public int kind()
Description copied from class: Quad
Return an integer enumeration of the kind of this Quad. The enumerated values are defined in QuadKind.

Specified by:
kind in class Quad

rename

public Quad rename(QuadFactory qqf,
                   TempMap defMap,
                   TempMap useMap)
Description copied from class: Quad
Create a new Quad identical to the receiver, but with all Temps renamed according to a mapping. The new Quad will have no edges.

The new Quad will come from the specified QuadFactory.

Specified by:
rename in class Quad

accept

public void accept(QuadVisitor v)
Description copied from class: Quad
Accept a visitor.

Specified by:
accept in class Quad

accept

public <T> T accept(QuadValueVisitor<T> v)
Specified by:
accept in class Quad

accept

public void accept(OperVisitor v)

toString

public String toString()
Returns a human-readable representation of this Quad.

Specified by:
toString in class Quad

evalType

public HClass evalType()
Determines the result type of an OPER.


evalValue

public Object evalValue(Object[] opvalues)
Evaluates a constant value for the result of an OPER, given constant values for the operands.