Jelajahi Sumber

* clean usercode_entry flag from outer block when copying a subroutine node tree for inlining, enables sometimes better inlining

git-svn-id: trunk@29627 -
florian 10 tahun lalu
induk
melakukan
d6bfb29313
1 mengubah file dengan 13 tambahan dan 0 penghapusan
  1. 13 0
      compiler/ncal.pas

+ 13 - 0
compiler/ncal.pas

@@ -4194,6 +4194,18 @@ implementation
       end;
 
 
+    { this procedure removes the user code flag because it prevents optimizations }
+    function removeusercodeflag(var n : tnode; arg : pointer) : foreachnoderesult;
+      begin
+        result:=fen_false;
+        if nf_usercode_entry in n.flags then
+          begin
+            exclude(n.flags,nf_usercode_entry);
+            result:=fen_norecurse_true;
+          end;
+      end;
+
+
     function tcallnode.pass1_inline:tnode;
       var
         n,
@@ -4230,6 +4242,7 @@ implementation
 
         { create a copy of the body and replace parameter loads with the parameter values }
         body:=tprocdef(procdefinition).inlininginfo^.code.getcopy;
+        foreachnodestatic(pm_postprocess,body,@removeusercodeflag,nil);
         foreachnode(pm_preprocess,body,@replaceparaload,@fileinfo);
 
         { Concat the body and finalization parts }