This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Dump before flag


On Wed, Jun 1, 2011 at 11:23 PM, Xinliang David Li <davidxl@google.com> wrote:
> On Wed, Jun 1, 2011 at 2:12 PM, Basile Starynkevitch
> <basile@starynkevitch.net> wrote:
>> On Wed, 1 Jun 2011 13:26:24 -0700
>> 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.
>>
>> Perhaps you forgot to actually attach the patch?
>
> Right -- attached in a follow up email.
>>
>>> 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.
>>
>> I don't understand what you mean by a dumping_level () function. What
>> should that hypothetical function do? (I'm wrongly guessing it would
>> return an integer, but IIRC dumpfile is a FILE*)
>
> THere are two sources of dump:
>
> 1) IR dump performed by pass manager
> 2) pass specific debugging dump (the verbosity is controlled by -details flag).
>
> 2) is the part that is messy and needs cleanup. Every pass just checks
> if dump_file is null or not and decide to dump the debugging info --
> there is no easy way to turn it on and off. Ideally, individual pass
> should call
>
> ?int debug_dump_level () -- dumps when it returns > 0.
>
> With that in place, the dump flag -fdump-xxx-yyy-ir_only can be easily
> implemented -- it only turns on pass manager dump, but lowers the
> debug dump level to 0.

Well.  There is just no distinction in the current design between
the "pass manager managed dump" and the "pass managed dump".
Instead the pass requests the function to be dumped before/after
it is run via the TODO flags.

Your patch doesn't really improve this but adds to the confusion.

+  /* 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;
+    }

and certainly writing to pass is not ok.  And the TDF_BEFORE flag
looks misplaced as it controls TODOs, not dumping behavior.
Yes, it's a mess right now but the above looks like a hack ontop
of that mess (maybe because of it, but well ...).

At least I would have expected to also get the dump after the
pass, not only the one before it with this dump flag.

Now, why can't you look at the previous pass output for the
before-dump (as I do usually)?

Richard.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]