This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: GCC Making a new PASS
On Mon, Jun 11, 2012 at 03:41:16PM +0530, Satya Prakash Prasad wrote:
> I am trying to write a new GCC pass in gcc-4.1.2. This is my first
> attempt and I am trying to print lines of code for a function gcc is
> compiling. So I added the below code. Note if I remove code in
> execute_gimple_manipulation method the issue does not occur :
>
> gcc/gcc-4.1.2 1223> cat gcc/gimple-manipulation.c
[...]
> Any help ? why the issue is occurring and how can I achieve the objective?
GCC 4.1 is a very old version of the compiler [most of us forgot the details of it]
I strongly suggest to upgrade to a recent version (e.g. 4.7 or at least 4.6).
You should test that cfun is non-null.
And recent versions may accept plugins, which is a nice and easy way to experiment addition of new passes in GCC.
BTW, you might even use MELT (a high-level domain specific language to extend GCC) for that purpose.
See http://gcc-melt.org/ for more (or ask me).
Cheers.
--
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} ***