Algorithm 7.1 Intraprocedural Context-Insensitive Whole-Program Pointer Analysis
Input: Set of statements of the input program .
Output: Pointer flow graph and point-to set of each pointer denoted by .
1: // work list, initialized as empty
2: // pointer flow graph, initialized as empty
3:for each pointer do
4: // point-to set of each pointer, initialized as empty
5:end for
6:
7:procedure Solve() // main algorithm
8:for each do
9:add to
10:end for
11:for each do
12:AddEdge()
13:end for
14:while is not empty do
15:remove from
16:
17:Propagate()
18:if represents a variable then
19:for each do
20:for each do
21:AddEdge()
22:end for
23:for each do
24:AddEdge()
25:end for
26:end for
27:end if
28:end while
29:end procedure
30:
31:procedure AddEdge()
32:if then
33:add to
34:if is not empty then
35:add to
36:end if
37:end if
38:end procedure
39:
40:procedure Propagate()
41:if is not empty then
42:
43:for each do
44:add to
45:end for
46:end if
47:end procedure