diff options
author | Jan Hubicka <jh@suse.cz> | 2013-09-01 19:47:21 +0200 |
---|---|---|
committer | Jan Hubicka <hubicka@gcc.gnu.org> | 2013-09-01 17:47:21 +0000 |
commit | 08f835dc74bccf078cb1cad4f3e20dda6d457d74 (patch) | |
tree | e2e4f83196fb64438ea666e999658cda183b0cf5 /gcc/cgraph.c | |
parent | 0adad9c5b470715ead5e012b9114cc87198531fd (diff) | |
download | gcc-08f835dc74bccf078cb1cad4f3e20dda6d457d74.zip gcc-08f835dc74bccf078cb1cad4f3e20dda6d457d74.tar.gz gcc-08f835dc74bccf078cb1cad4f3e20dda6d457d74.tar.bz2 |
Makefile.in: Add ipa-profile.o
* Makefile.in: Add ipa-profile.o
(ipa.o, ipa-devrit.o, ipa-inline-analysis.o): Adjust dependencies.
* cgraph.c (struct cgraph_propagate_frequency_data,
cgraph_propagate_frequency_1, cgraph_propagate_frequency): Move to
ipa-profile.c; replace cgraph_ by ipa_ prefix.
* cgraph.h (cgraph_propagate_frequency): Remove.
* ipa-inline-analysis.c: Include ipa-utils.h; drop duplicated cfgloop.h.
(inline_update_callee_summaries): Update.
* ipa-profile.c: New file.
* ipa-utils.h (ipa_propagate_frequency): Declare.
* ipa.c: Do not include pointer-set.h, hash-table.h, lto-streamer.h,
data-streamer.h, value-prof.h
(symtab_remove_unreachable_nodes): Update profile.
(struct histogram_entry, histogram, histogram_pool, histogram_hash,
account_time_size, cmp_counts, dump_histogram,
ipa_profile_generate_summary, ipa_profile_write_summary,
ipa_profile_read_summary, ipa_profile, gate_ipa_profile,
pass_data_ipa_profile, pass_ipa_profile, make_pass_ipa_profile):
Move to ipa-profile.c
From-SVN: r202154
Diffstat (limited to 'gcc/cgraph.c')
-rw-r--r-- | gcc/cgraph.c | 125 |
1 files changed, 0 insertions, 125 deletions
diff --git a/gcc/cgraph.c b/gcc/cgraph.c index a240bfc..5fc87ae 100644 --- a/gcc/cgraph.c +++ b/gcc/cgraph.c @@ -2279,131 +2279,6 @@ cgraph_set_pure_flag (struct cgraph_node *node, bool pure, bool looping) false); } -/* Data used by cgraph_propagate_frequency. */ - -struct cgraph_propagate_frequency_data -{ - bool maybe_unlikely_executed; - bool maybe_executed_once; - bool only_called_at_startup; - bool only_called_at_exit; -}; - -/* Worker for cgraph_propagate_frequency_1. */ - -static bool -cgraph_propagate_frequency_1 (struct cgraph_node *node, void *data) -{ - struct cgraph_propagate_frequency_data *d; - struct cgraph_edge *edge; - - d = (struct cgraph_propagate_frequency_data *)data; - for (edge = node->callers; - edge && (d->maybe_unlikely_executed || d->maybe_executed_once - || d->only_called_at_startup || d->only_called_at_exit); - edge = edge->next_caller) - { - if (edge->caller != node) - { - d->only_called_at_startup &= edge->caller->only_called_at_startup; - /* It makes sense to put main() together with the static constructors. - It will be executed for sure, but rest of functions called from - main are definitely not at startup only. */ - if (MAIN_NAME_P (DECL_NAME (edge->caller->symbol.decl))) - d->only_called_at_startup = 0; - d->only_called_at_exit &= edge->caller->only_called_at_exit; - } - if (!edge->frequency) - continue; - switch (edge->caller->frequency) - { - case NODE_FREQUENCY_UNLIKELY_EXECUTED: - break; - case NODE_FREQUENCY_EXECUTED_ONCE: - if (dump_file && (dump_flags & TDF_DETAILS)) - fprintf (dump_file, " Called by %s that is executed once\n", - cgraph_node_name (edge->caller)); - d->maybe_unlikely_executed = false; - if (inline_edge_summary (edge)->loop_depth) - { - d->maybe_executed_once = false; - if (dump_file && (dump_flags & TDF_DETAILS)) - fprintf (dump_file, " Called in loop\n"); - } - break; - case NODE_FREQUENCY_HOT: - case NODE_FREQUENCY_NORMAL: - if (dump_file && (dump_flags & TDF_DETAILS)) - fprintf (dump_file, " Called by %s that is normal or hot\n", - cgraph_node_name (edge->caller)); - d->maybe_unlikely_executed = false; - d->maybe_executed_once = false; - break; - } - } - return edge != NULL; -} - -/* See if the frequency of NODE can be updated based on frequencies of its - callers. */ -bool -cgraph_propagate_frequency (struct cgraph_node *node) -{ - struct cgraph_propagate_frequency_data d = {true, true, true, true}; - bool changed = false; - - /* We can not propagate anything useful about externally visible functions - nor about virtuals. */ - if (!node->local.local - || (flag_devirtualize && DECL_VIRTUAL_P (node->symbol.decl))) - return false; - gcc_assert (node->symbol.analyzed); - if (dump_file && (dump_flags & TDF_DETAILS)) - fprintf (dump_file, "Processing frequency %s\n", cgraph_node_name (node)); - - cgraph_for_node_and_aliases (node, cgraph_propagate_frequency_1, &d, true); - - if ((d.only_called_at_startup && !d.only_called_at_exit) - && !node->only_called_at_startup) - { - node->only_called_at_startup = true; - if (dump_file) - fprintf (dump_file, "Node %s promoted to only called at startup.\n", - cgraph_node_name (node)); - changed = true; - } - if ((d.only_called_at_exit && !d.only_called_at_startup) - && !node->only_called_at_exit) - { - node->only_called_at_exit = true; - if (dump_file) - fprintf (dump_file, "Node %s promoted to only called at exit.\n", - cgraph_node_name (node)); - changed = true; - } - /* These come either from profile or user hints; never update them. */ - if (node->frequency == NODE_FREQUENCY_HOT - || node->frequency == NODE_FREQUENCY_UNLIKELY_EXECUTED) - return changed; - if (d.maybe_unlikely_executed) - { - node->frequency = NODE_FREQUENCY_UNLIKELY_EXECUTED; - if (dump_file) - fprintf (dump_file, "Node %s promoted to unlikely executed.\n", - cgraph_node_name (node)); - changed = true; - } - else if (d.maybe_executed_once && node->frequency != NODE_FREQUENCY_EXECUTED_ONCE) - { - node->frequency = NODE_FREQUENCY_EXECUTED_ONCE; - if (dump_file) - fprintf (dump_file, "Node %s promoted to executed once.\n", - cgraph_node_name (node)); - changed = true; - } - return changed; -} - /* Return true when NODE can not return or throw and thus it is safe to ignore its side effects for IPA analysis. */ |