tinycc-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Tinycc-devel] manually inlining functions


From: uso ewin
Subject: Re: [Tinycc-devel] manually inlining functions
Date: Tue, 4 May 2021 23:57:50 +0200

On Sat, May 1, 2021 at 5:35 PM Vincent Lefevre <vincent@vinc17.net> wrote:
>
> On 2021-04-30 20:50:36 -0700, Elijah Stone wrote:
> > On Sat, 1 May 2021, Yakov wrote:
> >
> > > having to write macros for performance feels so obsolete, double
> > > evaluation hiding in dark corners etc. And function calls are so
> > > expensive in tight loops.
> >
> > Calls are fairly cheap, on modern architectures.  The performance impact of
> > an inliner would be fairly marginal for tcc, compared with, say, a register
> > allocator.
>
> Inline functions have (at least) 3 advantages:
>
> 1. They eliminate the call, which is rather useful in case a call
>    to a function of a shared library, as such calls can be very
>    expensive. For very simple functions (e.g. accessing a field
>    of a structure), there would be much overhead.
>
> 2. With the inline definition, the compiler can know what the function
>    does (e.g. enabling value range propagation), so that it may be
>    able optimize the code around.
>
> 3. A call to an inline function may have specific arguments, such
>    as constant ones, so that the compiler may be able to optimize
>    the code of the instantiated function, e.g. avoiding tests and
>    eliminating dead code via constant propagation.
>
> I think that tcc could benefit from these 3 points.
>
> --
> Vincent Lefèvre <vincent@vinc17.net> - Web: <https://www.vinc17.net/>
> 100% accessible validated (X)HTML - Blog: <https://www.vinc17.net/blog/>
> Work: CR INRIA - computer arithmetic / AriC project (LIP, ENS-Lyon)
>
Tinycc handle inline function like if they were macro, so using inline
in tcc always inline functions.
The doc is outdated I think.

> _______________________________________________
> Tinycc-devel mailing list
> Tinycc-devel@nongnu.org
> https://lists.nongnu.org/mailman/listinfo/tinycc-devel



reply via email to

[Prev in Thread] Current Thread [Next in Thread]