|
@@ -409,7 +409,7 @@ var
|
|
|
|
|
|
var
|
|
var
|
|
prevreginfo: toptreginfo;
|
|
prevreginfo: toptreginfo;
|
|
- hp2, hp3{, EndMod},highPrev, orgPrev: tai;
|
|
|
|
|
|
+ hp2, hp3{, EndMod},highPrev, orgPrev, pprev: tai;
|
|
{Cnt,} OldNrofMods: Longint;
|
|
{Cnt,} OldNrofMods: Longint;
|
|
startRegInfo, OrgRegInfo, HighRegInfo: toptreginfo;
|
|
startRegInfo, OrgRegInfo, HighRegInfo: toptreginfo;
|
|
regModified, lastregloadremoved: array[RS_EAX..RS_ESP] of boolean;
|
|
regModified, lastregloadremoved: array[RS_EAX..RS_ESP] of boolean;
|
|
@@ -439,6 +439,7 @@ begin {CheckSequence}
|
|
regsNotRead := [RS_EAX,RS_EBX,RS_ECX,RS_EDX,RS_ESP,RS_EBP,RS_EDI,RS_ESI];
|
|
regsNotRead := [RS_EAX,RS_EBX,RS_ECX,RS_EDX,RS_ESP,RS_EBP,RS_EDI,RS_ESI];
|
|
regsStillValid := regsNotRead;
|
|
regsStillValid := regsNotRead;
|
|
GetLastInstruction(p, prev);
|
|
GetLastInstruction(p, prev);
|
|
|
|
+ pprev := prev;
|
|
tmpreg:=RS_INVALID;
|
|
tmpreg:=RS_INVALID;
|
|
regCounter := getNextRegToTest(prev,tmpreg);
|
|
regCounter := getNextRegToTest(prev,tmpreg);
|
|
while (regcounter <> RS_INVALID) do
|
|
while (regcounter <> RS_INVALID) do
|
|
@@ -519,17 +520,45 @@ begin {CheckSequence}
|
|
if not flagResultsNeeded then
|
|
if not flagResultsNeeded then
|
|
flagResultsNeeded := ptaiprop(hp3.optinfo)^.FlagsUsed;
|
|
flagResultsNeeded := ptaiprop(hp3.optinfo)^.FlagsUsed;
|
|
inc(Found);
|
|
inc(Found);
|
|
- if not GetNextInstruction(hp2, hp2) or
|
|
|
|
- not GetNextInstruction(hp3, hp3) then
|
|
|
|
- break;
|
|
|
|
|
|
+ if (Found <> OldNrofMods) then
|
|
|
|
+ if not GetNextInstruction(hp2, hp2) or
|
|
|
|
+ not GetNextInstruction(hp3, hp3) then
|
|
|
|
+ break;
|
|
end;
|
|
end;
|
|
|
|
|
|
|
|
+ getnextinstruction(hp3,hp3);
|
|
|
|
+{
|
|
|
|
+a) movl -4(%ebp),%edx
|
|
|
|
+ movl -12(%ebp),%ecx
|
|
|
|
+ ...
|
|
|
|
+ movl -8(%ebp),%eax
|
|
|
|
+ movl -12(%ebp),%edx (marked as removable)
|
|
|
|
+ movl (%eax,%edx),%eax (replaced by "movl (%eax,%ecx),%eax")
|
|
|
|
+ ...
|
|
|
|
+ movl -8(%ebp),%eax
|
|
|
|
+ movl -12(%ebp),%edx
|
|
|
|
+ movl (%eax,%edx),%eax
|
|
|
|
+ movl (%edx),%edx
|
|
|
|
+
|
|
|
|
+-> the "movl -12(ebp),%edx" can't be removed in the last sequence, because
|
|
|
|
+ edx has not been replaced with ecx there, and edx is still used after the
|
|
|
|
+ sequence
|
|
|
|
+
|
|
|
|
+b) tests/webtbs/tw4266.pp
|
|
|
|
+}
|
|
|
|
+
|
|
for regCounter2 := RS_EAX to RS_EDI do
|
|
for regCounter2 := RS_EAX to RS_EDI do
|
|
if (reginfo.new2OldReg[regCounter2] <> RS_INVALID) and
|
|
if (reginfo.new2OldReg[regCounter2] <> RS_INVALID) and
|
|
(regCounter2 in ptaiprop(hp3.optinfo)^.usedRegs) and
|
|
(regCounter2 in ptaiprop(hp3.optinfo)^.usedRegs) and
|
|
- not regLoadedWithNewValue(regCounter2,false,hp3) and
|
|
|
|
- lastregloadremoved[regcounter2] then
|
|
|
|
- found := 0;
|
|
|
|
|
|
+ { case a) above }
|
|
|
|
+ ((not regLoadedWithNewValue(regCounter2,false,hp3) and
|
|
|
|
+ lastregloadremoved[regcounter2]) or
|
|
|
|
+ { case b) above }
|
|
|
|
+ ((ptaiprop(pprev.optinfo)^.regs[regcounter2].wstate <>
|
|
|
|
+ ptaiprop(hp2.optinfo)^.regs[regcounter2].wstate))) then
|
|
|
|
+ begin
|
|
|
|
+ found := 0;
|
|
|
|
+ end;
|
|
|
|
|
|
if checkingPrevSequences then
|
|
if checkingPrevSequences then
|
|
begin
|
|
begin
|