* 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.
}
ti386paramanager = class(tparamanager)
function ret_in_acc(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 getintparaloc(nr : longint) : tparalocation;override;
@ -55,28 +54,29 @@ unit cpupara;
symconst,
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;
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:=false
else
result:=inherited ret_in_param(def,calloption);
case target_info.system of
system_i386_win32 :
begin
{ Win32 returns small records in the accumulator }
case def.deftype of
recorddef :
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;
function ti386paramanager.push_addr_param(def : tdef;calloption : tproccalloption) : boolean;
begin
case target_info.system of
@ -96,7 +96,7 @@ unit cpupara;
if (tarraydef(def).highrange>=tarraydef(def).lowrange) and
(calloption in [pocall_cdecl,pocall_cppdecl]) then
begin
result:=false;
result:=true;
exit;
end;
end;
@ -133,7 +133,11 @@ begin
end.
{
$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
* checks if there are differences between the expectloc and
location.loc from secondpass in EXTDEBUG

View File

@ -1206,7 +1206,7 @@ implementation
end;
else
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
uses_acc:=true;
r.enum:=R_INTREGISTER;
@ -1276,7 +1276,7 @@ implementation
else
begin
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);
end;
end;
@ -1850,7 +1850,11 @@ implementation
end.
{
$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
tg.direction's, wrong paralocation for decreasing refcount of
everything but ansistrings)

View File

@ -38,9 +38,6 @@ unit paramgr;
parameters. It should be overriden for each new processor
}
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
pointer.
}
@ -115,18 +112,6 @@ unit paramgr;
rgobj,
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 }
function tparamanager.ret_in_param(def : tdef;calloption : tproccalloption) : boolean;
begin
@ -299,7 +284,7 @@ unit paramgr;
end;
else
begin
if ret_in_acc(def,calloption) then
if not ret_in_param(def,calloption) then
begin
result.loc := LOC_REGISTER;
result.register.enum := accumulator;
@ -403,7 +388,11 @@ end.
{
$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
* x86-64 now uses ncgadd
* tparamanager.ret_in_acc doesn't return true anymore for a void-def