plugin specific LTO data?
Richard Guenther
richard.guenther@gmail.com
Wed Oct 28 21:29:00 GMT 2009
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.
More information about the Gcc
mailing list