Browse Source

* allocregbetween has to update the "initialregs" parameter, because it
can remove regallocs for the allocated register and reinstert them
before already processed instructions, thereby preventing the
peephole optimizer from ever seeing the allocation for this register
(mantis #13612)

git-svn-id: trunk@13085 -

Jonas Maebe 16 năm trước cách đây
mục cha
commit
9344484ea7
1 tập tin đã thay đổi với 3 bổ sung2 xóa
  1. 3 2
      compiler/i386/daopt386.pas

+ 3 - 2
compiler/i386/daopt386.pas

@@ -199,7 +199,7 @@ procedure RemoveLastDeallocForFuncRes(asmL: TAsmList; p: tai);
 function regLoadedWithNewValue(supreg: tsuperregister; canDependOnPrevValue: boolean;
            hp: tai): boolean;
 procedure UpdateUsedRegs(var UsedRegs: TRegSet; p: tai);
-procedure AllocRegBetween(asml: TAsmList; reg: tregister; p1, p2: tai; const initialusedregs: tregset);
+procedure AllocRegBetween(asml: TAsmList; reg: tregister; p1, p2: tai; var initialusedregs: tregset);
 function FindRegDealloc(supreg: tsuperregister; p: tai): boolean;
 
 function InstructionsEquivalent(p1, p2: tai; var RegInfo: toptreginfo): Boolean;
@@ -1166,7 +1166,7 @@ begin
 end;
 
 
-procedure AllocRegBetween(asml: TAsmList; reg: tregister; p1, p2: tai; const initialusedregs: tregset);
+procedure AllocRegBetween(asml: TAsmList; reg: tregister; p1, p2: tai; var initialusedregs: tregset);
 { allocates register reg between (and including) instructions p1 and p2 }
 { the type of p1 and p2 must not be in SkipInstr                        }
 { note that this routine is both called from the peephole optimizer     }
@@ -1208,6 +1208,7 @@ begin
     begin
       hp := tai_regalloc.alloc(reg,nil);
       insertllItem(asmL,p1.previous,p1,hp);
+      include(initialusedregs,supreg);
     end;
   while assigned(p1) and
         (p1 <> p2) do