* src/avr/gen.c (aopop),
[fw/sdcc] / src / mcs51 / peeph.def
index d4bf76ca16cd96bb9d3895c95a650e6c7c84eaf8..e0aed8b39b97174867b308a546b1476aa1295a64 100644 (file)
@@ -286,7 +286,7 @@ replace {
 } by {
        ;       Peephole 107    removed redundant ljmp
 %1:
-} labelRefCountChange(%1 -1)
+} if labelRefCountChange(%1 -1)
 
 replace {
        jc      %1
@@ -402,7 +402,7 @@ replace {
        ;       Peephole 115.b  jump optimization
        jz      %3
 %2:
-} labelRefCountChange(%2 -1)
+} if labelRefCountChange(%2 -1)
 
 replace {
        clr     a
@@ -684,7 +684,7 @@ replace {
        mov     a,%2
        add     a,#0xff - %1
        mov     %3,c
-}
+} if operandsLiteral(%1)
 
 replace {
        clr     c
@@ -696,7 +696,7 @@ replace {
        mov     a,%2
        add     a,#0xff - %1
        jnc     %5
-}
+} if operandsLiteral(%1)
 
 replace {
        clr     c
@@ -708,7 +708,7 @@ replace {
        mov     a,%2
        add     a,#0xff - %1
        jc      %5
-}
+} if operandsLiteral(%1)
 
 replace {
        clr     c
@@ -720,7 +720,7 @@ replace {
        mov     a,#0x100 - %2
        add     a,%1
        mov     %3,c
-} if operandsNotRelated('0x00' %2)
+} if operandsNotRelated('0x00' %2), operandsLiteral(%2)
 
 replace {
        clr     c
@@ -732,7 +732,7 @@ replace {
        mov     a,#0x100 - %2
        add     a,%1
        jc      %5
-} if operandsNotRelated('0x00' %2)
+} if operandsNotRelated('0x00' %2), operandsLiteral(%2)
 
 replace {
        clr     c
@@ -744,7 +744,7 @@ replace {
        mov     a,#0x100 - %2
        add     a,%1
        jnc     %5
-} if operandsNotRelated('0x00' %2)
+} if operandsNotRelated('0x00' %2), operandsLiteral(%2)
 
 
 replace {
@@ -1063,7 +1063,7 @@ replace {
        ;       Peephole 160.a  removed sjmp by inverse jump logic
        jc      %2
 %1:
-} labelRefCountChange(%1 -1)
+} if labelRefCountChange(%1 -1)
 
 replace {
        jc      %1
@@ -1073,7 +1073,7 @@ replace {
        ;       Peephole 160.b  removed sjmp by inverse jump logic
        jnc     %2
 %1:
-} labelRefCountChange(%1 -1)
+} if labelRefCountChange(%1 -1)
 
 replace {
        jnz     %1
@@ -1083,7 +1083,7 @@ replace {
        ;       Peephole 160.c  removed sjmp by inverse jump logic
        jz      %2
 %1:
-} labelRefCountChange(%1 -1)
+} if labelRefCountChange(%1 -1)
 
 replace {
        jz      %1
@@ -1093,7 +1093,7 @@ replace {
        ;       Peephole 160.d  removed sjmp by inverse jump logic
        jnz     %2
 %1:
-} labelRefCountChange(%1 -1)
+} if labelRefCountChange(%1 -1)
 
 replace {
        jnb     %3,%1
@@ -1103,7 +1103,7 @@ replace {
        ;       Peephole 160.e  removed sjmp by inverse jump logic
        jb      %3,%2
 %1:
-} labelRefCountChange(%1 -1)
+} if labelRefCountChange(%1 -1)
 
 replace {
        jb      %3,%1
@@ -1113,7 +1113,7 @@ replace {
        ;       Peephole 160.f  removed sjmp by inverse jump logic
        jnb     %3,%2
 %1:
-} labelRefCountChange(%1 -1)
+} if labelRefCountChange(%1 -1)
 
 replace {
        mov     %1,%2
@@ -1142,7 +1142,7 @@ replace {
        ;       Peephole 168    jump optimization
        jb      %1,%3
 %2:
-} labelRefCountChange(%2 -1)
+} if labelRefCountChange(%2 -1)
 
 replace {
        jb      %1,%2
@@ -1152,7 +1152,7 @@ replace {
        ;       Peephole 169    jump optimization
        jnb     %1,%3
 %2:
-} labelRefCountChange(%2 -1)
+} if labelRefCountChange(%2 -1)
 
 replace {
        clr     a
@@ -1536,20 +1536,21 @@ replace {
        inc     dptr
 }
 
-// char indexed access to: char code table[] = {4,3,2,1};
-replace {
-       add     a,#%1
-       mov     dpl,a
-       clr     a
-       addc    a,#(%1 >> 8)
-       mov     dph,a
-       clr     a
-       movc    a,@a+dptr
-} by {
-       ;       Peephole 186.d  optimized movc sequence
-       mov     dptr,#%1
-       movc    a,@a+dptr
-}
+// disabled due to bug #1434401
+//// char indexed access to: char code table[] = {4,3,2,1};
+//replace {
+//     add     a,#%1
+//     mov     dpl,a
+//     clr     a
+//     addc    a,#(%1 >> 8)
+//     mov     dph,a
+//     clr     a
+//     movc    a,@a+dptr
+//} by {
+//     ;       Peephole 186.d  optimized movc sequence
+//     mov     dptr,#%1
+//     movc    a,@a+dptr
+//}
 
 // char indexed access to: int code table[] = {4,3,2,1};
 replace {
@@ -1893,7 +1894,7 @@ replace {
 } by {
        ;       Peephole 200.a  removed redundant sjmp
 %1:
-} labelRefCountChange(%1 -1)
+} if labelRefCountChange(%1 -1)
 
 replace {
        sjmp    %1
@@ -1903,7 +1904,7 @@ replace {
        ;       Peephole 200.b  removed redundant sjmp
 %2:
 %1:
-} labelRefCountChange(%1 -1)
+} if labelRefCountChange(%1 -1)
 
 replace {
        push    acc
@@ -2211,6 +2212,18 @@ replace {
        ;       Peephole 225    removed redundant move to acc
 } if notVolatile %1
 
+replace {
+       clr     a
+       movx    @%1,a
+       inc     %1
+       clr     a
+} by {
+       clr     a
+       movx    @%1,a
+       inc     %1
+       ;       Peephole 226.a  removed unnecessary clr
+}
+
 replace {
        clr     a
        movx    @%1,a
@@ -2224,7 +2237,7 @@ replace {
        inc     %1
        movx    @%1,a
        inc     %1
-       ;       Peephole 226    removed unnecessary clr
+       ;       Peephole 226.b  removed unnecessary clr
 }
 
 replace {
@@ -2482,7 +2495,7 @@ replace {
        mov     %3,%4
 %1:
        ret
-} labelRefCountChange(%1 -1)
+} if labelRefCountChange(%1 -1)
 
 replace {
        sjmp    %1
@@ -2501,7 +2514,7 @@ replace {
        mov     dph,%6
 %1:
        ret
-} labelRefCountChange(%1 -1)
+} if labelRefCountChange(%1 -1)
 
 // applies to f.e. device/lib/log10f.c
 replace {
@@ -2623,7 +2636,7 @@ replace {
        inc     a
 %0:
 %1:
-} labelRefCountChange(%1 -1)
+} if labelRefCountChange(%1 -1)
 
 // applies to generic pointer compare
 replace {
@@ -2644,7 +2657,7 @@ replace {
        inc     a
 %0:
 %1:
-} labelRefCountChange(%1 -1)
+} if labelRefCountChange(%1 -1)
 
 // applies to f.e. time.c
 replace {
@@ -2663,7 +2676,7 @@ replace {
        inc     a
 %0:
 %1:
-} labelRefCountChange(%1 -1)
+} if labelRefCountChange(%1 -1)
 
 // applies to f.e. malloc.c
 replace {
@@ -2680,7 +2693,7 @@ replace {
        inc     a
 %0:
 %1:
-} labelRefCountChange(%1 -1)
+} if labelRefCountChange(%1 -1)
 
 // applies to f.e. j = (k!=0x1000);
 // with volatile idata long k;
@@ -2710,7 +2723,7 @@ replace {
        inc     a
 %1:
 %2:
-} labelRefCountChange(%2 -1)
+} if labelRefCountChange(%2 -1)
 
 // applies to f.e. j = (p!=NULL);
 // with volatile idata char *p;
@@ -2736,7 +2749,7 @@ replace {
        inc     a
 %1:
 %2:
-} labelRefCountChange(%2 -1)
+} if labelRefCountChange(%2 -1)
 
 // applies to f.e. j = (k!=0x1000);
 // with volatile idata int k;
@@ -2758,7 +2771,7 @@ replace {
        inc     a
 %1:
 %2:
-} labelRefCountChange(%2 -1)
+} if labelRefCountChange(%2 -1)
 
 // applies to f.e. vprintf.asm (--stack-auto)
 replace {
@@ -2775,7 +2788,7 @@ replace {
        inc     a
 %1:
 %2:
-} labelRefCountChange(%2 -1)
+} if labelRefCountChange(%2 -1)
 
 // applies to f.e. scott-bool1.c
 replace {
@@ -3846,7 +3859,7 @@ replace {
        mov     r%1,a
 %4:
 %3:
-} labelRefCountChange(%3 -1)
+} if labelRefCountChange(%3 -1)
 
 // in_byte>>=1; if(in_bit) in_byte|=0x80;
 replace {
@@ -3886,7 +3899,7 @@ replace {
        mov     r%1,a
 %4:
 %3:
-} labelRefCountChange(%3 -1)
+} if labelRefCountChange(%3 -1)
 
 // out_bit=out_byte&0x80; out_byte<<=1;
 // helps f.e. writing data on a 3-wire (SPI) bus