On Sat, May 1, 2021 at 5:35 PM Vincent Lefevre <[email protected]> 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 <[email protected]> - 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
> [email protected]
> https://lists.nongnu.org/mailman/listinfo/tinycc-devel

_______________________________________________
Tinycc-devel mailing list
[email protected]
https://lists.nongnu.org/mailman/listinfo/tinycc-devel

Reply via email to