ghc sparc NCG

Bulat Ziganshin bulat.ziganshin at gmail.com
Tue Jun 13 08:20:45 EDT 2006


Hello Simon,

Tuesday, June 13, 2006, 2:18:42 PM, you wrote:

>    http://hackage.haskell.org/trac/ghc/wiki/BackEndNotes

just small note for this page:

>The code generated by GHC for a tail-recursive loop uses an explicit
>tail call for the recursion, which gcc cannot spot as a branch.

gcc can convert recursion into loop and even unroll it. my tests
showed that gcc require that THE SAME VARIABLE used in recursion/loop
in order to understand that it is indeed a loop. so, the following:

while (i>0) {
  j=i;
  i=j-1;
}

will be not considered as loop and unrolled, while the following:

a(int i) {
  if (i>0) a(i-1);
}

will be tail-recursed and then even unrolled



> Basically we want to beef up the NCG and deprecate -fvia-C.

but it still will be used for unregisterised compilation?

-- 
Best regards,
 Bulat                            mailto:Bulat.Ziganshin at gmail.com



More information about the Glasgow-haskell-users mailing list