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
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054 #ifndef ipl_summarize_INCLUDED
00055 #define ipl_summarize_INCLUDED
00056
00057 #ifndef cxx_template_INCLUDED
00058 #include "cxx_template.h"
00059 #endif // cxx_template_INCLUDED
00060
00061 #ifndef cxx_hash_INCLUDED
00062 #include "cxx_hash.h"
00063 #endif // cxx_hash_INCLUDED
00064
00065 #ifndef wn_util_INCLUDED
00066 #include "wn_util.h"
00067 #endif // wn_util_INCLUDED
00068
00069 #ifndef wn_map_INCLUDED
00070 #include "wn_map.h"
00071 #endif // wn_map_INCLUDED
00072
00073 #ifndef lwn_util_INCLUDED
00074 #include "lwn_util.h"
00075 #endif // lwn_util_INCLUDED
00076
00077 #ifndef config_ipa_INCLUDED
00078 #include "config_ipa.h"
00079 #endif // config_ipa_INCLUDED
00080
00081 #ifndef opt_du_INCLUDED
00082 #include "opt_du.h"
00083 #endif // opt_du__INCLUDED
00084
00085 #ifndef opt_alias_interface_INCLUDED
00086 #include "opt_alias_interface.h"
00087 #endif // opt_alias_interface_INCLUDED
00088
00089 #ifndef opt_ssa_INCLUDED
00090 #include "opt_ssa.h"
00091 #endif // opt_ssa_INCLUDED
00092
00093 #ifndef ipl_summary_INCLUDED
00094 #include "ipl_summary.h"
00095 #endif // ipl_summary_INCLUDED
00096
00097 #ifndef CXX_MEMORY_INCLUDED
00098 #include "cxx_memory.h"
00099 #endif
00100
00101 #ifndef ipl_reorder_INCLUDED // for reorder_ipl_pool
00102 #include "ipl_reorder.h"
00103 #endif
00104
00105
00106
00107
00108
00109
00110 class ALT_ENTRY
00111 {
00112
00113 private:
00114 WN* _w;
00115 INT _position;
00116 INT _formal_count;
00117
00118 public:
00119 WN* Get_wn() const { return _w;};
00120 void Set_wn(WN* w) { _w = w;};
00121
00122 INT Get_position() const { return _position;};
00123 void Set_position(INT p) { _position = p;};
00124
00125 INT Get_formal_count() const { return _formal_count;};
00126 void Set_formal_count(INT f) { _formal_count = f;};
00127
00128 void Init() { BZERO (this, sizeof(ALT_ENTRY)); }
00129 };
00130
00131
00132
00133
00134 class INLINE_ATTR {
00135
00136 #define IPL_FILE_INLINE 0x1
00137 #define IPL_NO_FILE_INLINE 0x2
00138 #define IPL_PU_INLINE 0x4
00139 #define IPL_NO_PU_INLINE 0x8
00140
00141 private:
00142
00143 char *name;
00144 INT inline_attr;
00145
00146 public:
00147
00148
00149
00150 void Set_name (char *str) { name = str; }
00151 char *Get_name () const { return name; }
00152
00153 void Set_file_inline() { inline_attr |= IPL_FILE_INLINE;};
00154 BOOL Is_file_inline() const { return inline_attr & IPL_FILE_INLINE;};
00155
00156 void Set_no_file_inline() { inline_attr |= IPL_NO_FILE_INLINE;};
00157 BOOL Is_no_file_inline() const { return inline_attr & IPL_NO_FILE_INLINE;};
00158
00159 void Set_pu_inline() { inline_attr |= IPL_PU_INLINE;};
00160 BOOL Is_pu_inline() const { return inline_attr & IPL_PU_INLINE;};
00161
00162 void Set_no_pu_inline() { inline_attr |= IPL_NO_PU_INLINE;};
00163 BOOL Is_no_pu_inline() const { return inline_attr & IPL_NO_PU_INLINE;};
00164
00165 };
00166
00167
00168
00169 typedef HASH_TABLE<const ST *, INT> GLOBAL_HASH_TABLE;
00170 typedef HASH_TABLE<INT, ST *> COMMON_HASH_TABLE;
00171
00172 class EMITTER;
00173 class SUMMARY_CHECK_POINT;
00174
00175
00176
00177 class SUMMARY_DESC
00178 {
00179 private:
00180
00181 WN *_w;
00182 union {
00183 PHI_NODE *_phi;
00184 CODEREP *_chi_cr;
00185 } u;
00186 IPA_CONST_TYPE _type;
00187 BOOL _addr_of;
00188 BOOL _convertible_to_global;
00189 TYPE_ID _target_mtype;
00190
00191 public:
00192
00193 SUMMARY_DESC () {
00194 BZERO (this, sizeof(SUMMARY_DESC));
00195 }
00196
00197 void Set_wn (WN *w) { _w = w; }
00198 WN *Get_wn () const { return _w; }
00199
00200 void Set_type (IPA_CONST_TYPE t) { _type = t;}
00201 IPA_CONST_TYPE Get_type () const { return _type; }
00202
00203 void Set_phi (PHI_NODE *p) { u._phi = p; }
00204 PHI_NODE *Get_phi () const { return u._phi; };
00205
00206 void Set_chi_cr (CODEREP *cr) { u._chi_cr = cr; }
00207 CODEREP *Get_chi_cr () const { return u._chi_cr; };
00208
00209 void Set_is_addr_of () { _addr_of = TRUE; }
00210 void Reset_is_addr_of () { _addr_of = FALSE; }
00211 BOOL Is_addr_of () const { return _addr_of; }
00212
00213 void Set_convertible_to_global () { _convertible_to_global = TRUE; }
00214 void Reset_convertible_to_global () { _convertible_to_global = FALSE; }
00215 BOOL Is_convertible_to_global () const { return _convertible_to_global; }
00216
00217 void Set_target_mtype (TYPE_ID m) { _target_mtype = m; }
00218 TYPE_ID Target_mtype () const { return _target_mtype; }
00219
00220 };
00221
00222
00223 enum PROGRAM { IPL, INLINER };
00224
00225
00226
00227
00228
00229
00230
00231
00232 class SUMMARY_CREF_SYMBOL {
00233 private:
00234 INT32 _symbol_index;
00235 INT _cur_cref_count;
00236 public:
00237 void Set_symbol_index(INT32 idx) { _symbol_index = idx;};
00238 INT32 Get_symbol_index() const { return _symbol_index;};
00239 void Reset_cur_cref_count() { _cur_cref_count = 0;};
00240 void Incr_cur_cref_count() { _cur_cref_count++;};
00241 void Decr_cur_cref_count() { _cur_cref_count--;};
00242 INT Get_cur_cref_count() const { return _cur_cref_count;}
00243 };
00244
00245
00246
00247
00248
00249
00250
00251 class SUMMARY_PROC_INFO {
00252 private:
00253 mINT32 _symbol_index;
00254 INT32 _call_count;
00255 mUINT32 _state;
00256
00257 #define PROC_HAS_ISTORE 0x001 // There is an ISTORE in the body
00258 public:
00259 void Set_symbol_index (INT32 s) { _symbol_index = s; }
00260 INT32 Get_symbol_index () const { return _symbol_index; }
00261 UINT32 Get_state () const { return _state; }
00262 void Set_has_istore() { _state |= PROC_HAS_ISTORE;}
00263 BOOL Has_istore() const { return (_state & PROC_HAS_ISTORE);}
00264 void Incr_call_count () { ++_call_count; }
00265 void Decr_call_count () { --_call_count; }
00266 BOOL Is_Leaf_now () const { return (_call_count == 0);}
00267 void Init (void) {
00268 BZERO (this, sizeof(SUMMARY_PROC_INFO));
00269 _call_count = 0;
00270 }
00271
00272 };
00273
00274 extern void
00275 Init_Aux_Symbol_Info (SYMTAB_IDX level);
00276
00277
00278
00279
00280
00281
00282
00283
00284
00285 template <PROGRAM program>
00286 class SUMMARIZE
00287 {
00288
00289 private:
00290
00291 MEM_POOL *mem;
00292
00293 WN *entry_point;
00294
00295
00296
00297 struct DU_MANAGER *du_mgr;
00298 struct ALIAS_MANAGER *alias_mgr;
00299 EMITTER *emitter;
00300
00301 DYN_ARRAY<SUMMARY_PROCEDURE> _procedure;
00302 DYN_ARRAY<SUMMARY_CALLSITE> _callsite;
00303 DYN_ARRAY<SUMMARY_STMT> _stmt;
00304 DYN_ARRAY<SUMMARY_CONTROL_DEPENDENCE> _ctrl_dep;
00305 DYN_ARRAY<SUMMARY_FORMAL> _formal;
00306 DYN_ARRAY<SUMMARY_ACTUAL> _actual;
00307 DYN_ARRAY<SUMMARY_VALUE> _value;
00308 DYN_ARRAY<SUMMARY_EXPR> _expr;
00309 DYN_ARRAY<SUMMARY_PHI> _phi;
00310 DYN_ARRAY<SUMMARY_CHI> _chi;
00311 DYN_ARRAY<SUMMARY_SYMBOL> _symbol;
00312
00313 DYN_ARRAY<SUMMARY_CREF_SYMBOL> _symbol_crefcount;
00314 DYN_ARRAY<SUMMARY_PROC_INFO> _proc_info;
00315 DYN_ARRAY<SUMMARY_GLOBAL> _global;
00316 DYN_ARRAY<SUMMARY_FEEDBACK> _feedback;
00317 DYN_ARRAY<SUMMARY_COMMON> _common;
00318 DYN_ARRAY<SUMMARY_COMMON_SHAPE> _common_shape;
00319 DYN_ARRAY<SUMMARY_STID> _global_stid;
00320 DYN_ARRAY<TCON *> _tcon;
00321 DYN_ARRAY<ALT_ENTRY> _alt_entry;
00322 DYN_ARRAY<INLINE_ATTR> _inline_attr;
00323 DYN_ARRAY<SUMMARY_STRUCT_ACCESS> _struct_access;
00324
00325 #ifdef KEY
00326 DYN_ARRAY<SUMMARY_TY_INFO> _ty_info;
00327 #endif
00328 BOOL Trace_Modref;
00329
00330
00331
00332 DYN_ARRAY<INT> *Global_index;
00333
00334
00335
00336
00337 GLOBAL_HASH_TABLE *Global_hash_table;
00338
00339
00340 typedef hash_map<mUINT32, mUINT32> TY_TO_ACCESS_MAP;
00341 TY_TO_ACCESS_MAP *Ty_to_access_map;
00342
00343 #ifdef KEY
00344 typedef HASH_TABLE<UINT32, INT> TY_INFO_HASH_TABLE;
00345 TY_INFO_HASH_TABLE * Ty_info_hash_table;
00346 #endif
00347
00348 typedef STACK<UINT64> LOOP_COUNT_STACK;
00349 LOOP_COUNT_STACK *loop_count_stack;
00350 INT first_struct_access_of_PU, last_struct_access_of_PU;
00351 #define max_hot_loops 5 //just consider partial loops, how to find it?
00352
00353 BOOL File_Pragmas;
00354
00355
00356 void Set_entry_point (WN *w) { entry_point = w; }
00357
00358
00359
00360 SUMMARY_PROCEDURE *New_procedure () {
00361 INT new_idx = _procedure.Newidx ();
00362 _procedure[new_idx].Init ();
00363 return &(_procedure[new_idx]);
00364 }
00365
00366 SUMMARY_PROC_INFO *New_proc_info () {
00367 INT new_idx = _proc_info.Newidx ();
00368 _proc_info[new_idx].Init ();
00369 return &(_proc_info[new_idx]);
00370 }
00371
00372 SUMMARY_CALLSITE *New_callsite () {
00373 INT new_idx = _callsite.Newidx ();
00374 _callsite[new_idx].Init ();
00375 return &(_callsite[new_idx]);
00376 }
00377
00378 SUMMARY_STMT *New_stmt () {
00379 INT new_idx = _stmt.Newidx ();
00380 _stmt[new_idx].Init ();
00381 return &(_stmt[new_idx]);
00382 }
00383
00384 SUMMARY_CONTROL_DEPENDENCE *New_ctrl_dep () {
00385 INT new_idx = _ctrl_dep.Newidx ();
00386 _ctrl_dep[new_idx].Init ();
00387 return &(_ctrl_dep[new_idx]);
00388 }
00389
00390 SUMMARY_ACTUAL *New_actual () {
00391 INT new_idx = _actual.Newidx ();
00392 _actual[new_idx].Init ();
00393 return &(_actual[new_idx]);
00394 }
00395
00396 SUMMARY_FORMAL *New_formal () {
00397 INT new_idx = _formal.Newidx ();
00398 return &(_formal[new_idx]);
00399 }
00400
00401 SUMMARY_VALUE *New_value () {
00402 INT new_idx = _value.Newidx ();
00403 _value[new_idx].Init ();
00404 return &(_value[new_idx]);
00405 }
00406
00407 SUMMARY_EXPR *New_expr () {
00408 INT new_idx = _expr.Newidx ();
00409 _expr[new_idx].Init ();
00410 return &(_expr[new_idx]);
00411 }
00412
00413 SUMMARY_PHI *New_phi () {
00414 INT new_idx = _phi.Newidx ();
00415 _phi[new_idx].Init ();
00416 return &(_phi[new_idx]);
00417 }
00418
00419 SUMMARY_CHI *New_chi () {
00420 INT new_idx = _chi.Newidx ();
00421 _chi[new_idx].Init ();
00422 return &(_chi[new_idx]);
00423 }
00424
00425 SUMMARY_SYMBOL *New_symbol () {
00426 INT new_idx = _symbol.Newidx ();
00427 _symbol[new_idx].Init ();
00428 return &(_symbol[new_idx]);
00429 }
00430
00431 SUMMARY_CREF_SYMBOL *New_symbol_crefcount () {
00432 INT new_idx = _symbol_crefcount.Newidx ();
00433 _symbol_crefcount[new_idx].Reset_cur_cref_count();
00434
00435 return &(_symbol_crefcount[new_idx]);
00436 }
00437
00438 SUMMARY_GLOBAL *New_global () {
00439 INT new_idx = _global.Newidx ();
00440 _global[new_idx].Init ();
00441 return &(_global[new_idx]);
00442 }
00443
00444 SUMMARY_FEEDBACK *New_feedback () {
00445 INT new_idx = _feedback.Newidx ();
00446 _feedback[new_idx].Init ();
00447 return &(_feedback[new_idx]);
00448 }
00449
00450 SUMMARY_COMMON *New_common () {
00451 INT new_idx = _common.Newidx ();
00452 _common[new_idx].Init ();
00453 return &(_common[new_idx]);
00454 }
00455
00456 SUMMARY_COMMON_SHAPE *New_common_shape () {
00457 INT new_idx = _common_shape.Newidx ();
00458 _common_shape[new_idx].Init ();
00459 return &(_common_shape[new_idx]);
00460 }
00461
00462 SUMMARY_STID *New_global_stid () {
00463 INT new_idx = _global_stid.Newidx ();
00464 _global_stid[new_idx].Init ();
00465 return &(_global_stid[new_idx]);
00466 }
00467
00468 TCON **New_tcon () {
00469 INT new_idx = _tcon.Newidx ();
00470 return &(_tcon[new_idx]);
00471 }
00472
00473 ALT_ENTRY *New_alt_entry () {
00474 INT new_idx = _alt_entry.Newidx ();
00475 _alt_entry[new_idx].Init ();
00476 return &(_alt_entry[new_idx]);
00477 }
00478
00479 INLINE_ATTR *New_inline_attr () {
00480 INT new_idx = _inline_attr.Newidx ();
00481 return &(_inline_attr[new_idx]);
00482 }
00483 mUINT32 New_struct_access(mUINT32 ty_index, mUINT32 flatten_flds){
00484 mUINT32 new_idx = _struct_access.Newidx ();
00485 _struct_access[new_idx].Init (ty_index,flatten_flds,&reorder_ipl_pool);
00486 return new_idx;
00487 }
00488
00489 #ifdef KEY
00490 SUMMARY_TY_INFO *New_ty_info () {
00491 INT new_idx = _ty_info.Newidx ();
00492 _ty_info[new_idx].Init ();
00493 return &(_ty_info[new_idx]);
00494 }
00495 #endif
00496
00497 void Process_alt_procedure (WN *w, INT formal_index, INT formal_count);
00498 void Process_callsite (WN *w, INT id, INT loopnest, float =-1);
00499 #if defined(KEY) && !defined(_STANDALONE_INLINER) && !defined(_LIGHTWEIGHT_INLINER)
00500 void Process_icall (SUMMARY_PROCEDURE *, WN *, INT, float);
00501 #endif
00502 void Process_formal (WN *w, INT num_formals, SUMMARY_PROCEDURE *proc);
00503 void Process_formal_alt (WN *w, INT kid_count);
00504 void Process_actual (WN *actual);
00505 void Process_alt_entry (WN *w);
00506 void Process_IO(WN* w);
00507 void Set_IO(WN *w, BOOL is_read);
00508 void Process_inline_attr (WN *pragma_node);
00509 void Process_commons_in_whirl(WN* w, SUMMARY_PROCEDURE *proc);
00510
00511 inline void Restore_from_check_point (const SUMMARY_CHECK_POINT *cp);
00512 void Process_constant_jump_function (WN *w, SUMMARY_VALUE *value);
00513 void Process_phi_operand (INT phi_index, WN *orig_wn, CODEREP *cr, INT kid);
00514 INT Process_phi_jump_function (WN *orig_wn, PHI_NODE *phi);
00515 INT Process_chi_jump_function (WN *wn, const SUMMARY_DESC &desc);
00516 void Process_operand (WN *w, INT kid, INT expr_idx);
00517 INT Process_polynomial_jump_function (WN *w);
00518 BOOL Mismatched_load_store (CODEREP *cr, BOOL is_ptr_var, ST *st, INT
00519 load_offset, TYPE_ID load_type);
00520 void Classify_indirect (SUMMARY_DESC &result, WN *w);
00521 void Classify_const_value (SUMMARY_DESC &result, WN *w);
00522 void Classify_const_value (SUMMARY_DESC &result, WN *w, CODEREP *cr);
00523 INT Process_jump_function (SUMMARY_DESC *desc);
00524 void Process_jump_function (WN *w, INT value_idx);
00525
00526 void Record_global_ref (WN *w, ST *s, OPERATOR op, BOOL refcount_only);
00527 void Record_ref_formal (WN *);
00528 void Record_ref_all_formal (WN *w, BOOL parm_store = FALSE);
00529 void Check_kid_ref (WN* w);
00530 void Record_ref (WN *w);
00531
00532 void Record_global_dmod (const WN *w, const WN *rhs, const ST *st);
00533 void Record_mod_formal (WN *w);
00534 void Record_mod_common (WN *w, const ST *st);
00535 void Record_mod (WN *w);
00536
00537 INT Process_cd_for_phi_node (IDTYPE cd_bb_idx);
00538 BOOL Process_control_dependence (WN *w, INT node_index);
00539 void Copy_summary_ctrl_dep (SUMMARY_CONTROL_DEPENDENCE *cd);
00540 inline void Generate_summary_control_dependence (void);
00541
00542 void Update_Addr_Passed_Count (WN* opr_parm);
00543 void Set_local_addr_taken_attrib ();
00544
00545 void Process_pragma_node (WN* w);
00546 void Process_pragmas (WN *w);
00547 void Update_call_pragmas (SUMMARY_CALLSITE *callsite);
00548 void Start_PU_process_struct_access(){
00549 first_struct_access_of_PU=Get_struct_access_idx()+1;
00550 }
00551
00552 void Record_struct_access(WN *w, mUINT64 loop_count);
00553 UINT Finish_PU_process_struct_access(){
00554 last_struct_access_of_PU=Get_struct_access_idx()+1;
00555 INT num_ele;
00556 num_ele=last_struct_access_of_PU-first_struct_access_of_PU;
00557 return num_ele;
00558 };
00559
00560 #ifdef KEY
00561 void Record_ty_info_for_type (TY_IDX ty, TY_FLAGS flags);
00562 #endif
00563
00564
00565 INT IPL_GEN_Value(WN* wn_value, DYN_ARRAY<SUMMARY_VALUE>* sv,
00566 DYN_ARRAY<SUMMARY_EXPR>* sx);
00567 INT IPL_GEN_Expr(OPERATOR opr, INT exp_one, INT exp_two,
00568 DYN_ARRAY<SUMMARY_EXPR>* sx);
00569 INT IPL_GEN_Const(INT value, DYN_ARRAY<SUMMARY_VALUE>* sv,
00570 DYN_ARRAY<SUMMARY_EXPR>* sx);
00571 BOOL Easy_Trip_Count(WN* wn_loop, WN** wn_addr_ub, WN** wn_addr_lb,
00572 INT* addr_intconst);
00573 INT IPL_EX_Expr(WN* wn_expr, DYN_ARRAY<SUMMARY_VALUE>* sv,
00574 DYN_ARRAY<SUMMARY_EXPR>* sx);
00575 INT IPL_EX_Trip_Count(WN* wn_loop, DYN_ARRAY<SUMMARY_VALUE>* sv,
00576 DYN_ARRAY<SUMMARY_EXPR>* sx, BOOL constant_estimate);
00577 INT IPL_EX_Call(WN* wn_call, DYN_ARRAY<SUMMARY_VALUE>* sv,
00578 DYN_ARRAY<SUMMARY_EXPR>* sx);
00579 INT IPL_EX_Statement(WN* wn_statement, DYN_ARRAY<SUMMARY_VALUE>* sv,
00580 DYN_ARRAY<SUMMARY_EXPR>* sx, BOOL constant_estimate);
00581 INT IPL_EX_Block(WN* wn_block, DYN_ARRAY<SUMMARY_VALUE>* sv,
00582 DYN_ARRAY<SUMMARY_EXPR>* sx, BOOL constant_estimate);
00583 void IPL_Execution_Cost(WN* wn_func, SUMMARY_PROCEDURE* sp,
00584 MEM_POOL* mem_pool, BOOL constant_estimate);
00585 #ifdef KEY
00586 void Process_eh_globals (void);
00587 void Process_eh_region (WN *);
00588 #endif
00589
00590
00591 void Identify_switch_clause_labels (WN* node, INT& default_lab_num,
00592 BS* &case_labels, MEM_POOL* mem);
00593 void Collect_calls_in_switch (WN* first_stmt, INT default_lab_num,
00594 BS* case_label, BS* &calls_in_switch, MEM_POOL* mp);
00595
00596 public:
00597
00598
00599
00600 WN *Get_entry_point () const { return entry_point; }
00601
00602 BOOL Has_global_symbol_index(const ST* st);
00603
00604 void Set_mem_pool (MEM_POOL *m) { mem = m; }
00605 MEM_POOL *Get_mem_pool () const { return mem; }
00606
00607 void Set_du_mgr (struct DU_MANAGER *du) { du_mgr = du; }
00608 struct DU_MANAGER *Get_du_mgr () const { return du_mgr; }
00609
00610 void Set_alias_mgr (struct ALIAS_MANAGER *alias) { alias_mgr = alias; }
00611 struct ALIAS_MANAGER *Get_alias_mgr () const { return alias_mgr; }
00612
00613 void Set_emitter (EMITTER *e) { emitter = e; }
00614 EMITTER *Get_emitter () const { return emitter; }
00615
00616 SUMMARY_PROCEDURE *Get_procedure (INT id) const { return &(_procedure[id]); }
00617 SUMMARY_PROC_INFO *Get_proc_info (INT id) const { return &(_proc_info[id]); }
00618 SUMMARY_CALLSITE *Get_callsite (INT id) const { return &(_callsite[id]); }
00619 SUMMARY_STMT *Get_stmt (INT id) const { return &(_stmt[id]); }
00620 SUMMARY_CONTROL_DEPENDENCE *Get_ctrl_dep (INT id) const {
00621 return &(_ctrl_dep[id]);
00622 }
00623 SUMMARY_FORMAL *Get_formal (INT idx) const { return &(_formal[idx]); }
00624 SUMMARY_ACTUAL *Get_actual (INT idx) const { return &(_actual[idx]); }
00625 SUMMARY_VALUE *Get_value (INT idx) const { return &(_value[idx]); }
00626 SUMMARY_EXPR *Get_expr (INT idx) const { return &(_expr[idx]); }
00627 SUMMARY_PHI *Get_phi (INT idx) const { return &(_phi[idx]); }
00628 SUMMARY_CHI *Get_chi (INT idx) const { return &(_chi[idx]); }
00629 SUMMARY_SYMBOL *Get_symbol (INT idx) const { return &(_symbol[idx]); }
00630 SUMMARY_CREF_SYMBOL *Get_symbol_crefcount (INT idx) const { return &(_symbol_crefcount[idx]);}
00631 SUMMARY_GLOBAL *Get_global (INT idx) const { return &(_global[idx]); }
00632 SUMMARY_FEEDBACK *Get_feedback (INT idx) const { return &(_feedback[idx]);}
00633 SUMMARY_COMMON *Get_common (INT idx) const { return &(_common[idx]); }
00634 SUMMARY_COMMON_SHAPE *Get_common_shape (INT idx) const {
00635 return &(_common_shape[idx]);
00636 }
00637 SUMMARY_STID *Get_global_stid (INT idx) const {
00638 return &(_global_stid[idx]);
00639 }
00640 TCON **Get_tcon (INT idx) const { return &(_tcon[idx]); }
00641 ALT_ENTRY *Get_alt_entry (INT idx) const { return &(_alt_entry[idx]); }
00642 INLINE_ATTR *Get_inline_attr (INT idx) const { return &(_inline_attr[idx]); }
00643 SUMMARY_STRUCT_ACCESS * Get_struct_access(INT idx)const{return &(_struct_access[idx]);}
00644
00645 #ifdef KEY
00646 SUMMARY_TY_INFO *Get_ty_info (INT idx) const { return &(_ty_info[idx]); }
00647 #endif
00648
00649 BOOL Has_procedure_entry () const { return _procedure.Lastidx () != -1; }
00650 BOOL Has_proc_info_entry () const { return _proc_info.Lastidx () != -1; }
00651 BOOL Has_callsite_entry () const { return _callsite.Lastidx () != -1; }
00652 BOOL Has_stmt_entry () const { return _stmt.Lastidx () != -1; }
00653 BOOL Has_ctrl_dep_entry () const { return _ctrl_dep.Lastidx () != -1; }
00654 BOOL Has_formal_entry () const { return _formal.Lastidx () != -1; }
00655 BOOL Has_actual_entry () const { return _actual.Lastidx () != -1; }
00656 BOOL Has_value_entry () const { return _value.Lastidx () != -1; }
00657 BOOL Has_expr_entry () const { return _expr.Lastidx () != -1; }
00658 BOOL Has_phi_entry () const { return _phi.Lastidx () != -1; }
00659 BOOL Has_chi_entry () const { return _chi.Lastidx () != -1; }
00660 BOOL Has_symbol_entry () const { return _symbol.Lastidx () != -1; }
00661 BOOL Has_symbol_crefcount_entry () const { return _symbol_crefcount.Lastidx () != -1; }
00662 BOOL Has_global_entry () const { return _global.Lastidx () != -1; }
00663 BOOL Has_feedback_entry () const { return _feedback.Lastidx () != -1; }
00664 BOOL Has_common_entry () const { return _common.Lastidx () != -1; }
00665 BOOL Has_common_shape_entry () const{ return _common_shape.Lastidx () != -1; }
00666 BOOL Has_alt_entry () const { return _alt_entry.Lastidx () != -1; }
00667 BOOL Has_inline_attr () const { return _inline_attr.Lastidx
00668 () != -1; }
00669 BOOL Has_global_stid_entry () const { return _global_stid.Lastidx () != -1; }
00670 BOOL Has_struct_access_entry() const{return _struct_access.Lastidx()!=-1;}
00671 #ifdef KEY
00672 BOOL Has_ty_info_entry() const { return _ty_info.Lastidx () != -1; }
00673 #endif
00674
00675 INT Get_procedure_idx () const { return _procedure.Lastidx (); }
00676 INT Get_proc_info_idx () const { return _proc_info.Lastidx (); }
00677 INT Get_callsite_idx () const { return _callsite.Lastidx (); }
00678 INT Get_stmt_idx () const { return _stmt.Lastidx (); }
00679 INT Get_ctrl_dep_idx () const { return _ctrl_dep.Lastidx (); }
00680 INT Get_formal_idx () const { return _formal.Lastidx (); }
00681 INT Get_actual_idx () const { return _actual.Lastidx (); }
00682 INT Get_value_idx () const { return _value.Lastidx (); }
00683 INT Get_expr_idx () const { return _expr.Lastidx (); }
00684 INT Get_phi_idx () const { return _phi.Lastidx (); }
00685 INT Get_chi_idx () const { return _chi.Lastidx (); }
00686 INT Get_symbol_idx () const { return _symbol.Lastidx (); }
00687 INT Get_symbol_crefcount_idx () const { return _symbol_crefcount.Lastidx (); }
00688 INT Get_global_idx () const { return _global.Lastidx (); }
00689 INT Get_feedback_idx () const { return _feedback.Lastidx (); }
00690 INT Get_common_idx () const { return _common.Lastidx (); }
00691 INT Get_common_shape_idx () const { return _common_shape.Lastidx (); }
00692 INT Get_alt_entry_idx () const { return _alt_entry.Lastidx (); }
00693 INT Get_inline_attr_idx () const { return _inline_attr.Lastidx (); }
00694 INT Get_global_stid_idx () const { return _global_stid.Lastidx (); }
00695 INT Get_struct_access_idx() const {return _struct_access.Lastidx();}
00696 #ifdef KEY
00697 INT Get_ty_info_idx () const { return _ty_info.Lastidx (); }
00698 #endif
00699
00700
00701
00702 SUMMARIZE (MEM_POOL *m) {
00703 SUMMARY_VALUE* value = NULL;
00704 Set_mem_pool (m);
00705 _procedure.Set_Mem_Pool (m);
00706 _proc_info.Set_Mem_Pool (m);
00707 _callsite.Set_Mem_Pool (m);
00708 _stmt.Set_Mem_Pool (m);
00709 _ctrl_dep.Set_Mem_Pool (m);
00710 _formal.Set_Mem_Pool (m);
00711 _actual.Set_Mem_Pool (m);
00712 _value.Set_Mem_Pool (m);
00713 _expr.Set_Mem_Pool (m);
00714 _phi.Set_Mem_Pool (m);
00715 _chi.Set_Mem_Pool (m);
00716 _symbol.Set_Mem_Pool (m);
00717 _symbol_crefcount.Set_Mem_Pool (m);
00718 _global.Set_Mem_Pool (m);
00719 _feedback.Set_Mem_Pool (m);
00720 _common.Set_Mem_Pool (m);
00721 _common_shape.Set_Mem_Pool (m);
00722 _tcon.Set_Mem_Pool (m);
00723 _alt_entry.Set_Mem_Pool (m);
00724 _inline_attr.Set_Mem_Pool (m);
00725 _global_stid.Set_Mem_Pool (m);
00726 _struct_access.Set_Mem_Pool (m);
00727 #ifdef KEY
00728 _ty_info.Set_Mem_Pool (m);
00729 #endif
00730 Trace_Modref = FALSE;
00731 entry_point = NULL;
00732 File_Pragmas = FALSE;
00733
00734 Global_index = CXX_NEW (DYN_ARRAY<INT>(m), m);
00735
00736 INT Global_index_size = ST_Table_Size (GLOBAL_SYMTAB);
00737 Global_index->Setidx (Global_index_size);
00738 Global_index->Bzero_array ();
00739
00740 Global_hash_table = 0;
00741
00742 Ty_to_access_map=CXX_NEW(TY_TO_ACCESS_MAP(20),mem);
00743 loop_count_stack=CXX_NEW(LOOP_COUNT_STACK(mem),mem);;
00744 #ifdef KEY
00745 Ty_info_hash_table = CXX_NEW (TY_INFO_HASH_TABLE(113, mem), mem);
00746 #endif
00747
00748 Init_Aux_Symbol_Info (GLOBAL_SYMTAB);
00749
00750 if (program == INLINER)
00751 return;
00752
00753
00754 value = New_value ();
00755 value->Set_mtype (MTYPE_I4);
00756 value->Set_int_const ();
00757 value->Set_int_const_value (0);
00758
00759 value = New_value ();
00760 value->Set_mtype (MTYPE_I4);
00761 value->Set_int_const ();
00762 value->Set_int_const_value (1);
00763
00764 };
00765
00766
00767
00768 void Summarize (WN *w);
00769 void Process_procedure (WN *w);
00770 INT Get_symbol_index (const ST *st);
00771 void Set_global_addr_taken_attrib (void);
00772
00773 INT Get_symbol_crefcount_index (INT32 i);
00774 INT Find_symbol_crefcount_index (INT32 i);
00775 INT Find_proc_info_index(INT32 i);
00776 void Finish_collect_struct_access(void){
00777 INT num_summary_access=Get_struct_access_idx()+1;
00778 if (num_summary_access) {
00779
00780 Get_struct_access(0)->Set_hot_fld_array(num_summary_access);
00781 }
00782 MEM_POOL_Pop (&reorder_ipl_pool);
00783
00784
00785 };
00786
00787
00788 void Trace(FILE* fp);
00789
00790 };
00791
00792 #ifdef IPA_SUMMARY
00793
00794 #define PROGRAM_NAME IPL
00795
00796 #define Trace_CopyProp (0)
00797
00798 #else // IPA_SUMMARY
00799
00800 #define PROGRAM_NAME INLINER
00801 extern BOOL Trace_CopyProp;
00802
00803 #endif // IPA_SUMMARY
00804
00805 typedef SUMMARIZE<PROGRAM_NAME> SUMMARY;
00806
00807 extern SUMMARY *Summary;
00808
00809 #endif