scale.score.analyses
Class MayUse

java.lang.Object
  extended by scale.score.analyses.MayUse
All Implemented Interfaces:
DisplayNode

public final class MayUse
extends java.lang.Object
implements DisplayNode

A node to represent MayUse information in the alias SSA form.

$Id: MayUse.java,v 1.7 2007-10-04 19:58:21 burrill Exp $

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

The may use node represents a potential use of a variable. May use information is associated with variable references. We create virtual variables to describe the potential variables used in the may use.

We model the may use information as described in the paper Effective Representation of Aliases and Indirect Memory Operations in SSA Form by Chow et. al.

See Also:
MayDef

Constructor Summary
MayUse(VirtualVar decl)
          Create may use information.
 
Method Summary
 void addMayUse(MayUse mayUse)
          Add may use information to the load expression.
 Expr copy()
          Return a deep-copy of this object.
 MayUse copy(Expr graphNode)
          Make a copy of this expression.
 MayDef findMayDef()
          Find the use-def link that matches the virtual variable.
 VirtualVar getDecl()
          Return the Clef declaration of the variable being loaded.
 DColor getDisplayColorHint()
          Return an interger specifying the color to use for coloring this node in a graphical display.
 java.lang.String getDisplayLabel()
          Return the representative name for the operation.
 java.lang.String getDisplayName()
          Return a unique label for graphical displays.
 DShape getDisplayShapeHint()
          Return a String specifying a shape to use when drawing this node in a graphical display.
 Expr getGraphNode()
          Return the scribble/score node that represents the real use of the may use information.
 MayDef getMayDef()
          Return the ExprChord that defines the value load by this load expression.
 MayUse getMayUse()
          Return the may use information assocaited with the load.
 java.lang.String getName()
          Return the name of the variable declaration.
 Declaration getSubsetDecl()
          Return the original declaration of the value loaded.
 void setDecl(VariableDecl decl)
          Return the Clef declaration of the variable being loaded.
 void setDecl(VirtualVar decl)
          Change the declaration associated with the load operation.
 void setGraphNode(Expr graphNode)
          Connect the may-use to the node where the use occurs.
 void setMayDef(MayDef expr)
          Define a link from this load of a value to the scale.score.chords.ExprChord that defines the value.
 void validate()
          Check this node for validity.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MayUse

public MayUse(VirtualVar decl)
Create may use information. The may use node represents the potential reference used by a variable reference due to aliasing.

Parameters:
decl - a declaration for the virtual variable
Method Detail

copy

public MayUse copy(Expr graphNode)
Make a copy of this expression. The use - def information is copied too.


setMayDef

public void setMayDef(MayDef expr)
Define a link from this load of a value to the scale.score.chords.ExprChord that defines the value.

Parameters:
expr - the new use-def link

getMayDef

public MayDef getMayDef()
Return the ExprChord that defines the value load by this load expression.


addMayUse

public void addMayUse(MayUse mayUse)
Add may use information to the load expression.

Parameters:
mayUse - the expresion representing the may use

getMayUse

public final MayUse getMayUse()
Return the may use information assocaited with the load.


getDecl

public final VirtualVar getDecl()
Return the Clef declaration of the variable being loaded.


setDecl

public final void setDecl(VariableDecl decl)
Return the Clef declaration of the variable being loaded.


setDecl

public final void setDecl(VirtualVar decl)
Change the declaration associated with the load operation.

Parameters:
decl - is the new declataion

getName

public java.lang.String getName()
Return the name of the variable declaration.


copy

public Expr copy()
Return a deep-copy of this object. This form of copy() not allowed.


setGraphNode

public void setGraphNode(Expr graphNode)
Connect the may-use to the node where the use occurs.


getGraphNode

public Expr getGraphNode()
Return the scribble/score node that represents the real use of the may use information.

Returns:
the scribble/score node that points to this info.

getSubsetDecl

public Declaration getSubsetDecl()
Return the original declaration of the value loaded. This is the variable before SSA renumbering is used to determine whether two virtual vars are in the same subset or if one is a superset. Hence the name.


findMayDef

public MayDef findMayDef()
Find the use-def link that matches the virtual variable. May return null.


getDisplayColorHint

public DColor getDisplayColorHint()
Description copied from interface: DisplayNode
Return an interger specifying the color to use for coloring this node in a graphical display. The color specified is not guaranteed to be used.

Specified by:
getDisplayColorHint in interface DisplayNode
See Also:
DColor

getDisplayLabel

public java.lang.String getDisplayLabel()
Return the representative name for the operation.

Specified by:
getDisplayLabel in interface DisplayNode
Returns:
the representative name for the operation.

getDisplayShapeHint

public DShape getDisplayShapeHint()
Return a String specifying a shape to use when drawing this node in a graphical display. This method should be over-ridden as it simplay returns the shape "box".

Specified by:
getDisplayShapeHint in interface DisplayNode
See Also:
DShape

getDisplayName

public java.lang.String getDisplayName()
Return a unique label for graphical displays.

Specified by:
getDisplayName in interface DisplayNode

validate

public void validate()
Check this node for validity. This method throws an exception if the node is not linked properly.