[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Tinycc-devel] manually inlining functions
From: |
Vincent Lefevre |
Subject: |
Re: [Tinycc-devel] manually inlining functions |
Date: |
Sat, 1 May 2021 17:12:32 +0200 |
User-agent: |
Mutt/2.0.6+169 (acb2bdd4) vl-137001 (2021-04-28) |
On 2021-05-01 00:43:27 +0000, Kyryl Melekhin wrote:
> Yakov <exebook@gmail.com> wrote:
>
> > Kyryl you cannot inline everything because you will get code
> > explosion, often infinite code explosion when functions have a
> > circular dependency on each other. I am just talking about inlining
> > certain functions carefully chosen by a programmer.
>
> Yeah, I get that. That's why it is so hard to make such a tool.
> Because recursion is hard to decompose, so the inliner has to be
> smart enough to actually rewrite the recursive solution iteratively
> otherwise it will blow up.
In general, programmers mark functions as inline only when this
does not involve a recursion, though they are not obliged to do so.
With function-like macros, the preprocessor automatically disables
recursion. I suppose that the compiler can do the same thing with
inline functions (but it may also choose a higher recursion level).
Since tcc obviously supports function-like macros, handling recursion
for inline functions would not introduce a new difficulty.
--
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)