Ver código fonte

* fixed passing of fpu values by fpu register

florian 22 anos atrás
pai
commit
b5d749d24d
2 arquivos alterados com 50 adições e 27 exclusões
  1. 16 1
      compiler/cgobj.pas
  2. 34 26
      compiler/ncgutil.pas

+ 16 - 1
compiler/cgobj.pas

@@ -210,6 +210,7 @@ unit cgobj;
           procedure a_loadfpu_loc_reg(list: taasmoutput; const loc: tlocation; const reg: tregister);
           procedure a_loadfpu_reg_loc(list: taasmoutput; size: tcgsize; const reg: tregister; const loc: tlocation);
           procedure a_paramfpu_reg(list : taasmoutput;size : tcgsize;const r : tregister;const locpara : tparalocation);virtual;
+          procedure a_paramfpu_ref(list : taasmoutput;size : tcgsize;const ref : treference;const locpara : tparalocation);virtual;
 
           { vector register move instructions }
           procedure a_loadmm_reg_reg(list: taasmoutput; reg1, reg2: tregister); virtual; abstract;
@@ -996,6 +997,17 @@ unit cgobj;
       end;
 
 
+    procedure tcg.a_paramfpu_ref(list : taasmoutput;size : tcgsize;const ref : treference;const locpara : tparalocation);
+      var
+         hr : tregister;
+      begin
+         hr:=rg.getregisterfpu(list);
+         a_loadfpu_ref_reg(list,size,ref,hr);
+         a_paramfpu_reg(list,size,hr,locpara);
+         rg.ungetregisterfpu(list,hr);
+      end;
+
+
     procedure tcg.a_op_const_ref(list : taasmoutput; Op: TOpCG; size: TCGSize; a: AWord; const ref: TReference);
 
       var
@@ -1842,7 +1854,10 @@ finalization
 end.
 {
   $Log$
-  Revision 1.88  2003-04-23 20:16:03  peter
+  Revision 1.89  2003-04-26 17:21:08  florian
+    * fixed passing of fpu values by fpu register
+
+  Revision 1.88  2003/04/23 20:16:03  peter
     + added currency support based on int64
     + is_64bit for use in cg units instead of is_64bitint
     * removed cgmessage from n386add, replace with internalerrors

+ 34 - 26
compiler/ncgutil.pas

@@ -787,32 +787,37 @@ implementation
              LOC_REFERENCE,
              LOC_CREFERENCE :
                begin
-                 sizetopush:=align(p.resulttype.def.size,alignment);
-                 tempreference:=p.location.reference;
-                 inc(tempreference.offset,sizetopush);
-                 while (sizetopush>0) do
-                  begin
-                    if sizetopush>=4 then
-                     begin
-                       cgsize:=OS_32;
-                       inc(pushedparasize,4);
-                       dec(tempreference.offset,4);
-                       dec(sizetopush,4);
-                     end
-                    else
-                     begin
-                       cgsize:=OS_16;
-                       inc(pushedparasize,2);
-                       dec(tempreference.offset,2);
-                       dec(sizetopush,2);
+                 if locpara.loc=LOC_FPUREGISTER then
+                   cg.a_paramfpu_ref(list,def_cgsize(p.resulttype.def),p.location.reference,locpara)
+                 else
+                   begin
+                     sizetopush:=align(p.resulttype.def.size,alignment);
+                     tempreference:=p.location.reference;
+                     inc(tempreference.offset,sizetopush);
+                     while (sizetopush>0) do
+                      begin
+                        if sizetopush>=4 then
+                         begin
+                           cgsize:=OS_32;
+                           inc(pushedparasize,4);
+                           dec(tempreference.offset,4);
+                           dec(sizetopush,4);
+                         end
+                        else
+                         begin
+                           cgsize:=OS_16;
+                           inc(pushedparasize,2);
+                           dec(tempreference.offset,2);
+                           dec(sizetopush,2);
+                         end;
+                        if calloption=pocall_inline then
+                         begin
+                           reference_reset_base(href,procinfo.framepointer,para_offset-pushedparasize);
+                           cg.a_load_ref_ref(list,cgsize,tempreference,href);
+                         end
+                        else
+                         cg.a_param_ref(list,cgsize,tempreference,locpara);
                      end;
-                    if calloption=pocall_inline then
-                     begin
-                       reference_reset_base(href,procinfo.framepointer,para_offset-pushedparasize);
-                       cg.a_load_ref_ref(list,cgsize,tempreference,href);
-                     end
-                    else
-                     cg.a_param_ref(list,cgsize,tempreference,locpara);
                   end;
                end;
              else
@@ -2052,7 +2057,10 @@ implementation
 end.
 {
   $Log$
-  Revision 1.89  2003-04-25 20:59:33  peter
+  Revision 1.90  2003-04-26 17:21:08  florian
+    * fixed passing of fpu values by fpu register
+
+  Revision 1.89  2003/04/25 20:59:33  peter
     * removed funcretn,funcretsym, function result is now in varsym
       and aliases for result and function name are added using absolutesym
     * vs_hidden parameter for funcret passed in parameter