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

Chuck Zhao czhao at eecg.toronto.edu
Tue Jul 27 07:46:22 PDT 2010


  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.


Thank you

Chuck




More information about the llvm-dev mailing list