harpoon.IR.Bytecode
Class Instr

java.lang.Object
  extended by harpoon.IR.Bytecode.Instr
All Implemented Interfaces:
HCodeElement, CFGraphable<Instr,harpoon.IR.Bytecode.InstrEdge>, Graph.Node<Instr,harpoon.IR.Bytecode.InstrEdge>, Comparable<Instr>
Direct Known Subclasses:
InCti, InGen, InMerge

public abstract class Instr
extends Object
implements HCodeElement, CFGraphable<Instr,harpoon.IR.Bytecode.InstrEdge>, Comparable<Instr>

Bytecode.Instr is the base type for the specific bytecode instruction classes. It provides standard methods for accessing the opcode of a specific instruction and for determining which instructions may preceed or follow it.

As with all HCodeElements, Instrs are traceable to an original source file and line number, and have a unique numeric identifier.

Version:
$Id: Instr.java,v 1.9 2004/02/07 21:28:51 cananian Exp $
Author:
C. Scott Ananian <cananian@alumni.princeton.edu>
See Also:
InGen, InCti, InMerge, InSwitch, Code

Field Summary
static ArrayFactory<Instr> arrayFactory
          Array Factory: makes Instr[]s.
 
Constructor Summary
protected Instr(String sourcefile, int linenumber)
          Constructor.
 
Method Summary
 int compareTo(Instr o)
          Natural ordering on Instrs.
 List<harpoon.IR.Bytecode.InstrEdge> edgeC()
          Returns a List of all the edges to and from this HCodeElement.
 harpoon.IR.Bytecode.InstrEdge[] edges()
          Returns an array of all the edges to and from this CFGraphable.
 boolean equals(Object o)
           
 int getID()
          Returns a unique numeric identifier for this element.
 int getLineNumber()
          Returns the line in the original source file that this bytecode instruction can be traced to.
abstract  byte getOpcode()
          Returns the java bytecode of this instruction.
 String getSourceFile()
          Returns the original source file name that this bytecode instruction is derived from.
 int hashCode()
           
 boolean isPred(Instr i)
          Return true iff the given node is a predecessor of this node.
 boolean isSucc(Instr i)
          Return true iff the given node is a successor of this node.
 harpoon.IR.Bytecode.InstrEdge newEdge(Instr from, Instr to)
           
 Instr[] next()
          Return a list of all the possible Instrs that may succeed this one.
 Instr next(int i)
          Return the specified successor of this Instr.
 harpoon.IR.Bytecode.InstrEdge[] pred()
          Returns an array of all the edges entering this CFGraphable.
 List<harpoon.IR.Bytecode.InstrEdge> predC()
          Returns a List of all the edges to this HCodeElement.
 Instr[] prev()
          Return a list of all the Instrs that can precede this one.
 Instr prev(int i)
          Return the specified predecessor of this Instr.
 harpoon.IR.Bytecode.InstrEdge[] succ()
          Returns an array of all the edges leaving this CFGraphable.
 List<harpoon.IR.Bytecode.InstrEdge> succC()
          Returns a List of all the edges from this HCodeElement.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

arrayFactory

public static final ArrayFactory<Instr> arrayFactory
Array Factory: makes Instr[]s.

Constructor Detail

Instr

protected Instr(String sourcefile,
                int linenumber)
Constructor.

Method Detail

getSourceFile

public String getSourceFile()
Returns the original source file name that this bytecode instruction is derived from.

Specified by:
getSourceFile in interface HCodeElement

getLineNumber

public int getLineNumber()
Returns the line in the original source file that this bytecode instruction can be traced to.

Specified by:
getLineNumber in interface HCodeElement

getID

public int getID()
Returns a unique numeric identifier for this element.

Specified by:
getID in interface HCodeElement

getOpcode

public abstract byte getOpcode()
Returns the java bytecode of this instruction.


compareTo

public int compareTo(Instr o)
Natural ordering on Instrs.

Specified by:
compareTo in interface Comparable<Instr>

equals

public boolean equals(Object o)
Overrides:
equals in class Object

hashCode

public int hashCode()
Overrides:
hashCode in class Object

prev

public Instr[] prev()
Return a list of all the Instrs that can precede this one.


next

public Instr[] next()
Return a list of all the possible Instrs that may succeed this one.


next

public Instr next(int i)
Return the specified successor of this Instr.


prev

public Instr prev(int i)
Return the specified predecessor of this Instr.


newEdge

public harpoon.IR.Bytecode.InstrEdge newEdge(Instr from,
                                             Instr to)

succ

public harpoon.IR.Bytecode.InstrEdge[] succ()
Description copied from interface: CFGraphable
Returns an array of all the edges leaving this CFGraphable.

Specified by:
succ in interface CFGraphable<Instr,harpoon.IR.Bytecode.InstrEdge>

pred

public harpoon.IR.Bytecode.InstrEdge[] pred()
Description copied from interface: CFGraphable
Returns an array of all the edges entering this CFGraphable.

Specified by:
pred in interface CFGraphable<Instr,harpoon.IR.Bytecode.InstrEdge>

edges

public harpoon.IR.Bytecode.InstrEdge[] edges()
Description copied from interface: CFGraphable
Returns an array of all the edges to and from this CFGraphable.

Specified by:
edges in interface CFGraphable<Instr,harpoon.IR.Bytecode.InstrEdge>

edgeC

public List<harpoon.IR.Bytecode.InstrEdge> edgeC()
Description copied from interface: CFGraphable
Returns a List of all the edges to and from this HCodeElement.

Specified by:
edgeC in interface CFGraphable<Instr,harpoon.IR.Bytecode.InstrEdge>

predC

public List<harpoon.IR.Bytecode.InstrEdge> predC()
Description copied from interface: CFGraphable
Returns a List of all the edges to this HCodeElement. Each CFGEdge returned is guaranteed to return this in response to a call to to(); the actual predecessor will be returned from from().

Specified by:
predC in interface CFGraphable<Instr,harpoon.IR.Bytecode.InstrEdge>
Specified by:
predC in interface Graph.Node<Instr,harpoon.IR.Bytecode.InstrEdge>

succC

public List<harpoon.IR.Bytecode.InstrEdge> succC()
Description copied from interface: CFGraphable
Returns a List of all the edges from this HCodeElement. Each CFGEdge returned is guaranteed to return this in response to a call to from(); the actual successor to this will be returned from to().

Specified by:
succC in interface CFGraphable<Instr,harpoon.IR.Bytecode.InstrEdge>
Specified by:
succC in interface Graph.Node<Instr,harpoon.IR.Bytecode.InstrEdge>

isSucc

public boolean isSucc(Instr i)
Description copied from interface: Graph.Node
Return true iff the given node is a successor of this node.

Specified by:
isSucc in interface Graph.Node<Instr,harpoon.IR.Bytecode.InstrEdge>

isPred

public boolean isPred(Instr i)
Description copied from interface: Graph.Node
Return true iff the given node is a predecessor of this node.

Specified by:
isPred in interface Graph.Node<Instr,harpoon.IR.Bytecode.InstrEdge>