Browse Source

* fixed call bugs with assembler readers
+ OPR_SYMBOL to hold a symbol in the asm parser
* fixed staticsymtable vars which were acessed through %ebp instead of
name

peter 27 years ago
parent
commit
659c2fb45d
4 changed files with 240 additions and 516 deletions
  1. 183 251
      compiler/asmutils.pas
  2. 14 117
      compiler/rai386.pas
  3. 15 126
      compiler/ratti386.pas
  4. 28 22
      compiler/symdef.inc

+ 183 - 251
compiler/asmutils.pas

@@ -108,7 +108,7 @@ Type
   {---------------------------------------------------------------------}
   {---------------------------------------------------------------------}
 
 
   toperandtype = (OPR_NONE,OPR_REFERENCE,OPR_CONSTANT,OPR_REGISTER,OPR_LABINSTR,
   toperandtype = (OPR_NONE,OPR_REFERENCE,OPR_CONSTANT,OPR_REGISTER,OPR_LABINSTR,
-                  OPR_REGLIST);
+                  OPR_REGLIST,OPR_SYMBOL);
 
 
     { When the TReference field isintvalue = TRUE }
     { When the TReference field isintvalue = TRUE }
     { then offset points to an ABSOLUTE address   }
     { then offset points to an ABSOLUTE address   }
@@ -136,6 +136,7 @@ Type
        OPR_LABINSTR: (hl: plabel);
        OPR_LABINSTR: (hl: plabel);
        { Register list such as in the movem instruction }
        { Register list such as in the movem instruction }
        OPR_REGLIST:  (list: set of tregister);
        OPR_REGLIST:  (list: set of tregister);
+       OPR_SYMBOL : (symbol:pstring);
     end;
     end;
 
 
 
 
@@ -1207,194 +1208,188 @@ end;
   { search and sets up the correct fields in the Instr record }
   { search and sets up the correct fields in the Instr record }
   { for the NON-constant identifier passed to the routine.    }
   { for the NON-constant identifier passed to the routine.    }
   { if not found returns FALSE.                               }
   { if not found returns FALSE.                               }
-   var
-    sym:psym;
-    l: longint;
+  var
+    sym : psym;
+    l   : longint;
   Begin
   Begin
-     CreateVarInstr := FALSE;
-     { are we in a routine ? }
-     if assigned(aktprocsym) then
+    CreateVarInstr := FALSE;
+  { are we in a routine ? }
+    if assigned(aktprocsym) then
      begin
      begin
-      if assigned(aktprocsym^.definition^.localst) then
-      { search the local list for the name of this variable. }
+     { search the local list for the name of this variable. }
+       if assigned(aktprocsym^.definition^.localst) then
         sym:=aktprocsym^.definition^.localst^.search(hs)
         sym:=aktprocsym^.definition^.localst^.search(hs)
-      else
+       else
         sym:=nil;
         sym:=nil;
-      if assigned(sym) then
-      begin
-        if sym^.typ=varsym then
-          begin
-           { we always assume in asm statements that     }
-           { that the variable is valid.                 }
-           pvarsym(sym)^.is_valid:=1;
-           instr.operands[operandnum].ref.base := procinfo.framepointer;
-           instr.operands[operandnum].ref.offset := - (pvarsym(sym)^.address);
-           { the current size is NOT overriden if it already }
-           { exists, such as in the case of a byte ptr, in   }
-           { front of the identifier.                        }
-           if instr.operands[operandnum].size = S_NO then
-           Begin
-             case pvarsym(sym)^.getsize of
-              1: instr.operands[operandnum].size := S_B;
-              2: instr.operands[operandnum].size := S_W{ could be S_IS};
-              4: instr.operands[operandnum].size := S_L{ could be S_IL or S_FS};
-              8: instr.operands[operandnum].size := S_IQ{ could be S_D or S_FL};
-              extended_size: instr.operands[operandnum].size := S_FX;
-             else
-               { this is in the case where the instruction is LEA }
-               { or something like that, in that case size is not }
-               { important.                                       }
-               instr.operands[operandnum].size := S_NO;
-             end; { end case }
+       if assigned(sym) then
+        begin
+          case sym^.typ of
+  typedconstsym,
+         varsym : begin
+                    { we always assume in asm statements that     }
+                    { that the variable is valid.                 }
+                    pvarsym(sym)^.is_valid:=1;
+                    if pvarsym(sym)^.owner^.symtabletype=staticsymtable then
+                     begin
+                       if assigned(instr.operands[operandnum].ref.symbol) then
+                         FreeMem(instr.operands[operandnum].ref.symbol,length(instr.operands[operandnum].ref.symbol^)+1);
+                       instr.operands[operandnum].ref.symbol:=newpasstr(pvarsym(sym)^.mangledname);
+                     end
+                    else
+                     begin
+                       instr.operands[operandnum].ref.base := procinfo.framepointer;
+                       instr.operands[operandnum].ref.offset := -(pvarsym(sym)^.address);
+                     end;
+                    { the current size is NOT overriden if it already }
+                    { exists, such as in the case of a byte ptr, in   }
+                    { front of the identifier.                        }
+                    if instr.operands[operandnum].size = S_NO then
+                    Begin
+                      case pvarsym(sym)^.getsize of
+                       1: instr.operands[operandnum].size := S_B;
+                       2: instr.operands[operandnum].size := S_W{ could be S_IS};
+                       4: instr.operands[operandnum].size := S_L{ could be S_IL or S_FS};
+                       8: instr.operands[operandnum].size := S_IQ{ could be S_D or S_FL};
+                       extended_size: instr.operands[operandnum].size := S_FX;
+                      else
+                        { this is in the case where the instruction is LEA }
+                        { or something like that, in that case size is not }
+                        { important.                                       }
+                        instr.operands[operandnum].size := S_NO;
+                      end; { end case }
+                    end;
+                    { ok, finished for thir variable. }
+                    CreateVarInstr := TRUE;
+                    Exit;
+                  end;
+        procsym : begin
+                    { free the memory before changing the symbol name. }
+                    if assigned(instr.operands[operandnum].ref.symbol) then
+                      FreeMem(instr.operands[operandnum].ref.symbol,length(instr.operands[operandnum].ref.symbol^)+1);
+                    instr.operands[operandnum].operandtype:=OPR_SYMBOL;
+                    instr.operands[operandnum].symbol:=newpasstr(pprocsym(sym)^.definition^.mangledname);
+                    CreateVarInstr := TRUE;
+                    Exit;
+                  end
+          else
+           begin
+             Comment(V_Error,'Unsupported symbol type for operand');
+             exit;
            end;
            end;
-           { ok, finished for thir variable. }
-           CreateVarInstr := TRUE;
-           Exit;
-          end
-        else
-        { call to local function }
-        if (sym^.typ=procsym) then
-          begin
-            { free the memory before changing the symbol name. }
-            if assigned(instr.operands[operandnum].ref.symbol) then
-              FreeMem(instr.operands[operandnum].ref.symbol,
-            length(instr.operands[operandnum].ref.symbol^)+1);
-            instr.operands[operandnum].ref.symbol:=newpasstr(pprocsym(sym)^.definition^.mangledname);
-            CreateVarInstr := TRUE;
-            Exit;
-          end
-{        else
-        if (sym^.typ = typedconstsym) then
-        Begin}
-           { UGH????? pprocsym??? }
-{           instr.operands[operandnum].ref.symbol:=newpasstr(pprocsym(sym)^.definition^.mangledname);}
-           {* the current size is NOT overriden if it already *}
-           {* exists, such as in the case of a byte ptr, in   *}
-           {* front of the identifier.                        *}
-{           if instr.operands[operandnum].size = S_NO then
-           Begin
-             case ptypedconstsym(sym)^.definition^.size of
-              1: instr.operands[operandnum].size := S_B;
-              2: instr.operands[operandnum].size := S_W;
-              4: instr.operands[operandnum].size := S_L;
-              8: instr.operands[operandnum].size := S_IQ;
-              extended_size: instr.operands[operandnum].size := S_FX;
-             else}
-               {* this is in the case where the instruction is LEA *}
-               {* or something like that, in that case size is not *}
-               {* important.                                       *}
-{               instr.operands[operandnum].size := S_NO;}
-{             end;} {* end case *}
-{           end;}
-           {* ok, finished for this variable. *}
-{           CreateVarInstr := TRUE;
-           Exit;
-        end }
-      end;
-      { now check for parameters passed to routine }
-{      else}
-       begin
-         if assigned(aktprocsym^.definition^.parast) then
-            sym:=aktprocsym^.definition^.parast^.search(hs)
-         else
-           sym:=nil;
-         if assigned(sym) then
-         begin
-           if sym^.typ=varsym then
+          end;
+        end;
+
+     { now check for parameters passed to routine }
+       if assigned(aktprocsym^.definition^.parast) then
+        sym:=aktprocsym^.definition^.parast^.search(hs)
+       else
+        sym:=nil;
+       if assigned(sym) then
+        begin
+          case sym^.typ of
+         varsym : begin
+                    l:=pvarsym(sym)^.address;
+                    { set offset }
+                    inc(l,aktprocsym^.definition^.parast^.call_offset);
+                    pvarsym(sym)^.is_valid:=1;
+                    instr.operands[operandnum].ref.base := procinfo.framepointer;
+                    instr.operands[operandnum].ref.offset := l;
+                    { the current size is NOT overriden if it already }
+                    { exists, such as in the case of a byte ptr, in   }
+                    { front of the identifier.                        }
+                    if instr.operands[operandnum].size = S_NO then
+                    Begin
+                      case pvarsym(sym)^.getsize of
+                        1: instr.operands[operandnum].size := S_B;
+                        2: instr.operands[operandnum].size := S_W;
+                        4: instr.operands[operandnum].size := S_L;
+                        8: instr.operands[operandnum].size := S_IQ;
+                        extended_size: instr.operands[operandnum].size := S_FX;
+                      else
+                      { this is in the case where the instruction is LEA }
+                      { or something like that, in that case size is not }
+                      { important.                                       }
+                        instr.operands[operandnum].size := S_NO;
+                      end; { end case }
+                    end; { endif }
+                    CreateVarInstr := TRUE;
+                    Exit;
+                  end;
+          else
            begin
            begin
-             l:=pvarsym(sym)^.address;
-             { set offset }
-             inc(l,aktprocsym^.definition^.parast^.call_offset);
-             pvarsym(sym)^.is_valid:=1;
-             instr.operands[operandnum].ref.base := procinfo.framepointer;
-             instr.operands[operandnum].ref.offset := l;
-             { the current size is NOT overriden if it already }
-             { exists, such as in the case of a byte ptr, in   }
-             { front of the identifier.                        }
-             if instr.operands[operandnum].size = S_NO then
-             Begin
-               case pvarsym(sym)^.getsize of
-                 1: instr.operands[operandnum].size := S_B;
-                 2: instr.operands[operandnum].size := S_W;
-                 4: instr.operands[operandnum].size := S_L;
-                 8: instr.operands[operandnum].size := S_IQ;
-                 extended_size: instr.operands[operandnum].size := S_FX;
-               else
-               { this is in the case where the instruction is LEA }
-               { or something like that, in that case size is not }
-               { important.                                       }
-                 instr.operands[operandnum].size := S_NO;
-               end; { end case }
-             end; { endif }
-             CreateVarInstr := TRUE;
-             Exit;
-           end; { endif }
-         end; {endif }
-       end; { endif }
+             Comment(V_Error,'Unsupported symbol type for operand');
+             exit;
+           end;
+          end; { case }
+        end; { endif }
      end;
      end;
-
-     { not found.. .now look for global variables. }
-     getsym(hs,false);
-     sym:=srsym;
-     if assigned(sym) then
+  { not found.. .now look for global variables. }
+    getsym(hs,false);
+    sym:=srsym;
+    if assigned(sym) then
      Begin
      Begin
-       if (sym^.typ = varsym) or (sym^.typ = typedconstsym) then
-       Begin
-       { free the memory before changing the symbol name. }
-         if assigned(instr.operands[operandnum].ref.symbol) then
-           FreeMem(instr.operands[operandnum].ref.symbol,
-         length(instr.operands[operandnum].ref.symbol^)+1);
-         instr.operands[operandnum].ref.symbol:=newpasstr(sym^.mangledname);
-         { the current size is NOT overriden if it already }
-         { exists, such as in the case of a byte ptr, in   }
-         { front of the identifier.                        }
-         if (instr.operands[operandnum].size = S_NO) and (sym^.typ = varsym) then
-         Begin
-           case pvarsym(sym)^.getsize of
-             1: instr.operands[operandnum].size := S_B;
-             2: instr.operands[operandnum].size := S_W;
-             4: instr.operands[operandnum].size := S_L;
-             8: instr.operands[operandnum].size := S_IQ;
-           else
-           { this is in the case where the instruction is LEA }
-           { or something like that, in that case size is not }
-           { important.                                       }
-             instr.operands[operandnum].size := S_NO;
-           end;
-         end
-         else
-         if (instr.operands[operandnum].size = S_NO) and (sym^.typ = typedconstsym) then
-         Begin
-         { only these are valid sizes, otherwise prefixes are }
-         { required.                                          }
-            case ptypedconstsym(sym)^.definition^.size of
-              1: instr.operands[operandnum].size := S_B;
-              2: instr.operands[operandnum].size := S_W;
-              4: instr.operands[operandnum].size := S_L;
-              8: instr.operands[operandnum].size := S_IQ;
-            else
-            { this is in the case where the instruction is LEA }
-            { or something like that, in that case size is not }
-            { important.                                       }
-                 instr.operands[operandnum].size := S_NO;
-            end;
-         end; { endif }
-         CreateVarInstr := TRUE;
-         Exit;
-       end;
-       if (sym^.typ=procsym) then
-       begin
-         if assigned(pprocsym(sym)^.definition^.nextoverloaded) then
-          Message(assem_w_calling_overload_func);
-         { free the memory before changing the symbol name. }
-         if assigned(instr.operands[operandnum].ref.symbol) then
-           FreeMem(instr.operands[operandnum].ref.symbol,
-         length(instr.operands[operandnum].ref.symbol^)+1);
-         instr.operands[operandnum].ref.symbol:=
-           newpasstr(pprocsym(sym)^.definition^.mangledname);
-         CreateVarInstr := TRUE;
-         Exit;
-       end;
+       case sym^.typ of
+          varsym,
+   typedconstsym : Begin
+                   { free the memory before changing the symbol name. }
+                     if assigned(instr.operands[operandnum].ref.symbol) then
+                      FreeMem(instr.operands[operandnum].ref.symbol,
+                     length(instr.operands[operandnum].ref.symbol^)+1);
+                     instr.operands[operandnum].ref.symbol:=newpasstr(sym^.mangledname);
+                   { the current size is NOT overriden if it already }
+                   { exists, such as in the case of a byte ptr, in   }
+                   { front of the identifier.                        }
+                     if (instr.operands[operandnum].size = S_NO) and (sym^.typ = varsym) then
+                      Begin
+                        case pvarsym(sym)^.getsize of
+                         1: instr.operands[operandnum].size := S_B;
+                         2: instr.operands[operandnum].size := S_W;
+                         4: instr.operands[operandnum].size := S_L;
+                         8: instr.operands[operandnum].size := S_IQ;
+                        else
+                      { this is in the case where the instruction is LEA }
+                      { or something like that, in that case size is not }
+                      { important.                                       }
+                         instr.operands[operandnum].size := S_NO;
+                        end;
+                      end
+                     else
+                      if (instr.operands[operandnum].size = S_NO) and (sym^.typ = typedconstsym) then
+                       Begin
+                       { only these are valid sizes, otherwise prefixes are }
+                       { required.                                          }
+                         case ptypedconstsym(sym)^.definition^.size of
+                          1: instr.operands[operandnum].size := S_B;
+                          2: instr.operands[operandnum].size := S_W;
+                          4: instr.operands[operandnum].size := S_L;
+                          8: instr.operands[operandnum].size := S_IQ;
+                         else
+                         { this is in the case where the instruction is LEA }
+                         { or something like that, in that case size is not }
+                         { important.                                       }
+                           instr.operands[operandnum].size := S_NO;
+                         end;
+                    end; { endif }
+                    CreateVarInstr := TRUE;
+                    Exit;
+                  end;
+        procsym : begin
+                    if assigned(pprocsym(sym)^.definition^.nextoverloaded) then
+                     Message(assem_w_calling_overload_func);
+                    { free the memory before changing the symbol name. }
+                    if assigned(instr.operands[operandnum].ref.symbol) then
+                      FreeMem(instr.operands[operandnum].ref.symbol,length(instr.operands[operandnum].ref.symbol^)+1);
+                    instr.operands[operandnum].operandtype:=OPR_SYMBOL;
+                    instr.operands[operandnum].symbol:=newpasstr(pprocsym(sym)^.definition^.mangledname);
+                    CreateVarInstr := TRUE;
+                    Exit;
+                  end;
+       else
+        begin
+          Comment(V_Error,'Unsupported symbol type for operand');
+          exit;
+        end;
+       end; {case}
      end; { end looking for global variables .. }
      end; { end looking for global variables .. }
   end;
   end;
 
 
@@ -1626,80 +1621,17 @@ end;
 end.
 end.
 {
 {
   $Log$
   $Log$
-  Revision 1.2  1998-04-29 10:33:43  pierre
+  Revision 1.3  1998-05-31 14:13:30  peter
+    * fixed call bugs with assembler readers
+    + OPR_SYMBOL to hold a symbol in the asm parser
+    * fixed staticsymtable vars which were acessed through %ebp instead of
+      name
+
+  Revision 1.2  1998/04/29 10:33:43  pierre
     + added some code for ansistring (not complete nor working yet)
     + added some code for ansistring (not complete nor working yet)
     * corrected operator overloading
     * corrected operator overloading
     * corrected nasm output
     * corrected nasm output
     + started inline procedures
     + started inline procedures
     + added starstarn : use ** for exponentiation (^ gave problems)
     + added starstarn : use ** for exponentiation (^ gave problems)
     + started UseTokenInfo cond to get accurate positions
     + started UseTokenInfo cond to get accurate positions
-
-  Revision 1.1.1.1  1998/03/25 11:18:12  root
-  * Restored version
-
-  Revision 1.15  1998/03/10 01:17:14  peter
-    * all files have the same header
-    * messages are fully implemented, EXTDEBUG uses Comment()
-    + AG... files for the Assembler generation
-
-  Revision 1.14  1998/03/09 12:58:10  peter
-    * FWait warning is only showed for Go32V2 and $E+
-    * opcode tables moved to i386.pas/m68k.pas to reduce circular uses (and
-      for m68k the same tables are removed)
-    + $E for i386
-
-  Revision 1.13  1998/03/03 16:45:16  peter
-    + message support for assembler parsers
-
-  Revision 1.12  1998/03/02 01:48:02  peter
-    * renamed target_DOS to target_GO32V1
-    + new verbose system, merged old errors and verbose units into one new
-      verbose.pas, so errors.pas is obsolete
-
-  Revision 1.11  1998/02/13 10:34:34  daniel
-  * Made Motorola version compilable.
-  * Fixed optimizer
-
-  Revision 1.10  1998/01/09 19:21:19  carl
-  + added support for m68k
-
-  Revision 1.7  1997/12/14 22:43:17  florian
-    + command line switch -Xs for DOS (passes -s to the linker to strip symbols from
-      executable)
-    * some changes of Carl-Eric implemented
-
-  Revision 1.5  1997/12/09 13:23:54  carl
-  + less processor specific
-  - moved searching for externals/internal symbols from CreateVarInstr to
-    ratti386.pas (this would cause invalid stuff in rai386.pas!)
-
-  Revision 1.4  1997/12/04 12:20:39  pierre
-    +* MMX instructions added to att output with a warning that
-       GNU as version >= 2.81 is needed
-       bug in reading of reals under att syntax corrected
-
-  Revision 1.3  1997/12/01 17:42:49  pierre
-     + added some more functionnality to the assembler parser
-
-  Revision 1.2  1997/11/27 17:55:11  carl
-  * made it compile under bp (one comment was nested)
-
-  Revision 1.1.1.1  1997/11/27 08:32:50  michael
-  FPC Compiler CVS start
-
-
-  Pre-CVS log:
-
-  CEC   Carl-Eric Codere
-  FK    Florian Klaempfl
-  PM    Pierre Muller
-  +     feature added
-  -     removed
-  *     bug fixed or changed
-
- 11th november 1997:
-   * fixed problems when using reserved words TRUE and FALSE (CEC).
- 22th november 1997:
-   * changed operator (reserved word) into _operator (PM).
-
 }
 }

+ 14 - 117
compiler/rai386.pas

@@ -780,6 +780,9 @@ var
                       findtype := _regtypes[reg];
                       findtype := _regtypes[reg];
                       exit;
                       exit;
                      end;
                      end;
+         OPR_SYMBOL: Begin
+                       findtype := ao_jumpabsolute;
+                     end;
        OPR_NONE:     Begin
        OPR_NONE:     Begin
                        findtype := 0;
                        findtype := 0;
                      end;
                      end;
@@ -1472,6 +1475,10 @@ var
                               else
                               else
                                 Message(assem_e_invalid_opcode_and_operand);
                                 Message(assem_e_invalid_opcode_and_operand);
                           end;
                           end;
+             OPR_SYMBOL:  Begin
+                            p^.concat(new(pai386,op_csymbol(instruc,
+                             instr.stropsize, newcsymbol(instr.operands[1].symbol^,0))));
+                          End;
            OPR_NONE: Begin
            OPR_NONE: Begin
                        Message(assem_f_internal_error_in_concatopcode);
                        Message(assem_f_internal_error_in_concatopcode);
                      end;
                      end;
@@ -3369,7 +3376,13 @@ Begin
 end.
 end.
 {
 {
   $Log$
   $Log$
-  Revision 1.8  1998-05-30 14:31:07  peter
+  Revision 1.9  1998-05-31 14:13:32  peter
+    * fixed call bugs with assembler readers
+    + OPR_SYMBOL to hold a symbol in the asm parser
+    * fixed staticsymtable vars which were acessed through %ebp instead of
+      name
+
+  Revision 1.8  1998/05/30 14:31:07  peter
     + $ASMMODE
     + $ASMMODE
 
 
   Revision 1.7  1998/05/28 16:32:05  carl
   Revision 1.7  1998/05/28 16:32:05  carl
@@ -3406,120 +3419,4 @@ end.
       nasm output OK (program still crashes at end
       nasm output OK (program still crashes at end
       and creates wrong assembler files !!)
       and creates wrong assembler files !!)
       procsym types sym in tdef removed !!
       procsym types sym in tdef removed !!
-
-  Revision 1.2  1998/03/31 15:21:01  florian
-    * fix of out (intel syntax) applied
-
-  Revision 1.1.1.1  1998/03/25 11:18:15  root
-  * Restored version
-
-  Revision 1.19  1998/03/24 21:48:34  florian
-    * just a couple of fixes applied:
-         - problem with fixed16 solved
-         - internalerror 10005 problem fixed
-         - patch for assembler reading
-         - small optimizer fix
-         - mem is now supported
-
-  Revision 1.18  1998/03/10 01:17:26  peter
-    * all files have the same header
-    * messages are fully implemented, EXTDEBUG uses Comment()
-    + AG... files for the Assembler generation
-
-  Revision 1.17  1998/03/09 12:58:12  peter
-    * FWait warning is only showed for Go32V2 and $E+
-    * opcode tables moved to i386.pas/m68k.pas to reduce circular uses (and
-      for m68k the same tables are removed)
-    + $E for i386
-
-  Revision 1.16  1998/03/04 17:33:56  michael
-  + Changed ifdef FPK to ifdef FPC
-
-  Revision 1.15  1998/03/03 22:38:26  peter
-    * the last 3 files
-
-  Revision 1.14  1998/03/02 01:49:15  peter
-    * renamed target_DOS to target_GO32V1
-    + new verbose system, merged old errors and verbose units into one new
-      verbose.pas, so errors.pas is obsolete
-
-  Revision 1.13  1998/02/13 10:35:38  daniel
-  * Made Motorola version compilable.
-  * Fixed optimizer
-
-  Revision 1.12  1998/02/12 11:50:36  daniel
-  Yes! Finally! After three retries, my patch!
-
-  Changes:
-
-  Complete rewrite of psub.pas.
-  Added support for DLL's.
-  Compiler requires less memory.
-  Platform units for each platform.
-
-  Revision 1.11  1998/02/07 18:02:36  carl
-    + fwait warning for emulation
-
-  Revision 1.10  1998/01/19 03:11:40  carl
-    * bugfix number 78
-
-  Revision 1.9  1998/01/09 19:22:51  carl
-  * bugfix of __ID variable names
-
-  Revision 1.8  1997/12/09 14:00:25  carl
-  * bugfix of intr reg,reg instructions, size must always be specified
-    under gas (ref: DJGPP FAQ)
-  * bugfix of concatopcode with fits init twice!
-  + unknown instr. only poermitted when compiling system unit and/or
-    target processor > i386
-
-  Revision 1.7  1997/12/04 12:20:50  pierre
-    +* MMX instructions added to att output with a warning that
-       GNU as version >= 2.81 is needed
-       bug in reading of reals under att syntax corrected
-
-  Revision 1.6  1997/11/28 18:14:45  pierre
-   working version with several bug fixes
-
-  Revision 1.5  1997/11/28 15:43:20  florian
-  Fixed stack ajustment bug, 0.9.8 compiles now 0.9.8 without problems.
-
-  Revision 1.4  1997/11/28 15:31:59  carl
-  * uncommented firstop and lastop. (otherwise can cause bugs)
-
-  Revision 1.3  1997/11/28 14:26:22  florian
-  Fixed some bugs
-
-  Revision 1.2  1997/11/28 12:03:53  michael
-  Changed comment delimiters to braces, causes problems with 0.9.1
-  Changed use of ord to typecast with longint.
-  Made boolean expressions non-redundant.
-
-  Revision 1.1.1.1  1997/11/27 08:33:00  michael
-  FPC Compiler CVS start
-
-
-  Pre-CVS log:
-
-  CEC   Carl-Eric Codere
-  FK    Florian Klaempfl
-  PM    Pierre Muller
-  +     feature added
-  -     removed
-  *     bug fixed or changed
-
-  9th november 1997:
-   + first working version with main distribution line of FPC (CEC)
- 12th november 1997:
-   * bugfix of CALL and JMP with symbolic references. (CEC)
- 13th november 1997:
-   * too many bugfixes/improvements to name... (CEC)
-   * Fixed range check, line numbering, missing operand checking
-     bugs - range checking must be off to compile under tp. (CEC)
-   + speed improvement of 30% over old version with global look up tables.
- 14th november 1997:
-   + added support for record/object offsets. (CEC)
-   * fixed bug regarding ENTER and push imm8 instruction(CEC)
-   + fixed conflicts with fpu instructions. (CEC).
-
 }
 }

+ 15 - 126
compiler/ratti386.pas

@@ -954,6 +954,9 @@ const
                       findtype := _regtypes[reg];
                       findtype := _regtypes[reg];
                       exit;
                       exit;
                      end;
                      end;
+       OPR_SYMBOL:     Begin
+                       findtype := ao_jumpabsolute;
+                     end;
        OPR_NONE:     Begin
        OPR_NONE:     Begin
                        findtype := 0;
                        findtype := 0;
                      end;
                      end;
@@ -1648,6 +1651,11 @@ const
                 p^.concat(new(pai386,op_reg(instruc,
                 p^.concat(new(pai386,op_reg(instruc,
                   instr.stropsize, instr.operands[1].reg)));
                   instr.stropsize, instr.operands[1].reg)));
              End;
              End;
+           OPR_SYMBOL:
+             Begin
+                p^.concat(new(pai386,op_csymbol(instruc,
+                  instr.stropsize, newcsymbol(instr.operands[1].symbol^,0))));
+             End;
            OPR_REFERENCE:
            OPR_REFERENCE:
              { now first check suffix ... }
              { now first check suffix ... }
              if instr.stropsize <> S_NO then
              if instr.stropsize <> S_NO then
@@ -3683,7 +3691,13 @@ end.
 
 
 {
 {
   $Log$
   $Log$
-  Revision 1.10  1998-05-30 14:31:08  peter
+  Revision 1.11  1998-05-31 14:13:35  peter
+    * fixed call bugs with assembler readers
+    + OPR_SYMBOL to hold a symbol in the asm parser
+    * fixed staticsymtable vars which were acessed through %ebp instead of
+      name
+
+  Revision 1.10  1998/05/30 14:31:08  peter
     + $ASMMODE
     + $ASMMODE
 
 
   Revision 1.9  1998/05/29 09:58:16  pierre
   Revision 1.9  1998/05/29 09:58:16  pierre
@@ -3729,130 +3743,5 @@ end.
       nasm output OK (program still crashes at end
       nasm output OK (program still crashes at end
       and creates wrong assembler files !!)
       and creates wrong assembler files !!)
       procsym types sym in tdef removed !!
       procsym types sym in tdef removed !!
-
-  Revision 1.2  1998/03/30 15:53:01  florian
-    * last changes before release:
-       - gdb fixed
-       - ratti386 warning removed (about unset function result)
-
-  Revision 1.1.1.1  1998/03/25 11:18:15  root
-  * Restored version
-
-  Revision 1.21  1998/03/10 16:27:44  pierre
-    * better line info in stabs debug
-    * symtabletype and lexlevel separated into two fields of tsymtable
-    + ifdef MAKELIB for direct library output, not complete
-    + ifdef CHAINPROCSYMS for overloaded seach across units, not fully
-      working
-    + ifdef TESTFUNCRET for setting func result in underfunction, not
-      working
-
-  Revision 1.20  1998/03/10 01:17:27  peter
-    * all files have the same header
-    * messages are fully implemented, EXTDEBUG uses Comment()
-    + AG... files for the Assembler generation
-
-  Revision 1.19  1998/03/09 12:58:13  peter
-    * FWait warning is only showed for Go32V2 and $E+
-    * opcode tables moved to i386.pas/m68k.pas to reduce circular uses (and
-      for m68k the same tables are removed)
-    + $E for i386
-
-  Revision 1.18  1998/03/04 17:34:01  michael
-  + Changed ifdef FPK to ifdef FPC
-
-  Revision 1.17  1998/03/03 22:38:30  peter
-    * the last 3 files
-
-  Revision 1.16  1998/03/02 01:49:21  peter
-    * renamed target_DOS to target_GO32V1
-    + new verbose system, merged old errors and verbose units into one new
-      verbose.pas, so errors.pas is obsolete
-
-  Revision 1.15  1998/02/13 10:35:42  daniel
-  * Made Motorola version compilable.
-  * Fixed optimizer
-
-  Revision 1.14  1998/02/12 11:50:41  daniel
-  Yes! Finally! After three retries, my patch!
-
-  Changes:
-
-  Complete rewrite of psub.pas.
-  Added support for DLL's.
-  Compiler requires less memory.
-  Platform units for each platform.
-
-  Revision 1.13  1998/02/07 18:03:55  carl
-    + fwait warning for emulation
-
-  Revision 1.12  1998/01/19 03:10:52  carl
-    * bugfix number 78
-
-  Revision 1.11  1998/01/09 19:24:00  carl
-  + externals are now added if identifier is not found
-
-  Revision 1.10  1997/12/14 22:43:25  florian
-    + command line switch -Xs for DOS (passes -s to the linker to strip symbols from
-      executable)
-    * some changes of Carl-Eric implemented
-
-  Revision 1.9  1997/12/09 14:07:14  carl
-  + added better error size checkimg -- otherwise would cause problems
-    with intasmi3
-  * bugfixes as in rai386
-  * BuildRealConstant gave out Overflow errors (hex/bin/octal should be
-    directly decoded into real)
-  * bugfix of MOVSX/MOVZX instruction
-  * ConcatOpCode op_csymbol gave out a Runerrore 216 under each test
-    I performed, or output a nil symbol -- so removed.
-  * All identifiers must be in uppercase!!!
-    (except local labels and directives)
-  + supervisor stuff only possible when compiling the system unit
-
-  Revision 1.7  1997/12/04 12:21:09  pierre
-    +* MMX instructions added to att output with a warning that
-       GNU as version >= 2.81 is needed
-       bug in reading of reals under att syntax corrected
-
-  Revision 1.6  1997/12/01 17:42:56  pierre
-     + added some more functionnality to the assembler parser
-
-  Revision 1.5  1997/11/28 15:43:23  florian
-  Fixed stack ajustment bug, 0.9.8 compiles now 0.9.8 without problems.
-
-  Revision 1.4  1997/11/28 15:39:46  carl
-  - removed reference to WriteLn and replaced in inasmxxx
-  * uncommented firstop and lastop (otherwise can cause bugs)
-
-  Revision 1.3  1997/11/28 14:26:24  florian
-  Fixed some bugs
-
-  Revision 1.2  1997/11/28 12:05:44  michael
-  Changed comment delimiter to braces
-  CHanged use of ord to typecast with longint
-  Changed line constant to variable. Added initialization. v0.9.1 chokes
-  on 255 length constant strings.
-  Boolean expressions are now non-redundant.
-
-  Revision 1.1.1.1  1997/11/27 08:33:01  michael
-  FPC Compiler CVS start
-
-
-  Pre-CVS log:
-
-
-  CEC   Carl-Eric Codere
-  FK    Florian Klaempfl
-  PM    Pierre Muller
-  +     feature added
-  -     removed
-  *     bug fixed or changed
-
-  14th november 1997:
-   * fixed bug regarding ENTER and push imm8 instruction (CEC)
-   + fixed conflicts with fpu instructions. (CEC).
-   + adding real const support. (PM).
-
 }
 }
 
 

+ 28 - 22
compiler/symdef.inc

@@ -385,10 +385,10 @@
            writelong(len);
            writelong(len);
 {$ifdef NEWPPU}
 {$ifdef NEWPPU}
          case string_typ of
          case string_typ of
-           shortstring : ppufile.writeentry(ibstringdef);
-            longstring : ppufile.writeentry(iblongstringdef);
-            ansistring : ppufile.writeentry(ibansistringdef);
-            widestring : ppufile.writeentry(ibwidestringdef);
+           shortstring : ppufile^.writeentry(ibstringdef);
+            longstring : ppufile^.writeentry(iblongstringdef);
+            ansistring : ppufile^.writeentry(ibansistringdef);
+            widestring : ppufile^.writeentry(ibwidestringdef);
          end;
          end;
 {$endif}
 {$endif}
       end;
       end;
@@ -488,7 +488,7 @@
          tdef.write;
          tdef.write;
          writelong(max);
          writelong(max);
 {$ifdef NEWPPU}
 {$ifdef NEWPPU}
-         ppufile.writeentry(ibenumdef);
+         ppufile^.writeentry(ibenumdef);
 {$endif}
 {$endif}
       end;
       end;
 
 
@@ -640,7 +640,7 @@
          writelong(von);
          writelong(von);
          writelong(bis);
          writelong(bis);
 {$ifdef NEWPPU}
 {$ifdef NEWPPU}
-         ppufile.writeentry(iborddef);
+         ppufile^.writeentry(iborddef);
 {$endif}
 {$endif}
       end;
       end;
 
 
@@ -705,7 +705,7 @@
          tdef.write;
          tdef.write;
          writebyte(byte(typ));
          writebyte(byte(typ));
 {$ifdef NEWPPU}
 {$ifdef NEWPPU}
-         ppufile.writeentry(ibfloatdef);
+         ppufile^.writeentry(ibfloatdef);
 {$endif}
 {$endif}
       end;
       end;
 
 
@@ -805,7 +805,7 @@
          if filetype=ft_typed then
          if filetype=ft_typed then
            writedefref(typed_as);
            writedefref(typed_as);
 {$ifdef NEWPPU}
 {$ifdef NEWPPU}
-         ppufile.writeentry(ibfiledef);
+         ppufile^.writeentry(ibfiledef);
 {$endif}
 {$endif}
       end;
       end;
 
 
@@ -911,7 +911,7 @@
          tdef.write;
          tdef.write;
          writedefref(definition);
          writedefref(definition);
 {$ifdef NEWPPU}
 {$ifdef NEWPPU}
-         ppufile.writeentry(ibpointerdef);
+         ppufile^.writeentry(ibpointerdef);
 {$endif}
 {$endif}
       end;
       end;
 
 
@@ -990,7 +990,7 @@
          tdef.write;
          tdef.write;
          writedefref(definition);
          writedefref(definition);
 {$ifdef NEWPPU}
 {$ifdef NEWPPU}
-         ppufile.writeentry(ibclassrefdef);
+         ppufile^.writeentry(ibclassrefdef);
 {$endif}
 {$endif}
       end;
       end;
 
 
@@ -1061,7 +1061,7 @@
          if settype=varset then
          if settype=varset then
            writelong(savesize);
            writelong(savesize);
 {$ifdef NEWPPU}
 {$ifdef NEWPPU}
-         ppufile.writeentry(ibsetdef);
+         ppufile^.writeentry(ibsetdef);
 {$endif}
 {$endif}
       end;
       end;
 
 
@@ -1117,7 +1117,7 @@
 {$endif}
 {$endif}
          tdef.write;
          tdef.write;
 {$ifdef NEWPPU}
 {$ifdef NEWPPU}
-         ppufile.writeentry(ibformaldef);
+         ppufile^.writeentry(ibformaldef);
 {$endif}
 {$endif}
       end;
       end;
 
 
@@ -1197,7 +1197,7 @@
          writelong(lowrange);
          writelong(lowrange);
          writelong(highrange);
          writelong(highrange);
 {$ifdef NEWPPU}
 {$ifdef NEWPPU}
-         ppufile.writeentry(ibarraydef);
+         ppufile^.writeentry(ibarraydef);
 {$endif}
 {$endif}
       end;
       end;
 
 
@@ -1337,7 +1337,7 @@
          tdef.write;
          tdef.write;
          writelong(savesize);
          writelong(savesize);
 {$ifdef NEWPPU}
 {$ifdef NEWPPU}
-         ppufile.writeentry(ibrecorddef);
+         ppufile^.writeentry(ibrecorddef);
 {$endif}
 {$endif}
          self.symtable^.writeasstruct;
          self.symtable^.writeasstruct;
          read_member:=oldread_member;
          read_member:=oldread_member;
@@ -1691,7 +1691,7 @@
       { references do not change the ppu caracteristics      }
       { references do not change the ppu caracteristics      }
       { this only save the references to variables/functions }
       { this only save the references to variables/functions }
       { defined in the unit what about the others            }
       { defined in the unit what about the others            }
-         ppufile.do_crc:=false;
+         ppufile^.do_crc:=false;
          if assigned(lastwritten) then
          if assigned(lastwritten) then
            ref:=lastwritten
            ref:=lastwritten
          else
          else
@@ -1706,7 +1706,7 @@
            end;
            end;
          lastwritten:=lastref;
          lastwritten:=lastref;
          writebyte(ibend);
          writebyte(ibend);
-         ppufile.do_crc:=true;
+         ppufile^.do_crc:=true;
       end;
       end;
 
 
     procedure tprocdef.write_external_references;
     procedure tprocdef.write_external_references;
@@ -1714,7 +1714,7 @@
       var ref : pref;
       var ref : pref;
 
 
       begin
       begin
-         ppufile.do_crc:=false;
+         ppufile^.do_crc:=false;
          if lastwritten=lastref then exit;
          if lastwritten=lastref then exit;
          writebyte(ibextdefref);
          writebyte(ibextdefref);
          writedefref(@self);
          writedefref(@self);
@@ -1732,7 +1732,7 @@
            end;
            end;
          lastwritten:=lastref;
          lastwritten:=lastref;
          writebyte(ibend);
          writebyte(ibend);
-         ppufile.do_crc:=true;
+         ppufile^.do_crc:=true;
       end;
       end;
 
 
     procedure tprocdef.write_ref_to_file(var f : text);
     procedure tprocdef.write_ref_to_file(var f : text);
@@ -1798,7 +1798,7 @@
          writedefref(nextoverloaded);
          writedefref(nextoverloaded);
          writedefref(_class);
          writedefref(_class);
 {$ifdef NEWPPU}
 {$ifdef NEWPPU}
-         ppufile.writeentry(ibprocdef);
+         ppufile^.writeentry(ibprocdef);
 {$endif}
 {$endif}
 {$ifdef UseBrowser}
 {$ifdef UseBrowser}
          if (current_module^.flags and uf_uses_browser)<>0 then
          if (current_module^.flags and uf_uses_browser)<>0 then
@@ -1970,7 +1970,7 @@
 {$endif StoreFPULevel}
 {$endif StoreFPULevel}
          inherited write;
          inherited write;
 {$ifdef NEWPPU}
 {$ifdef NEWPPU}
-         ppufile.writeentry(ibprocvardef);
+         ppufile^.writeentry(ibprocvardef);
 {$endif}
 {$endif}
       end;
       end;
 
 
@@ -2215,7 +2215,7 @@
          writedefref(childof);
          writedefref(childof);
          writelong(options);
          writelong(options);
 {$ifdef NEWPPU}
 {$ifdef NEWPPU}
-         ppufile.writeentry(ibobjectdef);
+         ppufile^.writeentry(ibobjectdef);
 {$endif}
 {$endif}
          if (options and (oo_hasprivate or oo_hasprotected))<>0 then
          if (options and (oo_hasprivate or oo_hasprotected))<>0 then
            object_options:=true;
            object_options:=true;
@@ -2368,7 +2368,13 @@
 
 
 {
 {
   $Log$
   $Log$
-  Revision 1.1  1998-05-27 19:45:09  peter
+  Revision 1.2  1998-05-31 14:13:37  peter
+    * fixed call bugs with assembler readers
+    + OPR_SYMBOL to hold a symbol in the asm parser
+    * fixed staticsymtable vars which were acessed through %ebp instead of
+      name
+
+  Revision 1.1  1998/05/27 19:45:09  peter
     * symtable.pas splitted into includefiles
     * symtable.pas splitted into includefiles
     * symtable adapted for $ifdef NEWPPU
     * symtable adapted for $ifdef NEWPPU