Browse Source

* moved call to "cleanup_regvars" to cga.pas for i386 because it has
to insert "fstp %st0" instructions after the exit label

Jonas Maebe 24 years ago
parent
commit
60dc4bf0a9
2 changed files with 19 additions and 4 deletions
  1. 8 2
      compiler/i386/cga.pas
  2. 11 2
      compiler/pass_2.pas

+ 8 - 2
compiler/i386/cga.pas

@@ -2518,7 +2518,7 @@ implementation
   begin
   begin
       oldexprasmlist:=exprasmlist;
       oldexprasmlist:=exprasmlist;
       exprasmlist:=alist;
       exprasmlist:=alist;
-
+      
       if aktexit2label.is_used and
       if aktexit2label.is_used and
          ((procinfo^.flags and (pi_needs_implicit_finally or pi_uses_exceptions)) <> 0) then
          ((procinfo^.flags and (pi_needs_implicit_finally or pi_uses_exceptions)) <> 0) then
         begin
         begin
@@ -2530,6 +2530,8 @@ implementation
       if aktexitlabel.is_used then
       if aktexitlabel.is_used then
         exprasmList.concat(Tai_label.Create(aktexitlabel));
         exprasmList.concat(Tai_label.Create(aktexitlabel));
 
 
+      cleanup_regvars(alist);
+
       { call the destructor help procedure }
       { call the destructor help procedure }
       if (aktprocdef.proctypeoption=potype_destructor) and
       if (aktprocdef.proctypeoption=potype_destructor) and
          assigned(procinfo^._class) then
          assigned(procinfo^._class) then
@@ -2974,7 +2976,11 @@ implementation
 end.
 end.
 {
 {
   $Log$
   $Log$
-  Revision 1.9  2001-11-02 22:58:09  peter
+  Revision 1.10  2001-11-06 16:39:02  jonas
+    * moved call to "cleanup_regvars" to cga.pas for i386 because it has
+      to insert "fstp %st0" instructions after the exit label
+
+  Revision 1.9  2001/11/02 22:58:09  peter
     * procsym definition rewrite
     * procsym definition rewrite
 
 
   Revision 1.8  2001/10/25 21:22:41  peter
   Revision 1.8  2001/10/25 21:22:41  peter

+ 11 - 2
compiler/pass_2.pas

@@ -288,8 +288,13 @@ implementation
               { process register variable stuff (JM) }
               { process register variable stuff (JM) }
               assign_regvars(p);
               assign_regvars(p);
               load_regvars(procinfo^.aktentrycode,p);
               load_regvars(procinfo^.aktentrycode,p);
-              cleanup_regvars(procinfo^.aktexitcode);
 
 
+              { for the i386 it must be done in genexitcode because it has  }
+              { to add 'fstp' instructions when using fpu regvars and those }
+              { must come after the "exitlabel" (JM)                        }
+{$ifndef i386}
+              cleanup_regvars(procinfo^.aktexitcode);
+{$endif i386}
               if assigned(aktprocsym) and
               if assigned(aktprocsym) and
                  (aktprocdef.proccalloption=pocall_inline) then
                  (aktprocdef.proccalloption=pocall_inline) then
                 make_const_global:=true;
                 make_const_global:=true;
@@ -306,7 +311,11 @@ implementation
 end.
 end.
 {
 {
   $Log$
   $Log$
-  Revision 1.20  2001-11-02 22:58:02  peter
+  Revision 1.21  2001-11-06 16:39:02  jonas
+    * moved call to "cleanup_regvars" to cga.pas for i386 because it has
+      to insert "fstp %st0" instructions after the exit label
+
+  Revision 1.20  2001/11/02 22:58:02  peter
     * procsym definition rewrite
     * procsym definition rewrite
 
 
   Revision 1.19  2001/10/25 21:22:35  peter
   Revision 1.19  2001/10/25 21:22:35  peter