* src/mcs51/peeph.def: Frieder: removed 237, obsolete by 236g and 105; added 237 a/b
[fw/sdcc] / src / mcs51 / peeph.def
index e26372e8135f77f2f585f0af33c465453a4cbe4f..2a35344d1605884f20673db23f4d6669de613ea2 100644 (file)
@@ -1928,4 +1928,177 @@ replace {
         mov     dptr,#%2
 }
 
+replace {
+        movx    a,@dptr
+} by {
+        ; Peephole 232   using movc to read xdata (--xram-movc)
+        clr     a
+        movc    a,@a+dptr
+} if xramMovcOption
+
+replace {
+        lcall   _gptrget
+} by {
+        ; Peephole 233   using _gptrgetc instead of _gptrget (--xram-movc)
+        lcall   _gptrgetc
+} if xramMovcOption
+
+replace {
+        mov     r%1,a
+        mov     dpl,r%1
+%2:
+        ret
+} by {
+        ; Peephole 234   loading dpl directly from a(ccumulator)
+        mov     dpl,a
+%2:
+        ret
+}
+
+replace {
+        mov     r%1,a
+        mov     dpl,r%2
+        mov     dph,r%1
+%3:
+        ret
+} by {
+        ; Peephole 235   loading dph directly from a(ccumulator)
+        mov     dpl,r%2
+        mov     dph,a
+%3:
+        ret
+}
+
+// 14 rules by Fiorenzo D. Ramaglia <fd.ramaglia@tin.it>
+
+replace {
+        add  a,ar%1
+} by {
+        ; Peephole 236a
+        add  a,r%1
+}
+
+replace {
+        addc  a,ar%1
+} by {
+        ; Peephole 236b
+        addc  a,r%1
+}
+
+replace {
+        anl  a,ar%1
+} by {
+        ; Peephole 236c
+        anl  a,r%1
+}
+
+replace {
+        dec  ar%1
+} by {
+        ; Peephole 236d
+        dec  r%1
+}
+
+replace {
+        djnz  ar%1,%2
+} by {
+        ; Peephole 236e
+        djnz  r%1,%2
+}
+
+replace {
+        inc  ar%1
+} by {
+        ; Peephole 236f
+        inc  r%1
+}
+
+replace {
+        mov  a,ar%1
+} by {
+        ; Peephole 236g
+        mov  a,r%1
+}
+
+replace {
+        mov  ar%1,#%2
+} by {
+        ; Peephole 236h
+        mov  r%1,#%2
+}
+
+replace {
+        mov  ar%1,a
+} by {
+        ; Peephole 236i
+        mov  r%1,a
+}
+
+replace {
+        mov  ar%1,ar%2
+} by {
+        ; Peephole 236j
+        mov  r%1,ar%2
+}
+
+replace {
+        orl  a,ar%1
+} by {
+        ; Peephole 236k
+        orl  a,r%1
+}
+
+replace {
+        subb  a,ar%1
+} by {
+        ; Peephole 236l
+        subb  a,r%1
+}
+
+replace {
+        xch  a,ar%1
+} by {
+        ; Peephole 236m
+        xch  a,r%1
+}
+
+replace {
+        xrl  a,ar%1
+} by {
+        ; Peephole 236n
+        xrl  a,r%1
+}
+
+replace {
+        sjmp    %1
+%2:
+        mov     %3,%4
+%1:
+        ret
+} by {
+        ; Peephole 237a  removed sjmp to ret
+        ret
+%2:
+        mov     %3,%4
+%1:
+        ret
+}
 
+replace {
+        sjmp    %1
+%2:
+        mov     %3,%4
+        mov     dpl,%5
+        mov     dph,%6
+%1:
+        ret
+} by {
+        ; Peephole 237b  removed sjmp to ret
+        ret
+%2:
+        mov     %3,%4
+        mov     dpl,%5
+        mov     dph,%6
+%1:
+        ret
+}