harpoon.Analysis.DataFlow
Class LiveVars

java.lang.Object
  extended by harpoon.Analysis.Liveness
      extended by harpoon.Analysis.DataFlow.LiveVars

public class LiveVars
extends Liveness

LiveVars performs Liveness Analysis for the variables in the HCodes passed to it.

It attempts to do this in efficient manner by

  1. grouping the statements into BasicBlocks.
  2. using bit strings as the underlying representation for the Sets it works with.
  3. using the dataflow analysis framework which provides termination guarantees (as long as the transfer function and lattice of values provided meet certain conditions).

However, the implementation is also meant to be parameterized and flexible. So it allows the user to pass in their own CFGrapher and UseDefer for the code to be analyzed.

NOTE: I need to document what constraints there are on the UseDefer and CFGrapher parameters to preserve the termination guarantees of the analysis. For the time being, people who have no experience with Dataflow Analysis code should avoid passing in strange CFGraphers and UseDefers

Version:
$Id: LiveVars.java,v 1.5 2004/02/08 03:19:21 cananian Exp $
Author:
Felix S. Klock II <pnkfelix@mit.edu>

Nested Class Summary
static class LiveVars.BBVisitor
           
 
Field Summary
protected static boolean DEBUG
           
 
Fields inherited from class harpoon.Analysis.Liveness
hc
 
Constructor Summary
LiveVars(HCode hc, CFGrapher gr, Set liveOnExit)
          Constructs a new LiveVars.
LiveVars(HCode hc, CFGrapher gr, UseDefer ud, Set liveOnExit)
          Constructs a new LiveVars.
 
Method Summary
 Set getLiveIn(HCodeElement hce)
          Returns the Set of Temps that are live-in at the HCodeElement.
 Set getLiveOut(HCodeElement hce)
          Returns the Set of Temps that are live-out at the HCodeElement.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEBUG

protected static final boolean DEBUG
See Also:
Constant Field Values
Constructor Detail

LiveVars

public LiveVars(HCode hc,
                CFGrapher gr,
                Set liveOnExit)
Constructs a new LiveVars. Note that since the dataflow analysis is done during construction, this can take a while. Uses the default UseDefer built into hc for its analysis. Requires that elements of hc implement UseDefable.

Parameters:
hc - Code to be analyzed
gr - Represents control-flow information for hc
liveOnExit - Set of Temps that are live on exit from hc

LiveVars

public LiveVars(HCode hc,
                CFGrapher gr,
                UseDefer ud,
                Set liveOnExit)
Constructs a new LiveVars. Note that since the dataflow analysis is done during construction, this can take a while.

Parameters:
hc - Code to be analyzed
gr - Represents control-flow information for hc
ud - Represents use/def information for elements of hc
liveOnExit - Set of Temps that are live on exit from hc
Method Detail

getLiveIn

public Set getLiveIn(HCodeElement hce)
Description copied from class: Liveness
Returns the Set of Temps that are live-in at the HCodeElement.

Specified by:
getLiveIn in class Liveness

getLiveOut

public Set getLiveOut(HCodeElement hce)
Description copied from class: Liveness
Returns the Set of Temps that are live-out at the HCodeElement.

Specified by:
getLiveOut in class Liveness