Browse Source

* the maybe_push fix of Pierre wasn't 100%, the tree parameter
must contain a valid location (which is saved if necessary)

florian 26 years ago
parent
commit
9f62eb480b
3 changed files with 24 additions and 23 deletions
  1. 11 18
      compiler/cg386add.pas
  2. 7 3
      compiler/cg386mat.pas
  3. 6 2
      compiler/cgai386.pas

+ 11 - 18
compiler/cg386add.pas

@@ -190,13 +190,10 @@ implementation
                      begin
                         cmpop:=true;
                         secondpass(p^.left);
-                        pushed:=maybe_push(p^.right^.registers32,p,false);
+                        pushed:=maybe_push(p^.right^.registers32,p^.left,false);
                         secondpass(p^.right);
                         if pushed then
-                          begin
-                             restore(p,false);
-                             set_location(p^.left^.location,p^.location);
-                          end;
+                          restore(p^.left,false);
                         { release used registers }
                         del_location(p^.right^.location);
                         del_location(p^.left^.location);
@@ -289,13 +286,10 @@ implementation
                           begin
                              secondpass(p^.left);
                              { are too few registers free? }
-                             pushed:=maybe_push(p^.right^.registers32,p,false);
+                             pushed:=maybe_push(p^.right^.registers32,p^.left,false);
                              secondpass(p^.right);
                              if pushed then
-                               begin
-                                  restore(p,false);
-                                  set_location(p^.left^.location,p^.location);
-                               end;
+                               restore(p^.left,false);
                              { only one node can be stringconstn }
                              { else pass 1 would have evaluted   }
                              { this node                         }
@@ -364,17 +358,12 @@ implementation
          end;
 
         { are too few registers free? }
-        pushed:=maybe_push(p^.right^.registers32,p,false);
+        pushed:=maybe_push(p^.right^.registers32,p^.left,false);
         secondpass(p^.right);
         if codegenerror then
           exit;
         if pushed then
-          begin
-             restore(p,false);
-             set_location(p^.left^.location,p^.location);
-          end;
-
-
+          restore(p^.left,false);
 
         set_location(p^.location,p^.left^.location);
 
@@ -2142,7 +2131,11 @@ implementation
 end.
 {
   $Log$
-  Revision 1.80  1999-09-26 13:26:01  florian
+  Revision 1.81  1999-09-28 19:43:45  florian
+    * the maybe_push fix of Pierre wasn't 100%, the tree parameter
+      must contain a valid location (which is saved if necessary)
+
+  Revision 1.80  1999/09/26 13:26:01  florian
     * exception patch of Romio nevertheless the excpetion handling
       needs some corections regarding register saving
     * gettempansistring is again a procedure

+ 7 - 3
compiler/cg386mat.pas

@@ -291,10 +291,10 @@ implementation
          popecx:=false;
 
          secondpass(p^.left);
-         pushed:=maybe_push(p^.right^.registers32,p,is_64bitint(p^.left^.resulttype));
+         pushed:=maybe_push(p^.right^.registers32,p^.left,is_64bitint(p^.left^.resulttype));
          secondpass(p^.right);
          if pushed then
-           restore(p,is_64bitint(p^.left^.resulttype));
+           restore(p^.left,is_64bitint(p^.left^.resulttype));
 
          if is_64bitint(p^.left^.resulttype) then
            begin
@@ -940,7 +940,11 @@ implementation
 end.
 {
   $Log$
-  Revision 1.33  1999-09-27 23:37:26  peter
+  Revision 1.34  1999-09-28 19:43:47  florian
+    * the maybe_push fix of Pierre wasn't 100%, the tree parameter
+      must contain a valid location (which is saved if necessary)
+
+  Revision 1.33  1999/09/27 23:37:26  peter
     * fixed push/restore bug in div/mod
 
   Revision 1.32  1999/09/02 17:07:38  florian

+ 6 - 2
compiler/cgai386.pas

@@ -102,7 +102,7 @@ unit cgai386;
     procedure push_value_para(p:ptree;inlined:boolean;para_offset:longint;alignment : longint);
 
 {$ifdef TEMPS_NOT_PUSH}
-    { does the same as restore/maybe_push, but uses temp. space instead of pushing }
+    { does the same as restore/, but uses temp. space instead of pushing }
     function maybe_push(needed : byte;p : ptree;isint64 : boolean) : boolean;
     procedure restorefromtemp(p : ptree;isint64 : boolean);
 {$endif TEMPS_NOT_PUSH}
@@ -3359,7 +3359,11 @@ procedure mov_reg_to_dest(p : ptree; s : topsize; reg : tregister);
 end.
 {
   $Log$
-  Revision 1.47  1999-09-27 23:44:50  peter
+  Revision 1.48  1999-09-28 19:43:47  florian
+    * the maybe_push fix of Pierre wasn't 100%, the tree parameter
+      must contain a valid location (which is saved if necessary)
+
+  Revision 1.47  1999/09/27 23:44:50  peter
     * procinfo is now a pointer
     * support for result setting in sub procedure