فهرست منبع

* small optimization to case genlist() case statements

Jonas Maebe 23 سال پیش
والد
کامیت
775b065d70
2فایلهای تغییر یافته به همراه15 افزوده شده و 7 حذف شده
  1. 9 5
      compiler/i386/n386set.pas
  2. 6 2
      compiler/powerpc/nppcset.pas

+ 9 - 5
compiler/i386/n386set.pas

@@ -736,10 +736,11 @@ implementation
                       { present label then the lower limit can be checked    }
                       { immediately. else check the range in between:       }
 
-                      { note: you can't use gensub() here because dec doesn't }
-                      { change the carry flag (needed for jmp_lxx) (JM)       }
-                      emit_const_reg(A_SUB,opsize,longint(t^._low-last),hregister);
-                      emitjmp(jmp_le,elselabel);
+                      gensub(longint(t^._low-last));
+                      { no jump necessary here if the new range starts at }
+                      { at the value following the previous one           }
+                      if (t^._low-last) <> 1 then
+                        emitjmp(jmp_le,elselabel);
                     end;
                   emit_const_reg(A_SUB,opsize,longint(t^._high-t^._low),hregister);
                   emitjmp(jmp_lee,t^.statement);
@@ -1023,7 +1024,10 @@ begin
 end.
 {
   $Log$
-  Revision 1.40  2002-08-17 09:23:46  florian
+  Revision 1.41  2002-09-09 13:57:45  jonas
+    * small optimization to case genlist() case statements
+
+  Revision 1.40  2002/08/17 09:23:46  florian
     * first part of procinfo rewrite
 
   Revision 1.39  2002/08/12 15:08:42  carl

+ 6 - 2
compiler/powerpc/nppcset.pas

@@ -121,7 +121,8 @@ implementation
                     { present label then the lower limit can be checked    }
                     { immediately. else check the range in between:       }
                     gensub(longint(t^._low-last));
-                    tcgppc(cg).a_jmp_cond(exprasmlist,jmp_lt,elselabel);
+                    if (t^._low-last) <> 1 then
+                      tcgppc(cg).a_jmp_cond(exprasmlist,jmp_lt,elselabel);
                   end;
                 gensub(longint(t^._high-t^._low));
                 tcgppc(cg).a_jmp_cond(exprasmlist,jmp_le,t^.statement);
@@ -154,7 +155,10 @@ begin
 end.
 {
   $Log$
-  Revision 1.2  2002-09-08 20:14:33  jonas
+  Revision 1.3  2002-09-09 13:57:45  jonas
+    * small optimization to case genlist() case statements
+
+  Revision 1.2  2002/09/08 20:14:33  jonas
     * use genlinearcmplist() for unsigned 32bit case statements instead
       of genlinearlist(), because the addic. instruction always sets the
       flags as if the arguments are signed 32bits (for smaller unsigned