Petros Panayi wrote:
Hi,
I try to write an optimization pass which at some point will make a
call to a new runtime library.
To achieve this I need to write my own runtime library i.e something
like libgomp but much simpler for now.
I will like to know if there is a tutorial of any documentation on how
to do this?
With the new plugin mechanism in the trunk it should be even simpler
(basically, link your libary into your plugin or extend your library to
make it a GCC plugin).
However, even without plugins, it is not that hard.
The easy part is to change the gcc/Makefile.in - you might consider
looking into the MELT branch
http://gcc.gnu.org/viewcvs/branches/melt-branch/gcc/Makefile.in (which
adds some additional libraries into cc1). You probably should add stuff
into the BACKENDLIBS= make variable (not far from line 923 in
gcc/Makefile.in in the trunk)
The less easy part (which you might consider optional) would be to hack
the gcc/configure.ac file to test the availability of your additional
library. You may also want to add a --with-XXX argument to configure...
and be able to set your libraries header files and linkable archive
paths (ie the -I or -L arguments needed).
The hardest part is indeed to write an optimisation pass :-)
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} ***