--- src/mcs51/gen.c Mon Jan 26 07:32:40 2004 +++ src/mcs51/gen.c Sat Jan 31 17:39:37 2004 @@ -3113,6 +3113,14 @@ return TRUE; } + if (icount == 1) + { + MOVA (aopGet (AOP (IC_LEFT (ic)), 0, FALSE, FALSE)); + emitcode ("inc", "a"); + aopPut (AOP (IC_RESULT (ic)), "a", 0, isOperandVolatile (IC_RESULT (ic), FALSE)); + return TRUE; + } + return FALSE; } @@ -3528,6 +3536,14 @@ return TRUE; } + if (icount == 1) + { + MOVA (aopGet (AOP (IC_LEFT (ic)), 0, FALSE, FALSE)); + emitcode ("dec", "a"); + aopPut (AOP (IC_RESULT (ic)), "a", 0, isOperandVolatile (IC_RESULT (ic), FALSE)); + return TRUE; + } + return FALSE; } --- src/mcs51/peeph.def 2004-02-02 09:31:38.000000000 +0300 +++ src/mcs51/peeph.def 2004-02-02 11:22:14.000000000 +0300 @@ -139,12 +139,22 @@ add a,#0x01 mov r%1,a } by { - ; Peephole 104 optimized increment (acc not set to r%1, flags undefined) + ; Peephole 104.a optimized increment (acc not set to r%1, flags undefined) mov r%1,bp inc r%1 } replace { + mov %1,%3 + mov %3,%2 + add %3,%1 +} by { + ; Peephole 104.b optimized increment + mov %1,%3 + add %3,%2 +} + +replace { mov %1,a mov a,%1 } by { @@ -2075,7 +2085,7 @@ // 14 rules by Fiorenzo D. Ramaglia -replace { +replace restart { add a,ar%1 } by { ; Peephole 236.a used r%1 instead of ar%1