This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: Dump before flag
Sorry about it. Here it is.
David
On Wed, Jun 1, 2011 at 1:36 PM, Richard Guenther
<richard.guenther@gmail.com> wrote:
> On Wed, Jun 1, 2011 at 10:26 PM, Xinliang David Li <davidxl@google.com> wrote:
>> Hi, this is a simple patch that support dump_before flag. E.g,
>>
>> -fdump-tree-pre-before
>>
>> This is useful for diffing the the IR before and after a pass.
>>
>> Gcc dumping needs more cleanups -- such as allowing IR only dump,
>> allowing IR dumping for a particular function etc. The exposure of
>> 'dumpfile' (instead of a dumping_level () function) makes those change
>> a little messy, but can be done.
>>
>> Ok for trunk?
>
> -ENOPATCH
>
>> Thanks,
>>
>> David
>>
>
2011-06-01 David Li <davidxl@google.com>
* tree-dump.c: New dump flags.
* tree-pass.h: New dump flags.
* passes.c (execute_one_pass): Handle dump_before flag.
Index: tree-dump.c
===================================================================
--- tree-dump.c (revision 174446)
+++ tree-dump.c (working copy)
@@ -808,6 +808,7 @@ struct dump_option_value_info
in tree.h */
static const struct dump_option_value_info dump_options[] =
{
+ {"before", TDF_BEFORE},
{"address", TDF_ADDRESS},
{"asmname", TDF_ASMNAME},
{"slim", TDF_SLIM},
Index: tree-pass.h
===================================================================
--- tree-pass.h (revision 174446)
+++ tree-pass.h (working copy)
@@ -83,6 +83,7 @@ enum tree_dump_index
#define TDF_ALIAS (1 << 21) /* display alias information */
#define TDF_ENUMERATE_LOCALS (1 << 22) /* Enumerate locals by uid. */
#define TDF_CSELIB (1 << 23) /* Dump cselib details. */
+#define TDF_BEFORE (1 << 24) /* Dump IR before pass. */
/* In tree-dump.c */
Index: passes.c
===================================================================
--- passes.c (revision 174446)
+++ passes.c (working copy)
@@ -1563,6 +1563,13 @@ execute_one_pass (struct opt_pass *pass)
initializing_dump = pass_init_dump_file (pass);
+ /* Override dump TODOs. */
+ if (dump_file && (pass->todo_flags_finish & TODO_dump_func)
+ && (dump_flags & TDF_BEFORE))
+ {
+ pass->todo_flags_finish &= ~TODO_dump_func;
+ pass->todo_flags_start |= TODO_dump_func;
+ }
/* Run pre-pass verification. */
execute_todo (pass->todo_flags_start);