[<<][meta][>>][..]
Mon Dec 12 21:45:11 EST 2011
Compiling toplevel functions
Next error:
*Main> c $ term $ compileLoopTop f
*** Exception: statement: Lambda [Var (Type f []) "a0",Var (Type f [()]) "a1",Var (Type f [()]) "a2",Var (Type i []) "a3"] (LetRec [(Var (Type v []) "fun4",Lambda [Var (Type f []) "a5",Var (Type i []) "a6"] (Let (Var (Type f []) "r7") (Get (Var (Type f [()]) "a1") (Ref (Var (Type i []) "a6"))) (Let (Var (Type f []) "r8") (Op (Type f []) "add" [Ref (Var (Type f []) "a5"),Ref (Var (Type f []) "r7")]) (Begin (Set (Var (Type f [()]) "a2") (Ref (Var (Type i []) "a6")) (Ref (Var (Type f []) "r8"))) (Let (Var (Type *** Exception: Term.hs:(33,3)-(35,19): Non-exhaustive patterns in function show
There's some missing code to infer the return type of the function,
but basically here's what's working:
t9 = code $ termTopdef $ Topdef (Var (Type AInt []) "fun") t8
The array pointers are properly inferred.
*Main> t9
int fun(float a0, float * a1, float * a2, int a3)
{
{
float fun4_0;
int fun4_1;
{
fun4_0 = a0;
fun4_1 = 0;
goto fun4;
}
fun4:
{
const float a5 = fun4_0;
const int a6 = fun4_1;
const float r7 = *add(a1, a6);
const float r8 = add(a5, r7);
*add(a2, a6) = r8;
const int r9 = lt(a6, a3);
if (r9)
{
const int r10 = add(a6, 1);
fun4_0 = r8;
fun4_1 = r10;
goto fun4;
}
else
{
return 0;
}
}
}
}
Next:
- the state load/store
- return type infer
[Reply][About]
[<<][meta][>>][..]