+ inline subroutines with formal parameters as well

git-svn-id: trunk@47214 -
This commit is contained in:
florian 2020-10-26 22:18:03 +00:00
parent b864cc4723
commit 3baddff71e
2 changed files with 7 additions and 12 deletions

View File

@ -4734,6 +4734,10 @@ implementation
if para.parasym.varspez in [vs_var,vs_out] then
exit(false);
{ We cannot create a formaldef temp and assign something to it }
if para.parasym.vardef.typ=formaldef then
exit(false);
{ We don't need temps for parameters that are already temps, except if
the passed temp could be put in a regvar while the parameter inside
the routine cannot be (e.g., because its address is taken in the
@ -4751,10 +4755,6 @@ implementation
not(para.left.expectloc in [LOC_REFERENCE,LOC_CREFERENCE]) then
exit(true);
{ We cannot create a formaldef temp and assign something to it }
if para.parasym.vardef.typ=formaldef then
exit(false);
{ We try to handle complex expressions later by taking their address
and storing this address in a temp (which is then dereferenced when
the value is used; that doesn't work if we cannot take the address
@ -4912,6 +4912,9 @@ implementation
result:=true;
end
{ for formaldefs, we do not need a temp., but it must be inherited if they are not regable }
else if (para.parasym.vardef.typ=formaldef) and not(tparavarsym(para.parasym).is_regvar(false)) then
make_not_regable(para.left,[ra_addr_regable]);
end;

View File

@ -237,14 +237,6 @@ implementation
begin
currpara:=tparavarsym(procdef.paras[i]);
case currpara.vardef.typ of
formaldef :
begin
if (currpara.varspez in [vs_out,vs_var,vs_const,vs_constref]) then
begin
_no_inline('formal parameter');
exit;
end;
end;
arraydef :
begin
if is_array_of_const(currpara.vardef) or