Procházet zdrojové kódy

* consistently define empty saved_mm_registers arrays as containing a single
RS_INVALID superregister (instead of sometimes RS_NO and sometimes
RS_INVALID)
* check for RS_INVALID in tcg.g_save_registers() and ignore such entries

git-svn-id: trunk@21622 -

Jonas Maebe před 13 roky
rodič
revize
708a2532fc

+ 1 - 1
compiler/arm/cpubase.pas

@@ -314,7 +314,7 @@ unit cpubase;
         (RS_R4,RS_R5,RS_R6,RS_R7,RS_R8,RS_R9,RS_R10);
 
       { this is only for the generic code which is not used for this architecture }
-      saved_mm_registers : array[0..0] of tsuperregister = (RS_NO);
+      saved_mm_registers : array[0..0] of tsuperregister = (RS_INVALID);
 
       { Required parameter alignment when calling a routine declared as
         stdcall and cdecl. The alignment value should be the one defined

+ 2 - 2
compiler/avr/cpubase.pas

@@ -101,11 +101,11 @@ unit cpubase;
 
       { Float Super register first and last }
       first_fpu_supreg    = RS_INVALID;
-      first_fpu_imreg     = RS_INVALID;
+      first_fpu_imreg     = 0;
 
       { MM Super register first and last }
       first_mm_supreg    = RS_INVALID;
-      first_mm_imreg     = RS_INVALID;
+      first_mm_imreg     = 0;
 
       regnumber_count_bsstart = 32;
 

+ 11 - 4
compiler/cgobj.pas

@@ -2507,12 +2507,19 @@ implementation
 
                 for r:=low(saved_mm_registers) to high(saved_mm_registers) do
                   begin
-                    if saved_mm_registers[r] in rg[R_MMREGISTER].used_in_proc then
+                    { the array has to be declared even if no MM registers are saved
+                      (such as with SSE on i386), and since 0-element arrays don't
+                      exist, they contain a single RS_INVALID element in that case
+                    }
+                    if saved_mm_registers[r]<>RS_INVALID then
                       begin
-                        a_loadmm_reg_ref(list,OS_VECTOR,OS_VECTOR,newreg(R_MMREGISTER,saved_mm_registers[r],R_SUBNONE),href,nil);
-                        inc(href.offset,tcgsize2size[OS_VECTOR]);
+                        if saved_mm_registers[r] in rg[R_MMREGISTER].used_in_proc then
+                          begin
+                            a_loadmm_reg_ref(list,OS_VECTOR,OS_VECTOR,newreg(R_MMREGISTER,saved_mm_registers[r],R_SUBNONE),href,nil);
+                            inc(href.offset,tcgsize2size[OS_VECTOR]);
+                          end;
+                        include(rg[R_MMREGISTER].preserved_by_proc,saved_mm_registers[r]);
                       end;
-                    include(rg[R_MMREGISTER].preserved_by_proc,saved_mm_registers[r]);
                   end;
               end;
           end;

+ 1 - 1
compiler/jvm/cpubase.pas

@@ -254,7 +254,7 @@ uses
       );
 
       { this is only for the generic code which is not used for this architecture }
-      saved_mm_registers : array[0..0] of tsuperregister = (RS_NO);
+      saved_mm_registers : array[0..0] of tsuperregister = (RS_INVALID);
 
       {# Required parameter alignment when calling a routine
       }

+ 1 - 1
compiler/m68k/cpubase.pas

@@ -304,7 +304,7 @@ unit cpubase;
       saved_standard_address_registers : array[0..3] of tsuperregister = (RS_A2,RS_A3,RS_A4,RS_A5);
       
       { this is only for the generic code which is not used for this architecture }
-      saved_mm_registers : array[0..0] of tsuperregister = (RS_NO);
+      saved_mm_registers : array[0..0] of tsuperregister = (RS_INVALID);
 
       {# Required parameter alignment when calling a routine declared as
          stdcall and cdecl. The alignment value should be the one defined

+ 1 - 1
compiler/mips/cpubase.pas

@@ -244,7 +244,7 @@ unit cpubase;
         (RS_NO);
 
       { this is only for the generic code which is not used for this architecture }
-      saved_mm_registers : array[0..0] of tsuperregister = (RS_NO);
+      saved_mm_registers : array[0..0] of tsuperregister = (RS_INVALID);
 
       { Required parameter alignment when calling a routine declared as
         stdcall and cdecl. The alignment value should be the one defined

+ 1 - 1
compiler/powerpc/cpubase.pas

@@ -352,7 +352,7 @@ uses
       );
 
       { this is only for the generic code which is not used for this architecture }
-      saved_mm_registers : array[0..0] of tsuperregister = (RS_NO);
+      saved_mm_registers : array[0..0] of tsuperregister = (RS_INVALID);
 
       {# Required parameter alignment when calling a routine declared as
          stdcall and cdecl. The alignment value should be the one defined

+ 1 - 1
compiler/powerpc64/cpubase.pas

@@ -350,7 +350,7 @@ const
     );
 
   { this is only for the generic code which is not used for this architecture }
-  saved_mm_registers : array[0..0] of tsuperregister = (RS_NO);  
+  saved_mm_registers : array[0..0] of tsuperregister = (RS_INVALID);
   
   {# Required parameter alignment when calling a routine declared as
      stdcall and cdecl. The alignment value should be the one defined

+ 2 - 2
compiler/sparc/cpubase.pas

@@ -249,10 +249,10 @@ uses
          This value can be deduced from CALLED_USED_REGISTERS array in the
          GCC source.
       }
-      saved_standard_registers : array[0..0] of tsuperregister = (RS_NO);
+      saved_standard_registers : array[0..0] of tsuperregister = (RS_INVALID);
 
       { this is only for the generic code which is not used for this architecture }
-      saved_mm_registers : array[0..0] of tsuperregister = (RS_NO);
+      saved_mm_registers : array[0..0] of tsuperregister = (RS_INVALID);
 
       {# Required parameter alignment when calling a routine declared as
          stdcall and cdecl. The alignment value should be the one defined