Преглед на файлове

i386: Correction to GetIntRegisterBetween to ensure we only get 8-bit registers that we can actually encode

J. Gareth "Curious Kit" Moreton преди 3 години
родител
ревизия
683a92bcc8
променени са 1 файла, в които са добавени 9 реда и са изтрити 1 реда
  1. 9 1
      compiler/x86/aoptx86.pas

+ 9 - 1
compiler/x86/aoptx86.pas

@@ -1073,7 +1073,15 @@ unit aoptx86;
         for CurrentSuperReg in RegSet do
         for CurrentSuperReg in RegSet do
           begin
           begin
             CurrentReg := newreg(R_INTREGISTER, TSuperRegister(CurrentSuperReg), RegSize);
             CurrentReg := newreg(R_INTREGISTER, TSuperRegister(CurrentSuperReg), RegSize);
-            if not AUsedRegs[R_INTREGISTER].IsUsed(CurrentReg) then
+            if not AUsedRegs[R_INTREGISTER].IsUsed(CurrentReg)
+{$if defined(i386) or defined(i8086)}
+              { If the target size is 8-bit, make sure we can actually encode it }
+              and (
+                (RegSize >= R_SUBW) or { Not R_SUBL or R_SUBH }
+                (GetSupReg(CurrentReg) in [RS_EAX,RS_EBX,RS_ECX,RS_EDX])
+              )
+{$endif i386 or i8086}
+              then
               begin
               begin
                 Currentp := p;
                 Currentp := p;
                 Breakout := False;
                 Breakout := False;