3 ms·
I used a compiler 30 years ago for an embedded target that didn't support recursion. There was a tradeoff. By nixing recursion the compiler could perform varia
by Gibbon1 5y ago
I used a compiler 30 years ago for an embedded target that didn't support recursion.
There was a tradeoff. By nixing recursion the compiler could perform variable folding optimizations that would be impossible with recursion. That's because without recursion the call tree is an acyclic graph. The result is variables are held in registers and a tiny scratchpad instead of being pushed on a stack.
- zozbot234 5y ago> There was a tradeoff. By nixing recursion the compiler could perform variable folding optimizations that would be impossible with recursion. I don't think this is a real tradeoff. Your optimization clearly depends on whole-program compilation anyway, so programs that do not involve non-tail recursion can still be optimized as such.