1 // peeph.def
- PDK peephole rules
3 // Reads from RAM or I
/O change z flag.
7 ; peephole
0 removed dead load into
%1 from
%2.
8 } if
notUsed(%1), notUsed('z'), notVolatile(%1), notVolatile(%2)
10 // Write to memory or I
/O does not change z flag.
14 ; peephole
0a removed dead load into
%1 from
%2.
15 } if
notUsed(%1), notVolatile(%1)
20 ; peephole
0b removed dead load into
%1 from #
%2.
26 ; peephole
1 removed dead clear of
%1.
34 ; peephole
2 removed redundant load from
%1 into a.
35 } if
notVolatile(%1), notUsed('z')
41 ; peephole
3 removed redundant push
/ pop.
48 ; peephole
3a removed redundant pop af
/ push af.
49 } if
notUsed('a'), notUsed('z'), notUsed('c'), notUsed('ov')
55 ; peephole
4 moved load to ret.
63 ; peephole
5 removed redundant double exchange between a and
%1.
73 ; peephole
6 removed redundant and.
83 ; peephole
7 removed redundant mov a
, %1
84 } if
notUsed('z'), notVolatile(%1)
95 ; peephole
8 removed redundant mov a
, %1
96 } if
notUsed('z'), notVolatile(%1)
111 ; peephole
9 removed redundant mov a
, %1
112 } if
notUsed('z'), notVolatile(%1)
119 ; peephole j1 removed redundant ret after ret k.
130 ; peephole j2 removed goto by inverting test condition.
134 } if
labelRefCountChange(%4 -1)
144 ; peephole j3 removed goto by inverting test condition.
148 } if
labelRefCountChange(%4 -1)
158 ; peephole j4 removed goto by inverting test condition.
162 } if
labelRefCountChange(%4 -1)
172 ; peephole j5 removed goto by inverting test condition.
176 } if
labelRefCountChange(%4 -1)
186 ; peephole j6 removed goto by inverting test condition.
190 } if
labelRefCountChange(%4 -1)
200 ; peephole j7 removed goto by inverting test condition.
204 } if
labelRefCountChange(%4 -1)
214 ; peephole j8 removed goto by inverting test condition.
218 } if
isPort('pdk14' 'pdk15'), labelRefCountChange(%4 -1)
228 ; peephole j9 removed goto by inverting test condition.
232 } if
isPort('pdk14' 'pdk15'), labelRefCountChange(%4 -1)
242 ; peephole j10 removed goto by inverting test condition.
246 } if
isPort('pdk14' 'pdk15'), labelRefCountChange(%4 -1)
256 ; peephole j11 removed goto by inverting test condition.
260 } if
labelRefCountChange(%4 -1)
270 ; peephole j12 removed goto by inverting test condition.
274 } if
labelRefCountChange(%4 -1)
284 ; peephole j13 removed goto by inverting test condition.
288 } if
labelRefCountChange(%4 -1)
290 // Should be one of the last ones. Opens the code to further peephole optimization.
294 ; peephole j14 removed unused label
%1.
295 } if
labelRefCount(%1 0)
303 ; peephole j15 replaced goto by ret.
304 } if
labelIsReturnOnly(%1), labelRefCountChange(%1 -1)