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/cfgrtl.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/cfgrtl.c')
-rw-r--r-- | gcc/cfgrtl.c | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/gcc/cfgrtl.c b/gcc/cfgrtl.c index 7946a3f..1b578d7 100644 --- a/gcc/cfgrtl.c +++ b/gcc/cfgrtl.c @@ -4452,6 +4452,28 @@ rtl_duplicate_bb (basic_block bb) return bb; } +/* 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 +rtl_account_profile_record (basic_block bb, int after_pass, + struct profile_record *record) +{ + rtx insn; + FOR_BB_INSNS (bb, insn) + if (INSN_P (insn)) + { + record->size[after_pass] + += insn_rtx_cost (PATTERN (insn), false); + if (profile_status == PROFILE_READ) + record->time[after_pass] + += insn_rtx_cost (PATTERN (insn), true) * bb->count; + else if (profile_status == PROFILE_GUESSED) + record->time[after_pass] + += insn_rtx_cost (PATTERN (insn), true) * bb->frequency; + } +} + /* Implementation of CFG manipulation for linearized RTL. */ struct cfg_hooks rtl_cfg_hooks = { "rtl", @@ -4486,6 +4508,7 @@ struct cfg_hooks rtl_cfg_hooks = { NULL, /* flush_pending_stmts */ rtl_block_empty_p, /* block_empty_p */ rtl_split_block_before_cond_jump, /* split_block_before_cond_jump */ + rtl_account_profile_record, }; /* Implementation of CFG manipulation for cfg layout RTL, where @@ -4526,6 +4549,7 @@ struct cfg_hooks cfg_layout_rtl_cfg_hooks = { NULL, /* flush_pending_stmts */ rtl_block_empty_p, /* block_empty_p */ rtl_split_block_before_cond_jump, /* split_block_before_cond_jump */ + rtl_account_profile_record, }; #include "gt-cfgrtl.h" |