[LLVMdev] Parametric polymorphism

Gordon Henriksen gordonhenriksen at me.com
Wed Feb 18 12:27:37 PST 2009


On 2009-02-18, at 14:53, DeLesley Hutchins wrote:

> On 2009-02-18, at 08:06, Gordon Henriksen wrote:
>
>> Still, there are a large number of potential foibles here. For  
>> instance, passing an argument can require platform-specific  
>> contortions to conform to the platform ABI...
>
> Are those contortions done by the native code generator back-end, or  
> are they done when the C compiler generates llvm IR?  I'm assuming  
> it's done by the back-end, because it would be bad if the C compiler  
> had to generate different IR for every platform.

It's done by the front-end. There are a variety of attributes and  
mechanisms which are used to convolute data and marshall it through  
call sites in an ABI-conformant manner.

> I want llvm to do the specialization, because specialization is  
> inextricably tied to similar optimizations, like inlining and  
> partial evaluation.  Doing it within llvm has many advantages, such  
> as JIT support and link-time optimization.

These are IR-level optimizations, which LLVM does not magically do of  
its own accord. If LLVM transparently performs specialization, then no  
post-specialization IR optimizations can be performed.

— Gordon





More information about the llvm-dev mailing list