[m-dev.] Mutually recursive tailcalls in hlc.

Mark Brown mark at mercurylang.org
Sat Nov 7 06:06:21 AEDT 2015

On Fri, Nov 6, 2015 at 11:37 AM, Paul Bone <paul at bone.id.au> wrote:
> I've transformed it to this:
> /* Struct is used to represent arguments for recursive calls */
> typedef struct {
>   MR_Float Nr;
>   MR_Float Ni;
>   MR_Float Cr;
>   MR_Float Ci;
>   MR_Integer MaxIters;
>   MR_Integer Iters_0;
>   MR_Integer * Iters;
> } escape_data;

If all the functions in the SCC take something like this as an
argument, and return void, would gcc already make the calls tail
recursive? Come to think of it, could you meet gcc's criteria by just
padding out the functions in the SCC so they all have the same number
of arguments?


More information about the developers mailing list