aboutsummaryrefslogtreecommitdiff
path: root/gcc/cgraph.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/cgraph.c')
-rw-r--r--gcc/cgraph.c125
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. */