Browse Source

* don't try to create cse on void resultdefs, resolves #16488

git-svn-id: trunk@15363 -
florian 15 năm trước cách đây
mục cha
commit
84590d67b0
1 tập tin đã thay đổi với 14 bổ sung0 xóa
  1. 14 0
      compiler/optcse.pas

+ 14 - 0
compiler/optcse.pas

@@ -123,6 +123,8 @@ unit optcse;
           assigned(n.resultdef) and (tstoreddef(n.resultdef).is_intregable or tstoreddef(n.resultdef).is_fpuregable) and
           assigned(n.resultdef) 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
+          { same for voiddef }
+          not(is_void(n.resultdef)) and
           { adding tempref nodes is worthless but their complexity is probably <= 1 anyways }
           { adding tempref nodes is worthless but their complexity is probably <= 1 anyways }
           not(n.nodetype in [temprefn]) and
           not(n.nodetype in [temprefn]) and
 
 
@@ -240,13 +242,21 @@ unit optcse;
                         def:=tstoreddef(tnode(lists.nodelist[i]).resultdef);
                         def:=tstoreddef(tnode(lists.nodelist[i]).resultdef);
                         templist[i]:=ctempcreatenode.create_value(def,def.size,tt_persistent,
                         templist[i]:=ctempcreatenode.create_value(def,def.size,tt_persistent,
                           def.is_intregable or def.is_fpuregable,tnode(lists.nodelist[i]));
                           def.is_intregable or def.is_fpuregable,tnode(lists.nodelist[i]));
+                        { make debugging easier and set temp. location to the original location }
+                        tnode(templist[i]).fileinfo:=tnode(lists.nodelist[i]).fileinfo;
+
                         addstatement(creates,tnode(templist[i]));
                         addstatement(creates,tnode(templist[i]));
+                        { make debugging easier and set temp. location to the original location }
+                        creates.fileinfo:=tnode(lists.nodelist[i]).fileinfo;
 
 
                         hp:=ttempcreatenode(templist[i]);
                         hp:=ttempcreatenode(templist[i]);
                         do_firstpass(tnode(hp));
                         do_firstpass(tnode(hp));
                         templist[i]:=hp;
                         templist[i]:=hp;
 
 
                         pnode(lists.locationlist[i])^:=ctemprefnode.create(ttempcreatenode(templist[i]));
                         pnode(lists.locationlist[i])^:=ctemprefnode.create(ttempcreatenode(templist[i]));
+                        { make debugging easier and set temp. location to the original location }
+                        pnode(lists.locationlist[i])^.fileinfo:=tnode(lists.nodelist[i]).fileinfo;
+
                         do_firstpass(pnode(lists.locationlist[i])^);
                         do_firstpass(pnode(lists.locationlist[i])^);
 {$ifdef csedebug}
 {$ifdef csedebug}
                         printnode(output,statements);
                         printnode(output,statements);
@@ -262,6 +272,10 @@ unit optcse;
 {$endif defined(csedebug) or defined(csestats)}
 {$endif defined(csedebug) or defined(csestats)}
                         templist[i]:=templist[ptrint(lists.equalto[i])];
                         templist[i]:=templist[ptrint(lists.equalto[i])];
                         pnode(lists.locationlist[i])^:=ctemprefnode.create(ttempcreatenode(templist[ptrint(lists.equalto[i])]));
                         pnode(lists.locationlist[i])^:=ctemprefnode.create(ttempcreatenode(templist[ptrint(lists.equalto[i])]));
+
+                        { make debugging easier and set temp. location to the original location }
+                        pnode(lists.locationlist[i])^.fileinfo:=tnode(lists.nodelist[i]).fileinfo;
+
                         do_firstpass(pnode(lists.locationlist[i])^);
                         do_firstpass(pnode(lists.locationlist[i])^);
                       end;
                       end;
                   end;
                   end;