X-Git-Url: http://git.joshuawise.com/snipe.git/blobdiff_plain/6ade8b0a3251e44b34c6bdbbd9403e36d6fd6231..1144856ba9d6018d9922c6ede7e97779a0fe6373:/trans/tree.sml diff --git a/trans/tree.sml b/trans/tree.sml index f5a92b5..d3e8c0d 100644 --- a/trans/tree.sml +++ b/trans/tree.sml @@ -18,13 +18,16 @@ sig datatype exp = CONST of Word32.word | TEMP of Temp.temp - | ARG of Blarg (* I am j4cbo *) + | ARG of Blarg * int (* I am j4cbo *) | BINOP of binop * exp * exp | UNOP of unop * exp - | CALL of Ast.ident * exp list + | CALL of Ast.ident * (exp * int) list * int + | MEMORY of exp + | ALLOC of exp and stm = - MOVE of exp * exp - | RETURN of exp + MOVE of exp * exp * int + | RETURN of exp * int + | EFFECT of exp * int | LABEL of Label.label | JUMPIFN of exp * Label.label | JUMP of Label.label @@ -52,13 +55,16 @@ struct datatype exp = CONST of Word32.word | TEMP of Temp.temp - | ARG of Blarg + | ARG of Blarg * int | BINOP of binop * exp * exp | UNOP of unop * exp - | CALL of Ast.ident * exp list + | CALL of Ast.ident * (exp * int) list * int + | MEMORY of exp + | ALLOC of exp and stm = - MOVE of exp * exp - | RETURN of exp + MOVE of exp * exp * int + | RETURN of exp * int + | EFFECT of exp * int | LABEL of Label.label | JUMPIFN of exp * Label.label | JUMP of Label.label @@ -97,18 +103,21 @@ struct fun pp_exp (CONST(x)) = Word32Signed.toString x | pp_exp (TEMP(t)) = Temp.name t - | pp_exp (ARG(n)) = "arg#"^Int.toString n + | pp_exp (ARG(n, sz)) = "arg#"^Int.toString n | pp_exp (BINOP (binop, e1, e2)) = "(" ^ pp_exp e1 ^ " " ^ pp_binop binop ^ " " ^ pp_exp e2 ^ ")" | pp_exp (UNOP (unop, e1)) = pp_unop unop ^ "(" ^ pp_exp e1 ^ ")" - | pp_exp (CALL (f, l)) = - Symbol.name f ^ "(" ^ (String.concatWith ", " (List.map pp_exp l)) ^ ")" + | pp_exp (CALL (f, l, sz)) = + Symbol.name f ^ "(" ^ (String.concatWith ", " (List.map (fn (e, _) => pp_exp e) l)) ^ ")" + | pp_exp (MEMORY exp) = "M[" ^ pp_exp exp ^ "]" + | pp_exp (ALLOC(e)) = "NEW(" ^ pp_exp e ^ ")" - fun pp_stm (MOVE (e1,e2)) = + fun pp_stm (MOVE (e1,e2, sz)) = pp_exp e1 ^ " <-- " ^ pp_exp e2 - | pp_stm (RETURN e) = + | pp_stm (RETURN (e, sz)) = "return " ^ pp_exp e + | pp_stm (EFFECT (e, sz)) = pp_exp e | pp_stm (LABEL l) = Label.name l ^ ":" | pp_stm (JUMP l) =