00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030 #ifndef opt_alias_analysis_INCLUDED
00031 #define opt_alias_analysis_INCLUDED
00032
00033 #include "opt_points_to_summary.h"
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054
00055
00056
00057
00058
00059
00060
00061
00062
00063
00064
00065
00066
00067 class OPT_PU_POINTS_TO_SUMMARIZER {
00068 private:
00069
00070 class VER_ID_VISIT_CNT {
00071 ID_MAP<VER_ID, BOOL> _visited;
00072 public:
00073 VER_ID_VISIT_CNT(MEM_POOL* mp) :
00074 _visited(256, FALSE, mp, FALSE) {_visited.Init();}
00075
00076 BOOL Visited (VER_ID ver) const { return _visited.Lookup (ver);}
00077 void Set_visited (VER_ID ver) { _visited.Insert (ver, TRUE); }
00078 void Reset_visited (VER_ID ver) {_visited.Insert (ver, FALSE); }
00079 };
00080
00081 OPT_STAB* _opt_stab;
00082 PU_POINTS_TO_SUMMARY* _cur_pt_sum;
00083 MEM_POOL* _mem_pool;
00084 WN_MAP _callsite_2_pt_sum;
00085
00086 BOOL _tracing;
00087
00088 void Summarize_points_to (VER_ID ver,
00089 OPT_PU_POINTS_TO_SUMMARIZER::VER_ID_VISIT_CNT& visited,
00090 PT_SET& pt_set);
00091
00092 void Bind_callee_points_to_summary
00093 (UNIFORM_NAME*, PT_SET_MGR*, PT_SET_MGR*);
00094
00095 void Annotate_points_to_summary (UNIFORM_NAME*, PT_SET_MGR*, CHI_LIST*);
00096
00097 public:
00098 OPT_PU_POINTS_TO_SUMMARIZER (MEM_POOL* mp) : _mem_pool(mp) {
00099 _opt_stab = NULL;
00100 _cur_pt_sum = NULL;
00101 _tracing = Get_Trace (TP_WOPT2, PT_SUMMARY_FLAG);
00102 _callsite_2_pt_sum = WN_MAP_Create (mp);
00103 }
00104
00105 ~OPT_PU_POINTS_TO_SUMMARIZER (void) {
00106 WN_MAP_Delete (_callsite_2_pt_sum);
00107 }
00108
00109 void Set_opt_stab (OPT_STAB* stab) { _opt_stab = stab; }
00110
00111 PU_POINTS_TO_SUMMARY* Pu_summary (void) { return _cur_pt_sum; }
00112 void Set_pu_summary (PU_POINTS_TO_SUMMARY* sum)
00113 { _cur_pt_sum = sum; }
00114
00115
00116 OPT_STAB* Opt_stab (void) const { return _opt_stab; }
00117 BOOL Tracing (void) const { return _tracing; }
00118 MEM_POOL* Mem_pool (void) const { return _mem_pool; }
00119
00120 BOOL Bind_name (UNIFORM_NAME* uname, UNIFORM_NAME* bound_name,
00121 WN* call_site);
00122
00123 void Bind_callee_points_to_summary (WN* entry_wn);
00124
00125 void Annotate_points_to_summary (void);
00126
00127 void Summarize_points_to (void);
00128
00129 PU_POINTS_TO_SUMMARY* Get_bound_pt_sum (WN* callsite) {
00130 Is_True (WN_operator(callsite) == OPR_CALL,
00131 ("WN is not a call"));
00132 return (PU_POINTS_TO_SUMMARY*)WN_MAP_Get (_callsite_2_pt_sum, callsite);
00133 }
00134
00135 void Set_bound_pt_sum (WN* callsite, PU_POINTS_TO_SUMMARY* sum) {
00136 Is_True (WN_operator(callsite) == OPR_CALL,
00137 ("WN is not a call"));
00138 return WN_MAP_Set (_callsite_2_pt_sum, callsite, sum);
00139 }
00140 };
00141
00142 #endif // opt_alias_analysis_INCLUDED