Browse Source

* x86_64-win64 returns structured types up to 8 bytes in rax

git-svn-id: trunk@5528 -
florian 18 years ago
parent
commit
4c2b412613
2 changed files with 4 additions and 6 deletions
  1. 1 1
      compiler/ncgutil.pas
  2. 3 5
      compiler/x86_64/cpupara.pas

+ 1 - 1
compiler/ncgutil.pas

@@ -1381,7 +1381,7 @@ implementation
                       if paramanager.ret_in_param(current_procinfo.procdef.returndef,current_procinfo.procdef.proccalloption) then
                       if paramanager.ret_in_param(current_procinfo.procdef.returndef,current_procinfo.procdef.proccalloption) then
                         cg.a_load_loc_reg(list,OS_ADDR,restmploc,hreg)
                         cg.a_load_loc_reg(list,OS_ADDR,restmploc,hreg)
                       else
                       else
-                      cg.a_load_loc_reg(list,restmploc.size,restmploc,hreg);
+                        cg.a_load_loc_reg(list,restmploc.size,restmploc,hreg);
                     end;
                     end;
                 end;
                 end;
               LOC_FPUREGISTER:
               LOC_FPUREGISTER:

+ 3 - 5
compiler/x86_64/cpupara.pas

@@ -169,11 +169,10 @@ unit cpupara;
 
 
 
 
     function tx86_64paramanager.ret_in_param(def : tdef;calloption : tproccalloption) : boolean;
     function tx86_64paramanager.ret_in_param(def : tdef;calloption : tproccalloption) : boolean;
-      var
-        size: longint;
       begin
       begin
-        if (target_info.system=system_x86_64_win64) and (calloption=pocall_safecall) then
-          result:=true
+        if target_info.system=system_x86_64_win64 then
+          result:=(calloption=pocall_safecall) or
+            not(def.size in [1,2,4,8])
         else
         else
           result:=inherited ret_in_param(def,calloption);
           result:=inherited ret_in_param(def,calloption);
       end;
       end;
@@ -314,7 +313,6 @@ unit cpupara;
           retcgsize:=OS_ADDR
           retcgsize:=OS_ADDR
         else
         else
           retcgsize:=def_cgsize(p.returndef);
           retcgsize:=def_cgsize(p.returndef);
-
         location_reset(p.funcretloc[side],LOC_INVALID,OS_NO);
         location_reset(p.funcretloc[side],LOC_INVALID,OS_NO);
         { void has no location }
         { void has no location }
         if is_void(p.returndef) then
         if is_void(p.returndef) then