harpoon.Analysis.Loops
Class LoopFinder

java.lang.Object
  extended by harpoon.Analysis.Loops.LoopFinder
All Implemented Interfaces:
Loops

public class LoopFinder
extends Object
implements Loops

LoopFinder implements Dominator Tree Loop detection.

Version:
$Id: LoopFinder.java,v 1.5 2004/02/08 03:19:41 cananian Exp $
Author:
Brian Demsky <bdemsky@mit.edu>

Constructor Summary
LoopFinder(HCode hc)
          Creates a new LoopFinder object.
LoopFinder(HCode hc, CFGrapher grapher)
          Creates a new LoopFinder object.
 
Method Summary
 Loops getRootloop(HCode hc)
          This method returns the Root level loop for a given HCode.
 Set loopBackEdges()
          This method finds all of the backedges of the loop.
 Set loopEntranceEdges()
          Returns entrances to the Loop.
 Set loopEntrances()
          This method returns the entry point of the loop.
 Set loopExcElements()
          Returns all of the HCodeElements of this loop that aren't in a nested loop.
 Set loopExitEdges()
          Returns a Set of all HCodeEdges exiting the loop.
 Set loopExits()
          Returns a Set of all HCodeElements in the loop which have an edge exiting the loop.
 Set loopIncElements()
          Returns a Set with all of the HCodeElements of the loop and loops included entirely within this loop.
 Set nestedLoops()
          Returns a Set of loops that are nested inside of this loop.
 Loops parentLoop()
          Returns the Loops that contains this loop.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LoopFinder

public LoopFinder(HCode hc)
Creates a new LoopFinder object. This call takes an HCode and returns a LoopFinder object at the root level. Only use with Objects implementing the CFGraphable interface!
Requires: hc is a HCode implementing the CFGraphable interface.


LoopFinder

public LoopFinder(HCode hc,
                  CFGrapher grapher)
Creates a new LoopFinder object. This call takes an HCode and a CFGrapher and returns a LoopFinder object at the root level.
Requires: grapher is a CFGrapher for hc .

Method Detail

getRootloop

public Loops getRootloop(HCode hc)
This method returns the Root level loop for a given HCode. Does the same thing as the constructor call, but for an existing LoopFinder object.


loopEntrances

public Set loopEntrances()
This method returns the entry point of the loop. For the natural loops we consider, that is simply the header. It returns a Set of HCodeElements.

Specified by:
loopEntrances in interface Loops

loopEntranceEdges

public Set loopEntranceEdges()
Description copied from interface: Loops
Returns entrances to the Loop. This is a Set of HCodeEdges.

Specified by:
loopEntranceEdges in interface Loops

loopExits

public Set loopExits()
Returns a Set of all HCodeElements in the loop which have an edge exiting the loop.

Specified by:
loopExits in interface Loops

loopExitEdges

public Set loopExitEdges()
Returns a Set of all HCodeEdges exiting the loop.

Specified by:
loopExitEdges in interface Loops

loopBackEdges

public Set loopBackEdges()
This method finds all of the backedges of the loop. Since we combine natural loops with the same header, this can be greater than one. This method returns a Set of HCodeEdges.

Specified by:
loopBackEdges in interface Loops

loopIncElements

public Set loopIncElements()
Returns a Set with all of the HCodeElements of the loop and loops included entirely within this loop.

Specified by:
loopIncElements in interface Loops

loopExcElements

public Set loopExcElements()
Returns all of the HCodeElements of this loop that aren't in a nested loop. This returns a Set of HCodeElements.

Specified by:
loopExcElements in interface Loops

nestedLoops

public Set nestedLoops()
Returns a Set of loops that are nested inside of this loop.

Specified by:
nestedLoops in interface Loops

parentLoop

public Loops parentLoop()
Returns the Loops that contains this loop. If this is the top level loop, this call returns a null pointer.

Specified by:
parentLoop in interface Loops