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>
* 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;
enabled or not. */
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;
const char *prefix;
......@@ -352,9 +352,9 @@ register_one_dump_file (struct opt_pass *pass, bool ipa, int properties)
? 1 : pass->static_pass_number));
dot_name = concat (".", pass->name, num, NULL);
if (ipa)
if (pass->type == SIMPLE_IPA_PASS)
prefix = "ipa-", flags = TDF_IPA;
else if (properties & PROP_trees)
else if (pass->type == GIMPLE_PASS)
prefix = "tree-", flags = TDF_TREE;
else
prefix = "rtl-", flags = TDF_RTL;
......@@ -368,7 +368,7 @@ register_one_dump_file (struct opt_pass *pass, bool ipa, int properties)
/* Recursive worker function for register_dump_files. */
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
{
......@@ -376,11 +376,10 @@ register_dump_files_1 (struct opt_pass *pass, bool ipa, int properties)
& ~pass->properties_destroyed;
if (pass->name)
register_one_dump_file (pass, ipa, new_properties);
register_one_dump_file (pass);
if (pass->sub)
new_properties = register_dump_files_1 (pass->sub, false,
new_properties);
new_properties = register_dump_files_1 (pass->sub, new_properties);
/* If we have a gate, combine the properties that we could have with
and without the pass being examined. */
......@@ -396,16 +395,15 @@ register_dump_files_1 (struct opt_pass *pass, bool ipa, int properties)
return properties;
}
/* Register the dump files for the pipeline starting at PASS. IPA is
true if the pass is inter-procedural, and PROPERTIES reflects the
properties that are guaranteed to be available at the beginning of
the pipeline. */
/* Register the dump files for the pipeline starting at PASS.
PROPERTIES reflects the properties that are guaranteed to be available at
the beginning of the pipeline. */
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;
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
......@@ -793,12 +791,12 @@ init_optimization_passes (void)
#undef NEXT_PASS
/* 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;
register_dump_files (all_ipa_passes, true,
register_dump_files (all_ipa_passes,
PROP_gimple_any | PROP_gimple_lcf | PROP_gimple_leh
| PROP_cfg);
register_dump_files (all_passes, false,
register_dump_files (all_passes,
PROP_gimple_any | PROP_gimple_lcf | PROP_gimple_leh
| PROP_cfg);
}
......@@ -1071,6 +1069,17 @@ execute_one_pass (struct opt_pass *pass)
bool initializing_dump;
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;
/* See if we're supposed to run this pass. */
if (pass->gate && !pass->gate ())
......@@ -1177,6 +1186,8 @@ execute_pass_list (struct opt_pass *pass)
{
do
{
gcc_assert (pass->type == GIMPLE_PASS
|| pass->type == RTL_PASS);
if (execute_one_pass (pass) && pass->sub)
execute_pass_list (pass->sub);
pass = pass->next;
......@@ -1193,9 +1204,17 @@ execute_ipa_pass_list (struct opt_pass *pass)
{
gcc_assert (!current_function_decl);
gcc_assert (!cfun);
gcc_assert (pass->type == SIMPLE_IPA_PASS);
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)
cgraph_process_new_functions ();
pass = pass->next;
......
......@@ -1072,10 +1072,11 @@ decode_d_option (const char *arg)
case 'H':
setup_core_dumping();
break;
case 'a':
enable_rtl_dump_file ();
break;
default:
if (!enable_rtl_dump_file (c))
warning (0, "unrecognized gcc debugging option: %c", c);
break;
}
......
......@@ -72,7 +72,7 @@ extern void rest_of_type_compilation (tree, int);
extern void tree_rest_of_compilation (tree);
extern void init_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);
......
......@@ -39,7 +39,6 @@ static void dump_index (dump_info_p, unsigned int);
static void dequeue_and_dump (dump_info_p);
static void dump_new_line (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
assigned to T. */
......@@ -782,19 +781,19 @@ dump_node (const_tree t, int flags, FILE *stream)
tree_dump_index enumeration in tree-pass.h. */
static struct dump_file_info dump_files[TDI_end] =
{
{NULL, NULL, NULL, 0, 0, 0, 0},
{".cgraph", "ipa-cgraph", NULL, TDF_IPA, 0, 0, 0},
{".tu", "translation-unit", NULL, TDF_TREE, 0, 1, 0},
{".class", "class-hierarchy", NULL, TDF_TREE, 0, 2, 0},
{".original", "tree-original", NULL, TDF_TREE, 0, 3, 0},
{".gimple", "tree-gimple", NULL, TDF_TREE, 0, 4, 0},
{".nested", "tree-nested", NULL, TDF_TREE, 0, 5, 0},
{".vcg", "tree-vcg", NULL, TDF_TREE, 0, 6, 0},
{NULL, NULL, NULL, 0, 0, 0},
{".cgraph", "ipa-cgraph", NULL, TDF_IPA, 0, 0},
{".tu", "translation-unit", NULL, TDF_TREE, 0, 1},
{".class", "class-hierarchy", NULL, TDF_TREE, 0, 2},
{".original", "tree-original", NULL, TDF_TREE, 0, 3},
{".gimple", "tree-gimple", NULL, TDF_TREE, 0, 4},
{".nested", "tree-nested", NULL, TDF_TREE, 0, 5},
{".vcg", "tree-vcg", NULL, TDF_TREE, 0, 6},
#define FIRST_AUTO_NUMBERED_DUMP 7
{NULL, "tree-all", NULL, TDF_TREE, 0, 0, 0},
{NULL, "rtl-all", NULL, TDF_RTL, 0, 0, 0},
{NULL, "ipa-all", NULL, TDF_IPA, 0, 0, 0},
{NULL, "tree-all", NULL, TDF_TREE, 0, 0},
{NULL, "rtl-all", NULL, TDF_RTL, 0, 0},
{NULL, "ipa-all", NULL, TDF_IPA, 0, 0},
};
/* Dynamically registered tree dump files and switches. */
......@@ -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. */
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 n = 0;
size_t i;
for (i = TDI_none + 1; i < (size_t) TDI_end; i++)
if ((dump_files[i].flags & ir_dump_type)
&& (letter == 0 || letter == dump_files[i].letter))
if ((dump_files[i].flags & ir_dump_type))
{
dump_files[i].state = -1;
dump_files[i].flags |= flags;
......@@ -1009,8 +1007,7 @@ dump_enable_all (int flags, int letter)
}
for (i = 0; i < extra_dump_files_in_use; i++)
if ((extra_dump_files[i].flags & ir_dump_type)
&& (letter == 0 || letter == extra_dump_files[i].letter))
if ((extra_dump_files[i].flags & ir_dump_type))
{
extra_dump_files[i].state = -1;
extra_dump_files[i].flags |= flags;
......@@ -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
known dumps. */
if (dfi->suffix == NULL)
dump_enable_all (dfi->flags, 0);
dump_enable_all (dfi->flags);
return 1;
}
......@@ -1122,12 +1119,9 @@ dump_function (enum tree_dump_index phase, tree fn)
}
bool
enable_rtl_dump_file (int letter)
enable_rtl_dump_file (void)
{
if (letter == 'a')
letter = 0;
return dump_enable_all (TDF_RTL | TDF_DETAILS | TDF_BLOCKS, letter) > 0;
return dump_enable_all (TDF_RTL | TDF_DETAILS | TDF_BLOCKS) > 0;
}
......@@ -161,7 +161,6 @@ struct dump_file_info
int flags; /* user flags */
int state; /* state of play */
int num; /* dump file number */
int letter; /* enabling letter for RTL dumps */
};
/* 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