mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-12 20:29:23 +02:00
* do not set the addr taken flag for nodes to passed to const/var/out parameters, if
the code of the callee is known and within the callee no address of the parameters is taken
This commit is contained in:
parent
37b7835b12
commit
b2892adebf
@ -1385,10 +1385,16 @@ implementation
|
|||||||
begin
|
begin
|
||||||
{ compilerprocs never capture the address of their
|
{ compilerprocs never capture the address of their
|
||||||
parameters }
|
parameters }
|
||||||
if not(po_compilerproc in aktcallnode.procdefinition.procoptions) then
|
if (po_compilerproc in aktcallnode.procdefinition.procoptions) or
|
||||||
make_not_regable(left,[ra_addr_regable,ra_addr_taken])
|
{ if we handled already the proc. body and it is not inlined,
|
||||||
else
|
we can propagate the information if the address of a parameter is taken or not }
|
||||||
|
((aktcallnode.procdefinition.typ=procdef) and
|
||||||
|
not(po_inline in tprocdef(aktcallnode.procdefinition).procoptions) and
|
||||||
|
(tprocdef(aktcallnode.procdefinition).is_implemented) and
|
||||||
|
not(parasym.addr_taken)) then
|
||||||
make_not_regable(left,[ra_addr_regable])
|
make_not_regable(left,[ra_addr_regable])
|
||||||
|
else
|
||||||
|
make_not_regable(left,[ra_addr_regable,ra_addr_taken]);
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
case parasym.varspez of
|
case parasym.varspez of
|
||||||
@ -1400,10 +1406,16 @@ implementation
|
|||||||
set_varstate(left,vs_readwritten,[]);
|
set_varstate(left,vs_readwritten,[]);
|
||||||
{ compilerprocs never capture the address of their
|
{ compilerprocs never capture the address of their
|
||||||
parameters }
|
parameters }
|
||||||
if not(po_compilerproc in aktcallnode.procdefinition.procoptions) then
|
if (po_compilerproc in aktcallnode.procdefinition.procoptions) or
|
||||||
make_not_regable(left,[ra_addr_regable,ra_addr_taken])
|
{ if we handled already the proc. body and it is not inlined,
|
||||||
else
|
we can propagate the information if the address of a parameter is taken or not }
|
||||||
|
((aktcallnode.procdefinition.typ=procdef) and
|
||||||
|
not(po_inline in tprocdef(aktcallnode.procdefinition).procoptions) and
|
||||||
|
(tprocdef(aktcallnode.procdefinition).is_implemented) and
|
||||||
|
not(parasym.addr_taken)) then
|
||||||
make_not_regable(left,[ra_addr_regable])
|
make_not_regable(left,[ra_addr_regable])
|
||||||
|
else
|
||||||
|
make_not_regable(left,[ra_addr_regable,ra_addr_taken]);
|
||||||
end;
|
end;
|
||||||
vs_var,
|
vs_var,
|
||||||
vs_constref:
|
vs_constref:
|
||||||
@ -1411,10 +1423,16 @@ implementation
|
|||||||
set_varstate(left,vs_readwritten,[vsf_must_be_valid,vsf_use_hints]);
|
set_varstate(left,vs_readwritten,[vsf_must_be_valid,vsf_use_hints]);
|
||||||
{ compilerprocs never capture the address of their
|
{ compilerprocs never capture the address of their
|
||||||
parameters }
|
parameters }
|
||||||
if not(po_compilerproc in aktcallnode.procdefinition.procoptions) then
|
if (po_compilerproc in aktcallnode.procdefinition.procoptions) or
|
||||||
make_not_regable(left,[ra_addr_regable,ra_addr_taken])
|
{ if we handled already the proc. body and it is not inlined,
|
||||||
else
|
we can propagate the information if the address of a parameter is taken or not }
|
||||||
|
((aktcallnode.procdefinition.typ=procdef) and
|
||||||
|
not(po_inline in tprocdef(aktcallnode.procdefinition).procoptions) and
|
||||||
|
(tprocdef(aktcallnode.procdefinition).is_implemented) and
|
||||||
|
not(parasym.addr_taken)) then
|
||||||
make_not_regable(left,[ra_addr_regable])
|
make_not_regable(left,[ra_addr_regable])
|
||||||
|
else
|
||||||
|
make_not_regable(left,[ra_addr_regable,ra_addr_taken]);
|
||||||
end;
|
end;
|
||||||
else
|
else
|
||||||
set_varstate(left,vs_read,[vsf_must_be_valid]);
|
set_varstate(left,vs_read,[vsf_must_be_valid]);
|
||||||
|
Loading…
Reference in New Issue
Block a user