[LLVMdev] Best intermediate form to...

Nick Lewycky nicholas at mxc.ca
Fri Apr 30 23:11:32 PDT 2010


nonpoly wrote:
>
> Hello Everyone!
>     New to the forums, so hopefully I'm not a nuisance.  I just wanted to
> know where to go (since I heard there were about 5 different intermediate
> forms for llvm) to find the highest level intermediate form of llvm.

I assume you're referring to this comment:

   http://lwn.net/Articles/383707/

LLVM has one major IR that we mean when we say "the IR", and that's the 
one described by the LangRef you linked to.

As for the having five different ones, it really comes down to what you 
consider an IR. Many passes will to build up data structures on the side 
in order to facilitate their optimizations. At what point do those cross 
the line from being data to being another intermediate representation? I 
would argue that a good test is whether the intention is whether you 
lower from one to the next. For example, gcc lowers from GENERIC to 
GIMPLE and never looks back, Open64 lower VHL to HL to ML to LL to VLL 
the same way. The SCEV format at least isn't like that, but there is at 
least one lowering step from the IR to the DAG/MachineInsts that 
machine-specific CodeGen uses. MCInst may not be an IR on the grounds 
that it's not intermediate, it's just a direct representation of 
assembly instructions.

   I want
> to be able to get as much information from a front-end as possible.  Mainly
> I need to find out dependencies and control flows, amongst a few other
> things.  So far I've seen http://llvm.org/docs/LangRef.html which might be
> what I'm looking for, but I just wanted to make sure.

Yes.

>     Also I heard that there's something that can convert GCCs GIMPLE to llvm
> IR, which I looked up and I believe is llvm-gcc, but again, I want to make
> sure that's it.  Also, is there a plugin that converts llvm IR to GIMPLE, or
> is there a project currently working on it?

Yes, there's llvm-gcc which is a modified gcc 4.2. It's getting less 
attention as more work is done on clang. There's also the plugin you 
mentioned, dragonegg.llvm.org.

Nick



More information about the llvm-dev mailing list