mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-09-16 12:29:22 +02:00
Debugging code in AllocRegBetween is now safer and more accurate, and p2 can no longer be nil
This commit is contained in:
parent
3a1efb7c07
commit
50a37d00e7
@ -1369,24 +1369,29 @@ Unit AoptObj;
|
|||||||
(ptaiprop(p1.optinfo)^.usedregs <> initialusedregs) then
|
(ptaiprop(p1.optinfo)^.usedregs <> initialusedregs) then
|
||||||
internalerror(2004101010); }
|
internalerror(2004101010); }
|
||||||
{$endif EXTDEBUG}
|
{$endif EXTDEBUG}
|
||||||
|
if not Assigned(p2) then
|
||||||
|
{ We need a valid final instruction }
|
||||||
|
InternalError(2022010401);
|
||||||
|
|
||||||
start := p1;
|
start := p1;
|
||||||
if (reg = NR_STACK_POINTER_REG) or
|
if (reg = NR_STACK_POINTER_REG) or
|
||||||
(reg = current_procinfo.framepointer) or
|
(reg = current_procinfo.framepointer) or
|
||||||
not(assigned(p1)) then
|
not(assigned(p1)) then
|
||||||
{ this happens with registers which are loaded implicitely, outside the }
|
{ this happens with registers which are loaded implicitely, outside the }
|
||||||
{ current block (e.g. esi with self) }
|
{ current block (e.g. esi with self) }
|
||||||
exit;
|
exit;
|
||||||
|
|
||||||
|
{$ifdef allocregdebug}
|
||||||
|
insertllitem(p1.previous,p1,tai_comment.Create(strpnew('allocating '+std_regname(reg)+' from here...')));
|
||||||
|
insertllitem(p2,p2.next,tai_comment.Create(strpnew('allocated '+std_regname(reg)+' till here...')));
|
||||||
|
{$endif allocregdebug}
|
||||||
|
|
||||||
{ make sure we allocate it for this instruction }
|
{ make sure we allocate it for this instruction }
|
||||||
getnextinstruction(p2,p2);
|
getnextinstruction(p2,p2);
|
||||||
lastRemovedWasDealloc := false;
|
lastRemovedWasDealloc := false;
|
||||||
removedSomething := false;
|
removedSomething := false;
|
||||||
firstRemovedWasAlloc := false;
|
firstRemovedWasAlloc := false;
|
||||||
{$ifdef allocregdebug}
|
|
||||||
hp := tai_comment.Create(strpnew('allocating '+std_regname(reg)+' from here...'));
|
|
||||||
insertllitem(p1.previous,p1,hp);
|
|
||||||
hp := tai_comment.Create(strpnew('allocated '+std_regname(reg)+' till here...'));
|
|
||||||
insertllitem(p2,p2.next,hp);
|
|
||||||
{$endif allocregdebug}
|
|
||||||
{ do it the safe way: always allocate the full super register,
|
{ do it the safe way: always allocate the full super register,
|
||||||
as we do no register re-allocation in the peephole optimizer,
|
as we do no register re-allocation in the peephole optimizer,
|
||||||
this does not hurt
|
this does not hurt
|
||||||
|
Loading…
Reference in New Issue
Block a user