* doc/sdccman.lyx, src/SDCCmain.c, src/SDCCglobal.h, src/ds390/gen.c,
[fw/sdcc] / src / mcs51 / peeph.def
index e0ea01950bc2b68fd0e8b3ddf6cbae2cc6453525..0cb1d8dac07f49fd8792d4d3aad4dc9e0fc8a196 100644 (file)
@@ -1483,15 +1483,15 @@ replace {
        mov     %1,a
 } if notVolatile %1
 
-replace {
-// acc being incremented might cause problems
-       mov     %1,a
-       inc     %1
-} by {
-       ;       Peephole 185    changed order of increment (acc incremented also!)
-       inc     a
-       mov     %1,a
-} if notVolatile %1
+//replace {
+// acc being incremented might cause problems with register tracking
+//     mov     %1,a
+//     inc     %1
+//} by {
+//     ;       Peephole 185    changed order of increment (acc incremented also!)
+//     inc     a
+//     mov     %1,a
+//} if notVolatile %1
 
 // char indexed access to: long code table[] = {4,3,2,1};
 replace restart {
@@ -1690,15 +1690,26 @@ replace {
        ;       Peephole 191    removed redundant mov
 } if notVolatile %1
 
+// applies to f.e. regression/ports/mcs51/support.c
 replace {
        mov     r%1,a
        mov     @r%2,ar%1
 } by {
        mov     r%1,a
-       ;       Peephole 192    used a instead of ar%1 as source
+       ;       Peephole 192.a  used a instead of ar%1 as source
        mov     @r%2,a
 }
 
+// applies to f.e. printf_large.c
+replace {
+       mov     ar%1,@r%2
+       mov     a,r%1
+} by {
+       ;       Peephole 192.b  used a instead of ar%1 as destination
+       mov     a,@r%2
+       mov     r%1,a
+}
+
 replace {
        jnz     %3
        mov     a,%4
@@ -3712,39 +3723,6 @@ replace {
        mov     r%3,a
 }
 
-// applies to: void test( char c ) { if( c ) func1(); else func2(); }
-replace {
-       lcall   %1
-       ret
-} by {
-       ;       Peephole 253.a  replaced lcall/ret with ljmp
-       ljmp    %1
-}
-
-// applies to: void test( char c ) { if( c ) func1(); else func2(); }
-replace {
-       lcall   %1
-%2:
-       ret
-} by {
-       ;       Peephole 253.b  replaced lcall/ret with ljmp
-       ljmp    %1
-       ;
-} if labelRefCount %2 0
-
-// applies to f.e. scott-bool1.c
-replace {
-       lcall   %1
-%2:
-       ret
-} by {
-       ;       Peephole 253.c  replaced lcall with ljmp
-       ljmp    %1
-%2:
-       ret
-}
-
-
 // applies to f.e. funptrs.c
 // saves one byte if %1 is a register or @register
 replace {
@@ -4559,7 +4537,7 @@ replace {
 } by {
        ;       Peephole 263.a  optimized loading const
        mov     %1,#(%2 + 3)
-}
+} if notVolatile(%1)
 
 replace {
        mov     %1,#%2
@@ -4568,7 +4546,7 @@ replace {
 } by {
        ;       Peephole 263.b  optimized loading const
        mov     %1,#(%2 + 2)
-}
+} if notVolatile(%1)
 
 replace {
        mov     %1,#%2
@@ -4576,7 +4554,7 @@ replace {
 } by {
        ;       Peephole 263.c  optimized loading const
        mov     %1,#(%2 + 1)
-}
+} if notVolatile(%1)
 
 
 replace {
@@ -4605,9 +4583,42 @@ replace {
 } if notVolatile(%2), deadMove(%1)
 
 
+// applies to: void test( char c ) { if( c ) func1(); else func2(); }
+replace {
+       lcall   %1
+       ret
+} by {
+       ;       Peephole 400.a  replaced lcall/ret with ljmp
+       ljmp    %1
+}
+
+// applies to: void test( char c ) { if( c ) func1(); else func2(); }
+replace {
+       lcall   %1
+%2:
+       ret
+} by {
+       ;       Peephole 400.b  replaced lcall/ret with ljmp
+       ljmp    %1
+       ;
+} if labelRefCount %2 0
+
+// applies to f.e. scott-bool1.c
+replace {
+       lcall   %1
+%2:
+       ret
+} by {
+       ;       Peephole 400.c  replaced lcall with ljmp
+       ljmp    %1
+%2:
+       ret
+}
+
+
 // should be one of the last peepholes
 replace{
 %1:
 } by {
-       ;       Peephole 400    removed redundant label %1
+       ;       Peephole 500    removed redundant label %1
 } if labelRefCount(%1 0)