From 9344484ea786f7099b3343df3f0de88c97fb4a68 Mon Sep 17 00:00:00 2001 From: Jonas Maebe Date: Sat, 2 May 2009 22:26:24 +0000 Subject: [PATCH] * 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 - --- compiler/i386/daopt386.pas | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/compiler/i386/daopt386.pas b/compiler/i386/daopt386.pas index 97ace8f807..b8ffbeb0d2 100644 --- a/compiler/i386/daopt386.pas +++ b/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