treelang fix for rs6000 / treelang not proper front end

Steven Bosscher s.bosscher@student.tudelft.nl
Sun Jun 8 23:10:00 GMT 2003


Tim Josling wrote:

> Zack Weinberg wrote:
>
>> Tim Josling <tej@melbpc.org.au> writes:
>>
>>
>>> Treelang now works on RS6000 with this patch; the previous version had
>>> a missing symbol in the link. Tested also on i686-pc-linux-gnu. I will
>>> apply it shortly.
>>>
>>> Thanks to Matthias Klose for help testing this.
>>
>>
>>
>> Why are you linking rs6000-c.c into treelang in the first place?
>>
>> zw
>>
>>
>
> The treelang front end reuses some of the c front end code. That is, 
> code which is theoretically part of the c front end but actually is 
> used across a number of languages. 

Still, treelang uses way too much C stuff.  Somehow all other
front ends manage to get about just fine without linking to
C front end files.

> <snip>
>
> Some have expressed a view that reusing code from the c front end is 
> bad and that treelang should duplicate this code. Having actually 
> tried this theory early on, I disagree. The amount of effort required 
> to sustain this is an order of magnitude greater than the current regime. 

Reusing code is fine.  Linking to whatever code is not yours
is not.  How many times have we seen now that changes to the
C front end break treelang in the most unexpected ways?
Each front end should stand on its own feet.  By re-using
other front-end's code, you just move the maintainance
burden from one front end to another.

Also, what use is an example front end if it duplicates
or reuses code from the one front end that nobody truely
understands, let alone the target audience of treelang.

> As discussed on the gcc mailing list recently the interface between 
> front end and back end is not very clean, to put it mildly. This is 
> the real problem. Code that is not front end specific should be 
> factored out so that it can readily be reused. Front end specific code 
> should be in the directory for that front end, etc. 

This is so true!  But fortunately, people are working on
this (at last!).

On the tree-ssa branch, GENERIC is looking more and more
like the language-independent IR that any front end can
target.  Sure, there still are functions in the c-* files
that are useful to other front ends, but it's no big deal
to duplicate those if it helps you get rid of all the
C specific stuff you really _don't_ need.  For example,
G95 shrinked about 2000 lines (!) last week when I removed
all the C front end dependencies.

Moving the C front end into its own directory has also been
discussed recently, and I hope it will happen soon.  That
will more or less enforce a cleaner front end <--> back end
interface, and that's a good thing.

> I am not sure that this is going to happen any time soon though. Even 
> a simple proposal to move the c front end into its own directories and 
> to move all front ends under /fe seems to be waist deep in quicksand 
> at present.

Hmmm I thought pretty much everyone agreed that it should
happen.  The only questions are when and how.

> I am not going to volunteer to fix this, as it is quite easy to do a 
> lot of work for nothing. Even with agreement in advance about an 
> approach to be taken, people change their minds later.
>
> Treelang has already proven useful. Keisuke Nishida used is as a basis 
> for his cobol front end. We should not throw all that work away 
> because of abtract considerations such as it not being a 'proper' 
> front end.


If you would say this about a very complicated language with
a long GCC history, I would agree.  But an example front end
should set, well, an example.  Therefore it should be proper
as can be, and preferably always up-to-date with the latest
ideas about what GCC front ends should look like.

> I already offered to people, make it a 'proper' front end i.e. 
> duplicate all the c code. See how easy it is. Maintain it for a while. 
> Volunteer to take over treelang maintenance. 

Remember that in an earlier discussion we had, I already _did_
offer you to make treelang 'proper' for a tree-ssa, and to
take over as a maintainer for that branch so that you would
only have to take care of mainline?  That was only a couple
of months ago, and you then said you didn't think it was
worth the effort.

Gr.
Steven







More information about the Gcc mailing list