Points-To Analysis
The Flow-Insensitive Representation
AssignmentIF: A flow-insensitive representation of a program is a set ofAssignmentIF. AnAssignmentIFinstance represents an assignment in the program which is one of the following forms:- Base:
lhs = &rhs - Simple:
lhs = rhs - Complex 1:
*lhs = rhs - Complex 2:
lhs = *rhs
- Base:
For the case of
*lhs = *rhs, an auxiliary variabletmpis introduced:tmp = *rhs,*rhs = tmp.
For now, structs and array elements are all invisible for the flow-insensitive representation: so
expr.idis abstracted toexpr;expr->idis abstracted to*expr;a[I]is abstracted toa;*(p + i), whereIis an integer, is abstracted to*p.
For the case of
lhs = a op b(or*lhs = a op b), it is abstracted tolhs = a(or*lhs = a) andlhs = b(or*lhs = b)
Intra-Procedural Points-To Analysis
- Reference : Ben Hardekopf & Calvin Lin "The ant and the grasshopper: fast and accurate pointer analysis for millions of lines of code"
PointsToGraph: A points-to graph represents an over-approximation of "what pointers are point to" information in a function.- In the graph, nodes are the objects that are reachable from the function associated with the points-to graph.
- The graph also maintains a set of objects, which is the "points-to set" of a node, for every node.
- In the graph, edges are the subset-of relations between different nodes.
- A client of
PointsToGraphcan- ask answers for the question "what a variable points to ?"
- add additional points-to information to the graph. Modification to a graph will cause a re-computation of the graph.
Inter-Procedural Points-To Analysis
- Reference: Emami, Maryam and Ghiya, Rakesh and Hendren, Laurie J. "Context-sensitive inter-procedural points-to analysis in the presence of function pointers"
InvocationGraphNode: a node represents a lexical function call in the program. An invocation graph consists of nodes for all lexical function calls in a program.- A node
nhas multiple children, each of which represents a lexical function call in the function body of the function associated withn. - A node
nalso has parent node which represents a lexical call to a function whose body contains the call represented byn. - A node
nhas no child if there is no lexical call in the function body associated with it or it represents a recursive call (i.e., an ancestor ofnis associated with the same function asn). - Every
InvocationGraphNodeis associated with a unique instance of aPointsToGraph - The inter-procedural analysis traverses the invocation graph and keeps updating the
PointsToGraphof each node until a fix-point is reached
- A node
Read / Write Analysis
- A read / write record consists of 1) an
entityor anallocation/string; 2) an optionalsubscript-indices - Taking use of the result of the points-to analysis, all collected read / write records satisfy the following conditions:
- if a record contains a meaningful
subscript-indices, then theentityorallocation/stringin this record must be an array (allocated object and string can be considered as arrays) - for the case of
a[x]whereais a pointer, there are a number of records correspond toa[x]each of which contains anentityorallocation/stringthat is referred bya - for now, read / write sets of a function call is over-approximated: a function can read / write everything visible from its function body.
- if a record contains a meaningful
Todo List
- generalizes the two analysis above and puts them into ABC
- extends the points-to analysis for being aware of array elements and struct fields
- extends the read / write analysis with corresponds to the extension of the points-to analysis
- extends the read / write analysis with more precise analysis for function calls
Last modified
7 years ago
Last modified on 05/09/19 15:38:39
Note:
See TracWiki
for help on using the wiki.
