On 2011-01-30, at 1:18 PM, chevalma@iro.umontreal.ca wrote:
It should be possible to analyze the tail recursive functions and transform them so the recursion becomes a loop in the CFG. This way we can keep the IR the same-old SSA.
That is not sufficient. Correct support for tail-calls must be dynamic. For example if you have a tail-call to g in f, and in g you have a tail-call to f (mutual recursion with tail-calls). It has to be dynamic because g might be the defined with an eval, or other dynamic method.
The bottom line is that there must be a tail-call instruction (often called "jump") to transfer control to functions without stack growth.
Marc