Browse Source

* fixed another problem with readln(<floating point register variable>);
* the register allocator takes now care of necessary pushes/pops for
readln/writeln

florian 25 years ago
parent
commit
ff5b72e3bd
5 changed files with 60 additions and 19 deletions
  1. 12 2
      compiler/cg386inl.pas
  2. 6 5
      compiler/hcodegen.pas
  3. 8 8
      compiler/tccal.pas
  4. 7 1
      compiler/tcinl.pas
  5. 27 3
      compiler/tgeni386.pas

+ 12 - 2
compiler/cg386inl.pas

@@ -101,7 +101,12 @@ implementation
                  emit_reg(op,opsize,correct_fpuregister(dest^.location.register,fpuvaroffset+1));
                  emit_reg(op,opsize,correct_fpuregister(dest^.location.register,fpuvaroffset+1));
               end
               end
             else
             else
-              floatstore(PFloatDef(dest^.resulttype)^.typ,dest^.location.reference);
+              begin
+                 floatstore(PFloatDef(dest^.resulttype)^.typ,dest^.location.reference);
+                 { floatstore decrements the fpu var offset }
+                 { but in fact we didn't increment it       }
+                 inc(fpuvaroffset);
+              end;
           orddef:
           orddef:
             begin
             begin
               if is_64bitint(dest^.resulttype) then
               if is_64bitint(dest^.resulttype) then
@@ -1520,7 +1525,12 @@ implementation
 end.
 end.
 {
 {
   $Log$
   $Log$
-  Revision 1.97  2000-04-02 17:47:47  florian
+  Revision 1.98  2000-04-02 18:30:11  florian
+    * fixed another problem with readln(<floating point register variable>);
+    * the register allocator takes now care of necessary pushes/pops for
+      readln/writeln
+
+  Revision 1.97  2000/04/02 17:47:47  florian
     * readln(r); works now, if r is a fpu register variable
     * readln(r); works now, if r is a fpu register variable
 
 
   Revision 1.96  2000/03/31 22:56:46  pierre
   Revision 1.96  2000/03/31 22:56:46  pierre

+ 6 - 5
compiler/hcodegen.pas

@@ -132,9 +132,6 @@ implementation
        { Boolean, wenn eine loadn kein Assembler erzeugt hat }
        { Boolean, wenn eine loadn kein Assembler erzeugt hat }
        simple_loadn : boolean;
        simple_loadn : boolean;
 
 
-       { tries to hold the amount of times which the current tree is processed  }
-       t_times : longint;
-
        { true, if an error while code generation occurs }
        { true, if an error while code generation occurs }
        codegenerror : boolean;
        codegenerror : boolean;
 
 
@@ -160,7 +157,6 @@ implementation
     procedure codegen_newmodule;
     procedure codegen_newmodule;
     procedure codegen_newprocedure;
     procedure codegen_newprocedure;
 
 
-
 implementation
 implementation
 
 
      uses
      uses
@@ -449,7 +445,12 @@ end.
 
 
 {
 {
   $Log$
   $Log$
-  Revision 1.57  2000-02-18 20:53:14  pierre
+  Revision 1.58  2000-04-02 18:30:12  florian
+    * fixed another problem with readln(<floating point register variable>);
+    * the register allocator takes now care of necessary pushes/pops for
+      readln/writeln
+
+  Revision 1.57  2000/02/18 20:53:14  pierre
     * fixes a stabs problem for functions
     * fixes a stabs problem for functions
     + includes a stabs local var for with statements
     + includes a stabs local var for with statements
       the name is with in lowercase followed by an index
       the name is with in lowercase followed by an index

+ 8 - 8
compiler/tccal.pas

@@ -503,8 +503,7 @@ implementation
 {$ifndef newcg}
 {$ifndef newcg}
               { calc the correture value for the register }
               { calc the correture value for the register }
 {$ifdef i386}
 {$ifdef i386}
-              for regi:=R_EAX to R_EDI do
-                inc(reg_pushes[regi],t_times*2);
+              incrementregisterpushed($ff);
 {$endif}
 {$endif}
 {$ifdef m68k}
 {$ifdef m68k}
               for regi:=R_D0 to R_A6 do
               for regi:=R_D0 to R_A6 do
@@ -1063,11 +1062,7 @@ implementation
                 end;
                 end;
 {$ifndef newcg}
 {$ifndef newcg}
 {$ifdef i386}
 {$ifdef i386}
-              for regi:=R_EAX to R_EDI do
-                begin
-                   if (pprocdef(p^.procdefinition)^.usedregisters and ($80 shr word(regi)))<>0 then
-                     inc(reg_pushes[regi],t_times*2);
-                end;
+              incrementregisterpushed(pprocdef(p^.procdefinition)^.usedregisters);
 {$endif}
 {$endif}
 {$ifdef m68k}
 {$ifdef m68k}
              for regi:=R_D0 to R_A6 do
              for regi:=R_D0 to R_A6 do
@@ -1236,7 +1231,12 @@ implementation
 end.
 end.
 {
 {
   $Log$
   $Log$
-  Revision 1.82  2000-02-29 22:13:41  pierre
+  Revision 1.83  2000-04-02 18:30:12  florian
+    * fixed another problem with readln(<floating point register variable>);
+    * the register allocator takes now care of necessary pushes/pops for
+      readln/writeln
+
+  Revision 1.82  2000/02/29 22:13:41  pierre
    + use $GOTO ON
    + use $GOTO ON
 
 
   Revision 1.81  2000/02/24 18:41:39  peter
   Revision 1.81  2000/02/24 18:41:39  peter

+ 7 - 1
compiler/tcinl.pas

@@ -709,6 +709,7 @@ implementation
                             hp:=p^.left;
                             hp:=p^.left;
                             while assigned(hp) do
                             while assigned(hp) do
                               begin
                               begin
+                                incrementregisterpushed($ff);
                                 if (hp^.left^.treetype=typen) then
                                 if (hp^.left^.treetype=typen) then
                                   CGMessage(type_e_cant_read_write_type);
                                   CGMessage(type_e_cant_read_write_type);
                                 if assigned(hp^.left^.resulttype) then
                                 if assigned(hp^.left^.resulttype) then
@@ -1315,7 +1316,12 @@ implementation
 end.
 end.
 {
 {
   $Log$
   $Log$
-  Revision 1.72  2000-03-27 09:42:50  pierre
+  Revision 1.73  2000-04-02 18:30:12  florian
+    * fixed another problem with readln(<floating point register variable>);
+    * the register allocator takes now care of necessary pushes/pops for
+      readln/writeln
+
+  Revision 1.72  2000/03/27 09:42:50  pierre
     + add error if trying to use readln or writeln for files
     + add error if trying to use readln or writeln for files
       or read or write on untyped files.
       or read or write on untyped files.
       Reset and rewrite are still incompatible with BP
       Reset and rewrite are still incompatible with BP

+ 27 - 3
compiler/tgeni386.pas

@@ -44,6 +44,10 @@ unit tgeni386;
        usableregmmx : byte = 8;
        usableregmmx : byte = 8;
 {$endif SUPPORT_MMX}
 {$endif SUPPORT_MMX}
 
 
+    var
+       { tries to hold the amount of times which the current tree is processed  }
+       t_times : longint;
+
 {$ifdef TEMPREGDEBUG}
 {$ifdef TEMPREGDEBUG}
     procedure testregisters32;
     procedure testregisters32;
 {$endif TEMPREGDEBUG}
 {$endif TEMPREGDEBUG}
@@ -71,6 +75,9 @@ unit tgeni386;
     procedure saveusedregisters(var saved : tsaved;b : byte);
     procedure saveusedregisters(var saved : tsaved;b : byte);
     procedure restoreusedregisters(const saved : tsaved);
     procedure restoreusedregisters(const saved : tsaved);
 
 
+    { increments the push count of all registers in b}
+    procedure incrementregisterpushed(b : byte);
+
     procedure clearregistercount;
     procedure clearregistercount;
     procedure resetusableregisters;
     procedure resetusableregisters;
 
 
@@ -110,6 +117,19 @@ implementation
     uses
     uses
       globtype,temp_gen;
       globtype,temp_gen;
 
 
+    procedure incrementregisterpushed(b : byte);
+
+      var
+         regi : tregister;
+
+      begin
+         for regi:=R_EAX to R_EDI do
+           begin
+              if (b and ($80 shr word(regi)))<>0 then
+                inc(reg_pushes[regi],t_times*2);
+           end;
+      end;
+
     procedure pushusedregisters(var pushed : tpushed;b : byte);
     procedure pushusedregisters(var pushed : tpushed;b : byte);
 
 
       var
       var
@@ -631,7 +651,12 @@ begin
 end.
 end.
 {
 {
   $Log$
   $Log$
-  Revision 1.41  2000-02-10 11:27:18  jonas
+  Revision 1.42  2000-04-02 18:30:12  florian
+    * fixed another problem with readln(<floating point register variable>);
+    * the register allocator takes now care of necessary pushes/pops for
+      readln/writeln
+
+  Revision 1.41  2000/02/10 11:27:18  jonas
     * esi is never deallocated anymore in methods
     * esi is never deallocated anymore in methods
 
 
   Revision 1.40  2000/02/09 13:23:08  peter
   Revision 1.40  2000/02/09 13:23:08  peter
@@ -684,5 +709,4 @@ end.
   Revision 1.28  1999/08/02 17:17:11  florian
   Revision 1.28  1999/08/02 17:17:11  florian
     * small changes for the new code generator
     * small changes for the new code generator
 
 
-}
-
+}