High-level Cmm code and stack allocation
Herbert Valerio Riedel
hvriedel at gmail.com
Sun Jan 5 12:48:01 UTC 2014
On 2014-01-05 at 01:32:07 +0100, Carter Schonwald wrote:
> i'm inclined to assume that its a parser error.
> instead of (v)= call fun(args...argn);, did you try v = call fun(args1...n)
> ; ?
I've looked more closely at the parser, and the relevant productions...
| 'call' expr '(' exprs0 ')' ';'
{ doCall $2 [] $4 }
| '(' formals ')' '=' 'call' expr '(' exprs0 ')' ';'
{ doCall $6 $2 $8 }
...actually require the return values to be newly declared registers,
therefore the following works:
foo()
{
W_ arg1, arg2;
arg1 = 1; arg2 = 2;
(W_ ret1, W_ ret2) = call stg_fun (arg1,arg2);
return (ret2, ret1);
}
Cheers,
hvr
More information about the ghc-devs
mailing list