scale.score.pred
Class References

java.lang.Object
  extended by scale.score.pred.References

public class References
extends java.lang.Object

This class scans a Scribble CFG looking for declaration references.

$Id: References.java,v 1.75 2007-10-04 19:58:34 burrill Exp $

Copyright 2008 by the Scale Compiler Group,
Department of Computer Science
University of Massachusetts,
Amherst MA. 01003, USA
All Rights Reserved.

For this class, a definition of a variable is a place where it is (potentially) given a new value. A use site is where a variable's value is used. A reference site is any place that a variable is used or defined.


Constructor Summary
References()
          Construct a predicate to visit all the expressions in a CFG to determine all the places declarations are referenced.
 
Method Summary
 boolean anyDefChords(Declaration var)
          Return true if there are any defs of a variable.
 boolean anyUseChords(Declaration var)
          Return true if there are any uses of a variable.
 void compute(Scribble scribble)
          Determine the actual declaration references.
static int computed()
          Return the number of times the dominance frontier was computed.
static int created()
          Return the number of instances of this class that were created.
 java.util.Iterator<Chord> getDefChords(Declaration var)
          Return an iteration of the statements with definition sites for a given variable.
 HashSet<Chord> getDefChordSet(Declaration var)
          Return a set of statements with definition sites for a given variable.
 java.util.Iterator<Declaration> getGlobalVars()
          Return an iteration of the global variables, that are not const, which are referenced in this procedure.
 java.util.Iterator<Declaration> getStaticVars()
          Return an iteration of the local static variables, that are not const, which are referenced in this procedure.
 java.util.Iterator<Chord> getUseChords(Declaration var)
          Return an iteration of basic blocks with use sites for a given variable.
 HashSet<Chord> getUseChordSet(Declaration var)
          Return a set of statements with use sites for a given variable.
 boolean isValid()
          Return true if the reference information is valid.
 int numDefChords(Declaration var)
          Return the numberof definition sites.
 void recordDef(Chord stmt, Expr expr, Declaration decl)
          Record the definition (kill) of a variable.
 void recordUse(Chord stmt, Expr expr, Declaration decl)
          Record the use of a variable.
 void remove(Chord stmt, Declaration v)
          Remove all mappings from the specified variable to the specified CFG node.
 void removeVars(VariableDecl v)
          Remove a VariableDecl from the list of global variables list of local static variables Note - the use & def information is not modified.
 void setInvalid()
          Specify that the reference information is invalid.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

References

public References()
Construct a predicate to visit all the expressions in a CFG to determine all the places declarations are referenced.

Method Detail

created

public static int created()
Return the number of instances of this class that were created.


computed

public static int computed()
Return the number of times the dominance frontier was computed.


compute

public void compute(Scribble scribble)
Determine the actual declaration references.


isValid

public final boolean isValid()
Return true if the reference information is valid.


setInvalid

public void setInvalid()
Specify that the reference information is invalid. This also removes the reference information.


getGlobalVars

public final java.util.Iterator<Declaration> getGlobalVars()
Return an iteration of the global variables, that are not const, which are referenced in this procedure.


getStaticVars

public final java.util.Iterator<Declaration> getStaticVars()
Return an iteration of the local static variables, that are not const, which are referenced in this procedure.


getDefChordSet

public final HashSet<Chord> getDefChordSet(Declaration var)
Return a set of statements with definition sites for a given variable.


getUseChordSet

public final HashSet<Chord> getUseChordSet(Declaration var)
Return a set of statements with use sites for a given variable.


getDefChords

public final java.util.Iterator<Chord> getDefChords(Declaration var)
Return an iteration of the statements with definition sites for a given variable.


numDefChords

public final int numDefChords(Declaration var)
Return the numberof definition sites.


getUseChords

public final java.util.Iterator<Chord> getUseChords(Declaration var)
Return an iteration of basic blocks with use sites for a given variable.


anyUseChords

public final boolean anyUseChords(Declaration var)
Return true if there are any uses of a variable.


anyDefChords

public final boolean anyDefChords(Declaration var)
Return true if there are any defs of a variable.


recordUse

public void recordUse(Chord stmt,
                      Expr expr,
                      Declaration decl)
Record the use of a variable.

Parameters:
expr - is the expression where the variable is used.
decl - is the declaration of the variable.

removeVars

public final void removeVars(VariableDecl v)
Remove a VariableDecl from the Note - the use & def information is not modified.

Parameters:
v - is the variable

remove

public final void remove(Chord stmt,
                         Declaration v)
Remove all mappings from the specified variable to the specified CFG node.


recordDef

public void recordDef(Chord stmt,
                      Expr expr,
                      Declaration decl)
Record the definition (kill) of a variable.

Parameters:
expr - the expression where the variable is defined (killed)
decl - the declaration of the variable.