mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-04-13 14:49:47 +02:00
* more ABI compliant parameter passing
git-svn-id: trunk@46783 -
This commit is contained in:
parent
aea85fcd66
commit
243300c85f
@ -80,61 +80,28 @@ unit cpupara;
|
||||
|
||||
|
||||
function getparaloc(p : tdef) : tcgloc;
|
||||
|
||||
begin
|
||||
{ Later, the LOC_REFERENCE is in most cases changed into LOC_REGISTER
|
||||
if push_addr_param for the def is true
|
||||
}
|
||||
case p.typ of
|
||||
orddef:
|
||||
result:=LOC_REGISTER;
|
||||
floatdef:
|
||||
result:=LOC_REGISTER;
|
||||
enumdef:
|
||||
result:=LOC_REGISTER;
|
||||
pointerdef:
|
||||
result:=LOC_REGISTER;
|
||||
formaldef:
|
||||
result:=LOC_REGISTER;
|
||||
classrefdef:
|
||||
result:=LOC_REGISTER;
|
||||
procvardef:
|
||||
result:=LOC_REGISTER;
|
||||
recorddef:
|
||||
if p.size>24 then
|
||||
result:=LOC_REFERENCE
|
||||
else
|
||||
result:=LOC_REGISTER;
|
||||
objectdef:
|
||||
if is_object(p) and (p.size>24) then
|
||||
result:=LOC_REFERENCE
|
||||
else
|
||||
result:=LOC_REGISTER;
|
||||
stringdef:
|
||||
if is_shortstring(p) or is_longstring(p) then
|
||||
result:=LOC_REFERENCE
|
||||
else
|
||||
result:=LOC_REGISTER;
|
||||
filedef:
|
||||
result:=LOC_REGISTER;
|
||||
arraydef:
|
||||
if is_dynamic_array(p) or (p.size<=24) then
|
||||
getparaloc:=LOC_REGISTER
|
||||
else
|
||||
result:=LOC_REFERENCE;
|
||||
setdef:
|
||||
if is_smallset(p) then
|
||||
result:=LOC_REGISTER
|
||||
else
|
||||
result:=LOC_REFERENCE;
|
||||
variantdef:
|
||||
result:=LOC_REGISTER;
|
||||
{ avoid problems with errornous definitions }
|
||||
errordef:
|
||||
result:=LOC_REGISTER;
|
||||
else
|
||||
internalerror(2020082501);
|
||||
end;
|
||||
case p.typ of
|
||||
orddef,
|
||||
floatdef,
|
||||
enumdef,
|
||||
pointerdef,
|
||||
formaldef,
|
||||
classrefdef,
|
||||
procvardef,
|
||||
recorddef,
|
||||
objectdef,
|
||||
stringdef,
|
||||
filedef,
|
||||
arraydef,
|
||||
setdef,
|
||||
variantdef,
|
||||
{ avoid problems with errornous definitions }
|
||||
errordef:
|
||||
result:=LOC_REGISTER;
|
||||
else
|
||||
internalerror(2020082501);
|
||||
end;
|
||||
end;
|
||||
|
||||
|
||||
@ -379,7 +346,7 @@ unit cpupara;
|
||||
|
||||
locpara:=getparaloc(paradef);
|
||||
|
||||
if (locpara=LOC_REGISTER) and ((maxintreg-curintreg+1)*4<paradef.size) then
|
||||
if (maxintreg-curintreg+1)*4<paralen then
|
||||
begin
|
||||
locpara:=LOC_REFERENCE;
|
||||
curintreg:=maxintreg+1;
|
||||
@ -389,7 +356,7 @@ unit cpupara;
|
||||
loc.size:=paracgsize;
|
||||
loc.intsize:=paralen;
|
||||
loc.def:=paradef;
|
||||
if (locpara=LOC_REGISTER) and (is_64bit(paradef)) and
|
||||
if (locpara=LOC_REGISTER) and (paradef.alignment>4) and
|
||||
odd(curintreg-RS_A2) then
|
||||
inc(curintreg);
|
||||
if (paralen = 0) then
|
||||
@ -455,6 +422,7 @@ unit cpupara;
|
||||
else
|
||||
paraloc^.reference.index:=current_procinfo.framepointer;
|
||||
|
||||
cur_stack_offset:=align(cur_stack_offset,paradef.alignment);
|
||||
paraloc^.reference.offset:=cur_stack_offset;
|
||||
|
||||
inc(cur_stack_offset,align(paralen,4));
|
||||
|
Loading…
Reference in New Issue
Block a user