dllaurence at dslextreme.com
Sat Jan 9 12:35:33 CST 2010
On 01/09/2010 10:00 AM, Samuel Crow wrote:
> Always inline is the closest to a preprocessor macro you can get in
> LLVM Assembly since it doesn't have a preprocessor at all.
Mine does. :-)
> ...LLVM does
> aggressive inlining for functions used only once so those instances
> don't require specification as alwaysinline.
What I'm trying to do is understand the practical use cases. Concrete
example: I have some little type accessor and conversion functions that
are typically two or three instructions long because all they really do
is manipulate tag data in the low-order bits of pointers. (I'm not
exactly innovative, am I?) While small, they are called all over the
place for boxing and unboxing language-level objects. In C they would
be explicitly inline. What is the LLVM equivalent?
My guess is the optimizer will always inline such tiny functions no
matter what as it's probably both a space and a time win, so maybe I
need a different example. Suppose they were typically five, or ten, or
twenty, or forty instructions long? Who is responsible for deciding on
the advisability of inlining? The front-end (which in this case is
actually me?)? That would be the equivalent of the C99/C++ 'inline'
compiler hint. Or in LLVM is it better not to give manual compiler
hints about inlining in most cases and let the optimizers decide?
I suppose it's a fuzzy question because I'm fishing for intended usage,
not just semantics.
More information about the LLVMdev