coins.alias
クラス AliasAnalHir1

java.lang.Object
  |
  +--coins.alias.AliasAnalHir1
すべての実装インタフェース:
AliasAnal
直系の既知のサブクラス:
AliasAnalHir2

public class AliasAnalHir1
extends java.lang.Object
implements AliasAnal

Alias analysis level 1 implementation.

Alias analysis level 1 is a flow-insensitive intraprocedural analysis.

This class drives the alias analysis and also implements AliasAnal interface.

Two modes (Optimistic and Pessimistic), or options, for the analysis are available, each of which uses different assumptions about aliasing.

Handling of source languages other than C is not supported in this version.


フィールドの概要
protected static int AREA_INCLUDES
           
protected static int AREA_OVERLAPS
           
(パッケージプライベート)  Tag[] fBitAssignedTags
          Array of Tags that are assigned bits.
(パッケージプライベート)  TagVector fCurFrame
          TagVector that corresponds to the current frame (automatic variables that are in scope).
protected  int fDbgLevel
           
(パッケージプライベート)  TagVector fExternOpt
          TagVector that corresponds to the area visible from the outside of the current subprogram.
(パッケージプライベート)  TagVector fExternPes
          TagVector that corresponds to the area visible from the outside of the current subprogram.
(パッケージプライベート)  AliasFactory fFactory
          Factory object used to create other objects.
(パッケージプライベート)  TagVector fGlobals
          TagVector that corresponds to global variables.
(パッケージプライベート)  TagVector fHeap
          TagVector that corresponds to the heap (allocated) area.
(パッケージプライベート)  java.util.Map fHIRTomallocTag
          Map that maps malloc invocation nodes to corresponding tags.
(パッケージプライベート)  java.util.Map fHIRToTag
          Map that maps HIR nodes to tags.
(パッケージプライベート)  boolean fIsOptimistic
          Alias analysis option.
(パッケージプライベート)  TagVector fOther
          TagVector that corresponds to the area that is not included in fCurFrame or fStatic or fHeap, and includes frames from subprograms that called the currrent subprogram, global variables that do not appear in the current subprogram, and area allocated by the subprograms that called the current subprogram.
(パッケージプライベート)  TagVector[] fPointsTo
          The points-to graph represented as an array of TagVectors.
protected  java.util.Set fPredefined
          Set of predefined functions.
(パッケージプライベート)  TagVector fStatic
          TagVector that corresponds to the static area.
(パッケージプライベート)  int fTagBitCount
          Number of bit-allocated tags.
protected  AliasUtil fUtil
          AliasUtil object used to access utility methods.
 HirRoot hirRoot
          The HirRoot object shared by every module in the program.
 IoRoot ioRoot
          The IoRoot object shared by every module in the program.
protected static int MAY_ALIAS
           
protected static int MUST_ALIAS
           
protected static int NOT_ALIAS
           
protected static java.lang.String PREDEFINED
           
 
インタフェース coins.alias.AliasAnal から継承したフィールド
CATEGORY_NAME
 
コンストラクタの概要
AliasAnalHir1(boolean pIsOptimistic, HirRoot pHirRoot)
          Creats a new instance of AliasAnalHir1 that performs alias analysis with the specified assumptions (pIsOptimistic) about aliasing.
AliasAnalHir1(HirRoot pHirRoot)
          Creates a new instance of AliasAnalHir1 that performs alias analysis based on some set of assumptions about aliasing.
 
メソッドの概要
protected  int areAliased(Exp pExp, Exp pExp0)
          Returns one of the codes (MUST_ALIAS, MAY_ALIAS, NOT_ALIAS).
 void dbg(int pLevel, java.lang.String pHeader, java.lang.Object pBody)
          Prints out the String representation of the pBody object headed by pHeader if the debug level for this alias analysis category is greater than or equal to pLevel.
 AliasGroup getAliasGroupFor(Exp pExp)
          Returns the set of lvalue nodes the specified argument may be aliased to.
 boolean isLvalue(Exp pExp)
          Returns true if the specified argument is lvalue.
 boolean mayAlias(Exp pExp, Exp pExp0)
          Returns true if the two arguments may refer to the overlapping area in memory.
 boolean mustAlias(Exp pExp, Exp pExp0)
          Returns true if the two arguments definitely refer to the overlapping area in memory.
 void prepareForAliasAnalHir(SubpDefinition pSubpDef)
          Performs alias analysis for the given SubpDefinition argument so that may/mustAlias methods for nodes contained in the SubpDefinition are ready.
(パッケージプライベート)  void prepareTags(SubpDefinition pSubpDef)
          Instantiates tags and TagVectors, builds the tree structure between the tags and assigns TagVector bits to these tags.
 void printAliasPairs(SubpDefinition pSubpDef)
          Prints out alias pairs in IoRoot.printOut object.
 void printAliasPairsDetail(SubpDefinition pSubpDef)
          Prints out alias pairs in IoRoot.printOut object in somewhat more detailed format than in printAliasPairs.
 
クラス java.lang.Object から継承したメソッド
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

フィールドの詳細

AREA_INCLUDES

protected static final int AREA_INCLUDES
関連項目:
定数フィールド値

AREA_OVERLAPS

protected static final int AREA_OVERLAPS
関連項目:
定数フィールド値

MUST_ALIAS

protected static final int MUST_ALIAS
関連項目:
定数フィールド値

NOT_ALIAS

protected static final int NOT_ALIAS
関連項目:
定数フィールド値

MAY_ALIAS

protected static final int MAY_ALIAS
関連項目:
定数フィールド値

PREDEFINED

protected static final java.lang.String PREDEFINED
関連項目:
定数フィールド値

fPredefined

protected java.util.Set fPredefined
Set of predefined functions.


fHIRToTag

java.util.Map fHIRToTag
Map that maps HIR nodes to tags.


fHIRTomallocTag

java.util.Map fHIRTomallocTag
Map that maps malloc invocation nodes to corresponding tags.


fTagBitCount

int fTagBitCount
Number of bit-allocated tags. This determines the length of the TagVector.


fBitAssignedTags

Tag[] fBitAssignedTags
Array of Tags that are assigned bits.


fPointsTo

TagVector[] fPointsTo
The points-to graph represented as an array of TagVectors.


fCurFrame

TagVector fCurFrame
TagVector that corresponds to the current frame (automatic variables that are in scope).


fStatic

TagVector fStatic
TagVector that corresponds to the static area.


fHeap

TagVector fHeap
TagVector that corresponds to the heap (allocated) area.


fOther

TagVector fOther
TagVector that corresponds to the area that is not included in fCurFrame or fStatic or fHeap, and includes frames from subprograms that called the currrent subprogram, global variables that do not appear in the current subprogram, and area allocated by the subprograms that called the current subprogram.


fGlobals

TagVector fGlobals
TagVector that corresponds to global variables. This is a subset of fStatic.


fExternPes

TagVector fExternPes
TagVector that corresponds to the area visible from the outside of the current subprogram. This is the complement of fCurFrame.


fExternOpt

TagVector fExternOpt
TagVector that corresponds to the area visible from the outside of the current subprogram. This is the sum of fGlobals and fOther.


hirRoot

public final HirRoot hirRoot
The HirRoot object shared by every module in the program.


ioRoot

public final IoRoot ioRoot
The IoRoot object shared by every module in the program.


fIsOptimistic

final boolean fIsOptimistic
Alias analysis option. This determines the set of assumptions on which the alias analysis is based.

関連項目:
AliasAnalHir1(boolean, HirRoot)

fFactory

final AliasFactory fFactory
Factory object used to create other objects.


fUtil

protected final AliasUtil fUtil
AliasUtil object used to access utility methods.


fDbgLevel

protected int fDbgLevel
コンストラクタの詳細

AliasAnalHir1

public AliasAnalHir1(HirRoot pHirRoot)
Creates a new instance of AliasAnalHir1 that performs alias analysis based on some set of assumptions about aliasing. Two sets of assumptions ( Pessimistic and Optimistic) are available, and which one to use is determined from the command line, and defaults to Pessimistic.

パラメータ:
pHirRoot - the HirRoot object shared by every module in the program.
関連項目:
AliasAnalHir1(boolean, HirRoot)

AliasAnalHir1

public AliasAnalHir1(boolean pIsOptimistic,
                     HirRoot pHirRoot)
Creats a new instance of AliasAnalHir1 that performs alias analysis with the specified assumptions (pIsOptimistic) about aliasing. The difference between optimistic and pessimistic assumptions are:
  1. Whether vector (array) subscripts can get out of the declared range for the vector (in which case "storage promotion" is applied).
  2. Whether storage promotion will be applied to pointer arithmetic. If an arithmetic operation was performed on a pointer that is pointing to an object that is of a certain storage class, storage promotion may be applied, resulting in the result of the operation possibly pointing to any objects in the same storage class.
  3. Whether inconsistent object access (access by an object whose type differs from that of the stored object) may happen
  4. .

メソッドの詳細

prepareForAliasAnalHir

public void prepareForAliasAnalHir(SubpDefinition pSubpDef)

Performs alias analysis for the given SubpDefinition argument so that may/mustAlias methods for nodes contained in the SubpDefinition are ready.

This method may be called only once in the lifetime of this analysis object; for analyses of different SubpDefinitions, the AliasAnalHir1 object has to be newly created.

定義:
インタフェース AliasAnal 内の prepareForAliasAnalHir
パラメータ:
pSubpDef - the SubpDefinition instance nodes contained in which are to be analyzed for aliasing.

prepareTags

void prepareTags(SubpDefinition pSubpDef)
Instantiates tags and TagVectors, builds the tree structure between the tags and assigns TagVector bits to these tags.

パラメータ:
pSubpDef - SubpDefinition instance to analyze.

areAliased

protected int areAliased(Exp pExp,
                         Exp pExp0)
Returns one of the codes (MUST_ALIAS, MAY_ALIAS, NOT_ALIAS).


getAliasGroupFor

public AliasGroup getAliasGroupFor(Exp pExp)
Returns the set of lvalue nodes the specified argument may be aliased to. Each AliasGroup object for different argument (pExp) is distinct from one another, so it can be safely modified without affecting others.

定義:
インタフェース AliasAnal 内の getAliasGroupFor
パラメータ:
pExp - the lvalue node to check for aliasing.
戻り値:
the set of lvalue nodes the specified argument may be aliased to.
例外:
java.lang.IllegalArgumentException - if either of the arguments is not lvalue.

printAliasPairs

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

定義:
インタフェース AliasAnal 内の printAliasPairs
パラメータ:
pSubpDef - the SubpDefinition object aliasing relation between nodes contained in which are to be printed.

printAliasPairsDetail

public void printAliasPairsDetail(SubpDefinition pSubpDef)
Prints out alias pairs in IoRoot.printOut object in somewhat more detailed format than in printAliasPairs.

パラメータ:
pSubpDef - the SubpDefinition object aliasing relation between nodes contained in which are to be printed.

mayAlias

public boolean mayAlias(Exp pExp,
                        Exp pExp0)
Returns true if the two arguments may refer to the overlapping area in memory. A CONTENTS node with uninitialized pointer value operand (undefined behavior in C) does not represent an object that inhabits the memory space, so it is not aliased even to itself.

定義:
インタフェース AliasAnal 内の mayAlias
パラメータ:
pExp - lvalue node to check for aliasing.
pExp0 - lvalue node to check for aliasing.
戻り値:
true if the two arguments may refer to an overlapping area in memory.
例外:
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 the overlapping area in memory.

定義:
インタフェース AliasAnal 内の mustAlias
パラメータ:
pExp - lvalue node to check for aliasing.
pExp0 - lvalue node to check for aliasing.
戻り値:
true if the two arguments definitely refer to an overlapping area in memory.
例外:
java.lang.IllegalArgumentException - if either of the arguments is not lvalue.

isLvalue

public boolean isLvalue(Exp pExp)
Returns true if the specified argument is lvalue. As is the case for the query methods (mayAlias etc.) that is specified in the AliasAnal interface, this method also has to be called after the prepareForAliasAnalHir method for the corresponding SubpDefinition object has been called.

定義:
インタフェース AliasAnal 内の isLvalue
戻り値:
true if the specified argument is lvalue.

dbg

public void dbg(int pLevel,
                java.lang.String pHeader,
                java.lang.Object pBody)
Prints out the String representation of the pBody object headed by pHeader if the debug level for this alias analysis category is greater than or equal to pLevel.

パラメータ:
pLevel - the debug level required to actually print the debug information.
pHeader - header for the information
pBody - body of the information
関連項目:
Debug.printObject(int, String, Object)