X-Git-Url: http://git.joshuawise.com/snipe.git/blobdiff_plain/de034162d9af50e6bfb454f4de67213d856137c4..a83f1d602c6f50eb9ab0448a20f0ecb80fefcead:/codegen/codegen.sml diff --git a/codegen/codegen.sml b/codegen/codegen.sml index 8181905..de8fa1e 100644 --- a/codegen/codegen.sml +++ b/codegen/codegen.sml @@ -40,7 +40,7 @@ struct (* val _ = print ("s1 = " ^ Tm.sfx s1 ^ ", s2 = " ^ Tm.sfx s2 ^ ", ") *) (* val _ = print ("rs = " ^ Tm.sfx rs ^ " from " ^ TU.Print.pp_exp e1 ^ " and " ^ TU.Print.pp_exp e2 ^ "\n") *) in - i1 @ i2 @ [X.INSN (X.AL, oper (d, t))] + [X.COMMENT "binophit" ] @ i1 @ i2 @ [X.INSN (X.AL, oper (d, t)), X.COMMENT "binophit done"] end (* cmphit : X.oper -> X.exp -> X.insn list @@ -231,8 +231,8 @@ struct and condhit e1 e2 (pos, neg) = let - val t1 = X.TEMP (Temp.new ("var neq 1")) - val t2 = X.TEMP (Temp.new ("var neq 2")) + val t1 = X.TEMP (Temp.new ("var cond 1")) + val t2 = X.TEMP (Temp.new ("var cond 2")) val i1 = munch_exp t1 e1 val i2 = munch_exp t2 e2 in @@ -250,11 +250,11 @@ struct (insns, neg, pos) end | munch_cond (T.BINOP(T.NEQ, e1, e2)) = condhit e1 e2 (X.NE, X.EQ) - | munch_cond (T.BINOP(T.EQ, e1, e2)) = condhit e1 e2 (X.EQ, X.NE) - | munch_cond (T.BINOP(T.LE, e1, e2)) = condhit e1 e2 (X.LE, X.GT) - | munch_cond (T.BINOP(T.LT, e1, e2)) = condhit e1 e2 (X.LT, X.GE) - | munch_cond (T.BINOP(T.GT, e1, e2)) = condhit e1 e2 (X.GT, X.LE) - | munch_cond (T.BINOP(T.GE, e1, e2)) = condhit e1 e2 (X.GE, X.LT) + | munch_cond (T.BINOP(T.EQ, e1, e2)) = condhit e1 e2 (X.EQ, X.NE) + | munch_cond (T.BINOP(T.LE, e1, e2)) = condhit e1 e2 (X.LE, X.GT) + | munch_cond (T.BINOP(T.LT, e1, e2)) = condhit e1 e2 (X.LT, X.GE) + | munch_cond (T.BINOP(T.GT, e1, e2)) = condhit e1 e2 (X.GT, X.LE) + | munch_cond (T.BINOP(T.GE, e1, e2)) = condhit e1 e2 (X.GE, X.LT) | munch_cond (T.BINOP(T.BE, e1, e2)) = raise ErrorMsg.InternalError "memory safety not supported" @@ -269,7 +269,7 @@ struct (* munch_lval : T.exp -> X.operand * Takes an expression that has been typechecked as being a valid lvalue and a location of a datum, and then returns an instruction list to store. *) - and munch_lval (T.TEMP t) oper = [X.INSN (X.AL, X.MOV (oper, X.TEMP t))] + and munch_lval (T.TEMP t) oper = [X.INSN (X.AL, X.MOV (X.TEMP t, oper))] | munch_lval (T.MEMORY m) oper = let val t = X.TEMP (Tm.new "lv addr")