Re:Single-Assignment C
by guerrilla on Thursday December 26, 2019 @08:51PM
(#21888476)
It's easier for compilers to optimize. https://en.wikipedia.org/wiki/Static_single_assignment_form
[ Parent
| on HN ]
It actually is not. The compiler has no problems turning your imperative code into SSA on its own, and PHI functions are no problem for optimizers.
I guess it's just for readability and easier reasoning about the code.
Your claim is that not having to do something is not easier than doing it? Ok.
The point is that there's absolutely no difference for a compiler that uses SSA form. So it's not like it has to do something extra.
Any MFA code is trivially converted to SSA and that's pretty much the first thing your compiler will do.
So doing SSA by hand makes no real difference to the compiler unless your compiler is so trivial it doesn't start by converting its input to SSA.
Re:Single-Assignment C
by ternaryoperator on Friday December 27, 2019 @12:09AM
(#21889369)
You're not the OP of the comment, who is a compiler writer (C, C++, D). I hope he'll weigh in with his rationale.