* src/SDCCpeeph.c (labelIsReturnOnly): support hc08 rts opcode also
[fw/sdcc] / src / hc08 / peeph.def
index a4c8e75615af7a7eaec507b4d47d330c76c7e1e8..d70a5d1ebc48bd98af4e3bb70341e5e23789d6b1 100644 (file)
@@ -124,3 +124,107 @@ replace {
        ; Peephole 4d   - eliminated redundant tstx
        ldx     %1,s
 }
+
+replace {
+       clra
+       sta     %1
+       clra
+       sta     %2
+       clra
+       sta     %3
+       clra
+       sta     %4
+} by {
+       ; Peephole 5a   - eliminated redundant clra
+       clra
+       sta     %1
+       sta     %2
+       sta     %3
+       sta     %4
+}
+
+replace {
+       clra
+       sta     %1
+       clra
+       sta     %2
+       clra
+       sta     %3
+} by {
+       ; Peephole 5b   - eliminated redundant clra
+       clra
+       sta     %1
+       sta     %2
+       sta     %3
+}
+
+replace {
+       clra
+       sta     %1
+       clra
+       sta     %2
+} by {
+       ; Peephole 5c   - eliminated redundant clra
+       clra
+       sta     %1
+       sta     %2
+}
+
+replace {
+       lda     #%9
+       sta     %1
+       lda     #%9
+       sta     %2
+       lda     #%9
+       sta     %3
+       lda     #%9
+       sta     %4
+} by {
+       ; Peephole 5d   - eliminated redundant lda
+       lda     #%9
+       sta     %1
+       sta     %2
+       sta     %3
+       sta     %4
+}
+
+replace {
+       lda     #%9
+       sta     %1
+       lda     #%9
+       sta     %2
+       lda     #%9
+       sta     %3
+} by {
+       ; Peephole 5e   - eliminated redundant lda
+       lda     #%9
+       sta     %1
+       sta     %2
+       sta     %3
+}
+
+replace {
+       lda     #%9
+       sta     %1
+       lda     #%9
+       sta     %2
+} by {
+       ; Peephole 5f   - eliminated redundant lda
+       lda     #%9
+       sta     %1
+       sta     %2
+}
+
+replace {
+       jmp     %5
+} by {
+       ; Peephole 6a  - replaced jmp to rts with rts
+       rts
+} if labelIsReturnOnly
+
+replace {
+       bra     %5
+} by {
+       ; Peephole 6b  - replaced jmp to rts with rts
+       rts
+} if labelIsReturnOnly