* removed ret_in_acc, it's the reverse of ret_in_param

* fixed ret_in_param for win32 cdecl array
This commit is contained in:
peter 2003-05-13 15:16:13 +00:00
parent ff172b6b2d
commit c577c78366
3 changed files with 37 additions and 40 deletions

View File

@ -40,7 +40,6 @@ unit cpupara;
rtl are used. rtl are used.
} }
ti386paramanager = class(tparamanager) ti386paramanager = class(tparamanager)
function ret_in_acc(def : tdef;calloption : tproccalloption) : boolean;override;
function ret_in_param(def : tdef;calloption : tproccalloption) : boolean;override; function ret_in_param(def : tdef;calloption : tproccalloption) : boolean;override;
function push_addr_param(def : tdef;calloption : tproccalloption) : boolean;override; function push_addr_param(def : tdef;calloption : tproccalloption) : boolean;override;
function getintparaloc(nr : longint) : tparalocation;override; function getintparaloc(nr : longint) : tparalocation;override;
@ -55,28 +54,29 @@ unit cpupara;
symconst, symconst,
cginfo; cginfo;
function ti386paramanager.ret_in_acc(def : tdef;calloption : tproccalloption) : boolean;
begin
{ Win32 returns small records in the accumulator }
if ((target_info.system=system_i386_win32) and
(calloption=pocall_stdcall) and
(def.deftype=recorddef) and (def.size<=8)) then
result:=true
else
result:=inherited ret_in_acc(def,calloption);
end;
function ti386paramanager.ret_in_param(def : tdef;calloption : tproccalloption) : boolean; function ti386paramanager.ret_in_param(def : tdef;calloption : tproccalloption) : boolean;
begin begin
{ Win32 returns small records in the accumulator } case target_info.system of
if ((target_info.system=system_i386_win32) and system_i386_win32 :
(calloption=pocall_stdcall) and begin
(def.deftype=recorddef) and (def.size<=8)) then { Win32 returns small records in the accumulator }
result:=false case def.deftype of
else recorddef :
result:=inherited ret_in_param(def,calloption); begin
if (calloption in [pocall_stdcall,pocall_cdecl,pocall_cppdecl]) and (def.size<=8) then
begin
result:=false;
exit;
end;
end;
end;
end;
end;
result:=inherited ret_in_param(def,calloption);
end; end;
function ti386paramanager.push_addr_param(def : tdef;calloption : tproccalloption) : boolean; function ti386paramanager.push_addr_param(def : tdef;calloption : tproccalloption) : boolean;
begin begin
case target_info.system of case target_info.system of
@ -96,7 +96,7 @@ unit cpupara;
if (tarraydef(def).highrange>=tarraydef(def).lowrange) and if (tarraydef(def).highrange>=tarraydef(def).lowrange) and
(calloption in [pocall_cdecl,pocall_cppdecl]) then (calloption in [pocall_cdecl,pocall_cppdecl]) then
begin begin
result:=false; result:=true;
exit; exit;
end; end;
end; end;
@ -133,7 +133,11 @@ begin
end. end.
{ {
$Log$ $Log$
Revision 1.10 2003-04-22 23:50:23 peter Revision 1.11 2003-05-13 15:16:13 peter
* removed ret_in_acc, it's the reverse of ret_in_param
* fixed ret_in_param for win32 cdecl array
Revision 1.10 2003/04/22 23:50:23 peter
* firstpass uses expectloc * firstpass uses expectloc
* checks if there are differences between the expectloc and * checks if there are differences between the expectloc and
location.loc from secondpass in EXTDEBUG location.loc from secondpass in EXTDEBUG

View File

@ -1206,7 +1206,7 @@ implementation
end; end;
else else
begin begin
if paramanager.ret_in_acc(current_procdef.rettype.def,current_procdef.proccalloption) then if not paramanager.ret_in_param(current_procdef.rettype.def,current_procdef.proccalloption) then
begin begin
uses_acc:=true; uses_acc:=true;
r.enum:=R_INTREGISTER; r.enum:=R_INTREGISTER;
@ -1276,7 +1276,7 @@ implementation
else else
begin begin
r.enum:=accumulator; r.enum:=accumulator;
if paramanager.ret_in_acc(current_procdef.rettype.def,current_procdef.proccalloption) then if not paramanager.ret_in_param(current_procdef.rettype.def,current_procdef.proccalloption) then
cg.a_load_reg_ref(list,cgsize,r,href); cg.a_load_reg_ref(list,cgsize,r,href);
end; end;
end; end;
@ -1850,7 +1850,11 @@ implementation
end. end.
{ {
$Log$ $Log$
Revision 1.100 2003-05-12 08:08:27 jonas Revision 1.101 2003-05-13 15:16:13 peter
* removed ret_in_acc, it's the reverse of ret_in_param
* fixed ret_in_param for win32 cdecl array
Revision 1.100 2003/05/12 08:08:27 jonas
* fixed several initialization and finalization related bugs (missing * fixed several initialization and finalization related bugs (missing
tg.direction's, wrong paralocation for decreasing refcount of tg.direction's, wrong paralocation for decreasing refcount of
everything but ansistrings) everything but ansistrings)

View File

@ -38,9 +38,6 @@ unit paramgr;
parameters. It should be overriden for each new processor parameters. It should be overriden for each new processor
} }
tparamanager = class tparamanager = class
{# Returns true if the return value can be put in accumulator }
function ret_in_acc(def : tdef;calloption : tproccalloption) : boolean;virtual;
{# Returns true if the return value is actually a parameter {# Returns true if the return value is actually a parameter
pointer. pointer.
} }
@ -115,18 +112,6 @@ unit paramgr;
rgobj, rgobj,
defutil,cgbase,cginfo,verbose; defutil,cgbase,cginfo,verbose;
{ true if the return value is in accumulator (EAX for i386), D0 for 68k }
function tparamanager.ret_in_acc(def : tdef;calloption : tproccalloption) : boolean;
begin
ret_in_acc:=(def.deftype in [pointerdef,enumdef,classrefdef]) or
((def.deftype=orddef) and (torddef(def).typ<>uvoid)) or
((def.deftype=stringdef) and (tstringdef(def).string_typ in [st_ansistring,st_widestring])) or
((def.deftype=procvardef) and not(po_methodpointer in tprocvardef(def).procoptions)) or
((def.deftype=objectdef) and not is_object(def)) or
((def.deftype=setdef) and (tsetdef(def).settype=smallset));
end;
{ true if uses a parameter as return value } { true if uses a parameter as return value }
function tparamanager.ret_in_param(def : tdef;calloption : tproccalloption) : boolean; function tparamanager.ret_in_param(def : tdef;calloption : tproccalloption) : boolean;
begin begin
@ -299,7 +284,7 @@ unit paramgr;
end; end;
else else
begin begin
if ret_in_acc(def,calloption) then if not ret_in_param(def,calloption) then
begin begin
result.loc := LOC_REGISTER; result.loc := LOC_REGISTER;
result.register.enum := accumulator; result.register.enum := accumulator;
@ -403,7 +388,11 @@ end.
{ {
$Log$ $Log$
Revision 1.37 2003-04-30 22:15:59 florian Revision 1.38 2003-05-13 15:16:13 peter
* removed ret_in_acc, it's the reverse of ret_in_param
* fixed ret_in_param for win32 cdecl array
Revision 1.37 2003/04/30 22:15:59 florian
* some 64 bit adaptions in ncgadd * some 64 bit adaptions in ncgadd
* x86-64 now uses ncgadd * x86-64 now uses ncgadd
* tparamanager.ret_in_acc doesn't return true anymore for a void-def * tparamanager.ret_in_acc doesn't return true anymore for a void-def