On Mon, 2006-05-29 at 13:19 -0400, Stefan Teleman wrote:
> On 5/29/06, Erast Benson <[EMAIL PROTECTED]> wrote:
> > On Mon, 2006-05-29 at 12:51 -0400, Stefan Teleman wrote:
> > > On 5/29/06, Erast Benson <[EMAIL PROTECTED]> wrote:
> > > >
> > > > But I'm asking how to make Sun C compiler do what I want?
> > >
> > > The compiler is doing what you want, within the limits of it being
> > > explicitly allowed to ignore what you want. :-)
> >
> > OK. Than how to disable it? :-) I'm seeing that one could specify
> > explicit names of functions to always inline. How to make it a default
> > policy for all my inlined functions?
> 
> ISO/IEC 9899:1999:6.7.4 says:
> 
> [ ... ]
> 
> 5. A function declared with an *inline* function specifier is an
> _inline function_. The function specifier may appear more than once;
> the behavior is the same as if it appeared only once. Making a
> function an inline function suggests that calls to the function be as
> fast as possible[118]. The extent to which such suggestions are
> effective is implementation-defined[119].
> 
> 6. Any function with internal linkage can be an inline function. For a
> function with external linkage, the following restrictions apply: If a
> function is declared with an *inline* function specifier, then it
> shall also be defined in the same translation unit. If all of the
> function file scope declarations for a function in a translation unit
> include the *inline* function specifier without *extern*, then the
> definition in that translation unit is an _inline definition_. An
> inline definition does not provide an external definition for the
> function, and does not forbid an external definition in another
> translation unit. [ ... ] It is unspecified whether a call to the
> function uses the inline definition or the external definition[120].
> 
> [118] By using, for example, an altermative to the usual function call
> mechanism, such as "inline substitution". Inline substitution is not
> textual substitution, nor does it create a new function. [...]
> [119] For example, an implementation might never perform inline
> substitution, or might only perform inline substitutions to calls in
> the scope of an *inline* declaration.
> [120] Since an inline definition is distinct from the corresponding
> external definition and from any other corresponding inline
> definitions in other translation units, all corresponding objects with
> static storage duration are also distinct in each of the definition.
> 
> You can try:
> 
> - set the optimization level to -xO4 or higher
> - pass -xinline=%auto
> 
> However:
> 
>           A function is not inlined if any of the following apply
>           (no warning is issued):
>           o  Optimization is less than -xO3
>           o  The routine cannot be found
>           o  Inlining the routine does not look profitable or
>           safe to iropt
>           o  The source for the routine is not in the file being
>           compiled (however, see -xcrossfile).
> 
> --Stefan

Yes, Stefan, I read this doc and tried all these settings. Not all of my
inline functions (some of them really small like pointer casting only)
been inlined. Tried xcrossfile too, not helping much. I did comparision
with gcc-4.0.2 and noticed that GCC inlined all I wanted, as the result
I got ~20% performance gain... (x86). I'll try to come up with simple
example to show what I wanted to do later and dig into a problem a bit
further..

Thanks!

-- 
Erast

_______________________________________________
opensolaris-discuss mailing list
opensolaris-discuss@opensolaris.org

Reply via email to