mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-04-14 04:19:28 +02:00
* Changed tsuperregisterworklist.get() to always return the last item from the list.
* Reversed sort order of simplifyworklist so nodes with most interferences will get their colors first. Since degree of nodes in simplifyworklist before sorting is always less than the number of usable registers this should not trigger spilling and should lead to a better register allocation in some cases. After these changes sysutils.o for i386-win32 is 80 bytes less. :) git-svn-id: trunk@45857 -
This commit is contained in:
parent
72dc2145e9
commit
e6b89c98f5
@ -343,6 +343,7 @@ interface
|
||||
procedure clear;
|
||||
procedure add(s:tsuperregister);
|
||||
function addnodup(s:tsuperregister): boolean;
|
||||
{ returns the last element and removes it from the list }
|
||||
function get:tsuperregister;
|
||||
function readidx(i:word):tsuperregister;
|
||||
procedure deleteidx(i:word);
|
||||
@ -590,9 +591,8 @@ implementation
|
||||
begin
|
||||
if length=0 then
|
||||
internalerror(200310142);
|
||||
get:=buf^[0];
|
||||
buf^[0]:=buf^[length-1];
|
||||
dec(length);
|
||||
get:=buf^[length];
|
||||
end;
|
||||
|
||||
|
||||
|
@ -929,7 +929,17 @@ unit rgobj;
|
||||
|
||||
{Sorts the simplifyworklist by the number of interferences the
|
||||
registers in it cause. This allows simplify to execute in
|
||||
constant time.}
|
||||
constant time.
|
||||
|
||||
Sort the list in the descending order, since items of simplifyworklist
|
||||
are retrieved from end to start and then items are added to selectstack.
|
||||
The selectstack list is also processed from end to start.
|
||||
|
||||
Such way nodes with most interferences will get their colors first.
|
||||
Since degree of nodes in simplifyworklist before sorting is always
|
||||
less than the number of usable registers this should not trigger spilling
|
||||
and should lead to a better register allocation in some cases.
|
||||
}
|
||||
|
||||
var p,h,i,leni,lent:longword;
|
||||
t:Tsuperregister;
|
||||
@ -958,7 +968,7 @@ unit rgobj;
|
||||
leni:=0;
|
||||
if adji<>nil then
|
||||
leni:=adji^.length;
|
||||
if leni<=lent then
|
||||
if leni>=lent then
|
||||
break;
|
||||
buf^[i]:=buf^[i-p];
|
||||
dec(i,p)
|
||||
@ -1018,7 +1028,7 @@ unit rgobj;
|
||||
var n:cardinal;
|
||||
|
||||
begin
|
||||
{If we have 7 cpu registers, and the degree of a node is 7, we cannot
|
||||
{If we have 7 cpu registers, and the degree of a node >= 7, we cannot
|
||||
assign it to any of the registers, thus it is significant.}
|
||||
for n:=first_imaginary to maxreg-1 do
|
||||
with reginfo[n] do
|
||||
|
Loading…
Reference in New Issue
Block a user