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]

Re: Novice Questions: Interface To Compiler Front End?


On Monday 20 October 2003 10:39 pm, Reid Spencer wrote:
> GCCers,
>
> I am building a new language front end for GCC (yes, I know, yet another
> one). I've read all the documentation I can find and I've built both the
> 3.2.1 and 3.3.1 releases. So far so good. Now, what I'm looking for is a
> library and a set of header files that I can use in building my new
> front end.  I have noticed that there is a libbackend.a which seems to
> contain all the back end code. What I was hoping is that there would be
> a libfrontend.a that contains the front end code that I could link
> against in my new front end.  Is there a way to configure GCC to build
> such a thing? I couldn't see one.  Am I missing something here?
>
> Please Note: Because this is a new language, somewhat different from
> other front ends, and likely to be highly experimental over the next
> year, I am pretty certain you don't want me to integrate it into the
> current GCC sources (yet).  So, I plan to build a separate front end
> interface (like Ada) that uses the tree macros and AST support and
> downstream code generation. What I was hoping is that there would be
> just a few header files to include and a library I could link with to
> build my own front end. Is this a poor choice? Is adding a new language
> directory to the ${top_srcdir}/gcc directory required as opposed to just
> advised?

I think it's possible to build out of tree, but much harder to maintain. The 
big advantage of building in tree is that you get all the configury stuff 
for free.

It's really quite easy to maintain, no changes are required outside of 
${top_srcdir}/gcc/mynewfrontend . 

You probably also want to be looking at the tree-ssa branch. The interface 
to the backend is significantly cleaner than is was on mailine last time I 
looked.

> If building a libfrontend.a seems like a good idea to everyone but just
> hasn't been done yet, I'd be willing to contribute the time to make it
> happen as it will simplify my task later on.

This is effectively what happens, it just never actually gets linked into a 
library. libbackend.a, tree*.o, toplev.o (and possibly a few others) 
provide the common bits of the compiler, the language frontends just plug 
into this.

Paul


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