added 251.b and 253.x. 253.x are applied more than 500 times in the regression tests
authorfrief <frief@4a8a32a2-be11-0410-ad9d-d568d2c75423>
Fri, 5 Mar 2004 11:42:32 +0000 (11:42 +0000)
committerfrief <frief@4a8a32a2-be11-0410-ad9d-d568d2c75423>
Fri, 5 Mar 2004 11:42:32 +0000 (11:42 +0000)
git-svn-id: https://sdcc.svn.sourceforge.net/svnroot/sdcc/trunk/sdcc@3246 4a8a32a2-be11-0410-ad9d-d568d2c75423

src/mcs51/peeph.def

index 083d8fe5c3cb05edf935bef5d10543dbd307dc22..a4117ac1eb399354d685588ed23c365e2851dd49 100644 (file)
@@ -157,7 +157,7 @@ replace {
         clr     c
         mov     a,%1
 } by {
-        ;       Peephole 106    removed redundant mov 
+        ;       Peephole 106    removed redundant mov
         mov     %1,a
         clr     c
 } if notVolatile %1
@@ -3147,7 +3147,15 @@ replace {
 replace {
         ljmp    %5
 } by {
-        ;       Peephole 251    replaced ljmp to ret with ret
+        ;       Peephole 251.a  replaced ljmp to ret with ret
+        ret
+} if labelIsReturnOnly
+
+// not before peephole 250.b
+replace {
+        sjmp    %5
+} by {
+        ;       Peephole 251.b  replaced sjmp to ret with ret
         ret
 } if labelIsReturnOnly
 
@@ -3170,3 +3178,34 @@ replace {
         rlc     a
         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
+}