86 points · by protomyth · 13y ago · 36 comments
It goes to show the value in competition and a fresh perspective. Error messages, modularity, and licensing could unseat GCC, which is pretty amazing.
(I know GCC still has many advantages, but clang/llvm clearly have made a lot of progress.)
The current compiler known as "GCC" is a direct descendant of an earlier GCC fork named EGCS:
http://en.wikipedia.org/wiki/GNU_Compiler_Collection#EGCS_fo...
So GCC was already "unseated" once, the difference being by a direct descendant instead of by a fully different compiler.
- Everyone now seems to be using LLVM for language prototyping instead of JVM/.NET, clearly positive for native compilation and to show people without compiler knowledge that managed != VM
- The compiler as a library implementation of clang allows C, C++ and Objective-C to enjoy tooling support similar to JVM and .NET languages
- As someone with a sweet spot for the strong typing found in the Pascal family, the integrated static analysis are just great
When I looked at it some time ago, it appeared that I'd have to understand and write a lot of C++ code ... which I very much don't want to do.
In my opinion, you're usually better off just doing conservative-on-the-stack GC if you're using LLVM. (This is what Rust does.)
The basic problem is that LLVM loses the distinction between pointers and integers as soon as it drops into SelectionDAG and later passes. Fixing this would be a lot of work.
That said, it doesn't (i think) use any of the llvm hooks. Instead the gc machinery is baked into the relevant primops. The hand written primops can be found here https://github.com/ghc/ghc/blob/master/rts/PrimOps.cmm#L51 (the low level primops that aren't compiler generated are written in cmm, a ghc specific dialect of c minus minus. )
Joking aside, I'm glad for the competition, and for the options. It's always nice to have another automated way to audit code: throw another compiler with maximum warnings at it.
LLVM/clang is a rather different thing, for both good and bad reasons.
EDIT: Can't believe I used "it's" instead of "its".
http://docs.python.org/2/library/ast.html
http://golang.org/pkg/go/parser/
(See also gofmt: http://golang.org/cmd/gofmt/
and gofix: http://golang.org/cmd/fix/ )The need and desire was very clear, and it was clear LLVM would meet that.
IBM supports multiple compiler toolchains: XL C/C++/FORTRAN, GCC, Java, COBOL, etc...
So, when a customer comes by with a codebase and wants to run it on their System x/System p/System z big iron, IBM's response needs to be a simple "Yes" when it comes to support.
Customer A has used XL since the epoch of computing, cool, that's supported.
Customer B has codebase tuned and littered with GCC attributes, cool, that's supported as well.
Customer C wants Clang/LLVM because devs find it easier to debug and it's growing in features, cool, that will be supported as well.