浏览代码

* better lines for stabs
(no scroll back to if before else part
no return to case line at jump outside case)
+ source lines also if not in order

pierre 27 年之前
父节点
当前提交
e1bc033a5c
共有 8 个文件被更改,包括 118 次插入34 次删除
  1. 17 4
      compiler/aasm.pas
  2. 16 2
      compiler/cg386flw.pas
  3. 9 1
      compiler/cg386set.pas
  4. 1 0
      compiler/errorn.msg
  5. 11 1
      compiler/files.pas
  6. 8 2
      compiler/ra386att.pas
  7. 47 20
      compiler/ra386dir.pas
  8. 9 4
      compiler/symdef.inc

+ 17 - 4
compiler/aasm.pas

@@ -63,11 +63,9 @@ unit aasm;
           { the following is only used by the win32 version of the compiler }
           { and only the GNU AS Win32 is able to write it                   }
           ait_const_rva,
-{$ifdef GDB}
           ait_stabn,
           ait_stabs,
           ait_stab_function_name,
-{$endif GDB}
           ait_cut, { used to split into tiny assembler files }
 {$ifdef REGALLOC}
           ait_regalloc,
@@ -265,7 +263,9 @@ type
 
 
        paasmoutput = ^taasmoutput;
-       taasmoutput = tlinkedlist;
+       taasmoutput = object(tlinkedlist)
+                   function getlasttaifilepos : pfileposinfo;
+                   end;
 
     var
     { temporary lists }
@@ -832,11 +832,24 @@ uses
       end;
 
 
+    function taasmoutput.getlasttaifilepos : pfileposinfo;
+      begin
+         if assigned(last) then
+           getlasttaifilepos:=@pai(last)^.fileinfo
+         else
+           getlasttaifilepos:=nil;
+      end;
 
 end.
 {
   $Log$
-  Revision 1.15  1998-08-11 15:31:36  peter
+  Revision 1.16  1998-09-03 17:08:37  pierre
+    * better lines for stabs
+      (no scroll back to if before else part
+      no return to case line at jump outside case)
+    + source lines also if not in order
+
+  Revision 1.15  1998/08/11 15:31:36  peter
     * write extended to ppu file
     * new version 0.99.7
 

+ 16 - 2
compiler/cg386flw.pas

@@ -141,6 +141,8 @@ implementation
               if assigned(p^.right) then
                 begin
                    getlabel(hl);
+                   { do go back to if line !! }
+                   aktfilepos:=exprasmlist^.getlasttaifilepos^;
                    emitl(A_JMP,hl);
                 end;
               emitl(A_LABEL,falselabel);
@@ -738,7 +740,13 @@ do_jmp:
 end.
 {
   $Log$
-  Revision 1.13  1998-09-01 12:47:58  peter
+  Revision 1.14  1998-09-03 17:08:39  pierre
+    * better lines for stabs
+      (no scroll back to if before else part
+      no return to case line at jump outside case)
+    + source lines also if not in order
+
+  Revision 1.13  1998/09/01 12:47:58  peter
     * use pdef^.size instead of orddef^.typ
 
   Revision 1.12  1998/08/28 10:56:58  peter
@@ -747,7 +755,13 @@ end.
   Revision 1.11  1998/08/05 16:00:10  florian
     * some fixes for ansi strings
     * $log$ to $Log$
-    * $log$ to Revision 1.13  1998-09-01 12:47:58  peter
+    * $log$ to Revision 1.14  1998-09-03 17:08:39  pierre
+    * $log$ to   * better lines for stabs
+    * $log$ to     (no scroll back to if before else part
+    * $log$ to     no return to case line at jump outside case)
+    * $log$ to   + source lines also if not in order
+    * $log$ to
+    * $log$ to Revision 1.13  1998/09/01 12:47:58  peter
     * $log$ to   * use pdef^.size instead of orddef^.typ
     * $log$ to
     * $log$ to Revision 1.12  1998/08/28 10:56:58  peter

+ 9 - 1
compiler/cg386set.pas

@@ -759,6 +759,8 @@ implementation
            begin
               cleartempgen;
               secondpass(hp^.right);
+              { don't come back to case line }
+              aktfilepos:=exprasmlist^.getlasttaifilepos^;
               emitl(A_JMP,endlabel);
               hp:=hp^.left;
            end;
@@ -776,7 +778,13 @@ implementation
 end.
 {
   $Log$
-  Revision 1.9  1998-08-28 10:54:19  peter
+  Revision 1.10  1998-09-03 17:08:40  pierre
+    * better lines for stabs
+      (no scroll back to if before else part
+      no return to case line at jump outside case)
+    + source lines also if not in order
+
+  Revision 1.9  1998/08/28 10:54:19  peter
     * fixed smallset generation from elements, it has never worked before!
 
   Revision 1.8  1998/08/25 11:51:46  peter

+ 1 - 0
compiler/errorn.msg

@@ -354,6 +354,7 @@ assem_e_invalid_reference_syntax=E_Invalid Reference syntax
 assem_e_invalid_string_as_opcode_operand=E_Invalid string as opcode operand: $1
 assem_w_CODE_and_DATA_not_supported=W_@CODE and @DATA not supported
 assem_e_null_label_ref_not_allowed=E_Null label references are not allowed
+assem_w_calling_overloaded=W_Calling of an overloaded function in direct assembler
 assem_e_cannot_use_SELF_outside_a_method=E_Cannot use SELF outside a method
 assem_e_syn_start_with_bracket=E_Asm syntax error - Should start with bracket
 assem_e_syn_register=E_Asm syntax error - register: $1

+ 11 - 1
compiler/files.pas

@@ -416,6 +416,10 @@ unit files;
         if l<maxlinebuf then
          begin
            fpos:=linebuf^[l];
+           { fpos is set negativ if the line was already written }
+           { but we still know the correct value                 }
+           if fpos<0 then
+             fpos:=-fpos+1;
            if closed then
             open;
          { in current buf ? }
@@ -860,7 +864,13 @@ unit files;
 end.
 {
   $Log$
-  Revision 1.42  1998-09-03 11:24:00  peter
+  Revision 1.43  1998-09-03 17:08:45  pierre
+    * better lines for stabs
+      (no scroll back to if before else part
+      no return to case line at jump outside case)
+    + source lines also if not in order
+
+  Revision 1.42  1998/09/03 11:24:00  peter
     * moved more inputfile things from tscannerfile to tinputfile
     * changed ifdef Sourceline to cs_asm_source
 

+ 8 - 2
compiler/ra386att.pas

@@ -3730,14 +3730,20 @@ var
 
 Begin
  line:=''; { Initialization of line variable.
-             No 255 char coonst string in version 0.9.1 MVC}
+             No 255 char const string in version 0.9.1 MVC}
  old_exit := exitproc;
  exitproc := @ra386att_exit;
 end.
 
 {
   $Log$
-  Revision 1.11  1998-09-02 15:16:44  carl
+  Revision 1.12  1998-09-03 17:08:46  pierre
+    * better lines for stabs
+      (no scroll back to if before else part
+      no return to case line at jump outside case)
+    + source lines also if not in order
+
+  Revision 1.11  1998/09/02 15:16:44  carl
     * indirect register refs with movsx/movzx fixed
 
   Revision 1.10  1998/09/02 01:24:09  carl

+ 47 - 20
compiler/ra386dir.pas

@@ -32,7 +32,7 @@ unit Ra386dir;
   implementation
 
      uses
-        files,i386,hcodegen,globals,scanner,aasm,
+        comphook,files,i386,hcodegen,globals,scanner,aasm,
         cobjects,symtable,types,verbose,asmutils;
 
     function assemble : ptree;
@@ -100,9 +100,16 @@ unit Ra386dir;
                               begin
                                 getsym(upper(hs),false);
                                 if srsym<>nil then
-                                  Message(assem_w_using_defined_as_local);
-                              end;
-                            if upper(hs)='FWAIT' then
+                                  if (srsym^.typ = labelsym) then
+                                    Begin
+                                       hs:=lab2str(plabelsym(srsym)^.number);
+                                       {label is set !! }
+                                       plabelsym(srsym)^.number^.is_set:=true;
+                                    end
+                                  else
+                                    Message(assem_w_using_defined_as_local);
+                              end
+                            else if upper(hs)='FWAIT' then
                              FwaitWarning
                             else
                             { access to local variables }
@@ -125,7 +132,11 @@ unit Ra386dir;
                                         sym:=nil;
                                       if assigned(sym) then
                                         begin
-                                           if sym^.typ=varsym then
+                                           if (sym^.typ = labelsym) then
+                                             Begin
+                                                hs:=lab2str(plabelsym(sym)^.number);
+                                             end
+                                           else if sym^.typ=varsym then
                                              begin
                                              {variables set are after a comma }
                                              {like in movl %eax,I }
@@ -138,7 +149,8 @@ unit Ra386dir;
                                              end
                                            else
                                            { call to local function }
-                                           if (sym^.typ=procsym) and (pos('CALL',upper(s))>0) then
+                                           if (sym^.typ=procsym) and ((pos('CALL',upper(s))>0) or
+                                              (pos('LEA',upper(s))>0)) then
                                              begin
                                                 hs:=pprocsym(sym)^.definition^.mangledname;
                                              end;
@@ -164,26 +176,35 @@ unit Ra386dir;
                                       { I added that but it creates a problem in line.ppi
                                       because there is a local label wbuffer and
                                       a static variable WBUFFER ...
-                                      what would you decide, florian ?
+                                      what would you decide, florian ?}
                                       else
 
                                         begin
+{$ifdef TESTGLOBALVAR}
                                            getsym(upper(hs),false);
                                            sym:=srsym;
-                                           if assigned(sym) and (sym^.typ = varsym)
-                                              or (sym^.typ = typedconstsym) then
-                                             hs:=sym^.mangledname;
-                                           if (sym^.typ=procsym) and (pos('CALL',upper(s))>0) then
+                                           if assigned(sym) and (sym^.owner^.symtabletype in [unitsymtable,globalsymtable,staticsymtable]) then
                                              begin
-                                                if assigned(pprocsym(sym)^.definition^.nextoverloaded) then
+                                                if (sym^.typ = varsym) or (sym^.typ = typedconstsym) then
                                                   begin
-                                                     exterror:=strpnew(' calling an overloaded procedure in asm');
-                                                     warning(user_defined);
+                                                     Do_comment(V_Warning,hs+' translated to '+sym^.mangledname);
+                                                     hs:=sym^.mangledname;
                                                   end;
-                                                hs:=pprocsym(sym)^.definition^.mangledname;
-                                             end;
-                                        end   }
-                                           else if upper(hs)='__SELF' then
+                                                { procs can be called or the address can be loaded }
+                                                if (sym^.typ=procsym) and ((pos('CALL',upper(s))>0) or
+                                                   (pos('LEA',upper(s))>0)) then
+                                                  begin
+                                                     if assigned(pprocsym(sym)^.definition^.nextoverloaded) then
+                                                       begin
+                                                          Do_comment(V_Warning,hs+' is associated to an overloaded function');
+                                                       end;
+                                                     Do_comment(V_Warning,hs+' translated to '+sym^.mangledname);
+                                                     hs:=sym^.mangledname;
+                                                  end;
+                                             end
+                                           else
+{$endif TESTGLOBALVAR}
+                                           if upper(hs)='__SELF' then
                                              begin
                                                 if assigned(procinfo._class) then
                                                   hs:=tostr(procinfo.ESI_offset)+'('+att_reg2str[procinfo.framepointer]+')'
@@ -211,7 +232,7 @@ unit Ra386dir;
                                                   Message(assem_e_cannot_use___OLDEBP_outside_nested_procedure);
                                                 end;
                                            end;
-                                       { end;}
+                                        end;
                                    end;
                               end;
                             s:=s+hs;
@@ -240,7 +261,13 @@ unit Ra386dir;
 end.
 {
   $Log$
-  Revision 1.5  1998-08-21 08:45:51  pierre
+  Revision 1.6  1998-09-03 17:08:47  pierre
+    * better lines for stabs
+      (no scroll back to if before else part
+      no return to case line at jump outside case)
+    + source lines also if not in order
+
+  Revision 1.5  1998/08/21 08:45:51  pierre
     * better line info for asm statements
 
   Revision 1.4  1998/07/14 14:46:59  peter

+ 9 - 4
compiler/symdef.inc

@@ -619,10 +619,10 @@
 
     procedure tenumdef.calcsavesize;
       begin
-        if (aktpackenum=4) or (max>65535) then
+        if (aktpackenum=4) or (min<0) or (max>65535) then
          savesize:=4
         else
-         if (aktpackenum=2) or (max>255) then
+         if (aktpackenum=2) or (min<0) or (max>255) then
           savesize:=2
         else
          savesize:=1;
@@ -2771,7 +2771,13 @@
 
 {
   $Log$
-  Revision 1.32  1998-09-03 16:03:20  florian
+  Revision 1.33  1998-09-03 17:08:49  pierre
+    * better lines for stabs
+      (no scroll back to if before else part
+      no return to case line at jump outside case)
+    + source lines also if not in order
+
+  Revision 1.32  1998/09/03 16:03:20  florian
     + rtti generation
     * init table generation changed
 
@@ -2890,4 +2896,3 @@
     * symtable adapted for $ifndef OLDPPU
 
 }
-