5 // ; Peephole
1 removed pop
%1 push
%1 (not push pop
)
13 // ; Peephole
2 removed pop
%1 push
%1 (not push pop
)
18 // added by Jean Louis VERN for
24 ; Peephole
2.a removed redundant xch xch
32 ; Peephole
3.a changed mov to clr
42 ; Peephole
3.b changed mov to clr
48 // saving
1 byte
, loosing
1 cycle but maybe allowing peephole
3.b to start
53 ; Peephole
3.c changed mov to clr
63 ; Peephole
3.d changed mov to clr
73 ; Peephole
100 removed redundant mov
82 ; Peephole
100.a removed redundant mov
92 ; Peephole
101 removed redundant mov
110 ; Peephole
102 removed redundant mov
132 ; Peephole
103 removed redundant mov
149 ; Peephole
104 optimized
increment (acc not set to r
%1, flags undefined
)
158 ; Peephole
105 removed redundant mov
167 ; Peephole
106 removed redundant mov
176 ; Peephole
107 removed redundant ljmp
185 ; Peephole
108 removed ljmp by inverse jump logic
188 } if
labelInRange(%5)
195 ; Peephole
109 removed ljmp by inverse jump logic
198 } if
labelInRange(%5)
205 ; Peephole
110 removed ljmp by inverse jump logic
208 } if
labelInRange(%5)
215 ; Peephole
111 removed ljmp by inverse jump logic
218 } if
labelInRange(%5)
225 ; Peephole
112 removed ljmp by inverse jump logic
228 } if
labelInRange(%5)
234 ; Peephole
132 changed ljmp to sjmp
237 } if
labelInRange(%5)
248 ; Peephole
113 optimized misc sequence
253 } if labelRefCount
%3 1
264 ; Peephole
114 optimized misc sequence
270 } if labelRefCount
%3 2
279 ; Peephole
115 jump optimization
283 } if labelRefCount
%3 1
293 ; Peephole
116 jump optimization
298 } if labelRefCount
%3 2
309 ; Peephole
117 jump optimization
315 } if labelRefCount
%3 3
327 ; Peephole
118 jump optimization
334 } if labelRefCount
%3 4
343 ; Peephole
119 jump optimization
346 } if labelRefCount
%3 1
356 ; Peephole
120 jump optimization
360 } if labelRefCount
%3 2
371 ; Peephole
121 jump optimization
376 } if labelRefCount
%3 3
388 ; Peephole
122 jump optimization
394 } if labelRefCount
%3 4
403 ; Peephole
123 jump optimization
407 } if labelRefCount
%3 1
417 ; Peephole
124 jump optimization
422 } if labelRefCount
%3 2
433 ; Peephole
125 jump optimization
439 } if labelRefCount
%3 3
451 ; Peephole
126 jump optimization
458 } if labelRefCount
%3 4
471 ; Peephole
127 removed misc sequence
473 } if labelRefCount
%3 0
480 ; Peephole
128 jump optimization
489 ; Peephole
129 jump optimization
496 ; Peephole
130 changed target address mode r
%1 to ar
%1
506 ; Peephole
131 optimized
decrement (not caring for c
)
518 ; Peephole
133 removed redundant moves
531 ; Peephole
134 removed redundant moves
542 ; Peephole
135 removed redundant mov
554 ; Peephole
136a removed redundant moves
567 ; Peephole
136 removed redundant moves
573 // WTF? Doesn
't look sensible to me...
583 // ; Peephole 137 optimized misc jump sequence
587 //} if labelRefCount %4 1
598 // ; Peephole 138 optimized misc jump sequence
603 //} if labelRefCount %4 1
610 ; Peephole 139 removed redundant mov
620 ; Peephole 140 removed redundant mov
629 ; Peephole 141 removed redundant mov
639 ; Peephole 142 removed redundant moves
648 ; Peephole 143 converted rlc to rl
656 ; Peephole 144 converted rrc to rc
664 ; Peephole 145 changed to add without carry
673 ; Peephole 146 changed to add without carry
681 ; Peephole 147 changed target address mode r%1 to ar%1
688 ; Peephole 148 changed target address mode r%1 to ar%1
695 ; Peephole 149 changed target address mode r%1 to ar%1
705 ; Peephole 150 removed misc moves via dpl before return
718 ; Peephole 151 removed misc moves via dph, dpl before return
730 ; Peephole 152 removed misc moves via dph, dpl before return
745 ; Peephole 153 removed misc moves via dph, dpl, b before return
758 ; Peephole 154 removed misc moves via dph, dpl, b before return
772 ; Peephole 155 removed misc moves via dph, dpl, b before return
789 ; Peephole 156 removed misc moves via dph, dpl, b, a before return
804 ; Peephole 157 removed misc moves via dph, dpl, b, a before return
817 ; Peephole 158 removed misc moves via dph, dpl, b, a before return
825 ; Peephole 159 avoided xrl during execution
834 ; Peephole 160 removed sjmp by inverse jump logic
843 ; Peephole 161 removed sjmp by inverse jump logic
852 ; Peephole 162 removed sjmp by inverse jump logic
861 ; Peephole 163 removed sjmp by inverse jump logic
870 ; Peephole 164 removed sjmp by inverse jump logic
880 ; Peephole 165 removed sjmp by inverse jump logic
890 ; Peephole 166 removed redundant mov
899 ; Peephole 167 removed redundant bit moves (c not set to %1)
906 ; Peephole 168 jump optimization
914 ; Peephole 169 jump optimization
925 ; Peephole 170 jump optimization
928 } if labelRefCount %3 1
938 ; Peephole 171 jump optimization
942 } if labelRefCount %3 2
953 ; Peephole 172 jump optimization
958 } if labelRefCount %3 3
970 ; Peephole 173 jump optimization
976 } if labelRefCount %3 4
985 ; Peephole 174 optimized decrement (acc not set to %2, flags undefined)
997 ; Peephole 175 optimized increment (acc not set to %2, flags undefined)
1007 ; Peephole 176 optimized increment, removed redundant mov
1012 // this one will screw assigns to volatile/sfr's
1017 // ; Peephole
177 removed redundant mov
1026 ; Peephole
178 removed redundant mov
1031 // rules
179-182 provided by
: Frieder
<fe@lake.iup.uni
-heidelberg.de
>
1032 // saving
2 byte
, 1 cycle
1037 ; Peephole
179 changed mov to clr
1042 // saving
1 byte
, 0 cycles
1046 ; Peephole
180 changed mov to clr
1055 ; Peephole
181a used
24 bit load of dptr
1059 // saving
3 byte
, 2 cycles
, return(NULL
) profits here
1064 ; Peephole
181 used
16 bit load of dptr
1073 ; Peephole
182b used
24 bit load of DPTR
1077 // saves
2 bytes
, ?? cycles.
1083 ; Peephole
182a used
24 bit load of dptr
1085 } if
24bitMode(), isPort('ds390' 'ds400')
1087 // saves
2 bytes
, ?? cycles.
1093 ; Peephole
182b used
24 bit load of dptr
1094 mov dptr
,#
((%3 << 16) + (%2 << 8) + %1)
1095 } if
24bitMode(), isPort('ds390' 'ds400')
1097 // saving
3 byte
, 2 cycles
, return(float_constant
) profits here
1102 ; Peephole
182c used
16 bit load of dptr
1106 // saving
3 byte
, 2 cycles
, return(float_constant
) profits here
1111 ; Peephole
182 used
16 bit load of dptr
1112 mov dptr
,#
(((%2)<<8) + %1)
1119 ; Peephole
183 avoided anl during execution
1128 ; Peephole
184 removed redundant mov
1134 // acc being incremented might cause problems
1138 ; Peephole
185 changed order of
increment (acc incremented also
!)
1143 // char indexed access to
: long code table
[] = {4,3,2,1};
1165 ; Peephole
186.a optimized movc sequence
1183 // char indexed access to
: void
* code table
[] = {4,3,2,1};
1201 ; Peephole
186.b optimized movc sequence
1215 // char indexed access to
: int code table
[] = {4,3,2,1};
1229 ; Peephole
186.c optimized movc sequence
1238 // char indexed access to
: char code table
[] = {4,3,2,1};
1248 ; Peephole
186.d optimized movc sequence
1258 ; Peephole
187 used a instead of ar
%1 for anl
1270 ; Peephole
188 removed redundant mov
1282 ; Peephole
189 removed redundant mov and anl
1287 // rules
190 & 191 need to be in order
1293 ; Peephole
190 removed redundant mov
1305 ; Peephole
191 removed redundant mov
1316 ; Peephole
192 used a instead of ar
%1 as source
1333 ; Peephole
193.a optimized misc jump sequence
1343 } if labelRefCount
%3 4
1357 ; Peephole
193 optimized misc jump sequence
1367 } if labelRefCount
%3 4
1381 ; Peephole
193.a optimized misc jump sequence
1391 } if labelRefCount
%3 4
1402 ; Peephole
194 optimized misc jump sequence
1409 } if labelRefCount
%3 4
1421 ; Peephole
195.a optimized misc jump sequence
1429 } if labelRefCount
%3 3
1441 ; Peephole
195 optimized misc jump sequence
1449 } if labelRefCount
%3 3
1461 ; Peephole
195.a optimized misc jump sequence
1469 } if labelRefCount
%3 3
1479 ; Peephole
196 optimized misc jump sequence
1485 } if labelRefCount
%3 3
1495 ; Peephole
197.a optimized misc jump sequence
1501 } if labelRefCount
%3 2
1511 ; Peephole
197 optimized misc jump sequence
1517 } if labelRefCount
%3 2
1527 ; Peephole
197.a optimized misc jump sequence
1533 } if labelRefCount
%3 2
1542 ; Peephole
198 optimized misc jump sequence
1547 } if labelRefCount
%3 2
1555 ; Peephole
199 optimized misc jump sequence
1559 } if labelRefCount
%3 1
1565 ; Peephole
200 removed redundant sjmp
1574 ; Peephole
201 removed redundant sjmp
1584 ; Peephole
202 removed redundant push pop
1592 ; Peephole
202b removed redundant push pop
1600 ; Peephole
203 removed mov r
%1,_spx
1609 ; Peephole
204 removed redundant mov
1621 ; Peephole
205 optimized misc jump sequence
1625 } if labelRefCount
%2 1
1630 ; Peephole
206 removed redundant mov
%1,%1
1638 ; Peephole
207 removed zero
add (acc not set to
%1, flags undefined
)
1647 ; Peephole
208 removed redundant push pop
1657 ; Peephole
209 optimized
increment (acc not set to
%1, flags undefined
)
1663 mov dptr
,#
((((%1 >> 16)) <<16) + (((%1 >> 8)) <<8) + %1)
1665 ; Peephole
210a simplified expression
1670 mov dptr
,#
((((%1 >> 8)) <<8) + %1)
1672 ; Peephole
210 simplified expression
1680 ; Peephole
211 removed redundant push r
%1 pop r
%1
1688 ; Peephole
212 reduced add sequence to inc
1694 mov
%1,#
(( %2 >> 8 ) ^
0x80)
1696 ; Peephole
213.a inserted fix
1699 } if
isPort('ds390' 'ds400')
1702 mov
%1,#
(( %2 >> 16 ) ^
0x80)
1704 ; Peephole
213.b inserted fix
1707 } if
isPort('ds390' 'ds400')
1710 mov
%1,#
(( %2 + %3 >> 8 ) ^
0x80)
1712 ; Peephole
213.c inserted fix
1713 mov
%1,#
((%2 + %3) >> 8)
1715 } if
isPort('ds390' 'ds400')
1722 ; Peephole
214 reduced some extra movs
1732 ; Peephole
215 removed some movs
1745 ; Peephole
216 simplified
clear (2bytes
)
1764 ; Peephole
217 simplified
clear (3bytes
)
1788 ; Peephole
218 simplified
clear (4bytes
)
1807 ; Peephole
219 removed redundant clear
1823 ; Peephole
219a removed redundant clear
1836 ; Peephole
220a removed bogus DPS set
1844 ; Peephole
220b removed bogus DPS set
1852 ; Peephole
220c removed bogus DPS set
1860 ; Peephole
220d removed bogus DPS set
1866 mov
%1 + %2,(%2 + %1)
1868 ; Peephole
221a remove redundant move
1872 mov (%1 + %2 + %3),((%2 + %1) + %3)
1874 ; Peephole
221b remove redundant move
1881 ; removed dec
/inc pair
1889 ; Peephole
222 removed DPS abuse.
1900 ; Peephole
222a removed DPS abuse.
1917 ; Peephole
223: yet more DPS abuse removed.
1947 ; Peephole
224a
: DPS usage re
-arranged.
1961 ; Peephole
224: DPS usage re
-arranged.
2003 // char indexed access to
: long code table
[] = {4,3,2,1};
2028 ; Peephole
227.a movc optimize
2046 // char indexed access to
: void
* code table
[] = {4,3,2,1};
2067 ; Peephole
227.b movc optimize
2081 // char indexed access to
: int code table
[] = {4,3,2,1};
2098 ; Peephole
227.c movc optimize
2107 // char indexed access to
: char code table
[] = {4,3,2,1};
2120 ; Peephole
227.d movc optimize
2129 ; Peephole
228 redundant move
2138 ; Peephole
229.a redundant move
2148 ; Peephole
229.b redundant move
2162 ; Peephole
229.c redundant move
2175 ; Peephole
229.d redundant move
2193 ; Peephole
230.a save reload dptr
2217 ; Peephole
230.b save reload dptr
2240 ; Peephole
230.c save reload dptr
2258 ; Peephole
230.d save reload dptr
2277 ; Peephole
230.e save reload dptr
2300 ; Peephole
230.e save reload dptr
2323 ; Peephole
230.f save reload dptr
2341 ; Peephole
231.a simplified moves
2358 ; Peephole
231.b simplified or
2373 ; Peehole
232.a simplified xch
2385 ; Peehole
232.b simplified xch
2393 mov dpx1
,#
(%1 >> 16)
2395 ; Peephole
233 24 bit load of dptr1
2401 // 14 rules by Fiorenzo D. Ramaglia
<fd.ramaglia@tin.it
>
2508 ; Peephole
237a removed sjmp to ret
2525 ; Peephole
237b removed sjmp to ret
2535 // applies to f.e. device
/lib
/log10f.c
2561 ; Peephole
238.a removed
4 redundant moves
2562 } if
notSame(%1 %2 %3 %4 %5 %6 %7 %8)
2564 // applies to device
/lib
/log10f.c
2579 ; Peephole
238.b removed
3 redundant moves
2580 } if
notSame(%1 %2 %3 %4 %5 %6 %7)
2582 // applies to f.e. device
/lib
/time.c
2598 ; Peephole
238.c removed
2 redundant moves
2599 } if
notSame(%1 %2 %3 %4)
2601 // applies to f.e. support
/regression
/tests
/bug
-524209.c
2614 ; Peephole
238.d removed
3 redundant moves
2615 } if
notSame(%1 %2 %3 %4 %5 %6)
2617 // applies to f.e. ser_ir.asm
2621 ; Peephole
239 used a instead of acc
2629 ; Peephole
240 use clr instead of addc a
,#
0
2634 // peepholes
241.a to
241.c and
241.d to
241.f need to be in order
2646 ; Peephole
241.a optimized compare
2657 // applies to f.e. time.c
2667 ; Peephole
241.b optimized compare
2676 // applies to f.e. malloc.c
2685 ; Peephole
241.c optimized compare
2693 // applies to f.e. j
= (k
!=0x1000);
2694 // with volatile idata long k
;
2709 ; Peephole
241.d optimized compare
2723 // applies to f.e. j
= (k
!=0x1000);
2724 // with volatile idata int k
;
2735 ; Peephole
241.e optimized compare
2745 // applies to f.e. vprintf.
asm (--stack
-auto
)
2754 ; Peephole
241.f optimized compare
2762 // applies to f.e. scott
-bool1.c
2769 ; Peephole
242.a avoided branch jnz to jz
2774 } if labelRefCount
%1 1
2776 // applies to f.e. scott
-bool1.c
2784 ; Peephole
242.b avoided branch jnz to jz
2790 } if labelRefCount
%1 1
2792 // applies to f.e. logic.c
2802 ; Peephole
242.c avoided branch jnz to jz
2810 } if labelRefCount
%1 1
2816 ; Peephole
243a jump optimization
2817 } if labelRefCount
%1 1
2823 ; Peephole
243b jump optimization
2824 } if labelRefCount
%1 1
2827 // This allows non
-interrupt and interrupt code to safely compete
2828 // for a resource without the non
-interrupt code having to disable
2830 // volatile bit resource_is_free
;
2831 // if( resource_is_free
) {
2832 // resource_is_free
=0; do_something
; resource_is_free
=1;
2839 ; Peephole
244.a using atomic test and clear
2843 } if labelRefCount
%3 0
2851 ; Peephole
244.b using atomic test and clear
2855 } if labelRefCount
%2 1