Remove TMoveIns.id and use its address instead.

This commit is contained in:
Rika Ichinose 2022-05-12 10:43:20 +03:00
parent b2e596ada2
commit 3edf3566f0

View File

@ -81,7 +81,6 @@ unit rgobj;
Tmoveins=class(Tlinkedlistitem)
moveset:Tmoveset;
x,y:Tsuperregister;
id:uint32;
end;
PTmoveins=^Tmoveins;
@ -94,6 +93,7 @@ unit rgobj;
procedure done;
procedure add(ins:Tmoveins); { no-op if exists }
procedure rehash(foritems:sizeuint);
class function hashins(m:Tmoveins):sizeuint; static; {$ifdef USEINLINE} inline; {$endif}
end;
Treginfoflag=(
@ -263,7 +263,6 @@ unit rgobj;
has_usedmarks: boolean;
has_directalloc: boolean;
spillinfo : array of tspillinfo;
moveins_id_counter: uint32;
{ Disposes of the reginfo array.}
procedure dispose_reginfo;
@ -408,10 +407,9 @@ unit rgobj;
end;
procedure Tmovehashlist.add(ins:Tmoveins);
var hashRest : uint32;
ih,ii : sizeuint;
var hashRest,ih,ii : sizeuint;
begin
hashRest:=ins.id;
hashRest:=hashins(ins);
ih:=hashRest and hmask;
repeat
ii:=h[ih];
@ -443,8 +441,7 @@ unit rgobj;
var newh : puint32;
newitems : PTmoveins;
item : Tmoveins;
newhmask,newmaxitems,itemsOffset,iitem,ih : sizeuint;
hashRest : uint32;
newhmask,newmaxitems,itemsOffset,iitem,ih,hashRest : sizeuint;
begin
if foritems shr (bitsizeof(h^)-3)<>0 then
internalerror(202204251); { too big table }
@ -469,7 +466,7 @@ unit rgobj;
while iitem<nitems do
begin
item:=newitems[iitem];
hashRest:=item.id;
hashRest:=hashins(item);
ih:=hashRest and newhmask;
repeat
if newh[ih]=0 then
@ -494,6 +491,11 @@ unit rgobj;
maxitems:=newmaxitems;
end;
class function tmovehashlist.hashins(m:Tmoveins):sizeuint;
begin
result:=PtrUint(m) div (4*sizeof(pointer)); { "div approximate Tmoveins.InstanceSize". }
end;
{******************************************************************************
trgobj
@ -523,7 +525,6 @@ unit rgobj;
{ Get reginfo for CPU registers }
maxreginfo:=first_imaginary;
maxreginfoinc:=16;
moveins_id_counter:=0;
worklist_moves:=Tlinkedlist.create;
move_garbage:=TLinkedList.Create;
SetLength(reginfo,first_imaginary);
@ -999,13 +1000,7 @@ unit rgobj;
{ How should we handle m68k move %d0,%a0? }
if (getregtype(sreg)<>getregtype(dreg)) then
exit;
{$push} {$q-,r-}
inc(moveins_id_counter);
{$pop}
if moveins_id_counter=0 then
internalerror(2021112701);
i:=Tmoveins.create;
i.id:=moveins_id_counter;
i.moveset:=ms_worklist_moves;
worklist_moves.insert(i);
ssupreg:=getsupreg(sreg);