View Javadoc

1   package joeq.Compiler.Analysis.IPSSA;
2   
3   import java.util.Set;
4   import joeq.Class.jq_Method;
5   import joeq.Compiler.Analysis.FlowInsensitive.MethodSummary.Node;
6   import joeq.Compiler.Analysis.IPA.PA;
7   import joeq.Compiler.Analysis.IPA.PAResults;
8   import joeq.Compiler.Analysis.IPA.PointerAnalysisResults;
9   import joeq.Compiler.Analysis.IPA.ProgramLocation.QuadProgramLocation;
10  import joeq.Compiler.Quad.BasicBlock;
11  import joeq.Compiler.Quad.CallGraph;
12  import jwutil.util.Assert;
13  
14  /***
15   * This class returns pointer information in terms of ParametrizedLocation's.
16   * 
17   * @see ParametrizedLocation
18   * */
19  class LocalPointerResults implements PointerAnalysisResults {
20      PAResults _paResults;
21  
22      LocalPointerResults(PAResults paResults){
23          this._paResults = paResults;
24      }
25      /*** 
26       * 
27       * TODO: figure out a way to map from a Quad to the 
28       * Node used there
29       */
30      public Set mod(QuadProgramLocation loc, BasicBlock bb) {
31          if(IPSSABuilder.isStore(loc.getQuad())) {
32              // Need to map from the Quad to a Node that is being stored to
33              
34          } else
35          if(IPSSABuilder.isCall(loc.getQuad())) {
36                         
37          } 
38          Assert._assert(false);
39          return null;
40      }
41      public Set ref(QuadProgramLocation loc, BasicBlock block) {
42          if(IPSSABuilder.isStore(loc.getQuad())) {
43              // Need to map from the Quad to a Node that is being stored to
44              
45          } else
46          if(IPSSABuilder.isCall(loc.getQuad())) {
47                         
48          } 
49          Assert._assert(false);
50          return null;
51      }
52      public Set getAliases(jq_Method method, SSALocation loc) {
53          // TODO
54          return null;
55      }
56      public boolean hasAliases(jq_Method method, SSALocation loc, ContextSet contextSet) {
57          // TODO
58          return false;
59      }
60      public boolean hasAliases(jq_Method method, SSALocation loc) {
61          // TODO
62          return false;
63      }
64  
65      public PA getPAResults() {
66          return _paResults.getPAResults();
67      }
68  
69      /***
70       * This is just taken from PAResults.
71       * */
72      public Set getCallTargets(QuadProgramLocation loc) {
73          return _paResults.getCallTargets(loc);
74      }
75      public CallGraph getCallGraph() {
76          return _paResults.getCallGraph();
77      }
78  }
79  
80  /***
81   * This is a local SSALocation that is part of the Method summary.
82   * @see LocalPointerResults
83   * */
84  class ParametrizedLocation implements SSALocation {
85      Node _node = null;
86      
87      ParametrizedLocation(Node node){
88          this._node = node;
89      }
90      public String toString() {
91          return _node.toString();
92      } 
93      public String toString(PA pa) {
94          return toString();
95      }
96  }