diff options
author | Steven Bosscher <steven@gcc.gnu.org> | 2012-10-09 20:37:11 +0000 |
---|---|---|
committer | Steven Bosscher <steven@gcc.gnu.org> | 2012-10-09 20:37:11 +0000 |
commit | aa4723d7f56dd0c690c514b50c917c827a3d56dd (patch) | |
tree | 784313dcb1809538918556fac30dbf561f9d8332 /gcc/tree-cfg.c | |
parent | ca4277584fa6e046279dd3e75fdaa53881d9eaf3 (diff) | |
download | gcc-aa4723d7f56dd0c690c514b50c917c827a3d56dd.zip gcc-aa4723d7f56dd0c690c514b50c917c827a3d56dd.tar.gz gcc-aa4723d7f56dd0c690c514b50c917c827a3d56dd.tar.bz2 |
* basic-block. (profile_record): New struct, moved from passes.c.
* cfghooks.h (struct cfg_hooks) <account_profile_record>: New hook.
(account_profile_record): New prototype.
* cfghooks.c (account_profile_record): New function.
* tree-cfg.c (gimple_account_profile_record): New function
(gimple_cfg_hooks): Add it.
* cfgrtl.c (rtl_account_profile_record): New function
(rtl_cfg_hooks, cfg_layout_rtl_cfg_hooks): Add it.
* passes.c (check_profile_consistency): Simplify. Move IR-dependent
code around using cfghooks machinery.
From-SVN: r192271
Diffstat (limited to 'gcc/tree-cfg.c')
-rw-r--r-- | gcc/tree-cfg.c | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/gcc/tree-cfg.c b/gcc/tree-cfg.c index af277b7..7fc5a53 100644 --- a/gcc/tree-cfg.c +++ b/gcc/tree-cfg.c @@ -7591,6 +7591,30 @@ gimple_lv_add_condition_to_bb (basic_block first_head ATTRIBUTE_UNUSED, e0->flags |= EDGE_FALSE_VALUE; } + +/* Do book-keeping of basic block BB for the profile consistency checker. + If AFTER_PASS is 0, do pre-pass accounting, or if AFTER_PASS is 1 + then do post-pass accounting. Store the counting in RECORD. */ +static void +gimple_account_profile_record (basic_block bb, int after_pass, + struct profile_record *record) +{ + gimple_stmt_iterator i; + for (i = gsi_start_bb (bb); !gsi_end_p (i); gsi_next (&i)) + { + record->size[after_pass] + += estimate_num_insns (gsi_stmt (i), &eni_size_weights); + if (profile_status == PROFILE_READ) + record->time[after_pass] + += estimate_num_insns (gsi_stmt (i), + &eni_time_weights) * bb->count; + else if (profile_status == PROFILE_GUESSED) + record->time[after_pass] + += estimate_num_insns (gsi_stmt (i), + &eni_time_weights) * bb->frequency; + } +} + struct cfg_hooks gimple_cfg_hooks = { "gimple", gimple_verify_flow_info, @@ -7624,6 +7648,7 @@ struct cfg_hooks gimple_cfg_hooks = { flush_pending_stmts, /* flush_pending_stmts */ gimple_empty_block_p, /* block_empty_p */ gimple_split_block_before_cond_jump, /* split_block_before_cond_jump */ + gimple_account_profile_record, }; |