From: | torbenm@diku.dk (Torben Ęgidius Mogensen) |
Newsgroups: | comp.compilers |
Date: | Wed, 31 Aug 2011 11:15:31 +0200 |
Organization: | SunSITE.dk - Supporting Open source |
References: | 11-08-006 11-08-007 11-08-029 |
Keywords: | translator, C |
Posted-Date: | 31 Aug 2011 09:33:20 EDT |
jgk@panix.com (Joe keane) writes:
> Volker Birk <bumens@dingens.org> writes:
>>If you want to compile a programming language to assembler code
>
> I'm not sure why anyone would want to do this; if you have another
> language you can convert it to C code, and concentrate on what you are
> doing. If you find that the C->assembly step can be improved that is
> also useful.
C is not always well suited as a target language for a compiler (even
though it is often used for this purpose). For example:
- Standard C does not support indirect jumps.
- Few C compilers support tail-call optimisation.
- C does not support multiple return values from a function call.
- Exceptions are not supported and are difficult to implement
efficiently and portably.
- Finding the root set for tracing garbage collectors is not easy.
- Multi-word integer arithmetic is not supported, even though hardware
often does.
- A lot of C behaviour is defined as implementation dependent, so you
can not be sure your code works the same on all machines/compilers.
So there can be plenty of reasons to compile all the way to assembly
code. Or use something like LLVM as target.
Torben
Return to the
comp.compilers page.
Search the
comp.compilers archives again.