This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: -fobey-inline (was Re: gcc and inlining)
Op ma 17-03-2003, om 14:18 schreef Andreas Schwab:
> Steven Bosscher <s dot bosscher at student dot tudelft dot nl> writes:
> |> Hmm, I tried to make a point that there is no such thing as "smart
> |> enough", only "smart enough for where it's tuned to be smart". Really,
> |> I'd love to see really a smart inlining decision algorithm, but in the
> |> end a compiler will always just be guessing.
>
> When inlining is required for reason of semantics (eg. dynamic linker
> startup) you are outside the scope of the standard and always_inline is
> IMHO an appropriate answer.
>
> |> Now I'd love to be proven wrong. How would you want to make the
> |> compiler smarter, what heuristics are you thinking of here?
>
> Time moves forward, and better algorithms will be found, just like today's
> register allocators are good enough to be able to ignore the register
> keyword (although some people still think they know better).
For "register" you're absolutely right. For "inline" you are not.
Register allocation algorithms have a much better theoretical foundation
than inlining algorithms do. A register allocator does not have to
guess as much as the inliner, simply because it can be described
mathematically and because much more useful information is available by
the time you do register allocation.
Really, your "smart enough" inline algorithm is a myth. It ain't gonna
happen.
> |> Also, you ignore the point that the final decision should be left with
> |> the user. Apparently you disagree with that?
>
> always_inline gives you the control.
Yes, I suppose it does, but it's less than elegant, and it's patronizing
the user. Especially in 'C', when people use "inline" they usually mean
"inline". Again, for C++ things may be different.
Greetz
Steven