浏览代码

* typecast to tenumreg before updating usedregs to prevent varset usage, patch from Sergei Gorelkin

git-svn-id: trunk@9296 -
peter 17 年之前
父节点
当前提交
cb24c78d4d
共有 1 个文件被更改,包括 7 次插入6 次删除
  1. 7 6
      compiler/i386/daopt386.pas

+ 7 - 6
compiler/i386/daopt386.pas

@@ -65,8 +65,9 @@ const
 {********************************* Types *********************************}
 {********************************* Types *********************************}
 
 
 type
 type
-  TRegArray = Array[RS_EAX..RS_ESP] of tsuperregister;
-  TRegSet = Set of RS_EAX..RS_ESP;
+  TRegEnum = RS_EAX..RS_ESP;
+  TRegArray = Array[TRegEnum] of tsuperregister;
+  TRegSet = Set of TRegEnum;
   toptreginfo = Record
   toptreginfo = Record
                 NewRegsEncountered, OldRegsEncountered: TRegSet;
                 NewRegsEncountered, OldRegsEncountered: TRegSet;
                 RegsLoadedForRef: TRegSet;
                 RegsLoadedForRef: TRegSet;
@@ -337,9 +338,9 @@ begin
       begin
       begin
         case tai_regalloc(p).ratype of
         case tai_regalloc(p).ratype of
           ra_alloc :
           ra_alloc :
-            UsedRegs := UsedRegs + [tai_regalloc(p).reg];
+            Include(UsedRegs, TRegEnum(getsupreg(tai_regalloc(p).reg)));
           ra_dealloc :
           ra_dealloc :
-            UsedRegs := UsedRegs - [tai_regalloc(p).reg];
+            Exclude(UsedRegs, TRegEnum(getsupreg(tai_regalloc(p).reg)));
         end;
         end;
         p := tai(p.next);
         p := tai(p.next);
       end;
       end;
@@ -1151,9 +1152,9 @@ begin
           begin
           begin
             case tai_regalloc(p).ratype of
             case tai_regalloc(p).ratype of
               ra_alloc :
               ra_alloc :
-                UsedRegs := UsedRegs + [getsupreg(tai_regalloc(p).reg)];
+                Include(UsedRegs, TRegEnum(getsupreg(tai_regalloc(p).reg)));
               ra_dealloc :
               ra_dealloc :
-                UsedRegs := UsedRegs - [getsupreg(tai_regalloc(p).reg)];
+                Exclude(UsedRegs, TRegEnum(getsupreg(tai_regalloc(p).reg)));
             end;
             end;
           end;
           end;
         p := tai(p.next);
         p := tai(p.next);