Browse Source

* disable pass2inline

peter 20 years ago
parent
commit
959bdccc49
6 changed files with 141 additions and 74 deletions
  1. 75 52
      compiler/ncal.pas
  2. 20 2
      compiler/ncgbas.pas
  3. 23 5
      compiler/ncgcal.pas
  4. 8 2
      compiler/node.pas
  5. 8 1
      compiler/nutils.pas
  6. 7 12
      compiler/psub.pas

+ 75 - 52
compiler/ncal.pas

@@ -24,6 +24,8 @@ unit ncal;
 
 
 {$i fpcdefs.inc}
 {$i fpcdefs.inc}
 
 
+{ define NODEINLINE}
+
 interface
 interface
 
 
     uses
     uses
@@ -67,8 +69,9 @@ interface
           procedure order_parameters;
           procedure order_parameters;
 
 
           procedure createinlineparas(var createstatement, deletestatement: tstatementnode);
           procedure createinlineparas(var createstatement, deletestatement: tstatementnode);
-          function replaceparaload(var n: tnode; arg: pointer): foreachnoderesult;
+          function  replaceparaload(var n: tnode; arg: pointer): foreachnoderesult;
           procedure createlocaltemps(p:TNamedIndexItem;arg:pointer);
           procedure createlocaltemps(p:TNamedIndexItem;arg:pointer);
+          function  pass1_inline:tnode;
        protected
        protected
           pushedparasize : longint;
           pushedparasize : longint;
        public
        public
@@ -85,8 +88,10 @@ interface
           methodpointerinit,
           methodpointerinit,
           methodpointerdone : tblocknode;
           methodpointerdone : tblocknode;
           methodpointer  : tnode;
           methodpointer  : tnode;
+{$ifdef PASS2INLINE}
           { inline function body }
           { inline function body }
           inlinecode : tnode;
           inlinecode : tnode;
+{$endif PASS2INLINE}
           { varargs parasyms }
           { varargs parasyms }
           varargsparas : tvarargsparalist;
           varargsparas : tvarargsparalist;
           { node that specifies where the result should be put for calls }
           { node that specifies where the result should be put for calls }
@@ -707,7 +712,9 @@ type
          methodpointerdone:=nil;
          methodpointerdone:=nil;
          procdefinition:=nil;
          procdefinition:=nil;
          _funcretnode:=nil;
          _funcretnode:=nil;
+{$ifdef PASS2INLINE}
          inlinecode:=nil;
          inlinecode:=nil;
+{$endif PASS2INLINE}
          paralength:=-1;
          paralength:=-1;
          varargsparas:=nil;
          varargsparas:=nil;
       end;
       end;
@@ -724,7 +731,9 @@ type
          procdefinition:=nil;
          procdefinition:=nil;
          callnodeflags:=[cnf_return_value_used];
          callnodeflags:=[cnf_return_value_used];
          _funcretnode:=nil;
          _funcretnode:=nil;
+{$ifdef PASS2INLINE}
          inlinecode:=nil;
          inlinecode:=nil;
+{$endif PASS2INLINE}
          paralength:=-1;
          paralength:=-1;
          varargsparas:=nil;
          varargsparas:=nil;
       end;
       end;
@@ -823,7 +832,9 @@ type
          methodpointerinit.free;
          methodpointerinit.free;
          methodpointerdone.free;
          methodpointerdone.free;
          _funcretnode.free;
          _funcretnode.free;
+{$ifdef PASS2INLINE}
          inlinecode.free;
          inlinecode.free;
+{$endif PASS2INLINE}
          if assigned(varargsparas) then
          if assigned(varargsparas) then
            begin
            begin
              for i:=0 to varargsparas.count-1 do
              for i:=0 to varargsparas.count-1 do
@@ -848,7 +859,9 @@ type
         methodpointerinit:=tblocknode(ppuloadnode(ppufile));
         methodpointerinit:=tblocknode(ppuloadnode(ppufile));
         methodpointerdone:=tblocknode(ppuloadnode(ppufile));
         methodpointerdone:=tblocknode(ppuloadnode(ppufile));
         _funcretnode:=ppuloadnode(ppufile);
         _funcretnode:=ppuloadnode(ppufile);
+{$ifdef PASS2INLINE}
         inlinecode:=ppuloadnode(ppufile);
         inlinecode:=ppuloadnode(ppufile);
+{$endif PASS2INLINE}
       end;
       end;
 
 
 
 
@@ -862,7 +875,9 @@ type
         ppuwritenode(ppufile,methodpointerinit);
         ppuwritenode(ppufile,methodpointerinit);
         ppuwritenode(ppufile,methodpointerdone);
         ppuwritenode(ppufile,methodpointerdone);
         ppuwritenode(ppufile,_funcretnode);
         ppuwritenode(ppufile,_funcretnode);
+{$ifdef PASS2INLINE}
         ppuwritenode(ppufile,inlinecode);
         ppuwritenode(ppufile,inlinecode);
+{$endif PASS2INLINE}
       end;
       end;
 
 
 
 
@@ -879,8 +894,10 @@ type
           methodpointerdone.buildderefimpl;
           methodpointerdone.buildderefimpl;
         if assigned(_funcretnode) then
         if assigned(_funcretnode) then
           _funcretnode.buildderefimpl;
           _funcretnode.buildderefimpl;
+{$ifdef PASS2INLINE}
         if assigned(inlinecode) then
         if assigned(inlinecode) then
           inlinecode.buildderefimpl;
           inlinecode.buildderefimpl;
+{$endif PASS2INLINE}
       end;
       end;
 
 
 
 
@@ -901,8 +918,10 @@ type
           methodpointerdone.derefimpl;
           methodpointerdone.derefimpl;
         if assigned(_funcretnode) then
         if assigned(_funcretnode) then
           _funcretnode.derefimpl;
           _funcretnode.derefimpl;
+{$ifdef PASS2INLINE}
         if assigned(inlinecode) then
         if assigned(inlinecode) then
           inlinecode.derefimpl;
           inlinecode.derefimpl;
+{$endif PASS2INLINE}
         { Connect parasyms }
         { Connect parasyms }
         pt:=tcallparanode(left);
         pt:=tcallparanode(left);
         while assigned(pt) and
         while assigned(pt) and
@@ -961,10 +980,12 @@ type
          n._funcretnode:=_funcretnode.getcopy
          n._funcretnode:=_funcretnode.getcopy
         else
         else
          n._funcretnode:=nil;
          n._funcretnode:=nil;
+{$ifdef PASS2INLINE}
         if assigned(inlinecode) then
         if assigned(inlinecode) then
          n.inlinecode:=inlinecode.getcopy
          n.inlinecode:=inlinecode.getcopy
         else
         else
          n.inlinecode:=nil;
          n.inlinecode:=nil;
+{$endif PASS2INLINE}
         if assigned(varargsparas) then
         if assigned(varargsparas) then
          begin
          begin
            n.varargsparas:=tvarargsparalist.create;
            n.varargsparas:=tvarargsparalist.create;
@@ -1955,7 +1976,7 @@ type
           end
           end
         else
         else
           begin
           begin
-            tempnode := ctempcreatenode.create(tabstractvarsym(p).vartype,tabstractvarsym(p).vartype.def.size,tt_persistent,tparavarsym(p).varregable<>vr_none);
+            tempnode := ctempcreatenode.create(tabstractvarsym(p).vartype,tabstractvarsym(p).vartype.def.size,tt_persistent,tabstractvarsym(p).varregable<>vr_none);
             addstatement(tempinfo^.createstatement,tempnode);
             addstatement(tempinfo^.createstatement,tempnode);
             if assigned(tlocalvarsym(p).defaultconstsym) then
             if assigned(tlocalvarsym(p).defaultconstsym) then
               begin
               begin
@@ -2049,13 +2070,48 @@ type
       end;
       end;
 
 
 
 
-    function tcallnode.pass_1 : tnode;
+
+    function tcallnode.pass1_inline:tnode;
       var
       var
         createstatement,deletestatement: tstatementnode;
         createstatement,deletestatement: tstatementnode;
         createblock,deleteblock: tblocknode;
         createblock,deleteblock: tblocknode;
         i: longint;
         i: longint;
-      label
-        errorexit;
+      begin
+        if not assigned(tprocdef(procdefinition).inlininginfo^.code) then
+          internalerror(200412021);
+        { inherit flags }
+        current_procinfo.flags := current_procinfo.flags + ((procdefinition as tprocdef).inlininginfo^.flags*inherited_inlining_flags);
+        { create blocks for loading/deleting of local data }
+        createblock:=internalstatements(createstatement);
+        deleteblock:=internalstatements(deletestatement);
+        inlinelocals:=tlist.create;
+        { replace complex parameters with temps }
+        createinlineparas(createstatement,deletestatement);
+        { replace the parameter loads with the parameter values }
+        foreachnode(result,@replaceparaload,@fileinfo);
+        { free the temps for the locals }
+        for i := 0 to inlinelocals.count-1 do
+          if assigned(inlinelocals[i]) then
+            tnode(inlinelocals[i]).free;
+        inlinelocals.free;
+        inlinelocals:=nil;
+        addstatement(createstatement,tprocdef(procdefinition).inlininginfo^.code.getcopy);
+        addstatement(createstatement,deleteblock);
+        { set function result location if necessary }
+        if assigned(funcretnode) and
+           (cnf_return_value_used in callnodeflags) then
+          addstatement(createstatement,funcretnode.getcopy);
+        { consider it must not be inlined if called
+          again inside the args or itself }
+        procdefinition.proccalloption:=pocall_default;
+        firstpass(createblock);
+        procdefinition.proccalloption:=pocall_inline;
+        { return inlined block }
+        result := createblock;
+      end;
+
+
+    function tcallnode.pass_1 : tnode;
       begin
       begin
          result:=nil;
          result:=nil;
 
 
@@ -2064,49 +2120,8 @@ type
             { can we inline this procedure at the node level? }
             { can we inline this procedure at the node level? }
             (tprocdef(procdefinition).inlininginfo^.inlinenode) then
             (tprocdef(procdefinition).inlininginfo^.inlinenode) then
            begin
            begin
-              { inherit flags }
-              current_procinfo.flags := current_procinfo.flags + ((procdefinition as tprocdef).inlininginfo^.flags*inherited_inlining_flags);
-
-              if assigned(methodpointer) then
-                CGMessage(cg_e_unable_inline_object_methods);
-              if assigned(right) then
-                CGMessage(cg_e_unable_inline_procvar);
-              if assigned(inlinecode) then
-                internalerror(2004071110);
-
-              if assigned(tprocdef(procdefinition).inlininginfo^.code) then
-                result:=tprocdef(procdefinition).inlininginfo^.code.getcopy
-              else
-                CGMessage(cg_e_no_code_for_inline_stored);
-              if assigned(result) then
-                begin
-                  createblock := internalstatements(createstatement);
-                  deleteblock := internalstatements(deletestatement);
-                  inlinelocals:=tlist.create;
-                  { replace complex parameters with temps }
-                  createinlineparas(createstatement,deletestatement);
-                  { replace the parameter loads with the parameter values }
-                  foreachnode(result,@replaceparaload,@fileinfo);
-                  { free the temps for the locals }
-                  for i := 0 to inlinelocals.count-1 do
-                    if assigned(inlinelocals[i]) then
-                      tnode(inlinelocals[i]).free;
-                  inlinelocals.free;
-                  inlinelocals:=nil;
-                  addstatement(createstatement,result);
-                  addstatement(createstatement,deleteblock);
-                  { set function result location if necessary }
-                  if assigned(funcretnode) and
-                     (cnf_return_value_used in callnodeflags) then
-                    addstatement(createstatement,funcretnode.getcopy);
-                  result := createblock;
-                  { consider it must not be inlined if called
-                    again inside the args or itself }
-                  procdefinition.proccalloption:=pocall_default;
-                  firstpass(result);
-                  procdefinition.proccalloption:=pocall_inline;
-                  exit;
-                end;
+             result:=pass1_inline;
+             exit;
            end;
            end;
 {$endif NODEINLINE}
 {$endif NODEINLINE}
 
 
@@ -2157,6 +2172,7 @@ type
            begin
            begin
 	      if procdefinition.deftype<>procdef then
 	      if procdefinition.deftype<>procdef then
 	        internalerror(200411071);
 	        internalerror(200411071);
+{$ifdef PASS2INLINE}
               { calc the correture value for the register }
               { calc the correture value for the register }
               { handle predefined procedures }
               { handle predefined procedures }
               if (procdefinition.proccalloption=pocall_inline) then
               if (procdefinition.proccalloption=pocall_inline) then
@@ -2184,6 +2200,7 @@ type
                      end;
                      end;
                 end
                 end
               else
               else
+{$endif PASS2INLINE}
                 begin
                 begin
                   if not (block_type in [bt_const,bt_type]) then
                   if not (block_type in [bt_const,bt_type]) then
                     include(current_procinfo.flags,pi_do_call);
                     include(current_procinfo.flags,pi_do_call);
@@ -2292,16 +2309,18 @@ type
                end;
                end;
            end;
            end;
 
 
+{$ifdef PASS2INLINE}
          { determine the registers of the procedure variable }
          { determine the registers of the procedure variable }
          { is this OK for inlined procs also ?? (PM)     }
          { is this OK for inlined procs also ?? (PM)     }
          if assigned(inlinecode) then
          if assigned(inlinecode) then
            begin
            begin
               registersfpu:=max(inlinecode.registersfpu,registersfpu);
               registersfpu:=max(inlinecode.registersfpu,registersfpu);
               registersint:=max(inlinecode.registersint,registersint);
               registersint:=max(inlinecode.registersint,registersint);
-{$ifdef SUPPORT_MMX}
+  {$ifdef SUPPORT_MMX}
               registersmmx:=max(inlinecode.registersmmx,registersmmx);
               registersmmx:=max(inlinecode.registersmmx,registersmmx);
-{$endif SUPPORT_MMX}
+  {$endif SUPPORT_MMX}
            end;
            end;
+{$endif PASS2INLINE}
          { determine the registers of the procedure variable }
          { determine the registers of the procedure variable }
          { is this OK for inlined procs also ?? (PM)     }
          { is this OK for inlined procs also ?? (PM)     }
          if assigned(right) then
          if assigned(right) then
@@ -2321,9 +2340,10 @@ type
               registersmmx:=max(left.registersmmx,registersmmx);
               registersmmx:=max(left.registersmmx,registersmmx);
 {$endif SUPPORT_MMX}
 {$endif SUPPORT_MMX}
            end;
            end;
-      errorexit:
+{$ifdef PASS2INLINE}
          if assigned(inlinecode) then
          if assigned(inlinecode) then
            procdefinition.proccalloption:=pocall_inline;
            procdefinition.proccalloption:=pocall_inline;
+{$endif PASS2INLINE}
       end;
       end;
 
 
 {$ifdef state_tracking}
 {$ifdef state_tracking}
@@ -2409,7 +2429,10 @@ begin
 end.
 end.
 {
 {
   $Log$
   $Log$
-  Revision 1.265  2004-11-28 14:34:59  jonas
+  Revision 1.266  2004-12-02 19:26:14  peter
+    * disable pass2inline
+
+  Revision 1.265  2004/11/28 14:34:59  jonas
     * only try to replace locals from the inlined procedure with temps,
     * only try to replace locals from the inlined procedure with temps,
       cycle now works with -dNODEINLINE
       cycle now works with -dNODEINLINE
 
 

+ 20 - 2
compiler/ncgbas.pas

@@ -68,7 +68,7 @@ interface
 
 
     uses
     uses
       globtype,systems,
       globtype,systems,
-      cutils,verbose,cpuinfo,
+      cutils,verbose,
       aasmbase,aasmtai,aasmcpu,symsym,symconst,
       aasmbase,aasmtai,aasmcpu,symsym,symconst,
       defutil,
       defutil,
       nflw,pass_2,
       nflw,pass_2,
@@ -324,9 +324,17 @@ interface
     procedure tcgblocknode.pass_2;
     procedure tcgblocknode.pass_2;
       var
       var
         hp : tstatementnode;
         hp : tstatementnode;
+        oldexitlabel : tasmlabel;
       begin
       begin
         location_reset(location,LOC_VOID,OS_NO);
         location_reset(location,LOC_VOID,OS_NO);
 
 
+        { replace exitlabel? }
+        if nf_block_with_exit in flags then
+          begin
+            oldexitlabel:=current_procinfo.aktexitlabel;
+            objectlibrary.getlabel(current_procinfo.aktexitlabel);
+          end;
+
         { do second pass on left node }
         { do second pass on left node }
         if assigned(left) then
         if assigned(left) then
          begin
          begin
@@ -342,6 +350,13 @@ interface
               hp:=tstatementnode(hp.right);
               hp:=tstatementnode(hp.right);
             end;
             end;
          end;
          end;
+
+        { write exitlabel }
+        if nf_block_with_exit in flags then
+          begin
+            cg.a_label(exprasmlist,current_procinfo.aktexitlabel);
+            current_procinfo.aktexitlabel:=oldexitlabel;
+          end;
       end;
       end;
 
 
 
 
@@ -491,7 +506,10 @@ begin
 end.
 end.
 {
 {
   $Log$
   $Log$
-  Revision 1.71  2004-11-11 19:31:33  peter
+  Revision 1.72  2004-12-02 19:26:15  peter
+    * disable pass2inline
+
+  Revision 1.71  2004/11/11 19:31:33  peter
     * fixed compile of powerpc,sparc,arm
     * fixed compile of powerpc,sparc,arm
 
 
   Revision 1.70  2004/11/08 22:09:59  peter
   Revision 1.70  2004/11/08 22:09:59  peter

+ 23 - 5
compiler/ncgcal.pas

@@ -48,7 +48,9 @@ interface
        private
        private
           procedure release_para_temps;
           procedure release_para_temps;
           procedure normal_pass_2;
           procedure normal_pass_2;
+{$ifdef PASS2INLINE}
           procedure inlined_pass_2;
           procedure inlined_pass_2;
+{$endif PASS2INLINE}
           procedure pushparas;
           procedure pushparas;
           procedure freeparas;
           procedure freeparas;
        protected
        protected
@@ -364,10 +366,12 @@ implementation
              objectlibrary.getlabel(falselabel);
              objectlibrary.getlabel(falselabel);
              secondpass(left);
              secondpass(left);
 
 
-             if not(assigned(aktcallnode.inlinecode)) then
-               paramanager.createtempparaloc(exprasmlist,aktcallnode.procdefinition.proccalloption,parasym,tempcgpara)
+{$ifdef PASS2INLINE}
+             if assigned(aktcallnode.inlinecode) then
+               paramanager.duplicateparaloc(exprasmlist,aktcallnode.procdefinition.proccalloption,parasym,tempcgpara)
              else
              else
-               paramanager.duplicateparaloc(exprasmlist,aktcallnode.procdefinition.proccalloption,parasym,tempcgpara);
+{$endif PASS2INLINE}
+               paramanager.createtempparaloc(exprasmlist,aktcallnode.procdefinition.proccalloption,parasym,tempcgpara);
 
 
              { handle varargs first, because parasym is not valid }
              { handle varargs first, because parasym is not valid }
              if (cpf_varargs_para in callparaflags) then
              if (cpf_varargs_para in callparaflags) then
@@ -698,7 +702,9 @@ implementation
                  { better check for the real location of the parameter here, when stack passed parameters
                  { better check for the real location of the parameter here, when stack passed parameters
                    are saved temporary in registers, checking for the tmpparaloc.loc is wrong
                    are saved temporary in registers, checking for the tmpparaloc.loc is wrong
                  }
                  }
+{$ifdef PASS2INLINE}
                  if not assigned(inlinecode) then
                  if not assigned(inlinecode) then
+{$endif PASS2INLINE}
                    paramanager.freeparaloc(exprasmlist,ppn.tempcgpara);
                    paramanager.freeparaloc(exprasmlist,ppn.tempcgpara);
                  tmpparaloc:=ppn.tempcgpara.location;
                  tmpparaloc:=ppn.tempcgpara.location;
                  callerparaloc:=ppn.parasym.paraloc[callerside].location;
                  callerparaloc:=ppn.parasym.paraloc[callerside].location;
@@ -738,7 +744,9 @@ implementation
                          end;
                          end;
                        LOC_REFERENCE:
                        LOC_REFERENCE:
                          begin
                          begin
+{$ifdef PASS2INLINE}
                            if not assigned(inlinecode) then
                            if not assigned(inlinecode) then
+{$endif PASS2INLINE}
                              begin
                              begin
 {$ifdef cputargethasfixedstack}
 {$ifdef cputargethasfixedstack}
                                reference_reset_base(href,callerparaloc^.reference.index,callerparaloc^.reference.offset);
                                reference_reset_base(href,callerparaloc^.reference.index,callerparaloc^.reference.offset);
@@ -781,7 +789,10 @@ implementation
          ppn:=tcgcallparanode(left);
          ppn:=tcgcallparanode(left);
          while assigned(ppn) do
          while assigned(ppn) do
            begin
            begin
-             if not assigned(inlinecode) or
+             if
+{$ifdef PASS2INLINE}
+                not assigned(inlinecode) or
+{$endif PASS2INLINE}
                 (ppn.parasym.paraloc[callerside].location^.loc <> LOC_REFERENCE) then
                 (ppn.parasym.paraloc[callerside].location^.loc <> LOC_REFERENCE) then
                paramanager.freeparaloc(exprasmlist,ppn.parasym.paraloc[callerside]);
                paramanager.freeparaloc(exprasmlist,ppn.parasym.paraloc[callerside]);
              ppn:=tcgcallparanode(ppn.right);
              ppn:=tcgcallparanode(ppn.right);
@@ -1030,6 +1041,7 @@ implementation
       end;
       end;
 
 
 
 
+{$ifdef PASS2INLINE}
     procedure tcgcallnode.inlined_pass_2;
     procedure tcgcallnode.inlined_pass_2;
       var
       var
          oldaktcallnode : tcallnode;
          oldaktcallnode : tcallnode;
@@ -1224,6 +1236,7 @@ implementation
          current_procinfo:=oldprocinfo;
          current_procinfo:=oldprocinfo;
          inlining_procedure:=oldinlining_procedure;
          inlining_procedure:=oldinlining_procedure;
       end;
       end;
+{$endif PASS2INLINE}
 
 
 
 
     procedure tcgcallnode.pass_2;
     procedure tcgcallnode.pass_2;
@@ -1231,9 +1244,11 @@ implementation
         if assigned(methodpointerinit) then
         if assigned(methodpointerinit) then
           secondpass(methodpointerinit);
           secondpass(methodpointerinit);
 
 
+{$ifdef PASS2INLINE}
         if assigned(inlinecode) then
         if assigned(inlinecode) then
           inlined_pass_2
           inlined_pass_2
         else
         else
+{$endif PASS2INLINE}
           normal_pass_2;
           normal_pass_2;
 
 
         if assigned(methodpointerdone) then
         if assigned(methodpointerdone) then
@@ -1247,7 +1262,10 @@ begin
 end.
 end.
 {
 {
   $Log$
   $Log$
-  Revision 1.188  2004-11-21 18:13:31  peter
+  Revision 1.189  2004-12-02 19:26:15  peter
+    * disable pass2inline
+
+  Revision 1.188  2004/11/21 18:13:31  peter
     * fixed funcretloc for sparc
     * fixed funcretloc for sparc
 
 
   Revision 1.187  2004/11/21 17:54:59  peter
   Revision 1.187  2004/11/21 17:54:59  peter

+ 8 - 2
compiler/node.pas

@@ -240,7 +240,10 @@ interface
          nf_inlineconst,
          nf_inlineconst,
 
 
          { tasmnode }
          { tasmnode }
-         nf_get_asm_position
+         nf_get_asm_position,
+
+         { tblocknode }
+         nf_block_with_exit
        );
        );
 
 
        tnodeflags = set of tnodeflag;
        tnodeflags = set of tnodeflag;
@@ -1136,7 +1139,10 @@ implementation
 end.
 end.
 {
 {
   $Log$
   $Log$
-  Revision 1.90  2004-11-02 12:55:16  peter
+  Revision 1.91  2004-12-02 19:26:15  peter
+    * disable pass2inline
+
+  Revision 1.90  2004/11/02 12:55:16  peter
     * nf_internal flag for internal inserted typeconvs. This will
     * nf_internal flag for internal inserted typeconvs. This will
       supress the generation of warning/hints
       supress the generation of warning/hints
 
 

+ 8 - 1
compiler/nutils.pas

@@ -101,7 +101,9 @@ implementation
           begin
           begin
             { not in one statement, won't work because of b- }
             { not in one statement, won't work because of b- }
             result := foreachnode(tcallnode(n).methodpointer,f,arg) or result;
             result := foreachnode(tcallnode(n).methodpointer,f,arg) or result;
+{$ifdef PASS2INLINE}
             result := foreachnode(tcallnode(n).inlinecode,f,arg) or result;
             result := foreachnode(tcallnode(n).inlinecode,f,arg) or result;
+{$endif PASS2INLINE}
           end;
           end;
         ifn, whilerepeatn, forn:
         ifn, whilerepeatn, forn:
           begin
           begin
@@ -147,7 +149,9 @@ implementation
         calln:
         calln:
           begin
           begin
             result := foreachnodestatic(tcallnode(n).methodpointer,f,arg) or result;
             result := foreachnodestatic(tcallnode(n).methodpointer,f,arg) or result;
+{$ifdef PASS2INLINE}
             result := foreachnodestatic(tcallnode(n).inlinecode,f,arg) or result;
             result := foreachnodestatic(tcallnode(n).inlinecode,f,arg) or result;
+{$endif PASS2INLINE}
           end;
           end;
         ifn, whilerepeatn, forn:
         ifn, whilerepeatn, forn:
           begin
           begin
@@ -526,7 +530,10 @@ end.
 
 
 {
 {
   $Log$
   $Log$
-  Revision 1.22  2004-11-28 19:29:45  jonas
+  Revision 1.23  2004-12-02 19:26:15  peter
+    * disable pass2inline
+
+  Revision 1.22  2004/11/28 19:29:45  jonas
     * loadvmtaddrn and loadparentfpn both have complexity 1 (the latter
     * loadvmtaddrn and loadparentfpn both have complexity 1 (the latter
       fixes compilation of tw0935 with nodeinlining)
       fixes compilation of tw0935 with nodeinlining)
 
 

+ 7 - 12
compiler/psub.pas

@@ -937,15 +937,6 @@ implementation
        end;
        end;
 
 
 
 
-    function containsforbiddennode(var n: tnode; arg: pointer): foreachnoderesult;
-      begin
-        if (n.nodetype <> exitn) then
-          result := fen_false
-        else
-          result := fen_norecurse_true;
-      end;
-
-
     function checknodeinlining(procdef: tprocdef): boolean;
     function checknodeinlining(procdef: tprocdef): boolean;
       var
       var
         i : integer;
         i : integer;
@@ -966,8 +957,7 @@ implementation
                is_special_array(currpara.vartype.def)  then
                is_special_array(currpara.vartype.def)  then
               exit;
               exit;
           end;
           end;
-        { we currently can't handle exit-statements (would exit the caller) }
-        result := not foreachnodestatic(procdef.inlininginfo^.code,@containsforbiddennode,nil);
+        result:=true;
       end;
       end;
 
 
 
 
@@ -1057,6 +1047,8 @@ implementation
              procdef.inlininginfo^.code:=code.getcopy;
              procdef.inlininginfo^.code:=code.getcopy;
              procdef.inlininginfo^.flags:=current_procinfo.flags;
              procdef.inlininginfo^.flags:=current_procinfo.flags;
              procdef.inlininginfo^.inlinenode:=checknodeinlining(procdef);
              procdef.inlininginfo^.inlinenode:=checknodeinlining(procdef);
+             if procdef.inlininginfo^.code.nodetype=blockn then
+               include(procdef.inlininginfo^.code.flags,nf_block_with_exit);
            end
            end
          else
          else
            procdef.inlininginfo^.code:=code;
            procdef.inlininginfo^.code:=code;
@@ -1438,7 +1430,10 @@ implementation
 end.
 end.
 {
 {
   $Log$
   $Log$
-  Revision 1.220  2004-11-29 18:50:15  peter
+  Revision 1.221  2004-12-02 19:26:15  peter
+    * disable pass2inline
+
+  Revision 1.220  2004/11/29 18:50:15  peter
     * os2 fixes for import
     * os2 fixes for import
     * asmsymtype support for intel reader
     * asmsymtype support for intel reader