public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
* role of dump_file notably for/in plugins?
@ 2011-08-31 14:25 Basile Starynkevitch
  2011-08-31 14:28 ` Richard Guenther
  2011-09-01 15:18 ` Pierre Vittet
  0 siblings, 2 replies; 4+ messages in thread
From: Basile Starynkevitch @ 2011-08-31 14:25 UTC (permalink / raw)
  To: gcc

Hello Folks

What is the intended role of the dump_file [the one known in tree-pass.h
near line 101] for plugins?

May plugins print their arbitrary things (e.g. their own debug printing)
inside? I believe that yea, but I am not sure.

May plugins set the dump_file variable (for instance to stderr). I believe
that no, but I am not sure.

Can dump_file be used outside passes (e.g. in the initialization part of a
plugin)? I believe that no, but I hesitate.

Cheers.


-- 
Basile STARYNKEVITCH         http://starynkevitch.net/Basile/
email: basile<at>starynkevitch<dot>net mobile: +33 6 8501 2359
8, rue de la Faiencerie, 92340 Bourg La Reine, France
*** opinions {are only mines, sont seulement les miennes} ***

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: role of dump_file notably for/in plugins?
  2011-08-31 14:25 role of dump_file notably for/in plugins? Basile Starynkevitch
@ 2011-08-31 14:28 ` Richard Guenther
  2011-08-31 14:47   ` David Malcolm
  2011-09-01 15:18 ` Pierre Vittet
  1 sibling, 1 reply; 4+ messages in thread
From: Richard Guenther @ 2011-08-31 14:28 UTC (permalink / raw)
  To: Basile Starynkevitch; +Cc: gcc

On Wed, Aug 31, 2011 at 4:24 PM, Basile Starynkevitch
<basile@starynkevitch.net> wrote:
> Hello Folks
>
> What is the intended role of the dump_file [the one known in tree-pass.h
> near line 101] for plugins?
>
> May plugins print their arbitrary things (e.g. their own debug printing)
> inside? I believe that yea, but I am not sure.
>
> May plugins set the dump_file variable (for instance to stderr). I believe
> that no, but I am not sure.
>
> Can dump_file be used outside passes (e.g. in the initialization part of a
> plugin)? I believe that no, but I hesitate.

Look at how it is set.. That answers all of your questions.

Richard.

> Cheers.
>
>
> --
> Basile STARYNKEVITCH         http://starynkevitch.net/Basile/
> email: basile<at>starynkevitch<dot>net mobile: +33 6 8501 2359
> 8, rue de la Faiencerie, 92340 Bourg La Reine, France
> *** opinions {are only mines, sont seulement les miennes} ***
>

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: role of dump_file notably for/in plugins?
  2011-08-31 14:28 ` Richard Guenther
@ 2011-08-31 14:47   ` David Malcolm
  0 siblings, 0 replies; 4+ messages in thread
From: David Malcolm @ 2011-08-31 14:47 UTC (permalink / raw)
  To: Richard Guenther; +Cc: Basile Starynkevitch, gcc

On Wed, 2011-08-31 at 16:28 +0200, Richard Guenther wrote:
> On Wed, Aug 31, 2011 at 4:24 PM, Basile Starynkevitch
> <basile@starynkevitch.net> wrote:
> > Hello Folks
> >
> > What is the intended role of the dump_file [the one known in tree-pass.h
> > near line 101] for plugins?
> >
> > May plugins print their arbitrary things (e.g. their own debug printing)
> > inside? I believe that yea, but I am not sure.
> >
> > May plugins set the dump_file variable (for instance to stderr). I believe
> > that no, but I am not sure.
> >
> > Can dump_file be used outside passes (e.g. in the initialization part of a
> > plugin)? I believe that no, but I hesitate.
> 
> Look at how it is set.. That answers all of your questions.

FWIW, I wrapped writing to "dump_file" in my Python gcc plugin as the
API entrypoint:
   gcc.dump(obj)
but given that it didn't seem to be possible to enable dumping for a
given custom pass by name directly from the command-line, it didn't seem
very useful (you can toggle the dfi->state when the pass is created to
manually enable it, which I've wrapped as the "dump_enabled" property of
a gcc.Pass instance).

Given all of this I tend to simply use "dump_base_name", which I wrapped
as:
   gcc.get_dump_base_name()
to supply a meaningful filename, which I use open a regular file for
writing.

See:
http://readthedocs.org/docs/gcc-python-plugin/en/latest/passes.html#dumping-per-pass-information
and
http://readthedocs.org/docs/gcc-python-plugin/en/latest/passes.html#gcc.Pass.dump_enabled
for more notes on how the Python plugin approaches this.

The relevant code is mostly in:
http://git.fedorahosted.org/git/?p=gcc-python-plugin.git;a=blob;f=gcc-python.c;h=f6c5f5f284ffddff61195c40bbf6b8d62f7a7a9d;hb=HEAD#l675
and
http://git.fedorahosted.org/git/?p=gcc-python-plugin.git;a=blob;f=gcc-python-pass.c;h=a54ea9b6d6bd8ecc26f8a305c4e96605d2bd14ab;hb=HEAD#l253

Hope this is helpful
Dave

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: role of dump_file notably for/in plugins?
  2011-08-31 14:25 role of dump_file notably for/in plugins? Basile Starynkevitch
  2011-08-31 14:28 ` Richard Guenther
@ 2011-09-01 15:18 ` Pierre Vittet
  1 sibling, 0 replies; 4+ messages in thread
From: Pierre Vittet @ 2011-09-01 15:18 UTC (permalink / raw)
  To: gcc

Hello,

From what I understand, the question is not really how do we dump passes
but what a pass (from a plugin or not) should dump? So the question is
what do you expect from a dump file?

Do you expect to have the full internal representation of the code after
the end of the pass? For many dump files, we just get this (lower,cfg,
ssa...).
Or do you expect something more oriented on what the pass did? Like
"this pass remove three unreable basicblocks, they were located here,
here and here"?

Maybe there is no particular rules and it just depends of the pass.
However I guess there should some clear rules about this. Dump files can
be quite useful to understand the compiler behavior (sometimes it is a
huge task to search using the debugger).

Thanks.

Pierre Vittet

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2011-09-01 15:18 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-08-31 14:25 role of dump_file notably for/in plugins? Basile Starynkevitch
2011-08-31 14:28 ` Richard Guenther
2011-08-31 14:47   ` David Malcolm
2011-09-01 15:18 ` Pierre Vittet

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).