[bib] RFC/patch: eliminate C front-end dependencies in treelang

Tim Josling tej@melbpc.org.au
Thu Oct 10 13:42:00 GMT 2002


> 
>        [bib] RFC/patch: eliminate C front-end dependencies in treelang
>    Date: 
>        Wed, 9 Oct 2002 17:49:28 +1000
>   From: 
>        Fergus Henderson <fjh@cs.mu.OZ.AU>e
>     To: 
>        gcc-patches@gcc.gnu.org
> 
> 
> 
> The following change increases the size of the treelang front-end by
> about 300 lines, but eliminates the treelang front-end's dependencies
> on the C front-end.
> 
> Because of the increase in the source code size,
> I think this change is only of marginal benefit currently.
> However, I think it is a step towards the right direction.
> Most of the code added is not actually treelang-specific,
> and could be moved into libbackend.a in future patches,
> as default values for front-end hooks.
> 
> Tested by "make treelang" and "make check-treelang" on i686-pc-linux-gnu.
> Since the treelang test suite only has one test case, this is not a very
> good test.  However, the new code I've added here is copied from the Mercury
> front-end, which has been tested by bootstrapping itself on i686-pc-linux-gnu
> and by passing the Mercury test suite.
> 
> This patch is against the gcc-3_4-basic-improvements-branch branch.
> ...

Originally treelang was how you want to patch it, but I changed it because of
the effort involved in retrofitting changes.

At the moment, it reuses a lot of the 'C' code, which as you point out, is not
really 'C' code and should be in a non-language specific place. This means I
do not have to retrofit a lot of complex changes all the time...

As a result of this, there is currently a frequent need to add small dummy
routines to treelang, so the C code's linkage needs are met (due to new 'C'
specific functions). However these patches are simple, whereas it used to be
quite complex to keep treelang working.

As you point out, the way it is now requires fewer lines of code. If your
change is made as is, there will be more lines or code, and more effort to
maintain them, unless the libbackend.a change is made first.

In my view it would be best (and a very good idea) to move the code added into
libbackend.a first, and then patch treelang to remove the dependencies.

Tim Josling



More information about the Gcc-patches mailing list