mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-12 22:59:21 +02:00
* moved creating block/statement for reference temps into
maybereplacewithtempref() helper git-svn-id: branches/jvmbackend@18591 -
This commit is contained in:
parent
ad6ae44093
commit
4be0ba267a
@ -366,11 +366,11 @@ implementation
|
||||
{ start with org (save assignmenttarget itself to assign the result back to) }
|
||||
{ store left into a temp in case it may contain a function call
|
||||
(which must not be evaluated twice) }
|
||||
lefttemp:=maybereplacewithtempref(tcallparanode(left).left,tcallparanode(left).left.resultdef.size,false);
|
||||
newblock:=nil;
|
||||
newstatement:=nil;
|
||||
lefttemp:=maybereplacewithtempref(tcallparanode(left).left,newblock,newstatement,tcallparanode(left).left.resultdef.size,false);
|
||||
if assigned(lefttemp) then
|
||||
begin
|
||||
newblock:=internalstatements(newstatement);
|
||||
addstatement(newstatement,lefttemp);
|
||||
assignmenttarget:=ctemprefnode.create(lefttemp);
|
||||
typecheckpass(tnode(assignmenttarget));
|
||||
end
|
||||
@ -461,11 +461,11 @@ implementation
|
||||
stringtype:=tstringdef(left.resultdef);
|
||||
{ store left into a temp in case it may contain a function call
|
||||
(which must not be evaluated twice) }
|
||||
lefttemp:=maybereplacewithtempref(tcallparanode(left).left,stringtype.size,false);
|
||||
newblock:=nil;
|
||||
newstatement:=nil;
|
||||
lefttemp:=maybereplacewithtempref(tcallparanode(left).left,newblock,newstatement,stringtype.size,false);
|
||||
if assigned(lefttemp) then
|
||||
begin
|
||||
newblock:=internalstatements(newstatement);
|
||||
addstatement(newstatement,lefttemp);
|
||||
assignmenttarget:=ctemprefnode.create(lefttemp);
|
||||
typecheckpass(tnode(assignmenttarget));
|
||||
end
|
||||
|
@ -257,7 +257,7 @@ interface
|
||||
|
||||
{ if the complexity of n is "high", creates a reference temp to n's
|
||||
location and replace n with a ttemprefnode referring to that location }
|
||||
function maybereplacewithtempref(var n: tnode; size: ASizeInt; readonly: boolean): ttempcreatenode;
|
||||
function maybereplacewithtempref(var n: tnode; var block: tblocknode; var stat: tstatementnode; size: ASizeInt; readonly: boolean): ttempcreatenode;
|
||||
|
||||
implementation
|
||||
|
||||
@ -300,7 +300,7 @@ implementation
|
||||
end;
|
||||
|
||||
|
||||
function maybereplacewithtempref(var n: tnode; size: ASizeInt; readonly: boolean): ttempcreatenode;
|
||||
function maybereplacewithtempref(var n: tnode; var block: tblocknode; var stat: tstatementnode; size: ASizeInt; readonly: boolean): ttempcreatenode;
|
||||
begin
|
||||
result:=nil;
|
||||
if node_complexity(n) > 4 then
|
||||
@ -309,6 +309,9 @@ implementation
|
||||
typecheckpass(tnode(result));
|
||||
n:=ctemprefnode.create(result);
|
||||
typecheckpass(n);
|
||||
if not assigned(stat) then
|
||||
block:=internalstatements(stat);
|
||||
addstatement(stat,result)
|
||||
end;
|
||||
end;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user