X-Git-Url: http://git.joshuawise.com/snipe.git/blobdiff_plain/5c79bb689ab446551bc7ec4497e6c9b75582837e..a644da892dbd55a7be1aed029dafebe28d26d27e:/trans/treeutils.sml?ds=sidebyside diff --git a/trans/treeutils.sml b/trans/treeutils.sml index b5217b0..a15b1a3 100644 --- a/trans/treeutils.sml +++ b/trans/treeutils.sml @@ -28,12 +28,13 @@ struct | effect (T.UNOP (_, a)) = effect a | effect (T.MEMORY _) = true | effect (T.ALLOC _) = true + | effect (T.STRING _) = false | effect (T.COND (a, b, c)) = (effect a) orelse (effect b) orelse (effect c) | effect (T.STMVAR (sl, e)) = true (* Has to be, to be safe <--- jwise is an assclown, he was too lazy to write a effect_stm *) | effect (T.NULLPTR) = false fun effect_stm (T.MOVE (e1,e2)) = effect e1 orelse effect e2 - | effect_stm (T.RETURN (e1,e2)) = effect e1 orelse effect e1 + | effect_stm (T.RETURN (e1)) = effect e1 | effect_stm (T.EFFECT e) = effect e | effect_stm (T.JUMPIFN (e,_)) = effect e | effect_stm _ = false @@ -68,22 +69,23 @@ struct fun pp_exp (T.CONST(x)) = Word32Signed.toString x | pp_exp (T.TEMP(t)) = Temp.name t - | pp_exp (T.ARG(n, sz)) = "arg#"^Int.toString n + | pp_exp (T.ARG(n)) = "arg#"^Int.toString n | pp_exp (T.BINOP (binop, e1, e2)) = "(" ^ pp_exp e1 ^ " " ^ pp_binop binop ^ " " ^ pp_exp e2 ^ ")" | pp_exp (T.UNOP (unop, e1)) = pp_unop unop ^ "(" ^ pp_exp e1 ^ ")" - | pp_exp (T.CALL (f, l, sz)) = - Symbol.name f ^ "(" ^ (String.concatWith ", " (List.map (fn (e, _) => pp_exp e) l)) ^ ")" - | pp_exp (T.MEMORY (exp, sz)) = "M(" ^ Temp.sfx sz ^ ")[" ^ pp_exp exp ^ "]" + | pp_exp (T.CALL (f, l)) = + Symbol.name f ^ "(" ^ (String.concatWith ", " (List.map (fn e => pp_exp e) l)) ^ ")" + | pp_exp (T.MEMORY (exp)) = "M[" ^ pp_exp exp ^ "]" | pp_exp (T.ALLOC(e)) = "NEW(" ^ pp_exp e ^ ")" + | pp_exp (T.STRING(s)) = "STRING(" ^ (Stringref.name s) ^ ")" | pp_exp (T.COND(c,e1,e2)) = "(" ^ pp_exp c ^ ") ? (" ^ pp_exp e1 ^ ") : (" ^ pp_exp e2 ^ ")" | pp_exp (T.STMVAR(sl,v)) = "({" ^ (foldr (fn (st,s) => (pp_stm st) ^ "; " ^ s) "" sl) ^ (pp_exp v) ^ "})" | pp_exp (T.NULLPTR) = "NULL" and pp_stm (T.MOVE (e1,e2)) = pp_exp e1 ^ " <-- " ^ pp_exp e2 - | pp_stm (T.RETURN (e, sz)) = + | pp_stm (T.RETURN (e)) = "return " ^ pp_exp e | pp_stm (T.EFFECT e) = pp_exp e | pp_stm (T.LABEL l) =