This is the mail archive of the gcc@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]

plugin specific LTO data?


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} ***


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