public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
* plugin specific LTO data?
@ 2009-10-28 18:56 Basile STARYNKEVITCH
  2009-10-28 21:29 ` Richard Guenther
  0 siblings, 1 reply; 2+ messages in thread
From: Basile STARYNKEVITCH @ 2009-10-28 18:56 UTC (permalink / raw)
  To: GCC Mailing List

Hello All,

Is there some way from a plugin to read and to write some plugin 
specific LTO data?

When glancing in lto-streamer.h I believe I see no such things. But I 
don't understand all the details.

I was thinking of e.g. functions like

void lto_input_plugin_data(struct lto_file_decl_data*file_data,
			   const char* plugin_name,
			   char **datap,
			   size_t*sizep);

A pass from the plugin FOO would call

    char* mydata = NULL;
    size_t mydatasize = 0;
    lto_input_plugin_data(file_data, "FOO", &mydata, &mydatasize);

and then the buffer mydata would be malloc-ed by the LTO infrastructure 
and it will be read, and mydatasize set to the size of the read data.

For writing, I would be happy with

void lto_output_plugin_data(struct lto_file_decl_data *file_data,
			    const char* plugin_name,
			    char* data, size_t size);

and the plugin would call
    lto_output_plugin_data(file_data, "FOO", mydata, mysize);

Perhaps the lto_file_decl_data* type above is wrong (and should be 
something else).

Is it too late to add such a simple functionality in the LTO infrastructure.


There are many possible usage for that. For example, imagine a plugin 
which try to detect that every malloc() result has been tested against 
null. To work between compilation unit, that plugin has to serialize 
properties like "rootine foo returns a malloc()-ed pointer untested" etc.

Are there other alternatives?
	

BTW, the comment in lto-streamer.h near line 809 of rev 153460 reads

/* In lto-streamer-in.c */
extern void lto_input_cgraph (struct lto_file_decl_data *, const char*);


But I cannot find any lto_input_cgraph in rev 153460 of the trunk

Regards
-- 
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] 2+ messages in thread

* Re: plugin specific LTO data?
  2009-10-28 18:56 plugin specific LTO data? Basile STARYNKEVITCH
@ 2009-10-28 21:29 ` Richard Guenther
  0 siblings, 0 replies; 2+ messages in thread
From: Richard Guenther @ 2009-10-28 21:29 UTC (permalink / raw)
  To: Basile STARYNKEVITCH; +Cc: GCC Mailing List

On Wed, Oct 28, 2009 at 6:34 PM, Basile STARYNKEVITCH
<basile@starynkevitch.net> wrote:
> Hello All,
>
> Is there some way from a plugin to read and to write some plugin specific
> LTO data?
>
> When glancing in lto-streamer.h I believe I see no such things. But I don't
> understand all the details.
>
> I was thinking of e.g. functions like
>
> void lto_input_plugin_data(struct lto_file_decl_data*file_data,
>                           const char* plugin_name,
>                           char **datap,
>                           size_t*sizep);
>
> A pass from the plugin FOO would call
>
>   char* mydata = NULL;
>   size_t mydatasize = 0;
>   lto_input_plugin_data(file_data, "FOO", &mydata, &mydatasize);
>
> and then the buffer mydata would be malloc-ed by the LTO infrastructure and
> it will be read, and mydatasize set to the size of the read data.
>
> For writing, I would be happy with
>
> void lto_output_plugin_data(struct lto_file_decl_data *file_data,
>                            const char* plugin_name,
>                            char* data, size_t size);
>
> and the plugin would call
>   lto_output_plugin_data(file_data, "FOO", mydata, mysize);
>
> Perhaps the lto_file_decl_data* type above is wrong (and should be something
> else).
>
> Is it too late to add such a simple functionality in the LTO infrastructure.

You have to write an IPA pass, those can output/input pass specific data
to the LTO sections.  No need to add anything plugin specific.

Richard.

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

end of thread, other threads:[~2009-10-28 20:32 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-10-28 18:56 plugin specific LTO data? Basile STARYNKEVITCH
2009-10-28 21:29 ` Richard Guenther

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).