tip.cfg.dfa
Class IntervalAnalysis

java.lang.Object
  extended by tip.cfg.CFGAnalysisAdapter
      extended by tip.cfg.FlowAnalysis<EqualityMap<ALocalDecl,IntervalAnalysis.Interval>>
          extended by tip.cfg.dfa.IntervalAnalysis
All Implemented Interfaces:
FixedPointAnalysis<EqualityMap<ALocalDecl,IntervalAnalysis.Interval>>, ICFGAnalysis, WideningNarrowingAnalysis<EqualityMap<ALocalDecl,IntervalAnalysis.Interval>>

public class IntervalAnalysis
extends FlowAnalysis<EqualityMap<ALocalDecl,IntervalAnalysis.Interval>>
implements WideningNarrowingAnalysis<EqualityMap<ALocalDecl,IntervalAnalysis.Interval>>


Nested Class Summary
static class IntervalAnalysis.Evaluator
           
static class IntervalAnalysis.Interval
           
 
Constructor Summary
IntervalAnalysis()
           
 
Method Summary
 boolean caseCAssignVarStmPoint(AAssignVarStm node, CAssignVarStmPoint point)
          Default implementation.
 boolean caseCDeclStmPoint(ADeclStm node, CDeclStmPoint point)
          Default implementation.
 boolean caseEntryPoint(Node node, EntryPoint point)
          Default implementation.
 boolean defaultNode(Node node, IProgramPoint point)
          Default implementation for program points: The variable for point is updated to be the join of the points in its dependency set.
 IntervalAnalysis.Interval eval(EqualityMap<ALocalDecl,IntervalAnalysis.Interval> sigma, PExp exp)
           
 String getVariableString(EqualityMap<ALocalDecl,IntervalAnalysis.Interval> variable)
          Returns a textual representation of the variable variable.
 String getVariableStringForPoint(IProgramPoint point, int distance)
          Returns a textual representation of the variable for point only included information relevant for points in the distance vicinity of point.
 boolean isNarrowing()
          Returns true if the current analysis is in the narrowing phase.
 boolean isWidening()
          Returns true if the current analysis is in the widening phase.
 void setNarrowing()
          Sets the current analysis to be in the narrowing phase.
 void setWidening()
          Sets the current analysis to be in the widening phase.
 IntervalAnalysis.Interval widen(IntervalAnalysis.Interval interval)
           
 
Methods inherited from class tip.cfg.FlowAnalysis
end, getDependencySet, getLattice, getName, getVariable, getVariableStringForPoint, setVariable, start
 
Methods inherited from class tip.cfg.CFGAnalysisAdapter
caseCAssignPtrStmPoint, caseCBinopExpPoint, caseCBlockPoint, caseCDerefExpPoint, caseCFunctionCallExpPoint, caseCFunctionPtrCallExpPoint, caseCIfThenElseStmPoint, caseCIfThenStmPoint, caseCInputExpPoint, caseCIntConstExpPoint, caseCMallocExpPoint, caseCNullExpPoint, caseCOutputStmPoint, caseCPointerExpPoint, caseCReturnStmPoint, caseCVarExpPoint, caseCWhileStmPoint, caseExitPoint
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface tip.cfg.FixedPointAnalysis
end, getDependencySet, getName, getVariable, getVariableStringForPoint, start
 
Methods inherited from interface tip.cfg.ICFGAnalysis
caseCAssignPtrStmPoint, caseCBinopExpPoint, caseCBlockPoint, caseCDerefExpPoint, caseCFunctionCallExpPoint, caseCFunctionPtrCallExpPoint, caseCIfThenElseStmPoint, caseCIfThenStmPoint, caseCInputExpPoint, caseCIntConstExpPoint, caseCMallocExpPoint, caseCNullExpPoint, caseCOutputStmPoint, caseCPointerExpPoint, caseCReturnStmPoint, caseCVarExpPoint, caseCWhileStmPoint, caseExitPoint
 

Constructor Detail

IntervalAnalysis

public IntervalAnalysis()
Method Detail

isWidening

public boolean isWidening()
Description copied from interface: WideningNarrowingAnalysis
Returns true if the current analysis is in the widening phase.

Specified by:
isWidening in interface WideningNarrowingAnalysis<EqualityMap<ALocalDecl,IntervalAnalysis.Interval>>
Returns:
true if the current analysis is in the widening phase

setWidening

public void setWidening()
Description copied from interface: WideningNarrowingAnalysis
Sets the current analysis to be in the widening phase.

Specified by:
setWidening in interface WideningNarrowingAnalysis<EqualityMap<ALocalDecl,IntervalAnalysis.Interval>>

isNarrowing

public boolean isNarrowing()
Description copied from interface: WideningNarrowingAnalysis
Returns true if the current analysis is in the narrowing phase.

Specified by:
isNarrowing in interface WideningNarrowingAnalysis<EqualityMap<ALocalDecl,IntervalAnalysis.Interval>>
Returns:
true if the current analysis is in the narrowing phase

setNarrowing

public void setNarrowing()
Description copied from interface: WideningNarrowingAnalysis
Sets the current analysis to be in the narrowing phase.

Specified by:
setNarrowing in interface WideningNarrowingAnalysis<EqualityMap<ALocalDecl,IntervalAnalysis.Interval>>

defaultNode

public boolean defaultNode(Node node,
                           IProgramPoint point)
Description copied from class: FlowAnalysis
Default implementation for program points: The variable for point is updated to be the join of the points in its dependency set.

Overrides:
defaultNode in class FlowAnalysis<EqualityMap<ALocalDecl,IntervalAnalysis.Interval>>
Parameters:
node - the node associated with point
point - the handled point
Returns:
true is the variable chaned
See Also:
FlowAnalysis.join(IProgramPoint)

caseCDeclStmPoint

public boolean caseCDeclStmPoint(ADeclStm node,
                                 CDeclStmPoint point)
Description copied from class: CFGAnalysisAdapter
Default implementation. Calls CFGAnalysisAdapter.defaultNode(Node,IProgramPoint).

Specified by:
caseCDeclStmPoint in interface ICFGAnalysis
Overrides:
caseCDeclStmPoint in class CFGAnalysisAdapter
Parameters:
node - the ADeclStm associated with point
point - the CDeclStmPoint calling the method
Returns:
true if the result of the analysis is changed.

caseCAssignVarStmPoint

public boolean caseCAssignVarStmPoint(AAssignVarStm node,
                                      CAssignVarStmPoint point)
Description copied from class: CFGAnalysisAdapter
Default implementation. Calls CFGAnalysisAdapter.defaultNode(Node,IProgramPoint).

Specified by:
caseCAssignVarStmPoint in interface ICFGAnalysis
Overrides:
caseCAssignVarStmPoint in class CFGAnalysisAdapter
Parameters:
node - the AAssignVarStm associated with point
point - the CAssignVarStmPoint calling the method
Returns:
true if the result of the analysis is changed.

caseEntryPoint

public boolean caseEntryPoint(Node node,
                              EntryPoint point)
Description copied from class: CFGAnalysisAdapter
Default implementation. Calls CFGAnalysisAdapter.defaultNode(Node,IProgramPoint).

Specified by:
caseEntryPoint in interface ICFGAnalysis
Overrides:
caseEntryPoint in class CFGAnalysisAdapter
Parameters:
node - the Node associated with point
point - the EntryPoint calling the method
Returns:
true if the result of the analysis is changed.

widen

public IntervalAnalysis.Interval widen(IntervalAnalysis.Interval interval)

getVariableString

public String getVariableString(EqualityMap<ALocalDecl,IntervalAnalysis.Interval> variable)
Description copied from interface: FixedPointAnalysis
Returns a textual representation of the variable variable.

Specified by:
getVariableString in interface FixedPointAnalysis<EqualityMap<ALocalDecl,IntervalAnalysis.Interval>>
Parameters:
variable - the variable for which a text representation is returned
Returns:
a textual representation of the variable variable

getVariableStringForPoint

public String getVariableStringForPoint(IProgramPoint point,
                                        int distance)
Description copied from class: FlowAnalysis
Returns a textual representation of the variable for point only included information relevant for points in the distance vicinity of point.

Specified by:
getVariableStringForPoint in interface FixedPointAnalysis<EqualityMap<ALocalDecl,IntervalAnalysis.Interval>>
Overrides:
getVariableStringForPoint in class FlowAnalysis<EqualityMap<ALocalDecl,IntervalAnalysis.Interval>>
Parameters:
point - the point for which the variable string is returned
distance - the vicinity distance taken into account
Returns:
a textual representation of the varaible for point
See Also:
IProgramPoint.getVicinity(int)

eval

public IntervalAnalysis.Interval eval(EqualityMap<ALocalDecl,IntervalAnalysis.Interval> sigma,
                                      PExp exp)