[LLVMdev] Newbie Enquiry

Vikram S. Adve vadve at cs.uiuc.edu
Wed Aug 18 18:17:52 PDT 2004


On Aug 18, 2004, at 5:13 PM, Peter Ashford wrote:
> Hi There,
>
> I've just started reading about LLVM and I just wanted to make sure 
> that it can do what I was hoping it could do.  Am I correct in 
> assuming that I could use LLVM as a backend for a compiler, emiting 
> LLVM byte codes which could either be natively compiled (Sparc and 
> x86) or byte code interpretted / JITed??
>

Now, PowerPC as well!


and at 5:48 PM, Peter Ashford wrote:
>> Not at all, there's only one version of LLVM IR, but it can appear in
>> binary bytecode or textual form (human-readable).  They have a
>> one-to-one correlation.
>>
>> There is an assembler (llvm-as) and disassembler (llvm-dis) for
>> translating between the two formats.
>>
>>
> Ah, great!  That does mean that LLVM does what I was hoping for.  
> Thanks for the info :o)
>


That's good :-) because fundamentally, this *is* what LLVM was designed 
for -- to work as a common back-end with some specific capabilities.  
The IR will not directly represent most high-level language features 
but it should be possible to efficiently implement them and, in most 
cases, implement them cleanly enough to allow generic LLVM 
optimizations to produce efficient code for them as well.  By making 
the IR persistent and simple, it should be possible to apply the 
optimizations at multiple stages, from development time through 
production runs.

Of course, that's the theory :)  If you find cases where the IR doesn't 
allow some optimizations you want or would lead to inefficient code due 
to design limitations (not simply missing analysis or optimization 
passes), please let us know.

--Vikram
http://www.cs.uiuc.edu/~vadve
http://llvm.cs.uiuc.edu/







More information about the llvm-dev mailing list