-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1
On 05/06/11 04:44, Zdenek Dvorak wrote:
> Hi,
>
> when accumulator transformation is performed on a function like
>
> foo(a)
> {
> if (a > 0)
> return 1 + foo (a - 1)
>
> return bla();
> }
>
> this becomes
>
> foo(a)
> {
> int tmp = 0;
>
On Fri, May 6, 2011 at 12:44 PM, Zdenek Dvorak wrote:
> Hi,
>
> when accumulator transformation is performed on a function like
>
> foo(a)
> {
> if (a > 0)
> return 1 + foo (a - 1)
>
> return bla();
> }
>
> this becomes
>
> foo(a)
> {
> int tmp = 0;
>
> while (a > 0)
> tm = 1 + tmp;
>
>
Hi,
when accumulator transformation is performed on a function like
foo(a)
{
if (a > 0)
return 1 + foo (a - 1)
return bla();
}
this becomes
foo(a)
{
int tmp = 0;
while (a > 0)
tm = 1 + tmp;
return tmp + bla();
}
Before, bla was a tail-call, but after the optimization, it i