mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-06-14 13:18:26 +02:00
* x86: FuncMov2Func now has code to remove "mov %reg,%reg" (since it doesn't get removed in Pass 2).
This commit is contained in:
parent
3d805b8a9a
commit
a7d1f7d771
@ -2756,6 +2756,21 @@ unit aoptx86;
|
|||||||
AllocRegBetween(p_TargetReg, hp2, p, TmpUsedRegs);
|
AllocRegBetween(p_TargetReg, hp2, p, TmpUsedRegs);
|
||||||
end;
|
end;
|
||||||
RemoveCurrentp(p, hp1);
|
RemoveCurrentp(p, hp1);
|
||||||
|
|
||||||
|
{ If the Func was another MOV instruction, we might get
|
||||||
|
"mov %reg,%reg" that doesn't get removed in Pass 2
|
||||||
|
otherwise, so deal with it here (also do something
|
||||||
|
similar with lea (%reg),%reg}
|
||||||
|
if (taicpu(hp2).opcode = A_MOV) and MatchOperand(taicpu(hp2).oper[0]^, taicpu(hp2).oper[1]^.reg) then
|
||||||
|
begin
|
||||||
|
DebugMsg(SPeepholeOptimization + 'Mov2Nop 1a done', hp2);
|
||||||
|
|
||||||
|
if p = hp2 then
|
||||||
|
RemoveCurrentp(p)
|
||||||
|
else
|
||||||
|
RemoveInstruction(hp2);
|
||||||
|
end;
|
||||||
|
|
||||||
Result := True;
|
Result := True;
|
||||||
Exit;
|
Exit;
|
||||||
end;
|
end;
|
||||||
|
Loading…
Reference in New Issue
Block a user