Tail Call Elimination

Program-Transformation.Org: The Program Transformation Wiki
A function call as the last action of function body can be optimized by overwriting the stack frame of the caller. The callee returns directly to the caller of its caller. The gain of this program optimization is the stack space that is saved and a few instructions for restoring the return address and jumping to it. It can be as simple as replacing the call and return instructions with a jump instruction. Tail recursion elimination is a special case.

-- EelcoVisser - 06 Dec 2001


CategoryOptimization