Przeglądaj źródła

* put records with 16 bytes size into two register on 64 bit targets if possible
* don't put records containing floats into integer registers
* copy&paste error in tcg128.a_load128_const_reg fixed

git-svn-id: trunk@23317 -

florian 12 lat temu
rodzic
commit
4f30ac0247
3 zmienionych plików z 24 dodań i 3 usunięć
  1. 2 2
      compiler/cgobj.pas
  2. 2 1
      compiler/ncgutil.pas
  3. 20 0
      compiler/symdef.pas

+ 2 - 2
compiler/cgobj.pas

@@ -2711,8 +2711,8 @@ implementation
     procedure tcg128.a_load128_const_reg(list: TAsmList; valuelo,
      valuehi: int64; reg: tregister128);
      begin
-       cg.a_load_const_reg(list,OS_32,aint(valuelo),reg.reglo);
-       cg.a_load_const_reg(list,OS_32,aint(valuehi),reg.reghi);
+       cg.a_load_const_reg(list,OS_64,aint(valuelo),reg.reglo);
+       cg.a_load_const_reg(list,OS_64,aint(valuehi),reg.reghi);
      end;
 
 

+ 2 - 1
compiler/ncgutil.pas

@@ -937,7 +937,8 @@ implementation
                  ({ in case of fpu emulation, or abi's that pass fpu values
                     via integer registers }
                   (vardef.typ=floatdef) or
-                   is_methodpointer(vardef)) then
+                   is_methodpointer(vardef) or
+                   is_record(vardef)) then
                 begin
                   case paraloc^.loc of
                     LOC_REGISTER:

+ 20 - 0
compiler/symdef.pas

@@ -214,6 +214,8 @@ interface
           function search_enumerator_current: tsym; virtual;
           { JVM }
           function jvm_full_typename(with_package_name: boolean): string;
+          { check if the symtable contains a float field }
+          function contains_float_field : boolean;
        end;
 
        trecorddef = class(tabstractrecorddef)
@@ -1610,6 +1612,7 @@ implementation
               is_intregable:=
                 ispowerof2(recsize,temp) and
                 (recsize <= sizeof(asizeint)*2)
+                and not trecorddef(self).contains_float_field
                 and not needs_inittable;
             end;
         end;
@@ -3392,6 +3395,23 @@ implementation
       end;
 
 
+    function tabstractrecorddef.contains_float_field: boolean;
+      var
+        i : longint;
+      begin
+        result:=true;
+        for i:=0 to symtable.symlist.count-1 do
+          begin
+            if tsym(symtable.symlist[i]).typ<>fieldvarsym then
+              continue;
+            if assigned(tfieldvarsym(symtable.symlist[i]).vardef) and
+              tstoreddef(tfieldvarsym(symtable.symlist[i]).vardef).is_fpuregable then
+              exit;
+          end;
+        result:=false;
+      end;
+
+
 {***************************************************************************
                                   trecorddef
 ***************************************************************************}