Commit 08f835dc by Jan Hubicka Committed by Jan Hubicka

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
parent 0adad9c5
2013-09-01 Jan Hubicka <jh@suse.cz>
* 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
2013-09-01 John David Anglin <danglin@gcc.gnu.org>
* config/pa/pa.md: Allow "const 0" operand 1 in "scc" insns.
......
......@@ -1280,6 +1280,7 @@ OBJS = \
ipa-inline.o \
ipa-inline-analysis.o \
ipa-inline-transform.o \
ipa-profile.o \
ipa-prop.o \
ipa-pure-const.o \
ipa-reference.o \
......@@ -2952,11 +2953,15 @@ varpool.o : varpool.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \
$(TREE_FLOW_H)
ipa.o : ipa.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(CGRAPH_H) \
$(TREE_PASS_H) $(GIMPLE_H) $(TARGET_H) $(GGC_H) pointer-set.h \
$(IPA_UTILS_H) tree-inline.h $(HASH_TABLE_H) profile.h $(PARAMS_H) \
$(LTO_STREAMER_H) $(DATA_STREAMER_H)
$(IPA_UTILS_H) tree-inline.h profile.h $(PARAMS_H)
ipa-profile.o : ipa-profile.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(CGRAPH_H) \
$(TREE_PASS_H) $(GIMPLE_H) $(TARGET_H) $(GGC_H) \
$(IPA_UTILS_H) $(HASH_TABLE_H) profile.h $(PARAMS_H) \
value-prof.h alloc-pool.h tree-inline.h $(LTO_STREAMER_H) $(DATA_STREAMER_H) \
ipa-inline.h
ipa-devirt.o : ipa-devirt.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(CGRAPH_H) \
$(GIMPLE_H) $(TARGET_H) $(GGC_H) pointer-set.h \
$(IPA_UTILS_H) $(HASH_TABLE_H)
$(IPA_UTILS_H) $(HASH_TABLE_H) ipa-inline.h ipa-utils.h $(TREE_PRETTY_PRINT_H)
ipa-prop.o : ipa-prop.c $(CONFIG_H) $(SYSTEM_H) coretypes.h \
langhooks.h $(GGC_H) $(TARGET_H) $(CGRAPH_H) $(IPA_PROP_H) $(DIAGNOSTIC_H) \
$(TREE_FLOW_H) $(TM_H) $(TREE_PASS_H) $(FLAGS_H) $(TREE_H) \
......@@ -2986,7 +2991,8 @@ ipa-inline-analysis.o : ipa-inline-analysis.c $(CONFIG_H) $(SYSTEM_H) coretypes.
$(DIAGNOSTIC_H) $(PARAMS_H) $(TREE_PASS_H) $(CFGLOOP_H) \
$(HASHTAB_H) $(COVERAGE_H) $(GGC_H) $(TREE_FLOW_H) $(IPA_PROP_H) \
$(GIMPLE_PRETTY_PRINT_H) $(IPA_INLINE_H) $(LTO_STREAMER_H) $(DATA_STREAMER_H) \
$(TREE_STREAMER_H)
$(TREE_STREAMER_H) ipa-utils.h tree-scalar-evolution.h $(CFGLOOP_H) \
alloc-pool.h
ipa-inline-transform.o : ipa-inline-transform.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \
$(TREE_H) langhooks.h $(TREE_INLINE_H) $(FLAGS_H) $(CGRAPH_H) intl.h \
$(TREE_PASS_H) \
......
......@@ -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. */
......
......@@ -722,7 +722,6 @@ void cgraph_remove_edge_duplication_hook (struct cgraph_2edge_hook_list *);
struct cgraph_2node_hook_list *cgraph_add_node_duplication_hook (cgraph_2node_hook, void *);
void cgraph_remove_node_duplication_hook (struct cgraph_2node_hook_list *);
gimple cgraph_redirect_edge_call_stmt_to_callee (struct cgraph_edge *);
bool cgraph_propagate_frequency (struct cgraph_node *node);
struct cgraph_node * cgraph_function_node (struct cgraph_node *,
enum availability *avail = NULL);
bool cgraph_get_body (struct cgraph_node *node);
......
......@@ -87,8 +87,8 @@ along with GCC; see the file COPYING3. If not see
#include "ipa-inline.h"
#include "alloc-pool.h"
#include "cfgloop.h"
#include "cfgloop.h"
#include "tree-scalar-evolution.h"
#include "ipa-utils.h"
/* Estimate runtime of function can easilly run into huge numbers with many
nested loops. Be sure we can compute time * INLINE_SIZE_SCALE * 2 in an
......@@ -3102,7 +3102,7 @@ inline_update_callee_summaries (struct cgraph_node *node, int depth)
+ callee_info->estimated_self_stack_size;
if (inline_summary (node->global.inlined_to)->estimated_stack_size < peak)
inline_summary (node->global.inlined_to)->estimated_stack_size = peak;
cgraph_propagate_frequency (node);
ipa_propagate_frequency (node);
for (e = node->callees; e; e = e->next_callee)
{
if (!e->inline_failed)
......
......@@ -47,6 +47,9 @@ tree get_base_var (tree);
void ipa_merge_profiles (struct cgraph_node *dst,
struct cgraph_node *src);
/* In ipa-profile.c */
bool ipa_propagate_frequency (struct cgraph_node *node);
/* In ipa-devirt.c */
struct odr_type_d;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment