|
@@ -3272,29 +3272,52 @@ implementation
|
|
newstatement : tstatementnode;
|
|
newstatement : tstatementnode;
|
|
temp : ttempcreatenode;
|
|
temp : ttempcreatenode;
|
|
begin
|
|
begin
|
|
- { add two var sets }
|
|
|
|
- result:=internalstatements(newstatement);
|
|
|
|
-
|
|
|
|
- { create temp for result }
|
|
|
|
- temp:=ctempcreatenode.create(resultdef,resultdef.size,tt_persistent,true);
|
|
|
|
- addstatement(newstatement,temp);
|
|
|
|
-
|
|
|
|
- addstatement(newstatement,ccallnode.createintern(n,
|
|
|
|
- ccallparanode.create(cordconstnode.create(resultdef.size,sinttype,false),
|
|
|
|
- ccallparanode.create(ctemprefnode.create(temp),
|
|
|
|
- ccallparanode.create(right,
|
|
|
|
- ccallparanode.create(left,nil)))))
|
|
|
|
- );
|
|
|
|
-
|
|
|
|
- { remove reused parts from original node }
|
|
|
|
- left:=nil;
|
|
|
|
- right:=nil;
|
|
|
|
- { the last statement should return the value as
|
|
|
|
- location and type, this is done be referencing the
|
|
|
|
- temp and converting it first from a persistent temp to
|
|
|
|
- normal temp }
|
|
|
|
- addstatement(newstatement,ctempdeletenode.create_normal_temp(temp));
|
|
|
|
- addstatement(newstatement,ctemprefnode.create(temp));
|
|
|
|
|
|
+ { directly load the result set into the assignee if possible }
|
|
|
|
+ if assigned(aktassignmentnode) and
|
|
|
|
+ (aktassignmentnode.right=self) and
|
|
|
|
+ (aktassignmentnode.left.resultdef=resultdef) and
|
|
|
|
+ valid_for_var(aktassignmentnode.left,false) then
|
|
|
|
+ begin
|
|
|
|
+ result:=ccallnode.createintern(n,
|
|
|
|
+ ccallparanode.create(cordconstnode.create(resultdef.size,sinttype,false),
|
|
|
|
+ ccallparanode.create(aktassignmentnode.left.getcopy,
|
|
|
|
+ ccallparanode.create(right,
|
|
|
|
+ ccallparanode.create(left,nil))))
|
|
|
|
+ );
|
|
|
|
+
|
|
|
|
+ { remove reused parts from original node }
|
|
|
|
+ left:=nil;
|
|
|
|
+ right:=nil;
|
|
|
|
+
|
|
|
|
+ include(aktassignmentnode.flags,nf_assign_done_in_right);
|
|
|
|
+ firstpass(result);
|
|
|
|
+ end
|
|
|
|
+ else
|
|
|
|
+ begin
|
|
|
|
+ { add two var sets }
|
|
|
|
+ result:=internalstatements(newstatement);
|
|
|
|
+
|
|
|
|
+ { create temp for result }
|
|
|
|
+ temp:=ctempcreatenode.create(resultdef,resultdef.size,tt_persistent,true);
|
|
|
|
+ addstatement(newstatement,temp);
|
|
|
|
+
|
|
|
|
+ addstatement(newstatement,ccallnode.createintern(n,
|
|
|
|
+ ccallparanode.create(cordconstnode.create(resultdef.size,sinttype,false),
|
|
|
|
+ ccallparanode.create(ctemprefnode.create(temp),
|
|
|
|
+ ccallparanode.create(right,
|
|
|
|
+ ccallparanode.create(left,nil)))))
|
|
|
|
+ );
|
|
|
|
+
|
|
|
|
+ { remove reused parts from original node }
|
|
|
|
+ left:=nil;
|
|
|
|
+ right:=nil;
|
|
|
|
+ { the last statement should return the value as
|
|
|
|
+ location and type, this is done be referencing the
|
|
|
|
+ temp and converting it first from a persistent temp to
|
|
|
|
+ normal temp }
|
|
|
|
+ addstatement(newstatement,ctempdeletenode.create_normal_temp(temp));
|
|
|
|
+ addstatement(newstatement,ctemprefnode.create(temp));
|
|
|
|
+ end;
|
|
end;
|
|
end;
|
|
|
|
|
|
var
|
|
var
|