More peep to pCode parsing.
[fw/sdcc] / src / pic / peeph.def
1 //bogus test for pcode
2 replace restart {
3         movf    %1,w    ;comment at end
4 %4:     movf    %1,w
5         RETURN
6         clrf    INDF
7         movlw   0xa5
8         movf    fsr,w
9         incf    indf,f
10         %2
11 } by {
12         ; peep test remove redundant move
13 %4:     movf    %1,w    ;another comment
14         %2
15 } if AYBABTU %3
16
17
18 // peep 1
19 replace restart {
20         movf    %1,w
21         movwf   %2
22         movf    %2,w
23 } by {
24         ; peep 1 - Removed redundant move
25         movf    %1,w
26         movwf   %2
27 }
28
29 // peep 2
30 replace restart {
31         decf    %1,f
32         movf    %1,w
33         btfss   status,z
34         goto    %2
35 } by {
36         ; peep 2 - decf/mov/skpz to decfsz
37         decfsz  %1,f
38          goto   %2
39 }
40
41 // peep 3
42 replace restart {
43         movwf   %1
44         movf    %1,w
45         xorlw   %2
46 } by {
47         ; peep 3 - redundant move
48         movwf   %1
49         xorlw   %2
50 }
51
52 // peep 4
53 replace restart {
54         btfsc   %1,%2
55         goto    %3
56         incf    %4,f
57 %3:
58 } by {
59         ;peep 4 - test/jump to test/skip
60         btfss   %1,%2
61         incf   %4,f
62 %3:
63 }
64
65
66 // peep 5
67 replace restart {
68         btfss   %1,%2
69         goto    %3
70         incf    %4,f
71 %3:
72 } by {
73         ;peep 5 - test/jump to test/skip
74         btfsc   %1,%2
75         incf   %4,f
76 %3:
77 }
78
79 // peep 6
80 replace restart {
81         btfss   %1,%2
82         goto    %3
83 %4:
84         incf    %5,f
85 %3:
86 } by {
87         ;peep 6 - test/jump to test/skip
88         btfsc   %1,%2
89 %4:
90         incf   %5,f
91 %3:
92 }
93
94 // peep 7
95 replace restart {
96         btfsc   %1,%2
97         goto    %3
98 %4:
99         incf    %5,f
100 %3:
101 } by {
102         ;peep 6 - test/jump to test/skip
103         btfss   %1,%2
104 %4:
105         incf   %5,f
106 %3:
107 }
108
109 replace restart {
110         movf    %1,w
111         movf    %1,w
112 } by {
113         ; peep 8 - Removed redundant move
114         movf    %1,w
115 }
116
117 replace restart {
118         movwf   %1
119         movf    %1,w
120 } by {
121         ; peep 9 - Removed redundant move
122         movwf   %1
123 }
124
125 replace restart {
126         movlw   %1
127         movwf   %2
128         movlw   %1
129 } by {
130         ; peep 10 - Removed redundant move
131         movlw   %1
132         movwf   %2
133 }
134
135 replace restart {
136         movwf   %1
137         movwf   %1
138 } by {
139         ; peep 11 - Removed redundant move
140         movwf   %1
141 }
142