[LLVMdev] Un-inlining functions?

Patrick Meredith pmeredit at uiuc.edu
Tue Aug 7 12:04:41 PDT 2007


I found a book on this (http://www.amazon.com/Automatic-Algorithm- 
Recognition-Replacement-Optimization/dp/0262133687) on Amazon.
Last I heard this was considered an intractable problem in the  
general case... but ad hoc solutions for specific functions
(like memcpy) are possible.  That book looks fairly promising.

On Aug 7, 2007, at 10:32 AM, Nikhil A. Patil wrote:

> Hi,
>
> This is really more a general compiler question, not so specific to  
> LLVM.
>
> Given a set of pre-defined "primitive" functions, is there a way to
> un-inline function calls out of a function? (This is different from
> "extracting" functions because you are not allowed to create a new
> function, but only to use existing functions in the pool. These
> "primitive" functions are relatively simple.) One obvious application
> for this would be to extract llvm.instrinsics, memcpy() et al from
> equivalent loops.
>
> e.g:
> Original Function input to the un-inlining pass:
>     int foo(int a, int b)
>     {
>         return mem[a] & mem[b];
>     }
>
> Pool of "primitive" functions:
>     int get_mem(int a)
>     {
>         return mem[a];
>     }
>
> Output of un-inlining pass:
>     int foo(int a, int b)
>     {
>         return get_mem(a) & get_mem(b);
>     }
>
> I don't suppose LLVM has a pass for this yet; however, has anybody
> seen this done before? Can anybody point me to any existing work on
> these lines?
>
> Thanks!
> Nikhil
> _______________________________________________
> LLVM Developers mailing list
> LLVMdev at cs.uiuc.edu         http://llvm.cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev




More information about the llvm-dev mailing list