[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Tinycc-devel] manually inlining functions
From: |
Kyryl Melekhin |
Subject: |
Re: [Tinycc-devel] manually inlining functions |
Date: |
Sat, 01 May 2021 00:43:27 +0000 |
User-agent: |
Heirloom mailx 12.4 7/29/08 |
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. But that actually opens up a massive
opportunity for optimizations, because lets be real - recursion
sucks and there is never ever a situation where it's actually
useful for the cpu to do. And yes, the unary() function in tcc
which is recursive sucks a lot too, there is just so much
state in there that it's very difficult to understand what is
going on. Luckly I have been looking at that code for more
than a year, so my grasp got better, but if that were iterative,
I be loving it even more.
--