[LLVMdev] Strategy to compile for LLVM IR

Stéphane Letz letz at grame.fr
Fri Jun 15 07:11:04 PDT 2007


Hi,

We have a compiler for the Faust language (faust.grame.fr) that  
currently compiles a C++ class which implements a DSP plug-in with  
several methods.

Our strategy to compile LLVM IR instead is the following:

- use the current Faust ==> C++ compiler to compile a "empty" plug-in  
that we use as a template C++ class.

- compile this  template C++ class using "llvm-g++  -emit-llvm -c "  
to get a bytecode file template.bc

- use "llvm2cpp  template.bc" to get a  template.bc.cpp  of  C++ code  
the Faust ==> LLVM IR  new backend will have to execute to produce  
the correct bytecode.

- take this template.bc.cpp code as the "constant" part of the Faust  
==> LLVM IR backend and add everything needed to produce the  
"variable" part (that one corresponding to what the real Faust plug- 
in will do)

This method should work but is a bit complex, since we have to look  
at the template.bc.cpp code, find the "entry points" (Function* or  
BadsicBlock* objects) we will have to enrich with additional code.

Is there any more common and simple method to achieve the same  
result? or any other advice?

Thanks

Stephane Letz





More information about the llvm-dev mailing list