mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-25 12:29:25 +02:00
+ nf_addr_taken: it marks nodes which address is taken
+ check if tnodeflags is 4 bytes or less * do not do cse on expressions which address is taken git-svn-id: trunk@26713 -
This commit is contained in:
parent
8db439a027
commit
1366498255
1
.gitattributes
vendored
1
.gitattributes
vendored
@ -10158,6 +10158,7 @@ tests/tbs/tb0599.pp svneol=native#text/plain
|
|||||||
tests/tbs/tb0600.pp svneol=native#text/plain
|
tests/tbs/tb0600.pp svneol=native#text/plain
|
||||||
tests/tbs/tb0601.pp svneol=native#text/pascal
|
tests/tbs/tb0601.pp svneol=native#text/pascal
|
||||||
tests/tbs/tb0602.pp svneol=native#text/plain
|
tests/tbs/tb0602.pp svneol=native#text/plain
|
||||||
|
tests/tbs/tb0603.pp svneol=native#text/pascal
|
||||||
tests/tbs/tb205.pp svneol=native#text/plain
|
tests/tbs/tb205.pp svneol=native#text/plain
|
||||||
tests/tbs/tbs0594.pp svneol=native#text/pascal
|
tests/tbs/tbs0594.pp svneol=native#text/pascal
|
||||||
tests/tbs/ub0060.pp svneol=native#text/plain
|
tests/tbs/ub0060.pp svneol=native#text/plain
|
||||||
|
@ -974,6 +974,8 @@ implementation
|
|||||||
{ marks an lvalue as "unregable" }
|
{ marks an lvalue as "unregable" }
|
||||||
procedure make_not_regable_intern(p : tnode; how: tregableinfoflags; records_only: boolean);
|
procedure make_not_regable_intern(p : tnode; how: tregableinfoflags; records_only: boolean);
|
||||||
begin
|
begin
|
||||||
|
if ra_addr_taken in how then
|
||||||
|
include(p.flags,nf_address_taken);
|
||||||
repeat
|
repeat
|
||||||
case p.nodetype of
|
case p.nodetype of
|
||||||
subscriptn:
|
subscriptn:
|
||||||
|
@ -3748,7 +3748,7 @@ implementation
|
|||||||
begin
|
begin
|
||||||
temp:=paras.left.getcopy;
|
temp:=paras.left.getcopy;
|
||||||
{ inherit modification information, this is needed by the dfa/cse }
|
{ inherit modification information, this is needed by the dfa/cse }
|
||||||
temp.flags:=temp.flags+(n.flags*[nf_modify,nf_write]);
|
temp.flags:=temp.flags+(n.flags*[nf_modify,nf_write,nf_address_taken]);
|
||||||
n.free;
|
n.free;
|
||||||
n:=temp;
|
n:=temp;
|
||||||
typecheckpass(n);
|
typecheckpass(n);
|
||||||
@ -3766,7 +3766,7 @@ implementation
|
|||||||
internalerror(20040720);
|
internalerror(20040720);
|
||||||
temp := tnode(inlinelocals[indexnr]).getcopy;
|
temp := tnode(inlinelocals[indexnr]).getcopy;
|
||||||
{ inherit modification information, this is needed by the dfa/cse }
|
{ inherit modification information, this is needed by the dfa/cse }
|
||||||
temp.flags:=temp.flags+(n.flags*[nf_modify,nf_write]);
|
temp.flags:=temp.flags+(n.flags*[nf_modify,nf_write,nf_address_taken]);
|
||||||
n.free;
|
n.free;
|
||||||
n:=temp;
|
n:=temp;
|
||||||
typecheckpass(n);
|
typecheckpass(n);
|
||||||
|
@ -219,6 +219,8 @@ interface
|
|||||||
nf_write,
|
nf_write,
|
||||||
{ Node is modified }
|
{ Node is modified }
|
||||||
nf_modify,
|
nf_modify,
|
||||||
|
{ address of node is taken }
|
||||||
|
nf_address_taken,
|
||||||
nf_is_funcret,
|
nf_is_funcret,
|
||||||
nf_isproperty,
|
nf_isproperty,
|
||||||
nf_processing,
|
nf_processing,
|
||||||
@ -1317,9 +1319,12 @@ implementation
|
|||||||
|
|
||||||
begin
|
begin
|
||||||
{$push}{$warnings off}
|
{$push}{$warnings off}
|
||||||
{ tvaroption should fit into a 4 byte set for speed reasons }
|
{ tvaroption must fit into a 4 byte set for speed reasons }
|
||||||
if ord(high(tvaroption))>31 then
|
if ord(high(tvaroption))>31 then
|
||||||
internalerror(201110301);
|
internalerror(201110301);
|
||||||
|
{ tnodeflags must fit into a 4 byte set for speed reasons }
|
||||||
|
if ord(high(tnodeflags))>31 then
|
||||||
|
internalerror(2014020701);
|
||||||
{$pop}
|
{$pop}
|
||||||
end.
|
end.
|
||||||
|
|
||||||
|
@ -151,7 +151,7 @@ unit optcse;
|
|||||||
assigned(n.resultdef) and
|
assigned(n.resultdef) and
|
||||||
(
|
(
|
||||||
{ regable expressions }
|
{ regable expressions }
|
||||||
(actualtargetnode(@n)^.flags*[nf_write,nf_modify]=[]) and
|
(actualtargetnode(@n)^.flags*[nf_write,nf_modify,nf_address_taken]=[]) and
|
||||||
((tstoreddef(n.resultdef).is_intregable or tstoreddef(n.resultdef).is_fpuregable) and
|
((tstoreddef(n.resultdef).is_intregable or tstoreddef(n.resultdef).is_fpuregable) and
|
||||||
{ is_int/fpuregable allows arrays and records to be in registers, cse cannot handle this }
|
{ is_int/fpuregable allows arrays and records to be in registers, cse cannot handle this }
|
||||||
(not(n.resultdef.typ in [arraydef,recorddef])) and
|
(not(n.resultdef.typ in [arraydef,recorddef])) and
|
||||||
|
@ -86,7 +86,7 @@ unit optloop;
|
|||||||
((n.nodetype=temprefn) and (preplaceinfo(arg)^.node.nodetype=temprefn) and
|
((n.nodetype=temprefn) and (preplaceinfo(arg)^.node.nodetype=temprefn) and
|
||||||
(ttemprefnode(n).tempinfo=ttemprefnode(preplaceinfo(arg)^.node).tempinfo)) then
|
(ttemprefnode(n).tempinfo=ttemprefnode(preplaceinfo(arg)^.node).tempinfo)) then
|
||||||
begin
|
begin
|
||||||
if n.flags*[nf_modify,nf_write]<>[] then
|
if n.flags*[nf_modify,nf_write,nf_address_taken]<>[] then
|
||||||
internalerror(2012090402);
|
internalerror(2012090402);
|
||||||
n.free;
|
n.free;
|
||||||
n:=cordconstnode.create(preplaceinfo(arg)^.value,preplaceinfo(arg)^.node.resultdef,false);
|
n:=cordconstnode.create(preplaceinfo(arg)^.value,preplaceinfo(arg)^.node.resultdef,false);
|
||||||
|
8
tests/tbs/tb0603.pp
Normal file
8
tests/tbs/tb0603.pp
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
{ %OPT=-O3 }
|
||||||
|
{ %norun }
|
||||||
|
program test4;
|
||||||
|
var
|
||||||
|
S : ansistring;
|
||||||
|
begin
|
||||||
|
writeln((PByte(@S[1])^ = $1) or (S[1] = '.'));
|
||||||
|
end.
|
Loading…
Reference in New Issue
Block a user