-//replace restart {
-// pop %1
-// push %1
-//} by {
-// ; Peephole 1 removed pop %1 push %1 (not push pop)
-//}
-
-//replace restart {
-// pop %1
-// mov %2,%3
-// push %1
-//} by {
-// ; Peephole 2 removed pop %1 push %1 (not push pop)
-// mov %2,%3
-//}
-
-//
// added by Jean Louis VERN for
// his shift stuff
replace {
mov %1,a
} if notVolatile %1
-replace {
-// acc being incremented might cause problems
- mov %1,a
- inc %1
-} by {
- ; Peephole 185 changed order of increment (acc incremented also!)
- inc a
- mov %1,a
-} if notVolatile %1
+//replace {
+// acc being incremented might cause problems with register tracking
+// mov %1,a
+// inc %1
+//} by {
+// ; Peephole 185 changed order of increment (acc incremented also!)
+// inc a
+// mov %1,a
+//} if notVolatile %1
// char indexed access to: long code table[] = {4,3,2,1};
replace restart {
; Peephole 191 removed redundant mov
} if notVolatile %1
+// applies to f.e. regression/ports/mcs51/support.c
replace {
mov r%1,a
mov @r%2,ar%1
} by {
mov r%1,a
- ; Peephole 192 used a instead of ar%1 as source
+ ; Peephole 192.a used a instead of ar%1 as source
mov @r%2,a
}
+// applies to f.e. printf_large.c
+replace {
+ mov ar%1,@r%2
+ mov a,r%1
+} by {
+ ; Peephole 192.b used a instead of ar%1 as destination
+ mov a,@r%2
+ mov r%1,a
+}
+
replace {
jnz %3
mov a,%4
mov r%3,a
}
-// applies to: void test( char c ) { if( c ) func1(); else func2(); }
-replace {
- lcall %1
- ret
-} by {
- ; Peephole 253.a replaced lcall/ret with ljmp
- ljmp %1
-}
-
-// applies to: void test( char c ) { if( c ) func1(); else func2(); }
-replace {
- lcall %1
-%2:
- ret
-} by {
- ; Peephole 253.b replaced lcall/ret with ljmp
- ljmp %1
- ;
-} if labelRefCount %2 0
-
-// applies to f.e. scott-bool1.c
-replace {
- lcall %1
-%2:
- ret
-} by {
- ; Peephole 253.c replaced lcall with ljmp
- ljmp %1
-%2:
- ret
-}
-
-
// applies to f.e. funptrs.c
// saves one byte if %1 is a register or @register
replace {
} by {
; Peephole 263.a optimized loading const
mov %1,#(%2 + 3)
-}
+} if notVolatile(%1)
replace {
mov %1,#%2
} by {
; Peephole 263.b optimized loading const
mov %1,#(%2 + 2)
-}
+} if notVolatile(%1)
replace {
mov %1,#%2
} by {
; Peephole 263.c optimized loading const
mov %1,#(%2 + 1)
-}
+} if notVolatile(%1)
replace {
} if labelRefCount(%3 1), labelRefCountChange(%3 -1)
+replace restart {
+ pop ar%1
+} by {
+ ; Peephole 300 pop ar%1 removed
+} if deadMove %1
+
+replace {
+ mov r%1,%2
+} by {
+ ; Peephole 301 mov r%1,%2 removed
+} if notVolatile(%2), deadMove(%1)
+
+
+// applies to: void test( char c ) { if( c ) func1(); else func2(); }
+replace {
+ lcall %1
+ ret
+} by {
+ ; Peephole 400.a replaced lcall/ret with ljmp
+ ljmp %1
+}
+
+// applies to: void test( char c ) { if( c ) func1(); else func2(); }
+replace {
+ lcall %1
+%2:
+ ret
+} by {
+ ; Peephole 400.b replaced lcall/ret with ljmp
+ ljmp %1
+ ;
+} if labelRefCount %2 0
+
+// applies to f.e. scott-bool1.c
+replace {
+ lcall %1
+%2:
+ ret
+} by {
+ ; Peephole 400.c replaced lcall with ljmp
+ ljmp %1
+%2:
+ ret
+}
+
+
// should be one of the last peepholes
replace{
%1:
} by {
- ; Peephole 300 removed redundant label %1
+ ; Peephole 500 removed redundant label %1
} if labelRefCount(%1 0)