edu.cmu.cs.crystal.flow
Interface IFlowAnalysis<LE>

Type Parameters:
LE -
All Known Subinterfaces:
ITACFlowAnalysis<LE>
All Known Implementing Classes:
ConcurrentFlowAnalysis, FlowAnalysis, MotherFlowAnalysis, SimpleTACFlowAnalysis, TACFlowAnalysis

public interface IFlowAnalysis<LE>

All flow analyses must be able to return the information defined by this interface.

Author:
Nels Beckman

Method Summary
 LE getEndResults(MethodDeclaration decl)
          Gets the lattice results at the end of a method.
 IResult<LE> getLabeledEndResult(MethodDeclaration d)
          Gets the lattice results at the end of a method.
 IResult<LE> getLabeledResultsAfter(ASTNode node)
          Retrieves the analysis state that exists after analyzing the node in the control flow graph.
 IResult<LE> getLabeledResultsBefore(ASTNode node)
          Retrieves the analysis state that exists before analyzing the node in the control flow graph.
 IResult<LE> getLabeledStartResult(MethodDeclaration d)
          Gets the lattice results at the start of a method.
 LE getResultsAfter(ASTNode node)
          Deprecated. use getResultsAfterCFG(ASTNode) instead.
 LE getResultsAfterAST(ASTNode node)
          Retrieves the analysis state that exists after analyzing the node in the abstract syntax tree.
 LE getResultsAfterCFG(ASTNode node)
          Retrieves the analysis state that exists after analyzing the node in the control flow graph.
 LE getResultsBefore(ASTNode node)
          Deprecated. Use getResultsBeforeCFG(ASTNode) instead.
 LE getResultsBeforeAST(ASTNode node)
          Retrieves the analysis state that exists before analyzing the node in the abstract syntax tree.
 LE getResultsBeforeCFG(ASTNode node)
          Retrieves the analysis state that exists before analyzing the node in the control flow graph.
 LE getStartResults(MethodDeclaration decl)
          Gets the lattice results at the start of a method.
 

Method Detail

getResultsBefore

@Deprecated
LE getResultsBefore(ASTNode node)
Deprecated. Use getResultsBeforeCFG(ASTNode) instead.

Retrieves the analysis state that exists before analyzing the node, including bottom. Before is respective to normal program flow and not the direction of the analysis.

Parameters:
node - the ASTNode of interest
Returns:
the lattice that represents the analysis state before analyzing the node. Will be bottom if the node doesn't have a corresponding control flow node.
See Also:
getResultsBeforeCFG(ASTNode)

getResultsAfter

@Deprecated
LE getResultsAfter(ASTNode node)
Deprecated. use getResultsAfterCFG(ASTNode) instead.

Retrieves the analysis state that exists after analyzing the node, including bottom. After is respective to normal program flow and not the direction of the analysis.

Parameters:
node - the ASTNode of interest
Returns:
the lattice that represents the analysis state before analyzing the node. Will be bottom if the node doesn't have a corresponding control flow node.

getResultsBeforeCFG

LE getResultsBeforeCFG(ASTNode node)
Retrieves the analysis state that exists before analyzing the node in the control flow graph. Before is respective to normal program flow and not the direction of the analysis. When called on an expression, this returns the lattice that occurs before this expression is evaluated, but after all sub-expressions are evaluated. For example, when called on an assignment, it returns the lattice after the left and right sub-expressions are evaluated, but before the assignment itself takes place. If there are multiple before lattices for this node, they are joined and returned.

Parameters:
node - the ASTNode of interest
Returns:
the lattice that represents the analysis state before analyzing the corresponding node in the control flow graph. Will be bottom if the node doesn't have a corresponding control flow node.
See Also:
getResultsBeforeAST(ASTNode), getLabeledResultsBefore(ASTNode)

getResultsAfterCFG

LE getResultsAfterCFG(ASTNode node)
Retrieves the analysis state that exists after analyzing the node in the control flow graph. After is respective to normal program flow and not the direction of the analysis. When called on an node, this returns the lattice that occurs after this node is evaluated, but after all sub-node are evaluated. In particular, calling this on a while node will return results after the while node is evaluated, but not after the entire statement in the AST For most expressions, this returns the same result as getResultsAfterAST(ASTNode) If there are multiple before lattices for this node, they are joined and returned.

Parameters:
node - the ASTNode of interest
Returns:
the lattice that represents the analysis state before analyzing the corresponding node in the control flow graph. Will be bottom if the node doesn't have a corresponding control flow node.
See Also:
getResultsAfterAST(ASTNode), getLabeledResultsAfter(ASTNode)

getResultsBeforeAST

LE getResultsBeforeAST(ASTNode node)
Retrieves the analysis state that exists before analyzing the node in the abstract syntax tree. Before is respective to normal program flow and not the direction of the analysis. When called on an expression, this returns the lattice that occurs before all sub-expressions are evaluated. For example, when called on an assignment, it returns the lattice before either the left or right sub-expressions are evaluated. If there are multiple before lattices for this node, they are joined and returned.

Parameters:
node - the ASTNode of interest
Returns:
the lattice that represents the analysis state before analyzing any node contained by the given node in the abstract syntax tree. Will be bottom if the node doesn't have a corresponding control flow node.
See Also:
getResultsBeforeCFG(ASTNode)

getResultsAfterAST

LE getResultsAfterAST(ASTNode node)
Retrieves the analysis state that exists after analyzing the node in the abstract syntax tree. After is respective to normal program flow and not the direction of the analysis. When called on an node, this returns the lattice that occurs after this node and all sub-nodes are evaluated. In particular, calling this on a while node will return results after the entire while statement (including all sub-expressions) is evaluated. For most expressions, this returns the same result as getResultsAfterCFG(ASTNode) If there are multiple before lattices for this node, they are joined and returned.

Parameters:
node - the ASTNode of interest
Returns:
the lattice that represents the analysis state after analyzing any node contained by the given node in the abstract syntax tree. Will be bottom if the node doesn't have a corresponding control flow node.
See Also:
getResultsAfterCFG(ASTNode)

getStartResults

LE getStartResults(MethodDeclaration decl)
Gets the lattice results at the start of a method. This will probably be the same as the results from calling IFlowAnalysisDefinition.createEntryValue(MethodDeclaration)

Parameters:
decl - The method declaration to get results for
Returns:
The lattice results at the beginning of the method.
See Also:
IFlowAnalysisDefinition.createEntryValue(MethodDeclaration)

getEndResults

LE getEndResults(MethodDeclaration decl)
Gets the lattice results at the end of a method. This will join all possible exits from a method, including explicit returns, the default return, and exceptional exits.

Parameters:
decl - The method declaration to get results for
Returns:
The lattice results at the end of the method.

getLabeledResultsBefore

IResult<LE> getLabeledResultsBefore(ASTNode node)
Retrieves the analysis state that exists before analyzing the node in the control flow graph. Works like getResultsBeforeCFG(ASTNode), except it keeps all the labels separated in an IResult.

Parameters:
node - the ASTNode of interest
Returns:
the IResult that represents the analysis state before analyzing the corresponding node in the control flow graph, separated for each incoming edge. Will be bottom if the node doesn't have a corresponding control flow node.
See Also:
getResultsBeforeCFG(ASTNode)

getLabeledResultsAfter

IResult<LE> getLabeledResultsAfter(ASTNode node)
Retrieves the analysis state that exists after analyzing the node in the control flow graph. Works like getResultsAfterCFG(ASTNode), except it keeps all the labels separated in an IResult.

Parameters:
node - the ASTNode of interest
Returns:
the IResult that represents the analysis state after analyzing the corresponding node in the control flow graph, separated for each incoming edge. Will be bottom if the node doesn't have a corresponding control flow node.
See Also:
getResultsAfterCFG(ASTNode)

getLabeledStartResult

IResult<LE> getLabeledStartResult(MethodDeclaration d)
Gets the lattice results at the start of a method. Theoretically, this will be the same as getStartResults(MethodDeclaration) and IFlowAnalysisDefinition.createEntryValue(MethodDeclaration). However, it might be different for a system which keeps multiple possible contexts in which the method could be called from based on some specifications.

Parameters:
decl - The method declaration to get results for
Returns:
The analysis results at the beginning of the method, separated by incoming edge.
See Also:
IFlowAnalysisDefinition.createEntryValue(MethodDeclaration), getStartResults(MethodDeclaration)

getLabeledEndResult

IResult<LE> getLabeledEndResult(MethodDeclaration d)
Gets the lattice results at the end of a method. This method should be used when the caller wants to access different possible ending results, such as exceptional exits v. normal returns.

Parameters:
decl - The method declaration to get results for
Returns:
The analysis results at the end of the method.
See Also:
getEndResults(MethodDeclaration)