This is the mail archive of the gcc@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]

Some questions about writing a front end


BACKGROUND (optional)

I've now reached the point of writing the GCC middle/back end interface
for my Cobol compiler. See
 
http://cobolforgcc.sourceforge.net/

Previously I wrote two front ends but that was a while ago. These were
the original iteration of cobolforgcc 1998-2003, and the now defunct
treelang of similar vintage. I also translated and updated the "how to
write a front end document", now sadly out of date
http://cobolforgcc.sourceforge.net/cobol_14.html

But that was all a while ago and a lot has happened. I read the GCC
Summit papers and the GCC Wiki but a few questions remain and there are
some things I'm not quite sure about.


QUESTIONS

1. Sample front-end: Given treelang no longer exists and "is not a good
example anyway" what would be the best front end to use as a model and
to plagiarize code?

I have found that the Ada front end, while large, is quite easy to
follow and I've been using that. C/C++ seem to have the back end
interface very enmeshed in the hand coded parsers. The Java front end is
reasonably small (only handles class files?) but the back end (BE)
interface is spread among 30 files. The fortran Front End (FE) has 58
files with BE interfaces. Objective C/++ are mostly just add-ons to C.

What I don't know is how up-to-date the various front ends are and how
good an example they are.

2. Most-Gimplified front-end: Allied to Q1, which front ends have been
most thoroughly converted to GIMPLE?

3. LANG_HOOKS: There has been some discussion about LANG_HOOKS being
removed in the future. From memory this was in the context of the
"optimization in the linker (LTI)" projects. Is there a replacement I
should use now, or is there anything I should do to prepare for the
replacement?

4. What does Gimple cover: What is the scope of GIMPLE? Most of the
discussion is about procedural code. Does it also cover variable
definition, function prototype definition etc.

5. What is deprecated: Is there any time-effective way to identify
constructs, header files, macros, variable and functions that are
"deprecated".

6. Tuples: I am a bit confused about tuples. Tuples seem to be really
just structs by another name, unless I have missed the point. The idea
is not a bad one - I went through the same process in the Lisp code in
the front end where initially I stored everything in arrays and later
switched to structs/tuples. In lisp this provided the advantages of
run-time type-checking and the ability to use mnemonic names. 

The first email about tuples that I can find seems to assume a
reasonable amount of background on the part of the reader:
http://www.mailinglistarchive.com/gcc@gcc.gnu.org/msg01669.html

Some clarification about what the tuples project is trying to do, and in
particular how I should position for the advent of tuples would be very
useful. I have read the material in the Wiki and from the GCC summit.

7. Should I target GENERIC, High Gimple or Low Gimple? Would I miss
optimizations if I went straight to a Gimple representation? Is one
interface more likely to change radically in the future? The assumption
here is that the front end will be using an entirely different
representation so there is no question of using one of these in the
Front End. It is just a question of which format to convert into.

Thank you all for any help you can provide,
Tim Josling


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