tip.cfg.cfa
Class FunctionPointers

java.lang.Object
  extended by tip.analysis.AnalysisAdapter
      extended by tip.analysis.DepthFirstAdapter
          extended by tip.cfg.cfa.FunctionPointers
All Implemented Interfaces:
Analysis, PointsToMap

public class FunctionPointers
extends DepthFirstAdapter
implements PointsToMap

FunctionPointers is an implemention of a simple control flow analysis for functions pointers.

Author:
Johnni Winther, jw@brics.dk

Constructor Summary
FunctionPointers()
           
 
Method Summary
 String getName()
          Returns the name of this points-to map.
 void inAFuncDecl(AFuncDecl node)
          Called by DepthFirstAdapter.caseAFuncDecl(AFuncDecl) before traversing the children of AFuncDecl.
 void inAProgram(AProgram node)
          Called by DepthFirstAdapter.caseAProgram(AProgram) before traversing the children of AProgram.
 void inAAssignVarStm(AAssignVarStm node)
          Called by DepthFirstAdapter.caseAAssignVarStm(AAssignVarStm) before traversing the children of AAssignVarStm.
 boolean isFlowSensitive()
           
 void outAProgram(AProgram node)
          Called by DepthFirstAdapter.caseAProgram(AProgram) after traversing the children of AProgram.
 Map<Target,Set<Target>> pt(IProgramPoint point)
           
 Set<Target> pt(IProgramPoint point, ALocalDecl decl)
          Returns the pointer targets for the variable decl at the program point point as computed by the algorithm.
 
Methods inherited from class tip.analysis.DepthFirstAdapter
caseABinopExp, caseABlock, caseABlockStm, caseABody, caseADeclStm, caseADerefExp, caseADivideBinop, caseAEqBinop, caseAFuncDecl, caseAFunctionCallExp, caseAFunctionPtrCallExp, caseAGtBinop, caseAIfThenElseStm, caseAIfThenStm, caseAInputExp, caseAIntConstExp, caseALocalDecl, caseAMallocExp, caseAMinusBinop, caseANullExp, caseAOutputStm, caseAPlusBinop, caseAPointerExp, caseAProgram, caseAReturnStm, caseATimesBinop, caseAVarExp, caseAWhileStm, caseStart, caseAAssignPtrStm, caseAAssignVarStm, defaultIn, defaultInPBinop, defaultInPBlock, defaultInPBody, defaultInPDecl, defaultInPExp, defaultInPProgram, defaultInPStm, defaultOut, defaultOutPBinop, defaultOutPBlock, defaultOutPBody, defaultOutPDecl, defaultOutPExp, defaultOutPProgram, defaultOutPStm, defaultPBinop, defaultPBlock, defaultPBody, defaultPDecl, defaultPExp, defaultPProgram, defaultPStm, inABinopExp, inABlock, inABlockStm, inABody, inADeclStm, inADerefExp, inADivideBinop, inAEqBinop, inAFunctionCallExp, inAFunctionPtrCallExp, inAGtBinop, inAIfThenElseStm, inAIfThenStm, inAInputExp, inAIntConstExp, inALocalDecl, inAMallocExp, inAMinusBinop, inANullExp, inAOutputStm, inAPlusBinop, inAPointerExp, inAReturnStm, inATimesBinop, inAVarExp, inAWhileStm, inStart, inAAssignPtrStm, outABinopExp, outABlock, outABlockStm, outABody, outADeclStm, outADerefExp, outADivideBinop, outAEqBinop, outAFuncDecl, outAFunctionCallExp, outAFunctionPtrCallExp, outAGtBinop, outAIfThenElseStm, outAIfThenStm, outAInputExp, outAIntConstExp, outALocalDecl, outAMallocExp, outAMinusBinop, outANullExp, outAOutputStm, outAPlusBinop, outAPointerExp, outAReturnStm, outATimesBinop, outAVarExp, outAWhileStm, outStart, outAAssignPtrStm, outAAssignVarStm
 
Methods inherited from class tip.analysis.AnalysisAdapter
caseEOF, caseTAnd, caseTAssign, caseTComma, caseTCommentBlock, caseTCommentSingle, caseTDiv, caseTElse, caseTEq, caseTGt, caseTIdentifier, caseTIf, caseTInput, caseTIntegerConst, caseTLBrace, caseTLPar, caseTMalloc, caseTMinus, caseTNull, caseTOutput, caseTPlus, caseTRBrace, caseTReturn, caseTRPar, caseTSemicolon, caseTStar, caseTVar, caseTWhile, caseTWhiteSpace, defaultNode, defaultToken, getIn, getOut, setIn, setOut
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FunctionPointers

public FunctionPointers()
Method Detail

inAProgram

public void inAProgram(AProgram node)
Description copied from class: DepthFirstAdapter
Called by DepthFirstAdapter.caseAProgram(AProgram) before traversing the children of AProgram.

Overrides:
inAProgram in class DepthFirstAdapter
Parameters:
node - the visited AProgram node

outAProgram

public void outAProgram(AProgram node)
Description copied from class: DepthFirstAdapter
Called by DepthFirstAdapter.caseAProgram(AProgram) after traversing the children of AProgram.

Overrides:
outAProgram in class DepthFirstAdapter
Parameters:
node - the visited AProgram node

inAAssignVarStm

public void inAAssignVarStm(AAssignVarStm node)
Description copied from class: DepthFirstAdapter
Called by DepthFirstAdapter.caseAAssignVarStm(AAssignVarStm) before traversing the children of AAssignVarStm.

Overrides:
inAAssignVarStm in class DepthFirstAdapter
Parameters:
node - the visited AAssignVarStm node

inAFuncDecl

public void inAFuncDecl(AFuncDecl node)
Description copied from class: DepthFirstAdapter
Called by DepthFirstAdapter.caseAFuncDecl(AFuncDecl) before traversing the children of AFuncDecl.

Overrides:
inAFuncDecl in class DepthFirstAdapter
Parameters:
node - the visited AFuncDecl node

getName

public String getName()
Returns the name of this points-to map.

Specified by:
getName in interface PointsToMap
Returns:
the name of this points-to map

pt

public Set<Target> pt(IProgramPoint point,
                      ALocalDecl decl)
Returns the pointer targets for the variable decl at the program point point as computed by the algorithm.

Specified by:
pt in interface PointsToMap
Parameters:
point - the program point for which the pointer targets are returned
decl - the variable for which the pointer targets are returned
Returns:
the pointer target for the decl at point

isFlowSensitive

public boolean isFlowSensitive()
Specified by:
isFlowSensitive in interface PointsToMap

pt

public Map<Target,Set<Target>> pt(IProgramPoint point)
Specified by:
pt in interface PointsToMap