scale.score.analyses
Class MayDef

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

public class MayDef
extends java.lang.Object
implements DisplayNode

A node to represent MayDef information in the alias SSA form (some people call them preserving defs or weak updates).

$Id: MayDef.java,v 1.6 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 MayDef info represents an assignment that indirectly may change the value of a variable. However, it may not, which means that the old defintion is still valid. The May Def operator may only be associated with assignment and call operators.

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

See Also:
MayUse

Constructor Summary
MayDef(LoadDeclAddressExpr lhs, LoadDeclValueExpr rhs)
          Create may def information.
 
Method Summary
 void addDefUse(MayUse expr)
          Add a new link from the definition to the use.
 boolean checkDefUse(MayUse use)
          Return true is a def-use link exists.
 MayDef copy()
          Return a deep-copy of this object.
 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.
 Note getGraphNode()
          Return the scribble/score node that represents the real use of the may use information.
 LoadDeclAddressExpr getLhs()
          Get the lhs of the may definition.
 LoadDeclValueExpr getRhs()
          Get the rhs of the may definition.
 void removeDefUse(MayUse expr)
          Remove an existing link from the definition to the use.
 void setGraphNode(Note graphNode)
          Connect the may-use to the node where the use occurs.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MayDef

public MayDef(LoadDeclAddressExpr lhs,
              LoadDeclValueExpr rhs)
Create may def information. The may def node represents a potential definition of variables due to aliasing.

Parameters:
lhs - the left-hand-side of the may definition (a virtual variable)
rhs - the right-hand-side of the may definition (a virtual variable)
Method Detail

copy

public MayDef copy()
Return a deep-copy of this object.


getLhs

public final LoadDeclAddressExpr getLhs()
Get the lhs of the may definition.

Returns:
the lhs of the may definition.

getRhs

public final LoadDeclValueExpr getRhs()
Get the rhs of the may definition. If this is the initial definition then we return null.

Returns:
the rhs of the may definition.

addDefUse

public final void addDefUse(MayUse expr)
Add a new link from the definition to the use. This method DOES NOT update the use to def link in the use.

Parameters:
expr - the new use-def link

removeDefUse

public final void removeDefUse(MayUse expr)
Remove an existing link from the definition to the use. This method DOES NOT update the use to def link in the use.

Parameters:
expr - the existing use-def link

setGraphNode

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


getGraphNode

public Note 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.

getDisplayLabel

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

Specified by:
getDisplayLabel in interface DisplayNode

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

checkDefUse

public final boolean checkDefUse(MayUse use)
Return true is a def-use link exists.


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