[LLVMdev] Inlining in LLVM
dpatel at apple.com
Mon Oct 25 11:22:24 CDT 2010
On Oct 24, 2010, at 10:23 AM, J Nelson Amaral wrote:
> I am only superficially familiar with LLVM structure.
> What I am trying to find out is if functions that have a single invocation are still found in the code during the compilation.
> In Open64 and other compilers, there is an early inlining pass that inlines all procedures that have a single invocation site. The reasoning is that if there is a single call to a procedure, then there is not downside to inlining it.
There is not one but it is easy to write. LLVM inliner implementation is modular. It is easy to add new inliner based on your home grown heuristics. InlineSimple is standard inliner tuned for the needs of general purpose optimizations. It can be run multiple times. InlineAlways is a very simple instance of special inliner where it only inlines functions that are marked as "always_inline". It would be very simple to write another special inliner for you needs. All you need to do is identify functions that have single call site. See InlineAlways.cpp for an example of a special inliner.
> Does LLVM usually does that? Or would that be left to whatever front-end is being used?
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the LLVMdev