LWN.net Logo

Advertisement

Fast storage & processing: iSCSI, NFS, SMB/CIFS, clusters for financial, media, HPC, research, virtualization

Advertise here

GCC unplugged

GCC unplugged

Posted Nov 20, 2007 8:35 UTC (Tue) by JamesErik (subscriber, #17417)
In reply to: GCC unplugged by jordanb
Parent article: GCC unplugged

"Where does such flexibility make sense for compilers?"

I respectfully submit that you're not thinking outside the box enough.  An example I know of
that would benefit from a pluggable GCC is GCC-XML (http://www.gccxml.org), which has the
(limited, last I looked) capability of exposing part of the GCC internal representation as
XML.  No, I'm not an XML fanboy, but the wide array of XML tools that can be applied make code
transformations a great deal more **accessible to the average developer**.  I understand the
GCC-XML team had very deliberate push-back from the core GCC devs on integrating their work
precisely because of the "easing proprietary extensions" specter.  As a result, GCC-XML is
indeed a largely duplicate download of plain GCC.

This is just one example, though.  Perhaps you'd want to make better integration with a
debugger, farm out pieces to a co-processor, generate some fancy-schmancy metrics and graphs
for the suits... and on and on.  I don't think either of us can imagine all the possibilities.

All this notwitstanding, sure, an internal cleanup and better documentation would go a long
way towards attracting development energy.  It is, no doubt, "a staggeringly sensible idea,"
but other efforts to make GCC development accessible more approachable are pretty far along
the sensibility curve in my book, too.


(Log in to post comments)

GCC unplugged

Posted Nov 20, 2007 14:28 UTC (Tue) by Nelson (subscriber, #21712) [Link]

What are some meaningful tasks people are doing with GCC-XML? I always thought it was more about providing information as to the internal state of the compiler, not providing a new IR to perform analysis on and inject back in to the compiler. Almost like something an IDE might use. That's a substantially different goal than letting someone inject XML back in to GCC. What are all these XML tools that are supposed to do that in a good way also? I have seen a lot of parsers but not a lot of tools that can do the sorts of things you need to do to IR.

The whole plug-in thing is sexy in a way, you always have a tool to solve the problems you didn't think about or don't want to solve. It's astonishingly difficult to do well though, eclipse is an example of something built with that in mind and if you use a good sized set of plugins, you're always screwed when they roll the version of eclipse. There is a certain cost you have to put in to a project to get in merged in, with a plugin, that cost is lower and the likelihood that you'll abandon the code is higher, I think it's very common for "plugins" to be abandoned. The thing is, in a healthy open source project, it's alive and on going, you have access to the code and can change it to fix those unseen problems.

GCC front ends makes sense, and it's possible. If you play by the right rules, you can get your front-end incorporated in to the compiler distribution (D, Modula-3, Pascal are examples of them not doing that, and look at where they are now...) As for code generation and optimization, why wouldn't you want that included in the compiler?

The big thing is if you want to play with GCC you have to be a team player, there are rules to follow, you can't just hack out some code, throw it out and expect the GCC guys to jump on it, clean it up and incorporate it. These discussions always revolve around people following the community rules, look are Reiserfs 4, same issue, it's not like Linus and company didn't want it in, Hans just wouldn't/couldn't follow the rules.

GCC unplugged

Posted Nov 20, 2007 15:07 UTC (Tue) by dcoutts (subscriber, #5387) [Link]

What are some meaningful tasks people are doing with GCC-XML?

FFI tools for other high level languages. For example c2hs is a tool that reads .h files and generates Haskell code that imports the foreign C functions at the correct type. This guarantees cross-language type safety which is a pretty big deal.

At the moment c2hs has to use it's own hand-written C parser that understands all the GNU C extensions. This was not easy to make and it's not easy to maintain. Having a proper intermediate format generated by gcc would allow us to parse GNU C code easily and providing additional things like correct calculation of sizes of C types etc.

GCC unplugged

Posted Nov 20, 2007 18:11 UTC (Tue) by aleXXX (subscriber, #2742) [Link]

> What are some meaningful tasks people are doing with GCC-XML? 

Kitware (the CMake developers) wrote it and I think they use it to 
generate bindings to scripting languages for their libraries.

Alex

Copyright © 2008, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds