coins.alias
Interface AliasAnal

All Known Implementing Classes:
AliasAnalHir1

public interface AliasAnal

Interface for HIR alias analysis. All future alias analysis classes will implement this interface.

The query interfaces mayAlias, mustAlais, and getAliasGroupFor all deal with lvalues. An lvalue is an HIR node that is associated with an object, and its operator code (see {Link coins.ir.hir.HIR#getOperator}) is one of HIR.OP_VAR, HIR.OP_SUBS, HIR.OP_QUAL, HIR.OP_ARROW, HIR.OP_CONTENTS, and HIR.OP_UNDECAY. HIR nodes with the operator code HIR.OP_SUBS or HIR.OP_QUAL, however, are lvalue only when their first child (specified by {Link coins.ir.hir.SubscriptedExp#getArrayExp} and {Link coins.ir.hir.Exp#getQualifierExp}, respectively) is lvalue. To see if an Exp node is lvalue, the isLvalue method may be used.


Field Summary
static java.lang.String CATEGORY_NAME
          The category name of the alias analysis package.
 
Method Summary
 AliasGroup getAliasGroupFor(Exp pExp)
          Returns the set of lvalue nodes that are possibly aliased (mayAlias) to the specified argument.
 boolean isLvalue(Exp pExp)
          Returns true if the specified argument is considered lvalue in this alias analysis.
 boolean mayAlias(Exp pExp, Exp pExp0)
          Returns true if the two arguments may refer to an overlapping area in memory.
 boolean mustAlias(Exp pExp, Exp pExp0)
          Returns true if the two arguments definitely refer to an overlapping area in memory.
 void prepareForAliasAnalHir(SubpDefinition pSubpDef)
          Performs alias analysis for the given argument.
 void printAliasPairs(SubpDefinition pSubpDef)
          Prints out alias pairs in IoRoot.printOut object.
 

Field Detail

CATEGORY_NAME

public static final java.lang.String CATEGORY_NAME
The category name of the alias analysis package. It is "Alias". Used in debug-tracing.

See Also:
Constant Field Values
Method Detail

prepareForAliasAnalHir

public void prepareForAliasAnalHir(SubpDefinition pSubpDef)

Performs alias analysis for the given argument. After calling this method, the alias analysis object (object that implements this interface) is ready to accept the queries (mayAlias etc.) for the specified argument.

For intraprocedural analyses only (so far).

Parameters:
pSubpDef - the SubpDefinition instance nodes belonging to which are to be analyzed for aliasing.

isLvalue

public boolean isLvalue(Exp pExp)
Returns true if the specified argument is considered lvalue in this alias analysis.

Returns:
true if the specified argument is lvalue.

mayAlias

public boolean mayAlias(Exp pExp,
                        Exp pExp0)
Returns true if the two arguments may refer to an overlapping area in memory. The two arguments both must be contained in the SubpDefinition which was analyzed most recently by this analysis instance.

Parameters:
pExp - lvalue node to check for aliasing.
pExp0 - lvalue node to check for aliasing.
Returns:
true if the two arguments may refer to an overlapping area in memory.
Throws:
java.lang.IllegalArgumentException - if either of the arguments is not lvalue.

mustAlias

public boolean mustAlias(Exp pExp,
                         Exp pExp0)
Returns true if the two arguments definitely refer to an overlapping area in memory. The two arguments both must be contained in the SubpDefinition which was analyzed most recently by this analysis instance.

Parameters:
pExp - lvalue node to check for aliasing.
pExp0 - lvalue node to check for aliasing.
Returns:
true if the two arguments definitely refer to an overlapping area in memory.
Throws:
java.lang.IllegalArgumentException - if either of the arguments is not lvalue.

getAliasGroupFor

public AliasGroup getAliasGroupFor(Exp pExp)
Returns the set of lvalue nodes that are possibly aliased (mayAlias) to the specified argument. The argument must be contained in the SubpDefinition which was analyzed most recently by this analysis instance.

Parameters:
pExp - lvalue node to check for aliasing.
Returns:
the set of lvalue nodes that mayAlias to the specified argument.
Throws:
java.lang.IllegalArgumentException - if the argument is not lvalue. See #mayAlias

printAliasPairs

public void printAliasPairs(SubpDefinition pSubpDef)
Prints out alias pairs in IoRoot.printOut object. For debugging.

Parameters:
pSubpDef - the SubpDefinition object for which alias pairs will be printed.