[LLVMdev] Un-inlining functions?

Nikhil A. Patil patil.nikhil at gmail.com
Tue Aug 7 08:32:42 PDT 2007


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



More information about the llvm-dev mailing list