[M3devel] higher level m3cg?

Henning Thielemann lemming at henning-thielemann.de
Tue Aug 21 20:14:24 CEST 2012


On Tue, 21 Aug 2012, Antony Hosking wrote:

>       *** A warning ***
> Norman Ramsey's opinion (in stackoverflow) on possible compiler backends:
>  
> 
> Code generation is my business :-)
> 
> Comments on a few options:
>
>  * 
>
>     CLR:
>
>      +  Pro: industrial support
>      +  Con: you have to buy into their type system pretty much completely; depending on what you want
>         to do with types, this may not matter
>      +  Con: Only Windows platform is really prime-time quality
>  * 
>
>     LLVM:
>
>      +  Pro: enthusiastic user community with charismatic leader
>      +  Pro: serious backing from Apple
>      +  Pro: many interesting performance improvements
>      +  Con: somewhat complex interface
>      +  Con: history of holes in the engineering; as LLVM matures expect the holes in the engineering
>         to be plugged by adding to the complexity of the interface

Additional Con: They introduce bugs from time to time and then they do not 
fix them ...


>  * 
>
>     C--
>
>      +  Pro: target is an actual written language, not an API; you can easily inspect, debug, and edit
>         your C-- code

LLVM has also a text representation for its intermediate code. This way 
you can write intermediate code by hand and experiment with it. However, 
it is verbose and redundant.

>      +  Pro: design is reasonably mature and reasonably clean
>      +  Pro: supports accurate garbage collection
>      +  Pro: most users report it is very easy to use
>      +  Con: very small development team
>      +  Con: as of early 2009, supports only three hardware platforms (x86, PPC, ARM)
>      +  Con: does not ship with a garbage collector
>      +  Con: project has no future
>  * 
>
>     C as target language
>
>      +  Pro: looks easy
>      +  Con: nearly impossible to get decent performance
>      +  Con: will drive you nuts in the long run; ask the long line of people who have tried to
>         compile Haskell, ML, Modula-3, Scheme and more using this technique. At some point every one
>         of these people gave up and built their own native code generator.
> 
> Summary: anything except C is a reasonable choice. For the best combination of flexibility, quality,
> and expected longevity, I'd probably recommend LLVM.

Despite my 'con' point I would recommend LLVM, too.



More information about the M3devel mailing list