From 90125e9571b5281bb65c194211fb0c1b948e3393 Mon Sep 17 00:00:00 2001 From: "Juan J. Martinez" Date: Sun, 25 Sep 2022 18:28:57 +0100 Subject: Cases for plus/minus --- src/Micro/Asm/Sdcc.hs | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'src/Micro') diff --git a/src/Micro/Asm/Sdcc.hs b/src/Micro/Asm/Sdcc.hs index 8b7feb7..238fe2e 100644 --- a/src/Micro/Asm/Sdcc.hs +++ b/src/Micro/Asm/Sdcc.hs @@ -64,14 +64,12 @@ emit x = (A.BinOp A.Div _ (A.Num a _) (A.Num b _)) -> o {oCode = [show a ++ "/" ++ show b]} (A.BinOp A.Plus _ a (A.Num 1 _)) -> o {oCode = oCode (emit a) ++ ["\tinc a"]} - (A.BinOp A.Plus _ a@(A.Variable _ _) (A.Num v _)) -> + (A.BinOp A.Plus _ a (A.Num v _)) -> o {oCode = oCode (emit a) ++ ["\tadd #" ++ show v]} (A.BinOp A.Plus _ a b) -> o {oCode = oCode (emit a) ++ ["\tld c, a"] ++ oCode (emit b) ++ ["\tadd c"]} (A.BinOp A.Minus _ a (A.Num 1 _)) -> o {oCode = oCode (emit a) ++ ["\tdec a"]} - (A.BinOp A.Minus _ a@(A.Variable _ _) (A.Num v _)) -> - o {oCode = oCode (emit a) ++ ["\tsub #" ++ show v]} (A.BinOp A.Minus _ a (A.Num v _)) -> o {oCode = oCode (emit a) ++ ["\tsub #" ++ show v]} (A.BinOp A.Minus _ a b) -> -- cgit v1.2.3