On Tue, 2010-06-22 at 14:47 -0400, Jianzhou Zhao wrote: > Hi, > > Is there any project for translations between GCC RTL and LLVM SSA, > RTL -> SSA and SSA -> RTL? I am working on a project that may reuse > existing optimization passes from LLVM and GCC. So I was wondering if > there is a way to switch between their IR's.
I am not sure RTL is the best intermediate representation of GCC to translate to or even from LLVM SSA (which I confess not knowing much). I would rather recommend using Gimple, see http://gcc.gnu.org/onlinedocs/gccint/GIMPLE.html for more, or Gimple/SSA, inside GCC, as the intermediate representation in GCC to handle (i.e. to translate from or to LLVM IR). I am not sure that conversion between LLVM & GCC internal representations is an easy task. As usual, the evil is in the details (the source location -in the compiled *.c file- is probably very differently represented in GCC & in LLVM). To manipulate GIMPLE easily, you could be tempted to use the MELT plugin or branch, see http://gcc.gnu.org/wiki/MELT for more. MELT is a lispy domain specific language offering notably Gimple pattern matching, & this precise feature of MELT will help you a lot coding a Gimple to LLVM/SSA converter if you wanted to do that. However, a DraggonEgg plugin exist which precisely do that GCC -> LLVM conversion, according to my incomplete understanding (or perhaps DraggonEgg convert Gimple to LLVM *front-end* but not middle-end representation? I don't know!). You could ask me more (e.g. here) about MELT. I am its main author. Regards. -- Basile STARYNKEVITCH http://starynkevitch.net/Basile/ email: basile<at>starynkevitch<dot>net mobile: +33 6 8501 2359 8, rue de la Faiencerie, 92340 Bourg La Reine, France *** opinions {are only mines, sont seulement les miennes} ***