This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: GCC RTL <-> LLVM SSA


On Tue, Jun 22, 2010 at 2:56 PM, Basile Starynkevitch
<basile@starynkevitch.net> wrote:
> 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).

The Gimple/SSA provides a better mapping from LLVM's SSA. Is Gimple
more architect-independent than RTL? The optimizations run on LLVM's
SSA are almost target-independent. I am also only interested in the
target-independent pass in GCC for the time being.  If GCC RTL is for
lower level optimizations than Gimple, I think Gimple is a better
target.

>
> 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.

This is cool. I will look at it.

>
> 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!).

Thanks for pointing out this DragonEgg project
http://dragonegg.llvm.org/. It does the translation from Gimple to
LLVM bitcode (which means SSA in my understanding). It seems that I
need to find a translation for the other direction, or create a one.

>
> 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} ***
>
>
>



-- 
Jianzhou


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]