Browse Source

* isgp32reg was being called with both tsuperregister and tregister
parameters, so changed type to tsuperregister (fixes bug reported by
Bas Steendijk)
* improved regsizesok() checking so it gives no false positives anymore

Jonas Maebe 21 years ago
parent
commit
942cfc9aac
3 changed files with 34 additions and 16 deletions
  1. 16 4
      compiler/i386/csopt386.pas
  2. 9 9
      compiler/i386/daopt386.pas
  3. 9 3
      compiler/i386/popt386.pas

+ 16 - 4
compiler/i386/csopt386.pas

@@ -968,6 +968,7 @@ function RegSizesOK(oldReg,newReg: tsuperregister; p: taicpu): boolean;
 { oldreg and newreg must be 32bit components }
 var
   opCount: longint;
+  tmpreg: tsuperregister;
 begin
   RegSizesOK := true;
   { if only one of them is a general purpose register ... }
@@ -977,9 +978,14 @@ begin
         if (p.oper[opCount]^.typ = top_reg) and
            (getsubreg(p.oper[opCount]^.reg) in [R_SUBL,R_SUBH]) then
           begin
-            RegSizesOK := false;
-            break
-          end
+            tmpreg := getsupreg(p.oper[opCount]^.reg);
+            if (tmpreg = oldreg) or
+               (tmpreg = newreg) then
+              begin
+                RegSizesOK := false;
+                break
+              end
+          end;
     end;
 end;
 
@@ -2049,7 +2055,13 @@ end.
 
 {
   $Log$
-  Revision 1.53  2003-12-07 19:19:56  jonas
+  Revision 1.54  2003-12-13 15:48:47  jonas
+    * isgp32reg was being called with both tsuperregister and tregister
+      parameters, so changed type to tsuperregister (fixes bug reported by
+      Bas Steendijk)
+    * improved regsizesok() checking so it gives no false positives anymore
+
+  Revision 1.53  2003/12/07 19:19:56  jonas
     * fixed some more bugs which only showed up in a ppc cross compiler
 
   Revision 1.52  2003/11/28 18:49:05  jonas

+ 9 - 9
compiler/i386/daopt386.pas

@@ -161,7 +161,7 @@ procedure InsertLLItem(AsmL: TAAsmOutput; prev, foll, new_one: TLinkedListItem);
 
 function RefsEquivalent(const R1, R2: TReference; var RegInfo: toptreginfo; OpAct: TOpAction): Boolean;
 function RefsEqual(const R1, R2: TReference): Boolean;
-function IsGP32Reg(reg: TRegister): Boolean;
+function isgp32reg(supreg: tsuperregister): Boolean;
 function reginref(supreg: tsuperregister; const ref: treference): boolean;
 function RegReadByInstruction(supreg: tsuperregister; hp: tai): boolean;
 function RegModifiedByInstruction(supreg: tsuperregister; p1: tai): boolean;
@@ -661,16 +661,10 @@ begin
 end;
 
 
-function isgp32reg(reg: tregister): boolean;
+function isgp32reg(supreg: tsuperregister): boolean;
 {Checks if the register is a 32 bit general purpose register}
-var
-  supreg: tsuperregister;
 begin
   isgp32reg := false;
-  if (reg = NR_NO) or
-     (getregtype(reg) <> R_INTREGISTER) then
-    exit;
-  supreg := getsupreg(reg);
   if (supreg >= RS_EAX) and (supreg <= RS_EBX) then
     isgp32reg := true
 end;
@@ -2707,7 +2701,13 @@ end.
 
 {
   $Log$
-  Revision 1.56  2003-12-07 19:19:56  jonas
+  Revision 1.57  2003-12-13 15:48:47  jonas
+    * isgp32reg was being called with both tsuperregister and tregister
+      parameters, so changed type to tsuperregister (fixes bug reported by
+      Bas Steendijk)
+    * improved regsizesok() checking so it gives no false positives anymore
+
+  Revision 1.56  2003/12/07 19:19:56  jonas
     * fixed some more bugs which only showed up in a ppc cross compiler
 
   Revision 1.55  2003/11/22 13:10:32  jonas

+ 9 - 3
compiler/i386/popt386.pas

@@ -1901,7 +1901,7 @@ See test/tgadint64 in the test suite.
                         case taicpu(p).opsize of
                           S_BL:
                             begin
-                              if IsGP32Reg(taicpu(p).oper[1]^.reg) and
+                              if IsGP32Reg(getsupreg(taicpu(p).oper[1]^.reg)) and
                                  not(CS_LittleSize in aktglobalswitches) and
                                  (aktoptprocessor = ClassPentium) then
                                   {Change "movzbl %reg1, %reg2" to
@@ -1921,7 +1921,7 @@ See test/tgadint64 in the test suite.
                           (taicpu(p).oper[0]^.ref^.base <> taicpu(p).oper[1]^.reg) and
                           (taicpu(p).oper[0]^.ref^.index <> taicpu(p).oper[1]^.reg) and
                           not(CS_LittleSize in aktglobalswitches) and
-                          IsGP32Reg(taicpu(p).oper[1]^.reg) and
+                          IsGP32Reg(getsupreg(taicpu(p).oper[1]^.reg)) and
                           (aktoptprocessor = ClassPentium) and
                           (taicpu(p).opsize = S_BL) then
                         {changes "movzbl mem, %reg" to "xorl %reg, %reg; movb mem, %reg8" for
@@ -1996,7 +1996,13 @@ end.
 
 {
   $Log$
-  Revision 1.50  2003-11-22 00:40:19  jonas
+  Revision 1.51  2003-12-13 15:48:47  jonas
+    * isgp32reg was being called with both tsuperregister and tregister
+      parameters, so changed type to tsuperregister (fixes bug reported by
+      Bas Steendijk)
+    * improved regsizesok() checking so it gives no false positives anymore
+
+  Revision 1.50  2003/11/22 00:40:19  jonas
     * fixed optimiser so it compiles again
     * fixed several bugs which were in there already for a long time, but
       which only popped up now :) -O2/-O3 will now optimise less than in