scale.score.analyses
Class Aliases

java.lang.Object
  extended by scale.score.analyses.Aliases
Direct Known Subclasses:
CategoriesAliases

public class Aliases
extends java.lang.Object

This class computes aliases for a Suite of routines.

$Id: Aliases.java,v 1.78 2007-10-04 19:58:20 burrill Exp $

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

If simple analysis is selected, we assume that all variables whose addresses have been taken belong to the same alias variable. That is, a variable that points to another variable actually points to any variable that has its address taken. We add an extra pass which finds the variables whose addresses have been taken and creates a special alias variable for them.

If this is not simple analysis, we first create alias variables for each variable in the program. Then, we find the aliases. The alias variables are simply the interface to the alias analysis code. The type of alias analysis must be specified.

Note that we really don't need to create the alias variables during a separate pass. But, it is easier if we create them separately - that way we are able to keep track of them more easily.

See Also:
Suite, AliasAnalysis

Field Summary
protected  Vector<AliasVar> aliasVars
          A list of the alias variables created.
protected  AliasAnalysis analyzer
          The object representing the actual alias analyzer.
static boolean classTrace
          True if traces are to be performed.
static java.lang.String vvName
          Prefix for virtual variable names.
 
Constructor Summary
Aliases(AliasAnalysis analyzer, Suite suite, boolean simple)
          Create an object for computing aliases in a Suite.
 
Method Summary
 void addAliasVarToVector(AliasVar av)
          Add alias variable created on the fly in FindAliases to the vector.
 void addVirtualVariable(ECR ecr, VirtualVar vv)
          Associate a virtual variable with an ECR.
 void cleanup()
          Remove all the un-needed stuff.
 void computeAliases()
          The main routine for computing aliases.
protected  void computeSizeOfPointsToSet()
          Compute the size-points-to statistic.
protected  void createAliasVariables()
          The first pass of the alias analysis.
protected  void findAliases()
          The second pass of the alias analysis.
 VirtualVar getVirtualVar(ECR ecr)
          Return the virtual variable associated with the ECR or create a new virtual var if there isn't one already.
 VirtualVar getVirtualVariable(ECR ecr)
          Return the virtual variable associated with the ECR or create a new virtual var if there isn't one already.
 AliasVar newAliasVariable(Declaration d)
          Create an alias variable for a declaration and add an annotation to the declaration.
protected  java.lang.String nextVirtualName()
          Generate the next virtual variable name.
 void printAliasInfo()
          Print the aliasing information.
static int sizePointsTo()
          Return the size-points-to statistic.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

classTrace

public static boolean classTrace
True if traces are to be performed.


vvName

public static final java.lang.String vvName
Prefix for virtual variable names.

See Also:
Constant Field Values

analyzer

protected AliasAnalysis analyzer
The object representing the actual alias analyzer.


aliasVars

protected Vector<AliasVar> aliasVars
A list of the alias variables created.

Constructor Detail

Aliases

public Aliases(AliasAnalysis analyzer,
               Suite suite,
               boolean simple)
Create an object for computing aliases in a Suite.

Parameters:
analyzer - the alias analysis code
suite - a collection of modules to process (hopefully, a whole program)
simple - true if simple analysis is requested
Method Detail

sizePointsTo

public static int sizePointsTo()
Return the size-points-to statistic.


nextVirtualName

protected java.lang.String nextVirtualName()
Generate the next virtual variable name.


getVirtualVar

public VirtualVar getVirtualVar(ECR ecr)
Return the virtual variable associated with the ECR or create a new virtual var if there isn't one already.

Parameters:
ecr - an ECR that represents a virtual variable.
Returns:
the virtual variable associated with the ECR.

getVirtualVariable

public VirtualVar getVirtualVariable(ECR ecr)
Return the virtual variable associated with the ECR or create a new virtual var if there isn't one already.

Parameters:
ecr - an ECR that represents a virtual variable.
Returns:
the virtual variable associated with the ECR.

addVirtualVariable

public void addVirtualVariable(ECR ecr,
                               VirtualVar vv)
Associate a virtual variable with an ECR.


computeAliases

public void computeAliases()
The main routine for computing aliases. For simple analysis, we first find all variables that have their address taken and create a special alias variable for them. Then, we create alias variables for the rest of the user variables. Finally, we analyze the program to find the alias relationships among the variables.


createAliasVariables

protected void createAliasVariables()
The first pass of the alias analysis. We need to create alias variables which the alias analyzer uses to represent the relationship between the actual variables in program.


cleanup

public void cleanup()
Remove all the un-needed stuff.


findAliases

protected void findAliases()
The second pass of the alias analysis. We find the alias relationships for an entire program.


newAliasVariable

public AliasVar newAliasVariable(Declaration d)
Create an alias variable for a declaration and add an annotation to the declaration.

Parameters:
d - the declaration for the variable.
Returns:
the alias variable created for the declaration

addAliasVarToVector

public void addAliasVarToVector(AliasVar av)
Add alias variable created on the fly in FindAliases to the vector.


computeSizeOfPointsToSet

protected void computeSizeOfPointsToSet()
Compute the size-points-to statistic.


printAliasInfo

public void printAliasInfo()
Print the aliasing information.