diff -r ff3b48da282c -r 8fc109f36b78 progs/fun_llvm.scala --- a/progs/fun_llvm.scala Mon Oct 28 13:34:03 2019 +0000 +++ b/progs/fun_llvm.scala Fri Nov 01 13:21:51 2019 +0000 @@ -106,13 +106,14 @@ aux(args, Nil) } case Sequence(e1, e2) => - CPS(e1)(y1 => CPS(e2)(y2 => k(y2))) + CPS(e1)(_ => CPS(e2)(y2 => k(y2))) case Write(e) => { val z = Fresh("tmp") CPS(e)(y => KLet(z, KWrite(y), k(KVar(z)))) } } +//initial continuation def CPSi(e: Exp) = CPS(e)(KReturn) // some testcases @@ -190,8 +191,8 @@ case KLet(x: String, v: KVal, e: KExp) => i"%$x = ${compile_val(v)}" ++ compile_exp(e) case KIf(x, e1, e2) => { - val if_br = Fresh("if_br") - val else_br = Fresh("else_br") + val if_br = Fresh("if_branch") + val else_br = Fresh("else_branch") i"br i1 %$x, label %$if_br, label %$else_br" ++ l"\n$if_br" ++ compile_exp(e1) ++ @@ -208,7 +209,7 @@ define i32 @printInt(i32 %x) { %t0 = getelementptr [4 x i8], [4 x i8]* @.str, i32 0, i32 0 - call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %x) + call i32 (i8*, ...) @printf(i8* %t0, i32 %x) ret i32 %x }