+2006-02-08 Paolo Bonzini <bonzini@gnu.org>
+
+ * passes.c (register_one_dump_file): Accept the current properties
+ instead of pass number. Adjust call to dump_register. Remove
+ duplicated code.
+ (register_dump_files): Now a wrapper around...
+ (register_dump_files_1): ... this one. Do not modify the pass
+ structure.
+ (next_pass_1): Cosmetic fix.
+ (execute_todo): Keep second parameter only. Use curr_properties instead
+ of fetching it from the pass structure. Check and set last_verified.
+ (execute_one_pass): Handle TODO_set_props. Use curr_properties
+ instead of fetching it from the pass structure. Fix calls to
+ execute_todo. Update curr_properties and initialize .vcg RTL dump
+ after running the pass. Reset last_verified.
+ * tree-dump.c (dump_files): Renumber consecutively. Put .cgraph dump
+ at the beginning.
+ (FIRST_AUTO_NUMBERED_DUMP): New.
+ (dump_register): Remove "num" parameter, assign it within the
+ function.
+ (get_dump_file_name): Modify template for dumps.
+ * tree-dump.h (dump_register): Adjust prototype.
+ * tree-pass.h (enum tree_dump_index): Move cgraph at the beginning.
+ (PROP_trees): Add PROP_gimple_lomp.
+ (TODO_set_props): New.
+ * gimple-low.c (pass_lower_cf): Do not destroy PROP_gimple_lcf.
+ * tree-eh.c (pass_lower_eh): Do not destroy PROP_gimple_leh.
+ * cfgexpand.c (pass_expand): Destroy PROP_trees.
+
+
2006-02-08 Jakub Jelinek <jakub@redhat.com>
* config.gcc (sparc-*-linux*): Add sparc/t-linux to tmake_file.
/* ??? If TER is enabled, we actually receive GENERIC. */
PROP_gimple_leh | PROP_cfg, /* properties_required */
PROP_rtl, /* properties_provided */
- PROP_gimple_leh, /* properties_destroyed */
+ PROP_trees, /* properties_destroyed */
0, /* todo_flags_start */
TODO_dump_func, /* todo_flags_finish */
'r' /* letter */
0, /* tv_id */
PROP_gimple_any, /* properties_required */
PROP_gimple_lcf, /* properties_provided */
- PROP_gimple_any, /* properties_destroyed */
+ 0, /* properties_destroyed */
0, /* todo_flags_start */
TODO_dump_func, /* todo_flags_finish */
0 /* letter */
enabled or not. */
static void
-register_one_dump_file (struct tree_opt_pass *pass, bool ipa, int n)
+register_one_dump_file (struct tree_opt_pass *pass, bool ipa, int properties)
{
char *dot_name, *flag_name, *glob_name;
+ const char *prefix;
char num[10];
+ int flags;
/* See below in next_pass_1. */
num[0] = '\0';
dot_name = concat (".", pass->name, num, NULL);
if (ipa)
- {
- flag_name = concat ("ipa-", pass->name, num, NULL);
- glob_name = concat ("ipa-", pass->name, NULL);
- /* First IPA dump is cgraph that is dumped via separate channels. */
- pass->static_pass_number = dump_register (dot_name, flag_name, glob_name,
- TDF_IPA, n + 1, 0);
- }
- else if (pass->properties_provided & PROP_trees)
- {
- flag_name = concat ("tree-", pass->name, num, NULL);
- glob_name = concat ("tree-", pass->name, NULL);
- pass->static_pass_number = dump_register (dot_name, flag_name, glob_name,
- TDF_TREE, n + TDI_tree_all, 0);
- }
+ prefix = "ipa-", flags = TDF_IPA;
+ else if (properties & PROP_trees)
+ prefix = "tree-", flags = TDF_TREE;
else
- {
- flag_name = concat ("rtl-", pass->name, num, NULL);
- glob_name = concat ("rtl-", pass->name, NULL);
- pass->static_pass_number = dump_register (dot_name, flag_name, glob_name,
- TDF_RTL, n, pass->letter);
- }
+ prefix = "rtl-", flags = TDF_RTL;
+
+ flag_name = concat (prefix, pass->name, num, NULL);
+ glob_name = concat (prefix, pass->name, NULL);
+ pass->static_pass_number = dump_register (dot_name, flag_name, glob_name,
+ flags, pass->letter);
}
+/* Recursive worker function for register_dump_files. */
+
static int
-register_dump_files (struct tree_opt_pass *pass, bool ipa, int properties)
+register_dump_files_1 (struct tree_opt_pass *pass, bool ipa, int properties)
{
- static int n = 0;
do
{
- int new_properties;
- int pass_number;
+ int new_properties = (properties | pass->properties_provided)
+ & ~pass->properties_destroyed;
- pass->properties_required = properties;
- new_properties =
- (properties | pass->properties_provided) & ~pass->properties_destroyed;
-
- /* Reset the counter when we reach RTL-based passes. */
- if ((new_properties ^ pass->properties_required) & PROP_rtl)
- n = 0;
-
- pass_number = n;
if (pass->name)
- n++;
+ register_one_dump_file (pass, ipa, new_properties);
if (pass->sub)
- new_properties = register_dump_files (pass->sub, false, new_properties);
+ new_properties = register_dump_files_1 (pass->sub, false,
+ new_properties);
/* If we have a gate, combine the properties that we could have with
and without the pass being examined. */
else
properties = new_properties;
- pass->properties_provided = properties;
- if (pass->name)
- register_one_dump_file (pass, ipa, pass_number);
-
pass = pass->next;
}
while (pass);
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 guarenteed to be available at the beginning of
+ the pipeline. */
+
+static void
+register_dump_files (struct tree_opt_pass *pass, bool ipa, int properties)
+{
+ pass->properties_required |= properties;
+ pass->todo_flags_start |= TODO_set_props;
+ register_dump_files_1 (pass, ipa, properties);
+}
+
/* Add a pass to the pass list. Duplicate the pass if it's already
in the list. */
static struct tree_opt_pass **
next_pass_1 (struct tree_opt_pass **list, struct tree_opt_pass *pass)
{
-
/* A nonzero static_pass_number indicates that the
pass is already in the list. */
if (pass->static_pass_number)
#undef NEXT_PASS
/* Register the passes with the tree dump code. */
- register_dump_files (all_ipa_passes, true, PROP_gimple_leh | PROP_cfg);
+ register_dump_files (all_ipa_passes, true,
+ PROP_gimple_any | PROP_gimple_lcf | PROP_gimple_leh
+ | PROP_cfg);
register_dump_files (all_lowering_passes, false, PROP_gimple_any);
- register_dump_files (all_passes, false, PROP_gimple_leh | PROP_cfg);
+ register_dump_files (all_passes, false,
+ PROP_gimple_any | PROP_gimple_lcf | PROP_gimple_leh
+ | PROP_cfg);
}
static unsigned int last_verified;
+static unsigned int curr_properties;
+
static void
-execute_todo (struct tree_opt_pass *pass, unsigned int flags, bool use_required)
+execute_todo (unsigned int flags)
{
- int properties
- = use_required ? pass->properties_required : pass->properties_provided;
-
#if defined ENABLE_CHECKING
if (need_ssa_update_p ())
gcc_assert (flags & TODO_update_ssa_any);
#endif
+ if (curr_properties & PROP_ssa)
+ flags |= TODO_verify_ssa;
+ flags &= ~last_verified;
+ if (!flags)
+ return;
+
/* Always cleanup the CFG before doing anything else. */
if (flags & TODO_cleanup_cfg)
{
{
unsigned update_flags = flags & TODO_update_ssa_any;
update_ssa (update_flags);
+ last_verified &= ~TODO_verify_ssa;
}
if (flags & TODO_remove_unused_locals)
if ((flags & TODO_dump_func)
&& dump_file && current_function_decl)
{
- if (properties & PROP_trees)
+ if (curr_properties & PROP_trees)
dump_function_to_file (current_function_decl,
dump_file, dump_flags);
else
{
if (dump_flags & TDF_SLIM)
print_rtl_slim_with_bb (dump_file, get_insns (), dump_flags);
- else if (properties & PROP_cfg)
+ else if (curr_properties & PROP_cfg)
print_rtl_with_bb (dump_file, get_insns ());
else
print_rtl (dump_file, get_insns ());
- if (properties & PROP_cfg
+ if (curr_properties & PROP_cfg
&& graph_dump_format != no_graph
&& (dump_flags & TDF_GRAPH))
print_rtl_graph_with_bb (dump_file_name, get_insns ());
}
#if defined ENABLE_CHECKING
- if ((pass->properties_required & PROP_ssa)
- && !(pass->properties_destroyed & PROP_ssa))
+ if (flags & TODO_verify_ssa)
verify_ssa (true);
if (flags & TODO_verify_flow)
verify_flow_info ();
if (flags & TODO_verify_loops)
verify_loop_closed_ssa ();
#endif
+
+ last_verified = flags & TODO_verify_all;
}
static bool
execute_one_pass (struct tree_opt_pass *pass)
{
- unsigned int todo;
+ bool initializing_dump;
/* See if we're supposed to run this pass. */
if (pass->gate && !pass->gate ())
return false;
+ if (pass->todo_flags_start & TODO_set_props)
+ curr_properties = pass->properties_required;
+
/* Note that the folders should only create gimple expressions.
This is a hack until the new folder is ready. */
- in_gimple_form = (pass->properties_provided & PROP_trees) != 0;
+ in_gimple_form = (curr_properties & PROP_trees) != 0;
/* Run pre-pass verification. */
- todo = pass->todo_flags_start & ~last_verified;
- if (todo)
- execute_todo (pass, todo, true);
+ execute_todo (pass->todo_flags_start);
+
+ gcc_assert ((curr_properties & pass->properties_required)
+ == pass->properties_required);
/* If a dump file name is present, open it if enabled. */
if (pass->static_pass_number != -1)
{
- bool initializing_dump = !dump_initialized_p (pass->static_pass_number);
+ initializing_dump = !dump_initialized_p (pass->static_pass_number);
dump_file_name = get_dump_file_name (pass->static_pass_number);
dump_file = dump_begin (pass->static_pass_number, &dump_flags);
if (dump_file && current_function_decl)
? " (unlikely executed)"
: "");
}
-
- if (initializing_dump
- && dump_file
- && graph_dump_format != no_graph
- && (pass->properties_provided & (PROP_cfg | PROP_rtl))
- == (PROP_cfg | PROP_rtl))
- {
- get_dump_file_info (pass->static_pass_number)->flags |= TDF_GRAPH;
- dump_flags |= TDF_GRAPH;
- clean_graph_dump_file (dump_file_name);
- }
}
+ else
+ initializing_dump = false;
/* If a timevar is present, start it. */
if (pass->tv_id)
/* Do it! */
if (pass->execute)
- pass->execute ();
+ {
+ pass->execute ();
+ last_verified = 0;
+ }
/* Stop timevar. */
if (pass->tv_id)
timevar_pop (pass->tv_id);
+ curr_properties = (curr_properties | pass->properties_provided)
+ & ~pass->properties_destroyed;
+
+ if (initializing_dump
+ && dump_file
+ && graph_dump_format != no_graph
+ && (curr_properties & (PROP_cfg | PROP_rtl)) == (PROP_cfg | PROP_rtl))
+ {
+ get_dump_file_info (pass->static_pass_number)->flags |= TDF_GRAPH;
+ dump_flags |= TDF_GRAPH;
+ clean_graph_dump_file (dump_file_name);
+ }
+
/* Run post-pass cleanup and verification. */
- todo = pass->todo_flags_finish;
- last_verified = todo & TODO_verify_all;
- if (todo)
- execute_todo (pass, todo, false);
+ execute_todo (pass->todo_flags_finish);
/* Flush and close dump file. */
if (dump_file_name)
+2006-02-08 Paolo Bonzini <bonzini@gnu.org>
+
+ * lib/gcc-dg.exp (cleanup-rtl-dump, cleanup-tree-dump,
+ cleanup-ipa-dump): Update dump file glob patterns.
+ * lib/scantree.exp (scan-tree-dump, scan-tree-dump-times,
+ scan-tree-dump-not, scan-tree-dump-dem): Likewise.
+ * lib/scanipa.exp (scan-ipa-dump, scan-ipa-dump-times,
+ scan-ipa-dump-not, scan-ipa-dump-dem): Likewise.
+
+ * lib/scanrtl.exp: New.
+ * lib/gcc-dg.exp: Load it.
+ * objc.dg/stubify-2.m: Use scan-rtl-dump-not.
+
2006-02-07 Janis Johnson <janis187@us.ibm.com>
PR testsuite/26159
-# Copyright (C) 1997, 1999, 2000, 2003, 2004, 2005 Free Software Foundation, Inc.
+# Copyright (C) 1997, 1999, 2000, 2003, 2004, 2005, 2006
+# Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
load_lib target-supports.exp
load_lib target-supports-dg.exp
load_lib scanasm.exp
+load_lib scanrtl.exp
load_lib scantree.exp
load_lib scanipa.exp
load_lib prune.exp
#
# SUFFIX is the filename suffix pattern.
proc cleanup-rtl-dump { suffix } {
- cleanup-dump "\[0-9\]\*.$suffix"
+ cleanup-dump "\[0-9\]\[0-9\]\[0-9\]r.$suffix"
}
# Remove a specific tree dump file for the current test.
#
# SUFFIX is the tree dump file suffix pattern.
proc cleanup-tree-dump { suffix } {
- cleanup-dump "t\[0-9\]\*.$suffix"
+ cleanup-dump "\[0-9\]\[0-9\]\[0-9\]t.$suffix"
}
# Remove a specific ipa dump file for the current test.
#
# SUFFIX is the ipa dump file suffix pattern.
proc cleanup-ipa-dump { suffix } {
- cleanup-dump "i\[0-9\]\*.$suffix"
+ cleanup-dump "\[0-9\]\[0-9\]\[0-9\]i.$suffix"
}
# Remove all dump files with the provided suffix.
return
}
if { [llength $args] >= 3 } {
- scan-dump "ipa" [lindex $args 0] "i\[0-9\]\*.[lindex $args 1]" [lindex $args 2]
+ scan-dump "ipa" [lindex $args 0] "\[0-9\]\[0-9\]\[0-9\]i.[lindex $args 1]" [lindex $args 2]
} else {
- scan-dump "ipa" [lindex $args 0] "i\[0-9\]\*.[lindex $args 1]"
+ scan-dump "ipa" [lindex $args 0] "\[0-9\]\[0-9\]\[0-9\]i.[lindex $args 1]"
}
}
}
if { [llength $args] >= 4 } {
scan-dump-times "ipa" [lindex $args 0] [lindex $args 1] \
- "i\[0-9\]\*.[lindex $args 2]" [lindex $args 3]
+ "\[0-9\]\[0-9\]\[0-9\]i.[lindex $args 2]" [lindex $args 3]
} else {
scan-dump-times "ipa" [lindex $args 0] [lindex $args 1] \
- "i\[0-9\]\*.[lindex $args 2]"
+ "\[0-9\]\[0-9\]\[0-9\]i.[lindex $args 2]"
}
}
}
if { [llength $args] >= 3 } {
scan-dump-not "ipa" [lindex $args 0] \
- "i\[0-9\]\*.[lindex $args 1]" [lindex $args 2]
+ "\[0-9\]\[0-9\]\[0-9\]i.[lindex $args 1]" [lindex $args 2]
} else {
scan-dump-not "ipa" [lindex $args 0] \
- "i\[0-9\]\*.[lindex $args 1]"
+ "\[0-9\]\[0-9\]\[0-9\]i.[lindex $args 1]"
}
}
}
if { [llength $args] >= 3 } {
scan-dump-dem "ipa" [lindex $args 0] \
- "i\[0-9\]\*.[lindex $args 1]" [lindex $args 2]
+ "\[0-9\]\[0-9\]\[0-9\]i.[lindex $args 1]" [lindex $args 2]
} else {
scan-dump-dem "ipa" [lindex $args 0] \
- "i\[0-9\]\*.[lindex $args 1]"
+ "\[0-9\]\[0-9\]\[0-9\]i.[lindex $args 1]"
}
}
}
if { [llength $args] >= 3 } {
scan-dump-dem-not "ipa" [lindex $args 0] \
- "i\[0-9\]\*.[lindex $args 1]" \
+ "\[0-9\]\[0-9\]\[0-9\]i.[lindex $args 1]" \
[lindex $args 2]
} else {
scan-dump-dem-not "ipa" [lindex $args 0] \
- "i\[0-9\]\*.[lindex $args 1]"
+ "\[0-9\]\[0-9\]\[0-9\]i.[lindex $args 1]"
}
}
/* Any symbol_ref of an un-stubified objc_msgSend is an error; look
for "objc_msgSend" in quotes, without the $stub suffix. */
-/* { dg-final { scan-file-not stubify-2.m.08.jump "symbol_ref.*\"objc_msgSend\"" } } */
+/* { dg-final { scan-rtl-dump-not "symbol_ref.*\"objc_msgSend\"" "jump" } } */
\f
/* Table of tree dump switches. This must be consistent with the
- TREE_DUMP_INDEX enumeration in tree.h */
+ TREE_DUMP_INDEX enumeration in tree.h. */
static struct dump_file_info dump_files[TDI_end] =
{
{NULL, NULL, NULL, 0, 0, 0, 0},
- {".tu", "translation-unit", NULL, TDF_TREE, 0, 0, 0},
- {".class", "class-hierarchy", NULL, TDF_TREE, 0, 1, 0},
- {".original", "tree-original", NULL, TDF_TREE, 0, 2, 0},
- {".gimple", "tree-gimple", NULL, TDF_TREE, 0, 3, 0},
- {".nested", "tree-nested", NULL, TDF_TREE, 0, 4, 0},
- {".inlined", "tree-inlined", NULL, TDF_TREE, 0, 5, 0},
- {".vcg", "tree-vcg", NULL, TDF_TREE, 0, 6, 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},
+ {".inlined", "tree-inlined", NULL, TDF_TREE, 0, 6, 0},
+ {".vcg", "tree-vcg", NULL, TDF_TREE, 0, 7, 0},
+#define FIRST_AUTO_NUMBERED_DUMP 8
+
{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},
-
- { ".cgraph", "ipa-cgraph", NULL, TDF_IPA, 0, 0, 0},
};
/* Dynamically registered tree dump files and switches. */
unsigned int
dump_register (const char *suffix, const char *swtch, const char *glob,
- int flags, unsigned int num, int letter)
+ int flags, int letter)
{
+ static int next_dump = FIRST_AUTO_NUMBERED_DUMP;
+ int num = next_dump++;
+
size_t this = extra_dump_files_in_use++;
if (this >= extra_dump_files_alloced)
char *
get_dump_file_name (enum tree_dump_index phase)
{
- char dump_id[7];
+ char dump_id[10];
struct dump_file_info *dfi;
if (phase == TDI_none)
dump_id[0] = '\0';
else
{
- const char *template;
+ char suffix;
if (dfi->flags & TDF_TREE)
- template = ".t%02d";
+ suffix = 't';
else if (dfi->flags & TDF_IPA)
- template = ".i%02d";
+ suffix = 'i';
else
- template = ".%02d";
+ suffix = 'r';
- if (snprintf (dump_id, sizeof (dump_id), template, dfi->num) < 0)
+ if (snprintf (dump_id, sizeof (dump_id), ".%03d%c", dfi->num, suffix) < 0)
dump_id[0] = '\0';
}
extern int dump_flag (dump_info_p, int, tree);
extern unsigned int dump_register (const char *, const char *, const char *,
- int, unsigned int, int);
+ int, int);
+
#endif /* ! GCC_TREE_DUMP_H */
TV_TREE_EH, /* tv_id */
PROP_gimple_lcf, /* properties_required */
PROP_gimple_leh, /* properties_provided */
- PROP_gimple_lcf, /* properties_destroyed */
+ 0, /* properties_destroyed */
0, /* todo_flags_start */
TODO_dump_func, /* todo_flags_finish */
0 /* letter */
enum tree_dump_index
{
TDI_none, /* No dump */
+ TDI_cgraph, /* dump function call graph. */
TDI_tu, /* dump the whole translation unit. */
TDI_class, /* dump class hierarchy. */
TDI_original, /* dump each function before optimizing it */
TDI_rtl_all, /* enable all the RTL dumps. */
TDI_ipa_all, /* enable all the IPA dumps. */
- TDI_cgraph, /* dump function call graph. */
TDI_end
};
#define PROP_gimple_lomp (1 << 10) /* lowered OpenMP directives */
#define PROP_trees \
- (PROP_gimple_any | PROP_gimple_lcf | PROP_gimple_leh)
+ (PROP_gimple_any | PROP_gimple_lcf | PROP_gimple_leh | PROP_gimple_lomp)
/* To-do flags. */
#define TODO_dump_func (1 << 0)
the memory footprint for VAR_DECLs. */
#define TODO_remove_unused_locals (1 << 11)
+/* Internally used for the first in a sequence of passes. It is set
+ for the passes that are handed to register_dump_files. */
+#define TODO_set_props (1 << 12)
+
#define TODO_update_ssa_any \
(TODO_update_ssa \
| TODO_update_ssa_no_phi \