Commit 9e016eba by Jan Hubicka Committed by Jan Hubicka

tree-dump.c (dump_enable_all): Remove prototype; do not accept letter argument.


	* tree-dump.c (dump_enable_all): Remove prototype; do not accept
	letter argument.
	(dump_files): Update.
	(enable_rtl_dump_file): Do not accept letter argument.
	* tree-pass.h (dump_file_info): Remove letter argument.
	* toplev.c (decode_d_option): Update -da handling.
	* toplev.h (enable_rtl_dump_file): Update prototype.
	* passes.c (register_one_dump_file): Do not accept IPA argument; work
	it out based on pass type.
	(register_dump_files_1): Likewise.
	(init_optimization_passes): Update register_one_dump_file calls.
	(execute_one_pass): Sanity check that IPA passes are called at IPA level
	and RTL passes at RTL level.
	(execute_pass_list): IPA pass can not be after or subpass of
	GIMPLE/RTL pass.
	(execute_ipa_pass_list): Handle IPA subpasses of IPA subpasses and
	disallov RTL subpasses of IPA subpasses.

From-SVN: r133930
parent 23ef6d21
2008-04-05 Jan Hubicka <jh@suse.cz>
* tree-dump.c (dump_enable_all): Remove prototype; do not accept
letter argument.
(dump_files): Update.
(enable_rtl_dump_file): Do not accept letter argument.
* tree-pass.h (dump_file_info): Remove letter argument.
* toplev.c (decode_d_option): Update -da handling.
* toplev.h (enable_rtl_dump_file): Update prototype.
* passes.c (register_one_dump_file): Do not accept IPA argument; work
it out based on pass type.
(register_dump_files_1): Likewise.
(init_optimization_passes): Update register_one_dump_file calls.
(execute_one_pass): Sanity check that IPA passes are called at IPA level
and RTL passes at RTL level.
(execute_pass_list): IPA pass can not be after or subpass of
GIMPLE/RTL pass.
(execute_ipa_pass_list): Handle IPA subpasses of IPA subpasses and
disallov RTL subpasses of IPA subpasses.
2008-04-05 Ben Elliston <bje@au.ibm.com> 2008-04-05 Ben Elliston <bje@au.ibm.com>
* tree-cfg.c (need_fake_edge_p): Return false for calls to * tree-cfg.c (need_fake_edge_p): Return false for calls to
......
...@@ -338,7 +338,7 @@ struct opt_pass *all_passes, *all_ipa_passes, *all_lowering_passes; ...@@ -338,7 +338,7 @@ struct opt_pass *all_passes, *all_ipa_passes, *all_lowering_passes;
enabled or not. */ enabled or not. */
static void static void
register_one_dump_file (struct opt_pass *pass, bool ipa, int properties) register_one_dump_file (struct opt_pass *pass)
{ {
char *dot_name, *flag_name, *glob_name; char *dot_name, *flag_name, *glob_name;
const char *prefix; const char *prefix;
...@@ -352,9 +352,9 @@ register_one_dump_file (struct opt_pass *pass, bool ipa, int properties) ...@@ -352,9 +352,9 @@ register_one_dump_file (struct opt_pass *pass, bool ipa, int properties)
? 1 : pass->static_pass_number)); ? 1 : pass->static_pass_number));
dot_name = concat (".", pass->name, num, NULL); dot_name = concat (".", pass->name, num, NULL);
if (ipa) if (pass->type == SIMPLE_IPA_PASS)
prefix = "ipa-", flags = TDF_IPA; prefix = "ipa-", flags = TDF_IPA;
else if (properties & PROP_trees) else if (pass->type == GIMPLE_PASS)
prefix = "tree-", flags = TDF_TREE; prefix = "tree-", flags = TDF_TREE;
else else
prefix = "rtl-", flags = TDF_RTL; prefix = "rtl-", flags = TDF_RTL;
...@@ -368,7 +368,7 @@ register_one_dump_file (struct opt_pass *pass, bool ipa, int properties) ...@@ -368,7 +368,7 @@ register_one_dump_file (struct opt_pass *pass, bool ipa, int properties)
/* Recursive worker function for register_dump_files. */ /* Recursive worker function for register_dump_files. */
static int static int
register_dump_files_1 (struct opt_pass *pass, bool ipa, int properties) register_dump_files_1 (struct opt_pass *pass, int properties)
{ {
do do
{ {
...@@ -376,11 +376,10 @@ register_dump_files_1 (struct opt_pass *pass, bool ipa, int properties) ...@@ -376,11 +376,10 @@ register_dump_files_1 (struct opt_pass *pass, bool ipa, int properties)
& ~pass->properties_destroyed; & ~pass->properties_destroyed;
if (pass->name) if (pass->name)
register_one_dump_file (pass, ipa, new_properties); register_one_dump_file (pass);
if (pass->sub) if (pass->sub)
new_properties = register_dump_files_1 (pass->sub, false, new_properties = register_dump_files_1 (pass->sub, new_properties);
new_properties);
/* If we have a gate, combine the properties that we could have with /* If we have a gate, combine the properties that we could have with
and without the pass being examined. */ and without the pass being examined. */
...@@ -396,16 +395,15 @@ register_dump_files_1 (struct opt_pass *pass, bool ipa, int properties) ...@@ -396,16 +395,15 @@ register_dump_files_1 (struct opt_pass *pass, bool ipa, int properties)
return properties; return properties;
} }
/* Register the dump files for the pipeline starting at PASS. IPA is /* Register the dump files for the pipeline starting at PASS.
true if the pass is inter-procedural, and PROPERTIES reflects the PROPERTIES reflects the properties that are guaranteed to be available at
properties that are guaranteed to be available at the beginning of the beginning of the pipeline. */
the pipeline. */
static void static void
register_dump_files (struct opt_pass *pass, bool ipa, int properties) register_dump_files (struct opt_pass *pass,int properties)
{ {
pass->properties_required |= properties; pass->properties_required |= properties;
register_dump_files_1 (pass, ipa, properties); register_dump_files_1 (pass, properties);
} }
/* Add a pass to the pass list. Duplicate the pass if it's already /* Add a pass to the pass list. Duplicate the pass if it's already
...@@ -793,12 +791,12 @@ init_optimization_passes (void) ...@@ -793,12 +791,12 @@ init_optimization_passes (void)
#undef NEXT_PASS #undef NEXT_PASS
/* Register the passes with the tree dump code. */ /* Register the passes with the tree dump code. */
register_dump_files (all_lowering_passes, false, PROP_gimple_any); register_dump_files (all_lowering_passes, PROP_gimple_any);
all_lowering_passes->todo_flags_start |= TODO_set_props; all_lowering_passes->todo_flags_start |= TODO_set_props;
register_dump_files (all_ipa_passes, true, register_dump_files (all_ipa_passes,
PROP_gimple_any | PROP_gimple_lcf | PROP_gimple_leh PROP_gimple_any | PROP_gimple_lcf | PROP_gimple_leh
| PROP_cfg); | PROP_cfg);
register_dump_files (all_passes, false, register_dump_files (all_passes,
PROP_gimple_any | PROP_gimple_lcf | PROP_gimple_leh PROP_gimple_any | PROP_gimple_lcf | PROP_gimple_leh
| PROP_cfg); | PROP_cfg);
} }
...@@ -1071,6 +1069,17 @@ execute_one_pass (struct opt_pass *pass) ...@@ -1071,6 +1069,17 @@ execute_one_pass (struct opt_pass *pass)
bool initializing_dump; bool initializing_dump;
unsigned int todo_after = 0; unsigned int todo_after = 0;
/* IPA passes are executed on whole program, so cfun should be NULL.
Ohter passes needs function context set. */
if (pass->type == SIMPLE_IPA_PASS)
gcc_assert (!cfun && !current_function_decl);
else
{
gcc_assert (cfun && current_function_decl);
gcc_assert (!(cfun->curr_properties & PROP_trees)
|| pass->type != RTL_PASS);
}
current_pass = pass; current_pass = pass;
/* See if we're supposed to run this pass. */ /* See if we're supposed to run this pass. */
if (pass->gate && !pass->gate ()) if (pass->gate && !pass->gate ())
...@@ -1177,6 +1186,8 @@ execute_pass_list (struct opt_pass *pass) ...@@ -1177,6 +1186,8 @@ execute_pass_list (struct opt_pass *pass)
{ {
do do
{ {
gcc_assert (pass->type == GIMPLE_PASS
|| pass->type == RTL_PASS);
if (execute_one_pass (pass) && pass->sub) if (execute_one_pass (pass) && pass->sub)
execute_pass_list (pass->sub); execute_pass_list (pass->sub);
pass = pass->next; pass = pass->next;
...@@ -1193,9 +1204,17 @@ execute_ipa_pass_list (struct opt_pass *pass) ...@@ -1193,9 +1204,17 @@ execute_ipa_pass_list (struct opt_pass *pass)
{ {
gcc_assert (!current_function_decl); gcc_assert (!current_function_decl);
gcc_assert (!cfun); gcc_assert (!cfun);
gcc_assert (pass->type == SIMPLE_IPA_PASS);
if (execute_one_pass (pass) && pass->sub) if (execute_one_pass (pass) && pass->sub)
do_per_function_toporder ((void (*)(void *))execute_pass_list, {
pass->sub); if (pass->sub->type == GIMPLE_PASS)
do_per_function_toporder ((void (*)(void *))execute_pass_list,
pass->sub);
else if (pass->sub->type == SIMPLE_IPA_PASS)
execute_ipa_pass_list (pass->sub);
else
gcc_unreachable ();
}
if (!current_function_decl) if (!current_function_decl)
cgraph_process_new_functions (); cgraph_process_new_functions ();
pass = pass->next; pass = pass->next;
......
...@@ -1072,10 +1072,11 @@ decode_d_option (const char *arg) ...@@ -1072,10 +1072,11 @@ decode_d_option (const char *arg)
case 'H': case 'H':
setup_core_dumping(); setup_core_dumping();
break; break;
case 'a': case 'a':
enable_rtl_dump_file ();
break;
default: default:
if (!enable_rtl_dump_file (c))
warning (0, "unrecognized gcc debugging option: %c", c); warning (0, "unrecognized gcc debugging option: %c", c);
break; break;
} }
......
...@@ -72,7 +72,7 @@ extern void rest_of_type_compilation (tree, int); ...@@ -72,7 +72,7 @@ extern void rest_of_type_compilation (tree, int);
extern void tree_rest_of_compilation (tree); extern void tree_rest_of_compilation (tree);
extern void init_optimization_passes (void); extern void init_optimization_passes (void);
extern void finish_optimization_passes (void); extern void finish_optimization_passes (void);
extern bool enable_rtl_dump_file (int); extern bool enable_rtl_dump_file (void);
extern void announce_function (tree); extern void announce_function (tree);
......
...@@ -39,7 +39,6 @@ static void dump_index (dump_info_p, unsigned int); ...@@ -39,7 +39,6 @@ static void dump_index (dump_info_p, unsigned int);
static void dequeue_and_dump (dump_info_p); static void dequeue_and_dump (dump_info_p);
static void dump_new_line (dump_info_p); static void dump_new_line (dump_info_p);
static void dump_maybe_newline (dump_info_p); static void dump_maybe_newline (dump_info_p);
static int dump_enable_all (int, int);
/* Add T to the end of the queue of nodes to dump. Returns the index /* Add T to the end of the queue of nodes to dump. Returns the index
assigned to T. */ assigned to T. */
...@@ -782,19 +781,19 @@ dump_node (const_tree t, int flags, FILE *stream) ...@@ -782,19 +781,19 @@ dump_node (const_tree t, int flags, FILE *stream)
tree_dump_index enumeration in tree-pass.h. */ tree_dump_index enumeration in tree-pass.h. */
static struct dump_file_info dump_files[TDI_end] = static struct dump_file_info dump_files[TDI_end] =
{ {
{NULL, NULL, NULL, 0, 0, 0, 0}, {NULL, NULL, NULL, 0, 0, 0},
{".cgraph", "ipa-cgraph", NULL, TDF_IPA, 0, 0, 0}, {".cgraph", "ipa-cgraph", NULL, TDF_IPA, 0, 0},
{".tu", "translation-unit", NULL, TDF_TREE, 0, 1, 0}, {".tu", "translation-unit", NULL, TDF_TREE, 0, 1},
{".class", "class-hierarchy", NULL, TDF_TREE, 0, 2, 0}, {".class", "class-hierarchy", NULL, TDF_TREE, 0, 2},
{".original", "tree-original", NULL, TDF_TREE, 0, 3, 0}, {".original", "tree-original", NULL, TDF_TREE, 0, 3},
{".gimple", "tree-gimple", NULL, TDF_TREE, 0, 4, 0}, {".gimple", "tree-gimple", NULL, TDF_TREE, 0, 4},
{".nested", "tree-nested", NULL, TDF_TREE, 0, 5, 0}, {".nested", "tree-nested", NULL, TDF_TREE, 0, 5},
{".vcg", "tree-vcg", NULL, TDF_TREE, 0, 6, 0}, {".vcg", "tree-vcg", NULL, TDF_TREE, 0, 6},
#define FIRST_AUTO_NUMBERED_DUMP 7 #define FIRST_AUTO_NUMBERED_DUMP 7
{NULL, "tree-all", NULL, TDF_TREE, 0, 0, 0}, {NULL, "tree-all", NULL, TDF_TREE, 0, 0},
{NULL, "rtl-all", NULL, TDF_RTL, 0, 0, 0}, {NULL, "rtl-all", NULL, TDF_RTL, 0, 0},
{NULL, "ipa-all", NULL, TDF_IPA, 0, 0, 0}, {NULL, "ipa-all", NULL, TDF_IPA, 0, 0},
}; };
/* Dynamically registered tree dump files and switches. */ /* Dynamically registered tree dump files and switches. */
...@@ -993,15 +992,14 @@ dump_end (enum tree_dump_index phase ATTRIBUTE_UNUSED, FILE *stream) ...@@ -993,15 +992,14 @@ dump_end (enum tree_dump_index phase ATTRIBUTE_UNUSED, FILE *stream)
/* Enable all tree dumps. Return number of enabled tree dumps. */ /* Enable all tree dumps. Return number of enabled tree dumps. */
static int static int
dump_enable_all (int flags, int letter) dump_enable_all (int flags)
{ {
int ir_dump_type = (flags & (TDF_TREE | TDF_RTL | TDF_IPA)); int ir_dump_type = (flags & (TDF_TREE | TDF_RTL | TDF_IPA));
int n = 0; int n = 0;
size_t i; size_t i;
for (i = TDI_none + 1; i < (size_t) TDI_end; i++) for (i = TDI_none + 1; i < (size_t) TDI_end; i++)
if ((dump_files[i].flags & ir_dump_type) if ((dump_files[i].flags & ir_dump_type))
&& (letter == 0 || letter == dump_files[i].letter))
{ {
dump_files[i].state = -1; dump_files[i].state = -1;
dump_files[i].flags |= flags; dump_files[i].flags |= flags;
...@@ -1009,8 +1007,7 @@ dump_enable_all (int flags, int letter) ...@@ -1009,8 +1007,7 @@ dump_enable_all (int flags, int letter)
} }
for (i = 0; i < extra_dump_files_in_use; i++) for (i = 0; i < extra_dump_files_in_use; i++)
if ((extra_dump_files[i].flags & ir_dump_type) if ((extra_dump_files[i].flags & ir_dump_type))
&& (letter == 0 || letter == extra_dump_files[i].letter))
{ {
extra_dump_files[i].state = -1; extra_dump_files[i].state = -1;
extra_dump_files[i].flags |= flags; extra_dump_files[i].flags |= flags;
...@@ -1075,7 +1072,7 @@ dump_switch_p_1 (const char *arg, struct dump_file_info *dfi, bool doglob) ...@@ -1075,7 +1072,7 @@ dump_switch_p_1 (const char *arg, struct dump_file_info *dfi, bool doglob)
/* Process -fdump-tree-all and -fdump-rtl-all, by enabling all the /* Process -fdump-tree-all and -fdump-rtl-all, by enabling all the
known dumps. */ known dumps. */
if (dfi->suffix == NULL) if (dfi->suffix == NULL)
dump_enable_all (dfi->flags, 0); dump_enable_all (dfi->flags);
return 1; return 1;
} }
...@@ -1122,12 +1119,9 @@ dump_function (enum tree_dump_index phase, tree fn) ...@@ -1122,12 +1119,9 @@ dump_function (enum tree_dump_index phase, tree fn)
} }
bool bool
enable_rtl_dump_file (int letter) enable_rtl_dump_file (void)
{ {
if (letter == 'a') return dump_enable_all (TDF_RTL | TDF_DETAILS | TDF_BLOCKS) > 0;
letter = 0;
return dump_enable_all (TDF_RTL | TDF_DETAILS | TDF_BLOCKS, letter) > 0;
} }
...@@ -161,7 +161,6 @@ struct dump_file_info ...@@ -161,7 +161,6 @@ struct dump_file_info
int flags; /* user flags */ int flags; /* user flags */
int state; /* state of play */ int state; /* state of play */
int num; /* dump file number */ int num; /* dump file number */
int letter; /* enabling letter for RTL dumps */
}; };
/* Pass properties. */ /* Pass properties. */
......
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