harpoon.IR.Quads
Class TYPECAST

java.lang.Object
  extended by harpoon.IR.Quads.Quad
      extended by harpoon.IR.Quads.NOP
          extended by harpoon.IR.Quads.TYPECAST
All Implemented Interfaces:
HCodeElement, CFGraphable<Quad,Edge>, UseDefable, Graph.Node<Quad,Edge>, Serializable, Cloneable, Comparable<Quad>

public class TYPECAST
extends NOP

TYPECAST performs a typecast on a given variable. It throws an exception if the Temp cannot be type cast as requested. It is similar to the bytecode checkcast instruction.

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

Field Summary
protected  HClass hclass
          The class to cast to.
protected  Temp objectref
          The Temp to type cast.
 
Fields inherited from class harpoon.IR.Quads.Quad
arrayFactory
 
Constructor Summary
TYPECAST(QuadFactory qf, HCodeElement source, Temp objectref, HClass hclass)
          Creates a TYPECAST representing a type cast.
 
Method Summary
<T> T
accept(QuadValueVisitor<T> v)
           
 void accept(QuadVisitor v)
          Accept a visitor.
 HClass hclass()
          Return the class of this TYPECAST.
 int kind()
          Return an integer enumeration of the kind of this Quad.
 Temp objectref()
          Return the Temp type cast by this TYPECAST.
 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 quad.
 
Methods inherited from class harpoon.IR.Quads.Quad
addEdge, addEdges, addHandlers, clone, clone, clone, compareTo, def, 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

objectref

protected Temp objectref
The Temp to type cast.


hclass

protected final HClass hclass
The class to cast to.

Constructor Detail

TYPECAST

public TYPECAST(QuadFactory qf,
                HCodeElement source,
                Temp objectref,
                HClass hclass)
Creates a TYPECAST representing a type cast.

Parameters:
objectref - the Temp to type cast.
hclass - the class to cast to.
Method Detail

objectref

public Temp objectref()
Return the Temp type cast by this TYPECAST.


hclass

public HClass hclass()
Return the class of this TYPECAST.


use

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

Specified by:
use in interface UseDefable
Overrides:
use 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.

Overrides:
kind in class NOP

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.

Overrides:
rename in class NOP

accept

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

Overrides:
accept in class NOP

accept

public <T> T accept(QuadValueVisitor<T> v)
Overrides:
accept in class NOP

toString

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

Overrides:
toString in class NOP