[LLVMdev] Area for improvement

Chris Lattner sabre at nondot.org
Tue Feb 22 08:18:50 PST 2005


On Tue, 22 Feb 2005, Vikram S. Adve wrote:

> On Feb 22, 2005, at 9:09 AM, Vikram S. Adve wrote:
>
>>> The only way to make preselection or lowermultidimrefs work is to 
>>> duplication all of the knowledge of how the instruction selector will 
>>> select the code (e.g. the advice about allowing constant indices to be 
>>> grouped together).
>> 
>> This is why you need a separate, low-level optimization framework - the 
>> kind you were describing.
>
> Incidentally, for those interested in the big picture, the issues raised by 
> Jeff and Chris are a fundamental trade-off between the so-called "low-level" 
> model of compilation (like GCC and I believe IBM's  XL compiler family), and 
> the mid-level model we chose for LLVM.  In GCC and other low-level systems, 
> code is lowered to expose all the detailed operations needed on a specific 
> target early in the compilation process, so that they are all exposed to 
> optimization.  Of course, doing this in a single IR capable of supporting 
> multiple targets can lead to horrendously complex representations.  The 
> mid-level model does not expose architecture-specific operations in the IR 
> but this means that a separate back-end optimization framework is needed, in 
> addition to the primary mid-level, architecture-neutral, framework.
>
> My point is that this is a fundamental trade-off made very early on in the 
> LLVM design, and I think it was the right one.  It greatly simplifies the 
> higher-level optimizations, which are by far the most complex, and can even 
> make more optimizations possible (if the mid-level IR is able to expose types 
> and reference patterns that are obscured in the low-level IR).

I agree completely.  The important part is to decide what makes the 
most sense to do on LLVM and what makes the most sense to do in the 
backend.  Unfortunately, it is too easy just to assume that everything 
should be done on LLVM, because (like you say above), LLVM is not meant to 
be the host for target-specific stuff. :)

-Chris

-- 
http://nondot.org/sabre/
http://llvm.cs.uiuc.edu/




More information about the llvm-dev mailing list