Browse Source

* problem with maybe_push/restore solved hopefully

pierre 26 years ago
parent
commit
20d1fb52b6
2 changed files with 41 additions and 12 deletions
  1. 33 7
      compiler/cg386add.pas
  2. 8 5
      compiler/cgai386.pas

+ 33 - 7
compiler/cg386add.pas

@@ -158,7 +158,11 @@ implementation
                         set_location(p^.location,p^.left^.location);
                         set_location(p^.location,p^.left^.location);
                         pushed:=maybe_push(p^.right^.registers32,p,false);
                         pushed:=maybe_push(p^.right^.registers32,p,false);
                         secondpass(p^.right);
                         secondpass(p^.right);
-                        if pushed then restore(p,false);
+                        if pushed then
+                          begin
+                             restore(p,false);
+                             set_location(p^.left^.location,p^.location);
+                          end;
                         { get the temp location, must be done before regs are
                         { get the temp location, must be done before regs are
                           released/pushed because after the release the regs are
                           released/pushed because after the release the regs are
                           still used for the push (PFV) }
                           still used for the push (PFV) }
@@ -188,7 +192,11 @@ implementation
                         secondpass(p^.left);
                         secondpass(p^.left);
                         pushed:=maybe_push(p^.right^.registers32,p,false);
                         pushed:=maybe_push(p^.right^.registers32,p,false);
                         secondpass(p^.right);
                         secondpass(p^.right);
-                        if pushed then restore(p,false);
+                        if pushed then
+                          begin
+                             restore(p,false);
+                             set_location(p^.left^.location,p^.location);
+                          end;
                         { release used registers }
                         { release used registers }
                         del_location(p^.right^.location);
                         del_location(p^.right^.location);
                         del_location(p^.left^.location);
                         del_location(p^.left^.location);
@@ -283,7 +291,11 @@ implementation
                              { are too few registers free? }
                              { are too few registers free? }
                              pushed:=maybe_push(p^.right^.registers32,p,false);
                              pushed:=maybe_push(p^.right^.registers32,p,false);
                              secondpass(p^.right);
                              secondpass(p^.right);
-                             if pushed then restore(p,false);
+                             if pushed then
+                               begin
+                                  restore(p,false);
+                                  set_location(p^.left^.location,p^.location);
+                               end;
                              { only one node can be stringconstn }
                              { only one node can be stringconstn }
                              { else pass 1 would have evaluted   }
                              { else pass 1 would have evaluted   }
                              { this node                         }
                              { this node                         }
@@ -357,7 +369,11 @@ implementation
         if codegenerror then
         if codegenerror then
           exit;
           exit;
         if pushed then
         if pushed then
-          restore(p,false);
+          begin
+             restore(p,false);
+             set_location(p^.left^.location,p^.location);
+          end;
+             
 
 
         set_location(p^.location,p^.left^.location);
         set_location(p^.location,p^.left^.location);
 
 
@@ -743,7 +759,11 @@ implementation
                             getlabel(falselabel);
                             getlabel(falselabel);
                          end;
                          end;
                        secondpass(p^.right);
                        secondpass(p^.right);
-                       if pushed then restore(p,false);
+                       if pushed then
+                         begin
+                            restore(p,false);
+                            set_location(p^.left^.location,p^.location);
+                         end;
                        case p^.right^.location.loc of
                        case p^.right^.location.loc of
                           LOC_FLAGS:
                           LOC_FLAGS:
                             locflags2reg(p^.right^.location,opsize);
                             locflags2reg(p^.right^.location,opsize);
@@ -800,7 +820,10 @@ implementation
               pushed:=maybe_push(p^.right^.registers32,p,is_64bitint(p^.left^.resulttype));
               pushed:=maybe_push(p^.right^.registers32,p,is_64bitint(p^.left^.resulttype));
               secondpass(p^.right);
               secondpass(p^.right);
               if pushed then
               if pushed then
-                restore(p,is_64bitint(p^.left^.resulttype));
+                begin
+                  restore(p,is_64bitint(p^.left^.resulttype));
+                  set_location(p^.left^.location,p^.location);
+                end;
 
 
               if (p^.left^.resulttype^.deftype=pointerdef) or
               if (p^.left^.resulttype^.deftype=pointerdef) or
 
 
@@ -2116,7 +2139,10 @@ implementation
 end.
 end.
 {
 {
   $Log$
   $Log$
-  Revision 1.76  1999-08-23 23:31:00  pierre
+  Revision 1.77  1999-08-30 12:00:45  pierre
+   * problem with maybe_push/restore solved hopefully
+
+  Revision 1.76  1999/08/23 23:31:00  pierre
    * double del_location removed in add_set
    * double del_location removed in add_set
 
 
   Revision 1.75  1999/08/23 10:35:13  jonas
   Revision 1.75  1999/08/23 10:35:13  jonas

+ 8 - 5
compiler/cgai386.pas

@@ -1142,8 +1142,8 @@ procedure mov_reg_to_dest(p : ptree; s : topsize; reg : tregister);
               { normally usage of base register is much better (FK)      }
               { normally usage of base register is much better (FK)      }
               p^.location.reference.base:=hregister;
               p^.location.reference.base:=hregister;
               { Why is this done? We can never be sure about p^.left
               { Why is this done? We can never be sure about p^.left
-                because otherwise secondload fails !!! }
-              set_location(p^.left^.location,p^.location);
+                because otherwise secondload fails !!!
+              set_location(p^.left^.location,p^.location);}
            end;
            end;
 {$ifdef TEMPS_NOT_PUSH}
 {$ifdef TEMPS_NOT_PUSH}
          ungetiftemp(href);
          ungetiftemp(href);
@@ -1179,8 +1179,8 @@ procedure mov_reg_to_dest(p : ptree; s : topsize; reg : tregister);
               reset_reference(p^.location.reference);
               reset_reference(p^.location.reference);
               p^.location.reference.base:=hregister;
               p^.location.reference.base:=hregister;
               { Why is this done? We can never be sure about p^.left
               { Why is this done? We can never be sure about p^.left
-                because otherwise secondload fails PM }
-              set_location(p^.left^.location,p^.location);
+                because otherwise secondload fails PM
+              set_location(p^.left^.location,p^.location);}
            end;
            end;
          ungetiftemp(href);
          ungetiftemp(href);
       end;
       end;
@@ -3293,7 +3293,10 @@ procedure mov_reg_to_dest(p : ptree; s : topsize; reg : tregister);
 end.
 end.
 {
 {
   $Log$
   $Log$
-  Revision 1.34  1999-08-30 09:41:31  pierre
+  Revision 1.35  1999-08-30 12:00:44  pierre
+   * problem with maybe_push/restore solved hopefully
+
+  Revision 1.34  1999/08/30 09:41:31  pierre
    * last change undone because cycle was broken
    * last change undone because cycle was broken
 
 
   Revision 1.33  1999/08/28 17:48:34  peter
   Revision 1.33  1999/08/28 17:48:34  peter