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]

adding more plugin headers


Hello All,

The MELT plugin (which is actually a specialized plugin infrastructure itself) is still missing some plugin headers, that is some additional lines for PLUGIN_HEADERS in gcc/Makefile.in

As a general point of view, I feel that if some information, parameter, or tuning is already existing in core GCC, we should wish that plugin don't duplicate that feature (e.g. thru their own plugin argument, in the -fplugin-arg-NAME-KEY sense of http://gcc.gnu.org/onlinedocs/gccint/Plugins.html#Plugins) but preferably use existing GCC stuff.

I am detailing for each added file why I need it in MELT.

cppdefault.h is needed mostly to access gcc_exec_prefix. This is useful to other plugins, which might want to be installed there.

flags.h provide several useful information for plugins. A typical example is the optimize variable which should be useful to any plugin providing some specialized optimisation pass. Also various other declarations from this header file are useful to plugins. For example, I could imagine some plugins wanting to call set_Wstrict_aliasing() or to use the
IRA_REGION_MIXED flag, etc.


md5.h is from libiberty, but is quite useful to any plugins wanting to compute signature, and this may be the case for any plugin persisting data (outside of GCC generated objects).

params.h & params.def are needed to access parameters. A plugin doing some magic inlining might want to use MAX_INLINE_INSNS for instance, and I exepect lots of plugins will be happy to use existing parameters for their own tuning.

prefix.h is useful to get update_path. Again, some plugins might want to retrieve files installed at standard GCC locations in the system file hierarchy.

tree-inline.h provide useful functions like tree_can_inline_p or estimated_stack_frame_size. An optimisation (or static analysis) plugin may need to call these to make its decisions.


Currently, MELT can be compiled as a simple gcc-trunk plugin, but it does so by copying a lot of header files in its private installation directory, duplicating the PLUGIN_HEADERS variable of the Makefile.in. I would be very happy to avoid that, and I hope having explained why other plugins could use them.


(For those knowing nothing about MELT, it is a plugin able to translate some Lisp dialect into C, and then to compile the generated C, all that during a MELT plugin utilization inside a long-lasting GCC invocation using the melt.so plugin; so MELT really needs these header files).

I am attaching a patch to trunk rev 154487.

Ok for trunk?

#####
gcc/ChangeLog:
2009-11-24  Basile Starynkevitch  <basile@starynkevitch.net>
	* Makefile.in (PLUGIN_HEADERS): Added more files.
#####

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: gcc-trunk-bstarynk/gcc/Makefile.in
===================================================================
--- gcc-trunk-bstarynk/gcc/Makefile.in	(revision 154487)
+++ gcc-trunk-bstarynk/gcc/Makefile.in	(working copy)
@@ -4270,7 +4270,8 @@
   intl.h $(PLUGIN_VERSION_H) $(DIAGNOSTIC_H) $(C_COMMON_H) $(C_PRETTY_PRINT_H) \
   tree-iterator.h $(PLUGIN_H) $(TREE_FLOW_H) langhooks.h incpath.h \
   tree-ssa-sccvn.h real.h output.h $(IPA_UTILS_H) \
-  $(C_PRAGMA_H)  $(CPPLIB_H)  $(FUNCTION_H)
+  $(C_PRAGMA_H)  $(CPPLIB_H)  $(FUNCTION_H) \
+  cppdefault.h flags.h $(MD5_H) params.def params.h prefix.h tree-inline.h 
 
 # Install the headers needed to build a plugin.
 install-plugin: installdirs lang.install-plugin

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