mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-12 20:29:23 +02:00
* patch by J. Gareth Moreton to resolve bug introduced in the first patch, resolves #38294
git-svn-id: trunk@48117 -
This commit is contained in:
parent
4e9b42344e
commit
f42f62565b
@ -4986,7 +4986,7 @@ unit aoptx86;
|
|||||||
MinSize, MaxSize, TrySmaller, TargetSize: TOpSize;
|
MinSize, MaxSize, TrySmaller, TargetSize: TOpSize;
|
||||||
TargetSubReg: TSubRegister;
|
TargetSubReg: TSubRegister;
|
||||||
hp1, hp2: tai;
|
hp1, hp2: tai;
|
||||||
RegInUse, p_removed: Boolean;
|
RegInUse, RegChanged, p_removed: Boolean;
|
||||||
|
|
||||||
{ Store list of found instructions so we don't have to call
|
{ Store list of found instructions so we don't have to call
|
||||||
GetNextInstructionUsingReg multiple times }
|
GetNextInstructionUsingReg multiple times }
|
||||||
@ -5036,6 +5036,7 @@ unit aoptx86;
|
|||||||
TrySmallerLimit := UpperLimit;
|
TrySmallerLimit := UpperLimit;
|
||||||
TrySmaller := S_NO;
|
TrySmaller := S_NO;
|
||||||
SmallerOverflow := False;
|
SmallerOverflow := False;
|
||||||
|
RegChanged := False;
|
||||||
|
|
||||||
while GetNextInstructionUsingReg(hp1, hp1, ThisReg) and
|
while GetNextInstructionUsingReg(hp1, hp1, ThisReg) and
|
||||||
(hp1.typ = ait_instruction) and
|
(hp1.typ = ait_instruction) and
|
||||||
@ -5418,6 +5419,7 @@ unit aoptx86;
|
|||||||
begin
|
begin
|
||||||
DebugMsg(SPeepholeOptimization + 'Simplified register usage so ' + debug_regname(taicpu(hp1).oper[1]^.reg) + ' = ' + debug_regname(taicpu(p).oper[1]^.reg), p);
|
DebugMsg(SPeepholeOptimization + 'Simplified register usage so ' + debug_regname(taicpu(hp1).oper[1]^.reg) + ' = ' + debug_regname(taicpu(p).oper[1]^.reg), p);
|
||||||
ThisReg := taicpu(hp1).oper[1]^.reg;
|
ThisReg := taicpu(hp1).oper[1]^.reg;
|
||||||
|
RegChanged := True;
|
||||||
|
|
||||||
TransferUsedRegs(TmpUsedRegs);
|
TransferUsedRegs(TmpUsedRegs);
|
||||||
AllocRegBetween(ThisReg, p, hp1, TmpUsedRegs);
|
AllocRegBetween(ThisReg, p, hp1, TmpUsedRegs);
|
||||||
@ -5452,9 +5454,12 @@ unit aoptx86;
|
|||||||
{ Now go through every instruction we found and change the
|
{ Now go through every instruction we found and change the
|
||||||
size. If TargetSize = MaxSize, then almost no changes are
|
size. If TargetSize = MaxSize, then almost no changes are
|
||||||
needed and Result can remain False if it hasn't been set
|
needed and Result can remain False if it hasn't been set
|
||||||
yet. }
|
yet.
|
||||||
|
|
||||||
if (TargetSize <> MaxSize) and (InstrMax >= 0) then
|
If RegChanged is True, then the register requires changing
|
||||||
|
and so the point about TargetSize = MaxSize doesn't apply. }
|
||||||
|
|
||||||
|
if ((TargetSize <> MaxSize) or RegChanged) and (InstrMax >= 0) then
|
||||||
begin
|
begin
|
||||||
for Index := 0 to InstrMax do
|
for Index := 0 to InstrMax do
|
||||||
begin
|
begin
|
||||||
|
Loading…
Reference in New Issue
Block a user