[LLVMdev] [RFC] Resurrecting the C back-end

Roel Jordans r.jordans at tue.nl
Tue Aug 28 02:14:12 PDT 2012



On 28/08/12 04:30, Philipp Klaus Krause wrote:
> Will this allow users to compile C++ (or some other language that LLVM
> has a frontend for) to C, which then can be compiled using a C compiler
> for a target architecture, for which only a C compiler exists?
> Which use-cases do you have in mind for this backend?
>

Possibly yes, compiling C++ to C would require support for things like 
exception handling which require more work to be represented in C. I 
expect that LLVM has routines to translate exception handling to more C 
compatible structures for usage in the other backends. However, this 
approach would probably limit the exception handling to work in a 
specific way when translated to C which might not be what the user of a 
C++ to C compilation flow would like.

In short, I'd need to think about how this should work and how much 
would need to be configurable for the user.

My current goal is to be able to use the C backend for my research. I 
work within the ASAM project [1] on datapath synthesis for application 
specific processors. I have created some application analysis methods 
within the LLVM framework and I want to compare their predictions with 
real-life results on our target architecture. It is difficult for me to 
implement my analysis within our target compiler as it is closed source 
but I still want to be sure that the application code has been optimized 
in the same way. Therefore I would like to be able to translate the 
optimized IR back to C and compile it using the target compiler without 
further optimizations. That way I can also support/control some 
optimizations better which are more difficult to control in the target 
compiler. (writing a complete backend for my target architecture is 'a 
bit' too much work for me)


  Roel

> Philipp
> _______________________________________________
> LLVM Developers mailing list
> LLVMdev at cs.uiuc.edu         http://llvm.cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
>

[1] https://www.asam-project.org/



More information about the llvm-dev mailing list