mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-12-04 21:27:21 +01:00
* get rid or move the allocation of the replaced register if possible
git-svn-id: trunk@22193 -
This commit is contained in:
parent
77e579f59f
commit
3d7b603d11
@ -300,10 +300,23 @@ Implementation
|
||||
if assigned(dealloc) then
|
||||
begin
|
||||
asml.insertbefore(tai_comment.Create(strpnew('Peephole '+optimizer+' removed superfluous mov')), movp);
|
||||
|
||||
{ taicpu(p).oper[0]^.reg is not used anymore, try to find its allocation
|
||||
and remove it if possible }
|
||||
GetLastInstruction(p,hp1);
|
||||
asml.Remove(dealloc);
|
||||
alloc:=FindRegAlloc(taicpu(p).oper[0]^.reg,tai(hp1.Next));
|
||||
if assigned(alloc) then
|
||||
begin
|
||||
asml.Remove(alloc);
|
||||
alloc.free;
|
||||
dealloc.free;
|
||||
end
|
||||
else
|
||||
asml.InsertAfter(dealloc,p);
|
||||
|
||||
taicpu(p).loadreg(0,taicpu(movp).oper[0]^.reg);
|
||||
asml.remove(movp);
|
||||
asml.Remove(dealloc);
|
||||
asml.InsertAfter(dealloc,p);
|
||||
movp.free;
|
||||
end;
|
||||
end;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user