[LLVMdev] inline callsites whose function definitions are in different file?

Devang Patel devang.patel at gmail.com
Tue Jul 27 09:40:02 PDT 2010

On Tue, Jul 27, 2010 at 7:46 AM, Chuck Zhao <czhao at eecg.toronto.edu> wrote:
>  LLVM (2.7 release version) provides 2 implementations for inlining
> function callsites:
> - InlineSimple.cpp (-inline):               inline simple callsites
> according to its cost analysis
> - InlineAlways.cpp (-always-inline):  inline all callsites that are
> marked with "always_inline" attribute.
> They are both subclasses of Inline.cpp that assumes the function's
> definition (body) is in the same Module (file) as its callsites (that
> will be inlined).
> I am now having a situation that the functions are defined in file1.c
> (Module1) but all callsites are spread in file2, file3, ...fileN. Would
> LLVM be able to inline such callsites at compile time?
> I think the right approach is to conduct inlining at link time (via the
> LTO), but still wonder if it is possible to do it at compile time
> without heavy hacking.

At compiler time while compiling file2.c, how would compile know about
function definition in file1.c  ?

More information about the llvm-dev mailing list