tip.cfg.dfa
Class AvailableExpressionsAnalysis

java.lang.Object
  extended by tip.cfg.CFGAnalysisAdapter
      extended by tip.cfg.FlowAnalysis<EqualitySet<ABinopExp>>
          extended by tip.cfg.dfa.AvailableExpressionsAnalysis
All Implemented Interfaces:
FixedPointAnalysis<EqualitySet<ABinopExp>>, ICFGAnalysis

public class AvailableExpressionsAnalysis
extends FlowAnalysis<EqualitySet<ABinopExp>>

AvailableExpressionsAnalysis implements the Available Expressions forwards-must analysis. It utilizes the ExpressionEqualitor for definining equality on expression.

Author:
Johnni Winther, jw@brics.dk

Constructor Summary
AvailableExpressionsAnalysis()
          Creates a new AvailableExpressionsAnalysis analysis.
 
Method Summary
 boolean caseCAssignVarStmPoint(AAssignVarStm node, CAssignVarStmPoint point)
          Computes the variable the program associated with the assignment statement node.
 boolean caseCIfThenElseStmPoint(AIfThenElseStm node, CIfThenElseStmPoint point)
          Computes the variable the program associated with the if-then-else statement node.
 boolean caseCIfThenStmPoint(AIfThenStm node, CIfThenStmPoint point)
          Computes the variable the program associated with the if-then statement node.
 boolean caseCOutputStmPoint(AOutputStm node, COutputStmPoint point)
          Computes the variable the program associated with the output statement node.
 boolean caseCReturnStmPoint(AReturnStm node, CReturnStmPoint point)
          Computes the variable the program associated with the return statement node.
 boolean caseCWhileStmPoint(AWhileStm node, CWhileStmPoint point)
          Computes the variable the program associated with the while statement node.
 boolean caseEntryPoint(Node node, EntryPoint point)
          Computes the variable for the entry point point.
 String getVariableString(EqualitySet<ABinopExp> variable)
          Returns a textual representation of variable.
 
Methods inherited from class tip.cfg.FlowAnalysis
defaultNode, end, getDependencySet, getLattice, getName, getVariable, getVariableStringForPoint, getVariableStringForPoint, setVariable, start
 
Methods inherited from class tip.cfg.CFGAnalysisAdapter
caseCAssignPtrStmPoint, caseCBinopExpPoint, caseCBlockPoint, caseCDeclStmPoint, caseCDerefExpPoint, caseCFunctionCallExpPoint, caseCFunctionPtrCallExpPoint, caseCInputExpPoint, caseCIntConstExpPoint, caseCMallocExpPoint, caseCNullExpPoint, caseCPointerExpPoint, caseCVarExpPoint, caseExitPoint
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface tip.cfg.ICFGAnalysis
caseCAssignPtrStmPoint, caseCBinopExpPoint, caseCBlockPoint, caseCDeclStmPoint, caseCDerefExpPoint, caseCFunctionCallExpPoint, caseCFunctionPtrCallExpPoint, caseCInputExpPoint, caseCIntConstExpPoint, caseCMallocExpPoint, caseCNullExpPoint, caseCPointerExpPoint, caseCVarExpPoint, caseExitPoint
 

Constructor Detail

AvailableExpressionsAnalysis

public AvailableExpressionsAnalysis()
Creates a new AvailableExpressionsAnalysis analysis.

Method Detail

caseEntryPoint

public boolean caseEntryPoint(Node node,
                              EntryPoint point)
Computes the variable for the entry point point.

Specified by:
caseEntryPoint in interface ICFGAnalysis
Overrides:
caseEntryPoint in class CFGAnalysisAdapter
Parameters:
node - the associated node
point - the entry point in question
Returns:
true if the variable for point changed

caseCAssignVarStmPoint

public boolean caseCAssignVarStmPoint(AAssignVarStm node,
                                      CAssignVarStmPoint point)
Computes the variable the program associated with the assignment statement node.

Specified by:
caseCAssignVarStmPoint in interface ICFGAnalysis
Overrides:
caseCAssignVarStmPoint in class CFGAnalysisAdapter
Parameters:
node - the assignment statement in question
point - the point for which the variable is computed
Returns:
true if the variable for point has changed

caseCIfThenStmPoint

public boolean caseCIfThenStmPoint(AIfThenStm node,
                                   CIfThenStmPoint point)
Computes the variable the program associated with the if-then statement node.

Specified by:
caseCIfThenStmPoint in interface ICFGAnalysis
Overrides:
caseCIfThenStmPoint in class CFGAnalysisAdapter
Parameters:
node - the if-then statement in question
point - the point for which the variable is computed
Returns:
true if the variable for point has changed

caseCIfThenElseStmPoint

public boolean caseCIfThenElseStmPoint(AIfThenElseStm node,
                                       CIfThenElseStmPoint point)
Computes the variable the program associated with the if-then-else statement node.

Specified by:
caseCIfThenElseStmPoint in interface ICFGAnalysis
Overrides:
caseCIfThenElseStmPoint in class CFGAnalysisAdapter
Parameters:
node - the if-then-else statement in question
point - the point for which the variable is computed
Returns:
true if the variable for point has changed

caseCWhileStmPoint

public boolean caseCWhileStmPoint(AWhileStm node,
                                  CWhileStmPoint point)
Computes the variable the program associated with the while statement node.

Specified by:
caseCWhileStmPoint in interface ICFGAnalysis
Overrides:
caseCWhileStmPoint in class CFGAnalysisAdapter
Parameters:
node - the while statement in question
point - the point for which the variable is computed
Returns:
true if the variable for point has changed

caseCOutputStmPoint

public boolean caseCOutputStmPoint(AOutputStm node,
                                   COutputStmPoint point)
Computes the variable the program associated with the output statement node.

Specified by:
caseCOutputStmPoint in interface ICFGAnalysis
Overrides:
caseCOutputStmPoint in class CFGAnalysisAdapter
Parameters:
node - the output statement in question
point - the point for which the variable is computed
Returns:
true if the variable for point has changed

caseCReturnStmPoint

public boolean caseCReturnStmPoint(AReturnStm node,
                                   CReturnStmPoint point)
Computes the variable the program associated with the return statement node.

Specified by:
caseCReturnStmPoint in interface ICFGAnalysis
Overrides:
caseCReturnStmPoint in class CFGAnalysisAdapter
Parameters:
node - the return statement in question
point - the point for which the variable is computed
Returns:
true if the variable for point has changed

getVariableString

public String getVariableString(EqualitySet<ABinopExp> variable)
Returns a textual representation of variable. NodeText is passed to EqualitySet.toString(Stringifier) in order to let EqualitySet print each element as defined by NodeText.

Parameters:
variable - the variable for which a textual representation is returned
Returns:
the textual representation of variable