|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcoins.alias.AliasAnalHir1
coins.alias.alias2.AliasAnalHir2
Alias analysis level 2 implementation.
Alias analysis level 2 is a flow-sensitive intraprocedural analysis.
This class drives the alias analysis and also implements AliasAnal interface.
Flow sensitive analysis is performed only for structured subprograms, which don't contain unstructed jumps (jumps that do not correpond to C's break/continue). If the subprogram is unstructured, the analysis is reverted to that of level 1 (flow-insensitive analysis).
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.
| Field Summary | |
protected static int |
AREA_INCLUDES
|
protected static int |
AREA_OVERLAPS
|
(package private) java.util.Map |
fElemToMask
|
(package private) TagVector2 |
fExternOpt
TagVector2 that corresponds to the area
visible from the outside of the current subprogram. |
(package private) AliasFactory2 |
fFactory
Factory object used to create other objects. |
(package private) TagVector2 |
fGlobals
TagVector2 that corresponds to global variables. |
(package private) java.util.Map |
fHIRToLoc
Map that maps HIR nodes to TagVectors. |
(package private) boolean |
fIsOptimistic
Alias analysis option. |
(package private) TagVector2[] |
fLocalRootVects
|
(package private) java.util.Map |
fmallocToLoc
|
(package private) TagVector2[] |
fPointsTo
The points-to graph represented as an array of TagVector2s. |
protected java.util.Set |
fPredefined
Set of predefined functions. |
(package private) java.util.Map |
fSubscriptToMask
|
(package private) int |
fTagBitCount
Number of bit-allocated memory objects. |
protected AliasUtil |
fUtil
AliasUtil object used to access utility methods. |
(package private) java.util.Map |
fVarToLoc
|
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
|
| Fields inherited from class coins.alias.AliasAnalHir1 |
fDbgLevel |
| Fields inherited from interface coins.alias.AliasAnal |
CATEGORY_NAME |
| Constructor Summary | |
AliasAnalHir2(boolean pIsOptimistic,
HirRoot pHirRoot)
Creats a new instance of AliasAnalHir2
that performs alias analysis with the specified
assumptions (pIsOptimistic) about aliasing. |
|
AliasAnalHir2(HirRoot pHirRoot)
Creates a new instance of AliasAnalHir2 that performs
alias analysis based on some set of assumptions about aliasing. |
|
| Method Summary | |
protected int |
areAliased(Exp pExp,
Exp pExp0)
Returns one of the codes (MUST_ALIAS, MAY_ALIAS, NOT_ALIAS). |
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. |
(package private) boolean |
jumpCheck(SubpDefinition pSubpDef)
|
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. |
(package private) void |
prepare(SubpDefinition pSubpDef)
Instantiates TagVector2s and assigns TagVector2 objects to Var, malloced area, and external area. |
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 |
printAliasPairs(SubpDefinition pSubpDef)
Prints out alias pairs in IoRoot.printOut object. |
| Methods inherited from class coins.alias.AliasAnalHir1 |
dbg, printAliasPairsDetail |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
protected static final int AREA_INCLUDES
protected static final int AREA_OVERLAPS
protected static final int MUST_ALIAS
protected static final int NOT_ALIAS
protected static final int MAY_ALIAS
protected static final java.lang.String PREDEFINED
protected java.util.Set fPredefined
java.util.Map fHIRToLoc
TagVector2[] fLocalRootVects
int fTagBitCount
TagVector2.
TagVector2[] fPointsTo
TagVector2s.
TagVector2 fGlobals
TagVector2 that corresponds to global variables.
TagVector2 fExternOpt
TagVector2 that corresponds to the area
visible from the outside of the current subprogram.
public final HirRoot hirRoot
HirRoot object shared by every module in
the program.
public final IoRoot ioRoot
IoRoot object shared by every module in
the program.
final boolean fIsOptimistic
AliasAnalHir2(boolean, HirRoot)final AliasFactory2 fFactory
protected final AliasUtil fUtil
java.util.Map fVarToLoc
java.util.Map fSubscriptToMask
java.util.Map fElemToMask
java.util.Map fmallocToLoc
| Constructor Detail |
public AliasAnalHir2(HirRoot pHirRoot)
AliasAnalHir2 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.AliasAnalHir2(boolean, HirRoot)
public AliasAnalHir2(boolean pIsOptimistic,
HirRoot pHirRoot)
AliasAnalHir2
that performs alias analysis with the specified
assumptions (pIsOptimistic) about aliasing.
The difference between optimistic and pessimistic
assumptions are:
| Method Detail |
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 AliasAnalHir2 object has to be newly created.
prepareForAliasAnalHir in interface AliasAnalprepareForAliasAnalHir in class AliasAnalHir1pSubpDef - the SubpDefinition
instance nodes contained in which are to be analyzed
for aliasing.boolean jumpCheck(SubpDefinition pSubpDef)
void prepare(SubpDefinition pSubpDef)
pSubpDef - SubpDefinition instance
to analyze.
protected int areAliased(Exp pExp,
Exp pExp0)
areAliased in class AliasAnalHir1public AliasGroup getAliasGroupFor(Exp pExp)
AliasGroup object for different
argument (pExp) is distinct from one another,
so it can be safely modified without affecting others.
getAliasGroupFor in interface AliasAnalgetAliasGroupFor in class AliasAnalHir1pExp - the lvalue node to check for aliasing.
public void printAliasPairs(SubpDefinition pSubpDef)
IoRoot.printOut object.
For debugging.
printAliasPairs in interface AliasAnalprintAliasPairs in class AliasAnalHir1pSubpDef - the SubpDefinition object
aliasing relation between nodes contained in which are to
be printed.
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.
This method has to be called after the prepareForAliasAnalHir method has been called.
mayAlias in interface AliasAnalmayAlias in class AliasAnalHir1java.lang.IllegalArgumentException - if either of the
arguments is not lvalue.
public boolean mustAlias(Exp pExp,
Exp pExp0)
Returns true if the two arguments definitely refer to the overlapping area in memory.
This method has to be called after the prepareForAliasAnalHir method has been called.
mustAlias in interface AliasAnalmustAlias in class AliasAnalHir1java.lang.IllegalArgumentException - if either of the
arguments is not lvalue.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.
This method has to be called after the prepareForAliasAnalHir method has been called.
isLvalue in interface AliasAnalisLvalue in class AliasAnalHir1
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||