[LLVMdev] C back-end differences
isanbard at gmail.com
Tue May 8 22:45:25 PDT 2007
On May 8, 2007, at 10:05 PM, Mohd-Hanafiah Abdullah wrote:
> On Tue, 2007-05-08 at 11:58 -0700, Bill wrote:
>> On 5/8/07, Mohd-Hanafiah Abdullah <napi at axiomsol.com> wrote:
>>> How does the C back-end of LLVM differ from the one in gcc2c
>>> by SUN several years ago?
>> Hi Napi,
>> For one, it converts LLVM's bytecode to C instead of GCC's RTL. It's
>> also under a different license.
> Hi Bill:
> Would it be easier to convert from LLVM's bytecode to C as opposed to
> from RTL? What about the readability of the produced C code. I would
> think since RTL maintains a structure that is directly inherited from
> the high-level language structure it would be less difficult to
> turn it
> into some C code that is relatively more readable, as compared to
> synthesizing C code from the low-level bytecode. I stand corrected.
Considering that LLVM already has a C backend, then it's easier to
generate it from the LLVM bytecode. :-) LLVM's intermediate
representation of the program (the bytecode) is also derived directly
from the high-level language. When it gets to the C backend part, it
simply has had transformations done on it.
I don't believe that the C backend was made for readability. In fact,
because LLVM is in SSA form, it uses many temporary variables and
loses a lot of the information about what the original variable's
The best way to get a feel for how it is is to write a program and
generate the C code for it with the LLVM backend. (See the llc tool
for information on this.)
Though, this begs the question of why you want to use something which
converts it to C instead of just using one of the target backends to
generate native code.
More information about the llvm-dev