浏览代码

* don't write (stabs)line info when inlining a procedure

peter 23 年之前
父节点
当前提交
ecb430a8eb
共有 4 个文件被更改,包括 42 次插入27 次删除
  1. 7 4
      compiler/aggas.pas
  2. 26 7
      compiler/assemble.pas
  3. 4 7
      compiler/ncgcal.pas
  4. 5 9
      compiler/pass_2.pas

+ 7 - 4
compiler/aggas.pas

@@ -338,10 +338,10 @@ var
                 (cs_gdb_lineinfo in aktglobalswitches) then
                WriteFileLineInfo(hp.fileinfo);
 {$endif GDB}
-
-             if do_line then
+             { no line info for inlined code }
+             if do_line and (inlinelevel=0) then
               begin
-              { load infile }
+                { load infile }
                 if lastfileinfo.fileindex<>hp.fileinfo.fileindex then
                  begin
                    infile:=current_module.sourcefiles.get_file(hp.fileinfo.fileindex);
@@ -800,7 +800,10 @@ var
 end.
 {
   $Log$
-  Revision 1.10  2002-08-18 22:16:14  florian
+  Revision 1.11  2002-08-20 16:55:38  peter
+    * don't write (stabs)line info when inlining a procedure
+
+  Revision 1.10  2002/08/18 22:16:14  florian
     + the ppc gas assembler writer adds now registers aliases
       to the assembler file
 

+ 26 - 7
compiler/assemble.pas

@@ -979,14 +979,17 @@ Implementation
 
     function TInternalAssembler.TreePass1(hp:Tai):Tai;
       var
+        InlineLevel,
         i,l : longint;
       begin
+        inlinelevel:=0;
         while assigned(hp) do
          begin
 {$ifdef GDB}
-           { write stabs }
-          if ((cs_debuginfo in aktmoduleswitches) or
-             (cs_gdb_lineinfo in aktglobalswitches)) then
+           { write stabs, no line info for inlined code }
+           if (inlinelevel=0) and
+              ((cs_debuginfo in aktmoduleswitches) or
+               (cs_gdb_lineinfo in aktglobalswitches)) then
             begin
               if (objectalloc.currsec<>sec_none) and
                  not(hp.typ in  [
@@ -1145,6 +1148,11 @@ Implementation
              ait_cut :
                if SmartAsm then
                 break;
+             ait_marker :
+               if tai_marker(hp).kind=InlineStart then
+                 inc(InlineLevel)
+               else if tai_marker(hp).kind=InlineEnd then
+                 dec(InlineLevel);
            end;
            hp:=Tai(hp.next);
          end;
@@ -1154,18 +1162,21 @@ Implementation
 
     function TInternalAssembler.TreePass2(hp:Tai):Tai;
       var
+        InlineLevel,
         l  : longint;
 {$ifdef i386}
         co : comp;
 {$endif i386}
       begin
+        inlinelevel:=0;
         { main loop }
         while assigned(hp) do
          begin
 {$ifdef GDB}
-           { write stabs }
-          if ((cs_debuginfo in aktmoduleswitches) or
-             (cs_gdb_lineinfo in aktglobalswitches)) then
+           { write stabs, no line info for inlined code }
+           if (inlinelevel=0) and
+              ((cs_debuginfo in aktmoduleswitches) or
+               (cs_gdb_lineinfo in aktglobalswitches)) then
             begin
               if (objectdata.currsec<>sec_none) and
                  not(hp.typ in [
@@ -1277,6 +1288,11 @@ Implementation
              ait_cut :
                if SmartAsm then
                 break;
+             ait_marker :
+               if tai_marker(hp).kind=InlineStart then
+                 inc(InlineLevel)
+               else if tai_marker(hp).kind=InlineEnd then
+                 dec(InlineLevel);
            end;
            hp:=Tai(hp.next);
          end;
@@ -1592,7 +1608,10 @@ Implementation
 end.
 {
   $Log$
-  Revision 1.42  2002-08-12 15:08:39  carl
+  Revision 1.43  2002-08-20 16:55:38  peter
+    * don't write (stabs)line info when inlining a procedure
+
+  Revision 1.42  2002/08/12 15:08:39  carl
     + stab register indexes for powerpc (moved from gdb to cpubase)
     + tprocessor enumeration moved to cpuinfo
     + linker in target_info is now a class

+ 4 - 7
compiler/ncgcal.pas

@@ -1405,17 +1405,11 @@ implementation
           inlineexitcode:=TAAsmoutput.Create;
           ps:=para_size;
           make_global:=false; { to avoid warning }
-          aktfilepos.line:=0;
-          aktfilepos.column:=0;
-          aktfilepos.fileindex:=0;
           genentrycode(inlineentrycode,make_global,0,ps,nostackframe,true);
           if po_assembler in aktprocdef.procoptions then
             inlineentrycode.insert(Tai_marker.Create(asmblockstart));
           exprasmList.concatlist(inlineentrycode);
           secondpass(inlinetree);
-          aktfilepos.line:=0;
-          aktfilepos.column:=0;
-          aktfilepos.fileindex:=0;
           genexitcode(inlineexitcode,0,false,true);
           if po_assembler in aktprocdef.procoptions then
             inlineexitcode.concat(Tai_marker.Create(asmblockend));
@@ -1475,7 +1469,10 @@ begin
 end.
 {
   $Log$
-  Revision 1.13  2002-08-19 19:36:42  peter
+  Revision 1.14  2002-08-20 16:55:38  peter
+    * don't write (stabs)line info when inlining a procedure
+
+  Revision 1.13  2002/08/19 19:36:42  peter
     * More fixes for cross unit inlining, all tnodes are now implemented
     * Moved pocall_internconst to po_internconst because it is not a
       calling type at all and it conflicted when inlining of these small

+ 5 - 9
compiler/pass_2.pas

@@ -179,14 +179,7 @@ implementation
             curptree:=@p;
             p^.usableregs:=usablereg32;
 {$endif TEMPREGDEBUG}
-            if inlining_procedure then
-             begin
-               aktfilepos.line:=0;
-               aktfilepos.column:=0;
-               aktfilepos.fileindex:=0;
-             end
-            else
-             aktfilepos:=p.fileinfo;
+            aktfilepos:=p.fileinfo;
             aktlocalswitches:=p.localswitches;
             codegenerror:=false;
 {$ifdef EXTDEBUG}
@@ -337,7 +330,10 @@ implementation
 end.
 {
   $Log$
-  Revision 1.37  2002-08-19 19:36:44  peter
+  Revision 1.38  2002-08-20 16:55:38  peter
+    * don't write (stabs)line info when inlining a procedure
+
+  Revision 1.37  2002/08/19 19:36:44  peter
     * More fixes for cross unit inlining, all tnodes are now implemented
     * Moved pocall_internconst to po_internconst because it is not a
       calling type at all and it conflicted when inlining of these small