Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

Compil3r.Quad
Class QuadIterator  view QuadIterator download QuadIterator.java

java.lang.Object
  extended byCompil3r.Quad.QuadIterator
All Implemented Interfaces:
java.util.Iterator, java.util.ListIterator, Util.Templates.ListIterator.Quad

public class QuadIterator
extends java.lang.Object
implements Util.Templates.ListIterator.Quad

Version:
$Id: QuadIterator.java,v 1.11 2003/06/16 16:29:15 joewhaley Exp $

Field Summary
protected  ControlFlowGraph cfg
          A reference to the control flow graph that we are iterating over.
protected  BasicBlock currentBasicBlock
          References to the previous non-empty basic block, the current basic block, and the next non-empty basic block.
protected  int lastIndex
          The index of the last quad that was returned.
protected  Quad lastQuad
          The last quad that was returned.
protected  BasicBlock nextBasicBlock
          References to the previous non-empty basic block, the current basic block, and the next non-empty basic block.
protected  BasicBlock previousBasicBlock
          References to the previous non-empty basic block, the current basic block, and the next non-empty basic block.
protected  Util.Templates.ListIterator.Quad quadsInCurrentBasicBlock
          An iteration of the quads in the current basic block.
protected  Util.Templates.ListIterator.BasicBlock rpoBasicBlocks
          The reverse post order iteration of basic blocks in the control flow graph.
 
Constructor Summary
QuadIterator(ControlFlowGraph cfg)
          Initialize the iterator to iterate over the quads in the given control flow graph in reverse post order.
QuadIterator(ControlFlowGraph cfg, boolean direction)
          Initialize the iterator to iterate over the quads in the given control flow graph.
 
Method Summary
 void add(java.lang.Object obj)
          Adds a quad to the underlying quad list.
private static void addQuadsThatReachHandler(BasicBlock bb, java.util.Set result, ExceptionHandler eh)
           
 BasicBlock getCurrentBasicBlock()
           
 Quad getCurrentQuad()
           
protected  Quad getFirstQuad(BasicBlock bb)
          Returns the first quad reachable from the start of the given basic block.
protected  Quad getLastQuad(BasicBlock bb)
          Returns the last quad reachable from the end of the given basic block.
 Util.Graphs.Navigator getNavigator()
           
 boolean hasNext()
          Returns whether there is a next quad in this iteration.
 boolean hasPrevious()
          Returns whether this iteration has a previous quad.
 java.lang.Object next()
          Return the next quad in the iteration.
 int nextIndex()
          Returns the index of the next quad to be returned.
 Quad nextQuad()
          Return the next quad in the iteration.
 java.util.Iterator predecessors()
           
 java.util.Collection predecessors1()
           
 java.lang.Object previous()
          Returns the previous quad in the iteration.
 int previousIndex()
          Returns the index of the previous quad.
 Quad previousQuad()
          Returns the previous quad in the iteration.
 void remove()
          Removes the last-returned-quad from the underlying list.
 boolean searchBackward(java.lang.Object node)
           
 boolean searchForward(java.lang.Object node)
           
 void set(java.lang.Object obj)
          Sets the current quad.
 java.util.Iterator successors()
          Return an iterator of the possible successor quads of the most recently returned quad.
 java.util.Collection successors1()
           
protected  void updateNextBB()
          Update the nextBasicBlock field to point to the next non-empty basic block from the reverse post order, or null if there are no more non-empty basic blocks.
protected  void updatePreviousBB()
          Update the previousBasicBlock field to point to the previous non-empty basic block from the reverse post order, or null if there are no more previous non-empty basic blocks.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

cfg

protected final ControlFlowGraph cfg
A reference to the control flow graph that we are iterating over.


rpoBasicBlocks

protected final Util.Templates.ListIterator.BasicBlock rpoBasicBlocks
The reverse post order iteration of basic blocks in the control flow graph. When going forward, nextBasicBlock should always be the last basic block returned by this iterator.


previousBasicBlock

protected BasicBlock previousBasicBlock
References to the previous non-empty basic block, the current basic block, and the next non-empty basic block.


currentBasicBlock

protected BasicBlock currentBasicBlock
References to the previous non-empty basic block, the current basic block, and the next non-empty basic block.


nextBasicBlock

protected BasicBlock nextBasicBlock
References to the previous non-empty basic block, the current basic block, and the next non-empty basic block.


quadsInCurrentBasicBlock

protected Util.Templates.ListIterator.Quad quadsInCurrentBasicBlock
An iteration of the quads in the current basic block.


lastIndex

protected int lastIndex
The index of the last quad that was returned.


lastQuad

protected Quad lastQuad
The last quad that was returned.

Constructor Detail

QuadIterator

public QuadIterator(ControlFlowGraph cfg)
Initialize the iterator to iterate over the quads in the given control flow graph in reverse post order.


QuadIterator

public QuadIterator(ControlFlowGraph cfg,
                    boolean direction)
Initialize the iterator to iterate over the quads in the given control flow graph. If direction is true, the order is reverse post order and the iteration starts at the first quad. If direction is false, the order is post order on the reverse graph and the iteration starts at the last quad.

Method Detail

updateNextBB

protected void updateNextBB()
Update the nextBasicBlock field to point to the next non-empty basic block from the reverse post order, or null if there are no more non-empty basic blocks.


updatePreviousBB

protected void updatePreviousBB()
Update the previousBasicBlock field to point to the previous non-empty basic block from the reverse post order, or null if there are no more previous non-empty basic blocks.


getCurrentBasicBlock

public BasicBlock getCurrentBasicBlock()

getCurrentQuad

public Quad getCurrentQuad()

nextQuad

public Quad nextQuad()
Return the next quad in the iteration.

Specified by:
nextQuad in interface Util.Templates.ListIterator.Quad

next

public java.lang.Object next()
Return the next quad in the iteration. Use nextQuad to avoid the type cast.

Specified by:
next in interface java.util.ListIterator

hasNext

public boolean hasNext()
Returns whether there is a next quad in this iteration.

Specified by:
hasNext in interface java.util.ListIterator

getFirstQuad

protected Quad getFirstQuad(BasicBlock bb)
Returns the first quad reachable from the start of the given basic block.


getLastQuad

protected Quad getLastQuad(BasicBlock bb)
Returns the last quad reachable from the end of the given basic block.


set

public void set(java.lang.Object obj)
Sets the current quad.

Specified by:
set in interface java.util.ListIterator

nextIndex

public int nextIndex()
Returns the index of the next quad to be returned.

Specified by:
nextIndex in interface java.util.ListIterator

previousQuad

public Quad previousQuad()
Returns the previous quad in the iteration.

Specified by:
previousQuad in interface Util.Templates.ListIterator.Quad

previous

public java.lang.Object previous()
Returns the previous quad in the iteration. Use previousQuad to avoid the type cast.

Specified by:
previous in interface java.util.ListIterator

remove

public void remove()
Removes the last-returned-quad from the underlying list.

Specified by:
remove in interface java.util.ListIterator

previousIndex

public int previousIndex()
Returns the index of the previous quad.

Specified by:
previousIndex in interface java.util.ListIterator

hasPrevious

public boolean hasPrevious()
Returns whether this iteration has a previous quad.

Specified by:
hasPrevious in interface java.util.ListIterator

add

public void add(java.lang.Object obj)
Adds a quad to the underlying quad list.

Specified by:
add in interface java.util.ListIterator

successors

public java.util.Iterator successors()
Return an iterator of the possible successor quads of the most recently returned quad. If a possible successor is the method exit, it includes the "null" value in the iteration.


successors1

public java.util.Collection successors1()

predecessors

public java.util.Iterator predecessors()

predecessors1

public java.util.Collection predecessors1()

addQuadsThatReachHandler

private static void addQuadsThatReachHandler(BasicBlock bb,
                                             java.util.Set result,
                                             ExceptionHandler eh)

getNavigator

public Util.Graphs.Navigator getNavigator()

searchForward

public boolean searchForward(java.lang.Object node)

searchBackward

public boolean searchBackward(java.lang.Object node)