mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-28 17:00:40 +02:00
* Further register allocator work. Compiler now smaller with new
allocator than without. * Somebody forgot to adjust ppu version number
This commit is contained in:
parent
d1eb9015ae
commit
9e2084b8d5
@ -742,6 +742,7 @@ unit cgobj;
|
||||
pushed_reg.enum:=R_INTREGISTER;
|
||||
pushed_reg.number:=NR_NO;
|
||||
if size in [OS_8,OS_S8] then
|
||||
{$ifndef newra}
|
||||
if (rg.countunusedregsint = 0) then
|
||||
begin
|
||||
if (dref.base.enum<>R_NO) and (dref.base.enum<>R_INTREGISTER) then
|
||||
@ -762,6 +763,7 @@ unit cgobj;
|
||||
list.concat(taicpu.op_reg(A_PUSH,S_L,pushed_reg));
|
||||
end
|
||||
else
|
||||
{$endif}
|
||||
tmpreg := rg.getregisterint(list,size)
|
||||
else
|
||||
{$endif i386}
|
||||
@ -773,6 +775,7 @@ unit cgobj;
|
||||
a_load_ref_reg(list,size,sref,tmpreg);
|
||||
a_load_reg_ref(list,size,tmpreg,dref);
|
||||
{$ifdef i386}
|
||||
{$ifndef newra}
|
||||
if size in [OS_8,OS_S8] then
|
||||
begin
|
||||
if (pushed_reg.number<>NR_NO) then
|
||||
@ -781,6 +784,7 @@ unit cgobj;
|
||||
rg.ungetregisterint(list,tmpreg)
|
||||
end
|
||||
else
|
||||
{$endif}
|
||||
{$endif i386}
|
||||
{$ifdef newra}
|
||||
rg.ungetregisterint(list,tmpreg);
|
||||
@ -1838,7 +1842,12 @@ finalization
|
||||
end.
|
||||
{
|
||||
$Log$
|
||||
Revision 1.86 2003-04-23 13:20:34 peter
|
||||
Revision 1.87 2003-04-23 14:42:07 daniel
|
||||
* Further register allocator work. Compiler now smaller with new
|
||||
allocator than without.
|
||||
* Somebody forgot to adjust ppu version number
|
||||
|
||||
Revision 1.86 2003/04/23 13:20:34 peter
|
||||
* fix self passing to fpc_help_fail
|
||||
|
||||
Revision 1.85 2003/04/23 12:35:34 florian
|
||||
|
@ -163,8 +163,8 @@ implementation
|
||||
else
|
||||
if (pop_size=8) and
|
||||
not(cs_littlesize in aktglobalswitches) and
|
||||
(aktoptprocessor=ClassP5) and
|
||||
(rg.countunusedregsint>0) then
|
||||
(aktoptprocessor=ClassP5)
|
||||
{$ifndef newra} and (rg.countunusedregsint>0){$endif} then
|
||||
begin
|
||||
{$ifdef newra}
|
||||
hreg:=rg.getregisterint(exprasmlist,OS_INT);
|
||||
@ -201,7 +201,12 @@ begin
|
||||
end.
|
||||
{
|
||||
$Log$
|
||||
Revision 1.89 2003-04-22 14:33:38 peter
|
||||
Revision 1.90 2003-04-23 14:42:08 daniel
|
||||
* Further register allocator work. Compiler now smaller with new
|
||||
allocator than without.
|
||||
* Somebody forgot to adjust ppu version number
|
||||
|
||||
Revision 1.89 2003/04/22 14:33:38 peter
|
||||
* removed some notes/hints
|
||||
|
||||
Revision 1.88 2003/04/22 10:09:35 daniel
|
||||
|
@ -358,7 +358,9 @@ unit rgcpu;
|
||||
{ then save it }
|
||||
list.concat(Taicpu.Op_reg(A_PUSH,S_L,r2));
|
||||
include(unusedregsint,r);
|
||||
{$ifndef newra}
|
||||
inc(countunusedregsint);
|
||||
{$endif}
|
||||
pushed[r].pushed:=true;
|
||||
end;
|
||||
end;
|
||||
@ -393,7 +395,9 @@ unit rgcpu;
|
||||
r2.enum:=r;
|
||||
list.concat(Taicpu.Op_reg_ref(A_MOVQ,S_NO,r2,hr));
|
||||
include(unusedregsmm,r);
|
||||
{$ifndef newra}
|
||||
inc(countunusedregsmm);
|
||||
{$endif}
|
||||
pushed[r].pushed:=true;
|
||||
end;
|
||||
end;
|
||||
@ -422,7 +426,7 @@ unit rgcpu;
|
||||
that appear as used
|
||||
due to a unused tmep storage PM }
|
||||
else
|
||||
dec(countunusedregsint);
|
||||
{$ifndef newra}dec(countunusedregsint){$endif};
|
||||
exclude(unusedregsint,r);
|
||||
end;
|
||||
{$ifdef TEMPREGDEBUG}
|
||||
@ -454,7 +458,7 @@ unit rgcpu;
|
||||
that appear as used
|
||||
due to a unused tmep storage PM }
|
||||
else
|
||||
dec(countunusedregsmm);
|
||||
{$ifndef newra}dec(countunusedregsmm){$endif};
|
||||
exclude(unusedregsmm,r);
|
||||
end;
|
||||
{$ifdef TEMPREGDEBUG}
|
||||
@ -562,7 +566,12 @@ end.
|
||||
|
||||
{
|
||||
$Log$
|
||||
Revision 1.19 2003-04-22 10:09:35 daniel
|
||||
Revision 1.20 2003-04-23 14:42:08 daniel
|
||||
* Further register allocator work. Compiler now smaller with new
|
||||
allocator than without.
|
||||
* Somebody forgot to adjust ppu version number
|
||||
|
||||
Revision 1.19 2003/04/22 10:09:35 daniel
|
||||
+ Implemented the actual register allocator
|
||||
+ Scratch registers unavailable when new register allocator used
|
||||
+ maybe_save/maybe_restore unavailable when new register allocator used
|
||||
|
@ -41,7 +41,7 @@ type
|
||||
{$endif Test_Double_checksum}
|
||||
|
||||
const
|
||||
CurrentPPUVersion=32;
|
||||
CurrentPPUVersion=33;
|
||||
|
||||
{ buffer sizes }
|
||||
maxentrysize = 1024;
|
||||
@ -985,7 +985,12 @@ end;
|
||||
end.
|
||||
{
|
||||
$Log$
|
||||
Revision 1.31 2003-04-10 17:57:53 peter
|
||||
Revision 1.32 2003-04-23 14:42:07 daniel
|
||||
* Further register allocator work. Compiler now smaller with new
|
||||
allocator than without.
|
||||
* Somebody forgot to adjust ppu version number
|
||||
|
||||
Revision 1.31 2003/04/10 17:57:53 peter
|
||||
* vs_hidden released
|
||||
|
||||
Revision 1.30 2003/03/17 15:54:22 peter
|
||||
|
@ -65,6 +65,10 @@ the div instruction modifies edx, so variables that are in use at that time
|
||||
cannot be stored into edx. This can be modelled by making edx interfere
|
||||
with those variables.
|
||||
|
||||
Graph colouring is an NP complete problem. Therefore we use an approximation
|
||||
that pushes registers to colour on to a stack. This is done in the "simplify"
|
||||
procedure.
|
||||
|
||||
*******************************************************************************}
|
||||
|
||||
|
||||
@ -148,8 +152,10 @@ unit rgobj;
|
||||
unusedregsmm,usableregsmm : tregisterset;
|
||||
{ these counters contain the number of elements in the }
|
||||
{ unusedregsxxx/usableregsxxx sets }
|
||||
{$ifndef newra}
|
||||
countunusedregsint,
|
||||
countunusedregsaddr,
|
||||
{$endif}
|
||||
countunusedregsfpu,
|
||||
countunusedregsmm : byte;
|
||||
countusableregsint,
|
||||
@ -343,17 +349,17 @@ unit rgobj;
|
||||
{ the following two contain the common (generic) code for all }
|
||||
{ get- and ungetregisterxxx functions/procedures }
|
||||
function getregistergen(list: taasmoutput; const lowreg, highreg: Toldregister;
|
||||
var unusedregs:Tregisterset; var countunusedregs: byte): tregister;
|
||||
var unusedregs:Tregisterset;var countunusedregs:byte): tregister;
|
||||
function getregistergenint(list:Taasmoutput;subreg:Tsubregister;
|
||||
const lowreg,highreg:Tsuperregister;
|
||||
var fusedinproc,fusedbyproc,unusedregs:Tsupregset;
|
||||
var countunusedregs:byte):Tregister;
|
||||
var fusedinproc,fusedbyproc,unusedregs:Tsupregset
|
||||
{$ifndef newra};var countunusedregs:byte{$endif}):Tregister;
|
||||
procedure ungetregistergen(list: taasmoutput; const r: tregister;
|
||||
const usableregs: tregisterset; var unusedregs: tregisterset; var countunusedregs: byte);
|
||||
const usableregs:tregisterset;var unusedregs: tregisterset; var countunusedregs: byte);
|
||||
procedure ungetregistergenint(list:taasmoutput;const r:Tregister;
|
||||
const usableregs:Tsupregset;
|
||||
var unusedregs:Tsupregset;
|
||||
var countunusedregs:byte);
|
||||
var unusedregs:Tsupregset
|
||||
{$ifndef newra};var countunusedregs:byte{$endif});
|
||||
{$ifdef TEMPREGDEBUG}
|
||||
reg_user : regvar_ptreearray;
|
||||
reg_releaser : regvar_ptreearray;
|
||||
@ -425,8 +431,10 @@ unit rgobj;
|
||||
unusedregsaddr,usableregsaddr : Tsupregset;
|
||||
unusedregsfpu,usableregsfpu : tregisterset;
|
||||
unusedregsmm,usableregsmm : tregisterset;
|
||||
{$ifndef newra}
|
||||
countunusedregsint,
|
||||
countunusedregsaddr,
|
||||
{$endif}
|
||||
countunusedregsfpu,
|
||||
countunusedregsmm : byte;
|
||||
countusableregsint,
|
||||
@ -452,8 +460,10 @@ unit rgobj;
|
||||
unusedregsaddr : Tsupregset;
|
||||
unusedregsfpu : tregisterset;
|
||||
unusedregsmm : tregisterset;
|
||||
{$ifndef newra}
|
||||
countunusedregsint,
|
||||
countunusedregsaddr,
|
||||
{$endif}
|
||||
countunusedregsfpu,
|
||||
countunusedregsmm : byte;
|
||||
end;
|
||||
@ -514,8 +524,8 @@ unit rgobj;
|
||||
function Trgobj.getregistergenint(list:Taasmoutput;
|
||||
subreg:Tsubregister;
|
||||
const lowreg,highreg:Tsuperregister;
|
||||
var fusedinproc,fusedbyproc,unusedregs:Tsupregset;
|
||||
var countunusedregs:byte):Tregister;
|
||||
var fusedinproc,fusedbyproc,unusedregs:Tsupregset
|
||||
{$ifndef newra};var countunusedregs:byte{$endif}):Tregister;
|
||||
|
||||
var i:Tsuperregister;
|
||||
r:Tregister;
|
||||
@ -534,7 +544,9 @@ unit rgobj;
|
||||
exclude(unusedregs,i);
|
||||
include(fusedinproc,i);
|
||||
include(fusedbyproc,i);
|
||||
{$ifndef newra}
|
||||
dec(countunusedregs);
|
||||
{$endif}
|
||||
r.enum:=R_INTREGISTER;
|
||||
r.number:=i shl 8 or subreg;
|
||||
list.concat(Tai_regalloc.alloc(r));
|
||||
@ -542,9 +554,9 @@ unit rgobj;
|
||||
lastintreg:=i;
|
||||
if i>maxintreg then
|
||||
maxintreg:=i;
|
||||
{$ifdef newra}
|
||||
{$ifdef newra}
|
||||
add_edges_used(i);
|
||||
{$endif}
|
||||
{$endif}
|
||||
exit;
|
||||
end;
|
||||
until i=lastintreg;
|
||||
@ -580,8 +592,8 @@ unit rgobj;
|
||||
|
||||
procedure trgobj.ungetregistergenint(list:taasmoutput;const r:Tregister;
|
||||
const usableregs:Tsupregset;
|
||||
var unusedregs:Tsupregset;
|
||||
var countunusedregs:byte);
|
||||
var unusedregs:Tsupregset
|
||||
{$ifndef newra}var countunusedregs:byte{$endif});
|
||||
|
||||
var supreg:Tsuperregister;
|
||||
|
||||
@ -607,7 +619,7 @@ unit rgobj;
|
||||
{$endif EXTTEMPREGDEBUG}
|
||||
else
|
||||
{$endif TEMPREGDEBUG}
|
||||
inc(countunusedregs);
|
||||
{$ifndef newra}inc(countunusedregs){$endif};
|
||||
include(unusedregs,supreg);
|
||||
list.concat(tai_regalloc.dealloc(r));
|
||||
{$ifdef newra}
|
||||
@ -621,16 +633,18 @@ unit rgobj;
|
||||
var subreg:Tsubregister;
|
||||
|
||||
begin
|
||||
{$ifndef newra}
|
||||
if countunusedregsint=0 then
|
||||
internalerror(10);
|
||||
{$ifdef TEMPREGDEBUG}
|
||||
{$ifdef TEMPREGDEBUG}
|
||||
if curptree^^.usableregs-countunusedregsint>curptree^^.registers32 then
|
||||
internalerror(10);
|
||||
{$endif TEMPREGDEBUG}
|
||||
{$ifdef EXTTEMPREGDEBUG}
|
||||
{$endif TEMPREGDEBUG}
|
||||
{$ifdef EXTTEMPREGDEBUG}
|
||||
if curptree^^.usableregs-countunusedregsint>curptree^^.reallyusedregs then
|
||||
curptree^^.reallyusedregs:=curptree^^.usableregs-countunusedregsint;
|
||||
{$endif EXTTEMPREGDEBUG}
|
||||
{$endif EXTTEMPREGDEBUG}
|
||||
{$endif}
|
||||
subreg:=cgsize2subreg(size);
|
||||
result:=getregistergenint(list,
|
||||
subreg,
|
||||
@ -643,8 +657,8 @@ unit rgobj;
|
||||
{$endif}
|
||||
usedintbyproc,
|
||||
usedintinproc,
|
||||
unusedregsint,
|
||||
countunusedregsint);
|
||||
unusedregsint{$ifndef newra},
|
||||
countunusedregsint{$endif});
|
||||
{$ifdef TEMPREGDEBUG}
|
||||
reg_user[result]:=curptree^;
|
||||
testregisters32;
|
||||
@ -655,8 +669,8 @@ unit rgobj;
|
||||
procedure trgobj.ungetregisterint(list : taasmoutput; r : tregister);
|
||||
|
||||
begin
|
||||
ungetregistergenint(list,r,usableregsint,unusedregsint,
|
||||
countunusedregsint);
|
||||
ungetregistergenint(list,r,usableregsint,unusedregsint{$ifndef newra},
|
||||
countunusedregsint{$endif});
|
||||
{$ifdef TEMPREGDEBUG}
|
||||
reg_releaser[r]:=curptree^;
|
||||
testregisters32;
|
||||
@ -672,12 +686,14 @@ unit rgobj;
|
||||
begin
|
||||
if (r shr 8) in unusedregsint then
|
||||
begin
|
||||
{$ifndef newra}
|
||||
dec(countunusedregsint);
|
||||
{$ifdef TEMPREGDEBUG}
|
||||
if curptree^^.usableregs-countunusedregsint>curptree^^.registers32 then
|
||||
internalerror(10);
|
||||
reg_user[r shr 8]:=curptree^;
|
||||
{$endif TEMPREGDEBUG}
|
||||
{$endif newra}
|
||||
exclude(unusedregsint,r shr 8);
|
||||
include(usedintinproc,r shr 8);
|
||||
include(usedintbyproc,r shr 8);
|
||||
@ -801,7 +817,9 @@ unit rgobj;
|
||||
{$endif newra}
|
||||
|
||||
begin
|
||||
{$ifndef newra}
|
||||
countunusedregsint:=countusableregsint;
|
||||
{$endif}
|
||||
countunusedregsfpu:=countusableregsfpu;
|
||||
countunusedregsmm:=countusableregsmm;
|
||||
lastintreg:=0;
|
||||
@ -899,7 +917,9 @@ unit rgobj;
|
||||
cg.a_load_reg_ref(list,OS_INT,r2,hr);
|
||||
cg.a_reg_dealloc(list,r2);
|
||||
include(unusedregsint,r);
|
||||
{$ifndef newra}
|
||||
inc(countunusedregsint);
|
||||
{$endif}
|
||||
end;
|
||||
end;
|
||||
{$ifdef TEMPREGDEBUG}
|
||||
@ -993,7 +1013,9 @@ unit rgobj;
|
||||
may not be real (JM) }
|
||||
else
|
||||
begin
|
||||
{$ifndef newra}
|
||||
dec(countunusedregsint);
|
||||
{$endif}
|
||||
exclude(unusedregsint,r);
|
||||
end;
|
||||
tg.UnGetTemp(list,hr);
|
||||
@ -1130,7 +1152,9 @@ unit rgobj;
|
||||
begin
|
||||
supreg:=reg shr 8;
|
||||
dec(countusableregsint);
|
||||
{$ifndef newra}
|
||||
dec(countunusedregsint);
|
||||
{$endif}
|
||||
exclude(usableregsint,reg);
|
||||
exclude(unusedregsint,reg);
|
||||
include(is_reg_var_int,supreg);
|
||||
@ -1184,7 +1208,9 @@ unit rgobj;
|
||||
psavedstate(state)^.usableregsfpu := usableregsfpu;
|
||||
psavedstate(state)^.unusedregsmm := unusedregsmm;
|
||||
psavedstate(state)^.usableregsmm := usableregsmm;
|
||||
{$ifndef newra}
|
||||
psavedstate(state)^.countunusedregsint := countunusedregsint;
|
||||
{$endif}
|
||||
psavedstate(state)^.countunusedregsfpu := countunusedregsfpu;
|
||||
psavedstate(state)^.countunusedregsmm := countunusedregsmm;
|
||||
psavedstate(state)^.countusableregsint := countusableregsint;
|
||||
@ -1212,7 +1238,9 @@ unit rgobj;
|
||||
usableregsfpu := psavedstate(state)^.usableregsfpu;
|
||||
unusedregsmm := psavedstate(state)^.unusedregsmm;
|
||||
usableregsmm := psavedstate(state)^.usableregsmm;
|
||||
{$ifndef newra}
|
||||
countunusedregsint := psavedstate(state)^.countunusedregsint;
|
||||
{$endif}
|
||||
countunusedregsfpu := psavedstate(state)^.countunusedregsfpu;
|
||||
countunusedregsmm := psavedstate(state)^.countunusedregsmm;
|
||||
countusableregsint := psavedstate(state)^.countusableregsint;
|
||||
@ -1240,7 +1268,9 @@ unit rgobj;
|
||||
punusedstate(state)^.unusedregsint := unusedregsint;
|
||||
punusedstate(state)^.unusedregsfpu := unusedregsfpu;
|
||||
punusedstate(state)^.unusedregsmm := unusedregsmm;
|
||||
{$ifndef newra}
|
||||
punusedstate(state)^.countunusedregsint := countunusedregsint;
|
||||
{$endif}
|
||||
punusedstate(state)^.countunusedregsfpu := countunusedregsfpu;
|
||||
punusedstate(state)^.countunusedregsmm := countunusedregsmm;
|
||||
end;
|
||||
@ -1251,7 +1281,9 @@ unit rgobj;
|
||||
unusedregsint := punusedstate(state)^.unusedregsint;
|
||||
unusedregsfpu := punusedstate(state)^.unusedregsfpu;
|
||||
unusedregsmm := punusedstate(state)^.unusedregsmm;
|
||||
{$ifndef newra}
|
||||
countunusedregsint := punusedstate(state)^.countunusedregsint;
|
||||
{$endif}
|
||||
countunusedregsfpu := punusedstate(state)^.countunusedregsfpu;
|
||||
countunusedregsmm := punusedstate(state)^.countunusedregsmm;
|
||||
dispose(punusedstate(state));
|
||||
@ -1969,7 +2001,12 @@ end.
|
||||
|
||||
{
|
||||
$Log$
|
||||
Revision 1.37 2003-04-22 23:50:23 peter
|
||||
Revision 1.38 2003-04-23 14:42:07 daniel
|
||||
* Further register allocator work. Compiler now smaller with new
|
||||
allocator than without.
|
||||
* Somebody forgot to adjust ppu version number
|
||||
|
||||
Revision 1.37 2003/04/22 23:50:23 peter
|
||||
* firstpass uses expectloc
|
||||
* checks if there are differences between the expectloc and
|
||||
location.loc from secondpass in EXTDEBUG
|
||||
|
@ -1180,6 +1180,16 @@ unit cgx86;
|
||||
cgsize:=OS_32;
|
||||
while len<>0 do
|
||||
begin
|
||||
if len<2 then
|
||||
begin
|
||||
copysize:=1;
|
||||
cgsize:=OS_8;
|
||||
end
|
||||
else if len<4 then
|
||||
begin
|
||||
copysize:=2;
|
||||
cgsize:=OS_16;
|
||||
end;
|
||||
dec(len,copysize);
|
||||
r:=rg.getregisterint(list,cgsize);
|
||||
a_load_ref_reg(list,cgsize,srcref,r);
|
||||
@ -1189,16 +1199,6 @@ unit cgx86;
|
||||
inc(srcref.offset,copysize);
|
||||
inc(dstref.offset,copysize);
|
||||
rg.ungetregisterint(list,r);
|
||||
if copysize<2 then
|
||||
begin
|
||||
copysize:=1;
|
||||
cgsize:=OS_8;
|
||||
end
|
||||
else if copysize<4 then
|
||||
begin
|
||||
copysize:=2;
|
||||
cgsize:=OS_16;
|
||||
end;
|
||||
end;
|
||||
end
|
||||
else
|
||||
@ -1938,7 +1938,12 @@ unit cgx86;
|
||||
end.
|
||||
{
|
||||
$Log$
|
||||
Revision 1.41 2003-04-23 09:51:16 daniel
|
||||
Revision 1.42 2003-04-23 14:42:08 daniel
|
||||
* Further register allocator work. Compiler now smaller with new
|
||||
allocator than without.
|
||||
* Somebody forgot to adjust ppu version number
|
||||
|
||||
Revision 1.41 2003/04/23 09:51:16 daniel
|
||||
* Removed usage of edi in a lot of places when new register allocator used
|
||||
+ Added newra versions of g_concatcopy and secondadd_float
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user