coins.alias
クラス RecordAlias

java.lang.Object
  |
  +--coins.alias.RecordAlias

public class RecordAlias
extends java.lang.Object

RecordAlias Do the alias analysys of HIR subprogram and record its information so that it may be used in HIR-to-LIR conversion or LIR analysis. The sequence of statements AliasAnal lAlias2 = new AliasAnalHir2(hirRoot); .... lAliasAnal1.prepareForAliasAnalHir(subpDefinition); RecordAlias lAliasInf = new RecordAlias(lAliasAnal2, subpDefinition); will make following methods available: lAliasInf.possiblyAddressTaken(var) return true if var or its aliases are taken address else return false. (If false, var may be assigned to abstract register.) lAliasInf.mayAlias(var1, var2) return true if var1 and var2 are possibly aliased where, var, var1, var2 are HIR Var symbol which may be gotten from the corresponding LIR symbol. The above information is valid while one LIR symbol corresponds to at most one HIR symbol.


フィールドの概要
protected  java.util.Set fAddressTakenVars
           
 AliasAnal fAliasAnal
           
protected  java.util.Map fAliasGroupOfSym
          Maps variable to the set of variables that are aliased to it.
protected  java.util.Set fAliasOfAddressTakenVars
           
protected  boolean fCallWithSideEffectIncluded
          Turned to true if call node with side effect appered in the subprogram.
protected  int fDbgLevel
           
protected  java.util.Set fEmptySet
           
protected  java.util.Map fNodesOfSym
          Maps a variable to the set of VarNodes that are used to set or refer the value of the variable.
protected  java.util.Set fSetOfGlobalVariables
           
protected  java.util.Set fSetOfSyms
          Set of variables appered in the subprogram.
 HirRoot hirRoot
           
 IoRoot ioRoot0
           
 
コンストラクタの概要
RecordAlias(AliasAnal pAliasAnal, SubpDefinition pSubpDef)
          RecordAlias Do the alias analysys of HIR subprogram and record its information (alias group, etc.) so that it may be used in HIR-to-LIR conversion or LIR analysis.
RecordAlias(AliasAnal pAliasAnal, SubpDefinition pSubpDef, SubpFlow pSubpFlow)
           
 
メソッドの概要
 java.util.Set aliasExpGroup(java.util.Set pNodeSet)
           
 java.util.Set aliasExps(Exp pExp)
           
 java.util.Set aliasSymGroup(java.util.Set pSet)
          Get the symbols aliased with the symbols in pSet.
 java.util.Set aliasSyms(Sym pSym)
          Get the set of symbols that may be aliased to pSym.
 HIR ChangeLvalue(HIR pHir)
           
protected  void computeAliasGroupForSyms()
          computeAliasGroupForSyms: Compute alias group for all variables ppeared in the subprogram.
 Sym getLvalueSymbol(HIR pHir)
          getLvalueSymbol
 VarNode getLvalueSymNode(HIR pHir)
          getLvalueSymNode
 boolean mayAlias(Sym pSym1, Sym pSym2)
          mayAlias See if 2 variables are aliased or not.
 boolean possiblyAddressTaken(Sym pSym)
          possiblyAddressTaken See if a variable is taken its address or not.
 void printMapShort(java.lang.String pHeader, java.util.Map pMap)
          recordAliasOfExp:
(パッケージプライベート)  void recordLvalueNodeForSym(Sym pSym, Exp pExp, java.util.Map pMap)
          recordLvalueNodeForSym Record pExp to the set of l-value nodes corresponding to the variable pSym.
protected  void simplifiedAliasGrouping(SubpFlow pSubpFlow)
          simplifiedAliasGrouping is selected for subprograms with large complexity level (pSubpFlow.getComplexityLevel()) > 1).
 
クラス java.lang.Object から継承したメソッド
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

フィールドの詳細

hirRoot

public final HirRoot hirRoot

ioRoot0

public final IoRoot ioRoot0

fAliasAnal

public final AliasAnal fAliasAnal

fAddressTakenVars

protected java.util.Set fAddressTakenVars

fAliasOfAddressTakenVars

protected java.util.Set fAliasOfAddressTakenVars

fSetOfGlobalVariables

protected java.util.Set fSetOfGlobalVariables

fNodesOfSym

protected java.util.Map fNodesOfSym
Maps a variable to the set of VarNodes that are used to set or refer the value of the variable. (combined result of fSetNodesOfSym and fRefNodesOfSym


fSetOfSyms

protected java.util.Set fSetOfSyms
Set of variables appered in the subprogram.


fAliasGroupOfSym

protected java.util.Map fAliasGroupOfSym
Maps variable to the set of variables that are aliased to it.


fCallWithSideEffectIncluded

protected boolean fCallWithSideEffectIncluded
Turned to true if call node with side effect appered in the subprogram. Call with no side effect does not change this field.


fDbgLevel

protected int fDbgLevel

fEmptySet

protected java.util.Set fEmptySet
コンストラクタの詳細

RecordAlias

public RecordAlias(AliasAnal pAliasAnal,
                   SubpDefinition pSubpDef)
RecordAlias Do the alias analysys of HIR subprogram and record its information (alias group, etc.) so that it may be used in HIR-to-LIR conversion or LIR analysis.

パラメータ:
pAliasAnal - Instance of AliasAnalHir1.
pSubpDef - Subprogram definition subtree.

RecordAlias

public RecordAlias(AliasAnal pAliasAnal,
                   SubpDefinition pSubpDef,
                   SubpFlow pSubpFlow)
メソッドの詳細

possiblyAddressTaken

public boolean possiblyAddressTaken(Sym pSym)
possiblyAddressTaken See if a variable is taken its address or not. If the variable is aliased to some one that is taken address, then the variable is treated as address-taken variable. If subscripted variable of an array is taken address, then the array is treated as the one that is taken address. If element of structure/union is taken address, then the structure/union is treated as the one that is taken address.

パラメータ:
pSym - Variable (Var, Param, Elem) or ExpId for subscripted/qualified variable.
戻り値:
true if pSym or its aliases are taken address else return false.

mayAlias

public boolean mayAlias(Sym pSym1,
                        Sym pSym2)
mayAlias See if 2 variables are aliased or not.

パラメータ:
pSym1 - Variable (Var, Param, Elem) or ExpId for subscripted/qualified variable.
pSym2 - Variable (Var, Param, Elem) or ExpId for subscripted/qualified variable.
戻り値:
true if pSym1 is aliased to pSym2 or pSym2 is aliased to pSym1, else return false.

aliasSyms

public java.util.Set aliasSyms(Sym pSym)
Get the set of symbols that may be aliased to pSym. The returned result should not be changed (do not add elements, ...) because the returned result may be shared with others. //##62

パラメータ:
pSym - symbol to be examined.
戻り値:
the set of symbols that may be aliased to pSym.

aliasSymGroup

public java.util.Set aliasSymGroup(java.util.Set pSet)
Get the symbols aliased with the symbols in pSet. (The result always cover pSet.) //##84

パラメータ:
pSet - Set of symbols to be examined.
戻り値:
the set of symbols aliased with some of pSet.

aliasExps

public java.util.Set aliasExps(Exp pExp)

aliasExpGroup

public java.util.Set aliasExpGroup(java.util.Set pNodeSet)

computeAliasGroupForSyms

protected void computeAliasGroupForSyms()
computeAliasGroupForSyms: Compute alias group for all variables ppeared in the subprogram. Computation is done for fSetAliasGroupOfSym and fRefAliasGroupOfSym and then they are combined as fAliasGroupOfSym. Initial values for fSetAliasGroupOfSym and fRefAliasGroupOfSym are set of l-value variables computed from fSetLvalueNodes and fRefNodesOfSym respectively.


ChangeLvalue

public HIR ChangeLvalue(HIR pHir)

getLvalueSymbol

public Sym getLvalueSymbol(HIR pHir)
getLvalueSymbol

パラメータ:
pHir - l-value node.
戻り値:
the l-value symbol of pHir, or return null if pHir has no l-value symbol.

getLvalueSymNode

public VarNode getLvalueSymNode(HIR pHir)
getLvalueSymNode


recordLvalueNodeForSym

void recordLvalueNodeForSym(Sym pSym,
                            Exp pExp,
                            java.util.Map pMap)
recordLvalueNodeForSym Record pExp to the set of l-value nodes corresponding to the variable pSym.

パラメータ:
pSym - variable symbol.
pExp - variable node that uses pSym.
pMap - map showing the correspondence between the variable and set of variable nodes.

printMapShort

public void printMapShort(java.lang.String pHeader,
                          java.util.Map pMap)
recordAliasOfExp:


simplifiedAliasGrouping

protected void simplifiedAliasGrouping(SubpFlow pSubpFlow)
simplifiedAliasGrouping is selected for subprograms with large complexity level (pSubpFlow.getComplexityLevel()) > 1). It neither computes point-to graph nore scans the subprogram. For each variable used in the subprogram, its alias group contains all address-taken-variables if the variablbe is taken its address all global variables if the variable is a formal parameter or the subprogram contains call and the variable is global.

パラメータ:
pSubpFlow -