* cs_regalloc renamed to cs_regvars to avoid confusion with register

allocator
  * Some preventive changes to i386 spillinh code
This commit is contained in:
daniel 2003-08-09 18:56:54 +00:00
parent 2a3c6e0de5
commit 42c320cb29
14 changed files with 147 additions and 67 deletions

View File

@ -68,7 +68,7 @@ interface
cs_load_objpas_unit, cs_load_objpas_unit,
cs_load_gpc_unit, cs_load_gpc_unit,
{ optimizer } { optimizer }
cs_regalloc,cs_no_regalloc,cs_uncertainopts,cs_littlesize, cs_regvars,cs_no_regalloc,cs_uncertainopts,cs_littlesize,
cs_optimize,cs_fastoptimize,cs_slowoptimize,cs_align, cs_optimize,cs_fastoptimize,cs_slowoptimize,cs_align,
{ browser } { browser }
cs_browser_log, cs_browser_log,
@ -208,7 +208,12 @@ implementation
end. end.
{ {
$Log$ $Log$
Revision 1.38 2003-04-27 11:21:32 peter Revision 1.39 2003-08-09 18:56:54 daniel
* cs_regalloc renamed to cs_regvars to avoid confusion with register
allocator
* Some preventive changes to i386 spillinh code
Revision 1.38 2003/04/27 11:21:32 peter
* aktprocdef renamed to current_procdef * aktprocdef renamed to current_procdef
* procinfo renamed to current_procinfo * procinfo renamed to current_procinfo
* procinfo will now be stored in current_module so it can be * procinfo will now be stored in current_module so it can be

View File

@ -48,7 +48,7 @@ interface
const const
regname_count=45; regname_count=45;
regname_count_bsstart=32; regname_count_bsstart=32; {Largest power of 2 out of regname_count.}
intel_regname2regnum:array[0..regname_count-1] of regname2regnumrec=( intel_regname2regnum:array[0..regname_count-1] of regname2regnumrec=(
(name:'ah'; number:NR_AH), (name:'ah'; number:NR_AH),
@ -966,7 +966,12 @@ initialization
end. end.
{ {
$Log$ $Log$
Revision 1.34 2003-03-08 08:59:07 daniel Revision 1.35 2003-08-09 18:56:54 daniel
* cs_regalloc renamed to cs_regvars to avoid confusion with register
allocator
* Some preventive changes to i386 spillinh code
Revision 1.34 2003/03/08 08:59:07 daniel
+ $define newra will enable new register allocator + $define newra will enable new register allocator
+ getregisterint will return imaginary registers with $newra + getregisterint will return imaginary registers with $newra
+ -sr switch added, will skip register allocation so you can see + -sr switch added, will skip register allocation so you can see

View File

@ -287,8 +287,12 @@ interface
if o.reg.enum=R_INTREGISTER then if o.reg.enum=R_INTREGISTER then
asmwrite(intel_regname(o.reg.number)) asmwrite(intel_regname(o.reg.number))
else else
begin
if o.reg.enum>high(Toldregister) then
internalerror(01010101);
asmwrite(int_nasmreg2str[o.reg.enum]); asmwrite(int_nasmreg2str[o.reg.enum]);
end; end;
end;
top_const : top_const :
begin begin
if (ops=1) and (opcode<>A_RET) then if (ops=1) and (opcode<>A_RET) then
@ -925,7 +929,12 @@ initialization
end. end.
{ {
$Log$ $Log$
Revision 1.36 2003-07-06 15:31:21 daniel Revision 1.37 2003-08-09 18:56:54 daniel
* cs_regalloc renamed to cs_regvars to avoid confusion with register
allocator
* Some preventive changes to i386 spillinh code
Revision 1.36 2003/07/06 15:31:21 daniel
* Fixed register allocator. *Lots* of fixes. * Fixed register allocator. *Lots* of fixes.
Revision 1.35 2003/06/03 13:01:59 daniel Revision 1.35 2003/06/03 13:01:59 daniel

View File

@ -54,7 +54,7 @@ begin
'-' : '-' :
begin begin
initglobalswitches:=initglobalswitches-[cs_optimize,cs_fastoptimize,cs_slowoptimize,cs_littlesize, initglobalswitches:=initglobalswitches-[cs_optimize,cs_fastoptimize,cs_slowoptimize,cs_littlesize,
cs_regalloc,cs_uncertainopts]; cs_regvars,cs_uncertainopts];
FillChar(ParaAlignment,sizeof(ParaAlignment),0); FillChar(ParaAlignment,sizeof(ParaAlignment),0);
end; end;
'a' : 'a' :
@ -66,7 +66,7 @@ begin
'G' : initglobalswitches:=initglobalswitches-[cs_littlesize]; 'G' : initglobalswitches:=initglobalswitches-[cs_littlesize];
'r' : 'r' :
begin begin
initglobalswitches:=initglobalswitches+[cs_regalloc]; initglobalswitches:=initglobalswitches+[cs_regvars];
Simplify_ppu:=false; Simplify_ppu:=false;
end; end;
'u' : initglobalswitches:=initglobalswitches+[cs_uncertainopts]; 'u' : initglobalswitches:=initglobalswitches+[cs_uncertainopts];
@ -129,7 +129,12 @@ initialization
end. end.
{ {
$Log$ $Log$
Revision 1.9 2002-08-12 15:08:42 carl Revision 1.10 2003-08-09 18:56:54 daniel
* cs_regalloc renamed to cs_regvars to avoid confusion with register
allocator
* Some preventive changes to i386 spillinh code
Revision 1.9 2002/08/12 15:08:42 carl
+ stab register indexes for powerpc (moved from gdb to cpubase) + stab register indexes for powerpc (moved from gdb to cpubase)
+ tprocessor enumeration moved to cpuinfo + tprocessor enumeration moved to cpuinfo
+ linker in target_info is now a class + linker in target_info is now a class

View File

@ -1952,7 +1952,7 @@ See test/tgadint64 in the test suite.
{ "cmpl $3,%eax; movzbl 8(%ebp),%ebx; je .Lxxx" } { "cmpl $3,%eax; movzbl 8(%ebp),%ebx; je .Lxxx" }
{ so we can't safely replace the movzx then with xor/mov, } { so we can't safely replace the movzx then with xor/mov, }
{ since that would change the flags (JM) } { since that would change the flags (JM) }
if not(cs_regalloc in aktglobalswitches) then if not(cs_regvars in aktglobalswitches) then
Begin Begin
If (Taicpu(p).oper[1].typ = top_reg) Then If (Taicpu(p).oper[1].typ = top_reg) Then
If (Taicpu(p).oper[0].typ = top_reg) If (Taicpu(p).oper[0].typ = top_reg)
@ -2058,7 +2058,12 @@ End.
{ {
$Log$ $Log$
Revision 1.47 2003-06-08 18:48:03 jonas Revision 1.48 2003-08-09 18:56:54 daniel
* cs_regalloc renamed to cs_regvars to avoid confusion with register
allocator
* Some preventive changes to i386 spillinh code
Revision 1.47 2003/06/08 18:48:03 jonas
* first small steps towards an oop optimizer * first small steps towards an oop optimizer
Revision 1.46 2003/06/03 21:09:05 peter Revision 1.46 2003/06/03 21:09:05 peter

View File

@ -384,7 +384,7 @@ implementation
while assigned(hp) do while assigned(hp) do
begin begin
(* (*
if cs_regalloc in aktglobalswitches then if cs_regvars in aktglobalswitches then
begin begin
{ node transformations } { node transformations }
@ -852,7 +852,12 @@ begin
end. end.
{ {
$Log$ $Log$
Revision 1.58 2003-06-13 21:19:30 peter Revision 1.59 2003-08-09 18:56:54 daniel
* cs_regalloc renamed to cs_regvars to avoid confusion with register
allocator
* Some preventive changes to i386 spillinh code
Revision 1.58 2003/06/13 21:19:30 peter
* current_procdef removed, use current_procinfo.procdef instead * current_procdef removed, use current_procinfo.procdef instead
Revision 1.57 2003/06/10 09:10:47 jonas Revision 1.57 2003/06/10 09:10:47 jonas

View File

@ -207,7 +207,7 @@ implementation
{$ifdef i386} {$ifdef i386}
{ save regvars loaded in the beginning so that we can restore them } { save regvars loaded in the beginning so that we can restore them }
{ when processing the else-block } { when processing the else-block }
if cs_regalloc in aktglobalswitches then if cs_regvars in aktglobalswitches then
begin begin
org_list := exprasmlist; org_list := exprasmlist;
exprasmlist := taasmoutput.create; exprasmlist := taasmoutput.create;
@ -216,7 +216,7 @@ implementation
maketojumpbool(exprasmlist,left,lr_dont_load_regvars); maketojumpbool(exprasmlist,left,lr_dont_load_regvars);
{$ifdef i386} {$ifdef i386}
if cs_regalloc in aktglobalswitches then if cs_regvars in aktglobalswitches then
begin begin
org_regvar_loaded_int := rg.regvar_loaded_int; org_regvar_loaded_int := rg.regvar_loaded_int;
org_regvar_loaded_other := rg.regvar_loaded_other; org_regvar_loaded_other := rg.regvar_loaded_other;
@ -235,7 +235,7 @@ implementation
{$ifdef i386} {$ifdef i386}
{ save current asmlist (previous instructions + then-block) and } { save current asmlist (previous instructions + then-block) and }
{ loaded regvar state and create new clean ones } { loaded regvar state and create new clean ones }
if cs_regalloc in aktglobalswitches then if cs_regvars in aktglobalswitches then
begin begin
then_regvar_loaded_int := rg.regvar_loaded_int; then_regvar_loaded_int := rg.regvar_loaded_int;
then_regvar_loaded_other := rg.regvar_loaded_other; then_regvar_loaded_other := rg.regvar_loaded_other;
@ -253,7 +253,7 @@ implementation
objectlibrary.getlabel(hl); objectlibrary.getlabel(hl);
{ do go back to if line !! } { do go back to if line !! }
{$ifdef i386} {$ifdef i386}
if not(cs_regalloc in aktglobalswitches) then if not(cs_regvars in aktglobalswitches) then
{$endif i386} {$endif i386}
aktfilepos:=exprasmList.getlasttaifilepos^ aktfilepos:=exprasmList.getlasttaifilepos^
{$ifdef i386} {$ifdef i386}
@ -271,7 +271,7 @@ implementation
{$ifdef i386} {$ifdef i386}
{ save current asmlist (previous instructions + else-block) } { save current asmlist (previous instructions + else-block) }
{ and loaded regvar state and create a new clean list } { and loaded regvar state and create a new clean list }
if cs_regalloc in aktglobalswitches then if cs_regvars in aktglobalswitches then
begin begin
else_regvar_loaded_int := rg.regvar_loaded_int; else_regvar_loaded_int := rg.regvar_loaded_int;
else_regvar_loaded_other := rg.regvar_loaded_other; else_regvar_loaded_other := rg.regvar_loaded_other;
@ -285,7 +285,7 @@ implementation
else else
begin begin
{$ifdef i386} {$ifdef i386}
if cs_regalloc in aktglobalswitches then if cs_regvars in aktglobalswitches then
begin begin
else_regvar_loaded_int := rg.regvar_loaded_int; else_regvar_loaded_int := rg.regvar_loaded_int;
else_regvar_loaded_other := rg.regvar_loaded_other; else_regvar_loaded_other := rg.regvar_loaded_other;
@ -301,7 +301,7 @@ implementation
end; end;
{$ifdef i386} {$ifdef i386}
if cs_regalloc in aktglobalswitches then if cs_regvars in aktglobalswitches then
begin begin
{ add loads of regvars at the end of the then- and else-blocks } { add loads of regvars at the end of the then- and else-blocks }
{ so that at the end of both blocks the same regvars are loaded } { so that at the end of both blocks the same regvars are loaded }
@ -1539,7 +1539,12 @@ begin
end. end.
{ {
$Log$ $Log$
Revision 1.73 2003-07-23 11:01:14 jonas Revision 1.74 2003-08-09 18:56:54 daniel
* cs_regalloc renamed to cs_regvars to avoid confusion with register
allocator
* Some preventive changes to i386 spillinh code
Revision 1.73 2003/07/23 11:01:14 jonas
* several rg.allocexplicitregistersint/rg.deallocexplicitregistersint * several rg.allocexplicitregistersint/rg.deallocexplicitregistersint
pairs round calls to helpers pairs round calls to helpers

View File

@ -739,7 +739,7 @@ implementation
else else
{ not nodetype=ordconstn } { not nodetype=ordconstn }
begin begin
if (cs_regalloc in aktglobalswitches) and if (cs_regvars in aktglobalswitches) and
{ if we do range checking, we don't } { if we do range checking, we don't }
{ need that fancy code (it would be } { need that fancy code (it would be }
{ buggy) } { buggy) }
@ -898,7 +898,12 @@ begin
end. end.
{ {
$Log$ $Log$
Revision 1.67 2003-07-23 11:01:14 jonas Revision 1.68 2003-08-09 18:56:54 daniel
* cs_regalloc renamed to cs_regvars to avoid confusion with register
allocator
* Some preventive changes to i386 spillinh code
Revision 1.67 2003/07/23 11:01:14 jonas
* several rg.allocexplicitregistersint/rg.deallocexplicitregistersint * several rg.allocexplicitregistersint/rg.deallocexplicitregistersint
pairs round calls to helpers pairs round calls to helpers

View File

@ -250,10 +250,10 @@ implementation
internalerror(200301154); internalerror(200301154);
if t.reference.index.enum<>R_INTREGISTER then if t.reference.index.enum<>R_INTREGISTER then
internalerror(200301154); internalerror(200301154);
if not(cs_regalloc in aktglobalswitches) or if not(cs_regvars in aktglobalswitches) or
((t.reference.base.number shr 8) in rg.usableregsint) then ((t.reference.base.number shr 8) in rg.usableregsint) then
exclude(regs,t.reference.base.number shr 8); exclude(regs,t.reference.base.number shr 8);
if not(cs_regalloc in aktglobalswitches) or if not(cs_regvars in aktglobalswitches) or
((t.reference.index.number shr 8) in rg.usableregsint) then ((t.reference.index.number shr 8) in rg.usableregsint) then
exclude(regs,t.reference.index.number shr 8); exclude(regs,t.reference.index.number shr 8);
end; end;
@ -2030,7 +2030,12 @@ implementation
end. end.
{ {
$Log$ $Log$
Revision 1.132 2003-08-03 14:09:50 daniel Revision 1.133 2003-08-09 18:56:54 daniel
* cs_regalloc renamed to cs_regvars to avoid confusion with register
allocator
* Some preventive changes to i386 spillinh code
Revision 1.132 2003/08/03 14:09:50 daniel
* Fixed a register allocator bug * Fixed a register allocator bug
* Figured out why -dnewra generates superfluous "mov reg1,reg2" * Figured out why -dnewra generates superfluous "mov reg1,reg2"
statements: changes in location_force. These moves are now no longer statements: changes in location_force. These moves are now no longer

View File

@ -54,7 +54,7 @@ begin
'-' : '-' :
begin begin
initglobalswitches:=initglobalswitches-[cs_optimize,cs_fastoptimize,cs_slowoptimize,cs_littlesize, initglobalswitches:=initglobalswitches-[cs_optimize,cs_fastoptimize,cs_slowoptimize,cs_littlesize,
cs_regalloc,cs_uncertainopts]; cs_regvars,cs_uncertainopts];
FillChar(ParaAlignment,sizeof(ParaAlignment),0); FillChar(ParaAlignment,sizeof(ParaAlignment),0);
end; end;
'a' : 'a' :
@ -66,7 +66,7 @@ begin
'G' : initglobalswitches:=initglobalswitches-[cs_littlesize]; 'G' : initglobalswitches:=initglobalswitches-[cs_littlesize];
'r' : 'r' :
begin begin
initglobalswitches:=initglobalswitches+[cs_regalloc]; initglobalswitches:=initglobalswitches+[cs_regvars];
Simplify_ppu:=false; Simplify_ppu:=false;
end; end;
'u' : initglobalswitches:=initglobalswitches+[cs_uncertainopts]; 'u' : initglobalswitches:=initglobalswitches+[cs_uncertainopts];
@ -119,7 +119,12 @@ initialization
end. end.
{ {
$Log$ $Log$
Revision 1.8 2002-09-07 17:54:59 florian Revision 1.9 2003-08-09 18:56:54 daniel
* cs_regalloc renamed to cs_regvars to avoid confusion with register
allocator
* Some preventive changes to i386 spillinh code
Revision 1.8 2002/09/07 17:54:59 florian
* first part of PowerPC fixes * first part of PowerPC fixes
Revision 1.7 2002/09/04 16:03:53 jonas Revision 1.7 2002/09/04 16:03:53 jonas

View File

@ -154,7 +154,7 @@ implementation
{ max. optimizations } { max. optimizations }
{ only if no asm is used } { only if no asm is used }
{ and no try statement } { and no try statement }
if (cs_regalloc in aktglobalswitches) and if (cs_regvars in aktglobalswitches) and
{$ifndef i386} {$ifndef i386}
{ we have to store regvars back to memory in this case! } { we have to store regvars back to memory in this case! }
(tcgprocinfo(current_procinfo).nestedprocs.count = 0) and (tcgprocinfo(current_procinfo).nestedprocs.count = 0) and
@ -468,7 +468,7 @@ implementation
regvarinfo: pregvarinfo; regvarinfo: pregvarinfo;
r:Tregister; r:Tregister;
begin begin
if (cs_regalloc in aktglobalswitches) and if (cs_regvars in aktglobalswitches) and
not(pi_uses_asm in current_procinfo.flags) and not(pi_uses_asm in current_procinfo.flags) and
not(pi_uses_exceptions in current_procinfo.flags) then not(pi_uses_exceptions in current_procinfo.flags) then
begin begin
@ -575,7 +575,7 @@ implementation
{ can happen when inlining assembler procedures (JM) } { can happen when inlining assembler procedures (JM) }
if not assigned(current_procinfo.procdef.regvarinfo) then if not assigned(current_procinfo.procdef.regvarinfo) then
exit; exit;
if (cs_regalloc in aktglobalswitches) and if (cs_regvars in aktglobalswitches) and
not(pi_uses_asm in current_procinfo.flags) and not(pi_uses_asm in current_procinfo.flags) and
not(pi_uses_exceptions in current_procinfo.flags) then not(pi_uses_exceptions in current_procinfo.flags) then
with pregvarinfo(current_procinfo.procdef.regvarinfo)^ do with pregvarinfo(current_procinfo.procdef.regvarinfo)^ do
@ -616,7 +616,12 @@ end.
{ {
$Log$ $Log$
Revision 1.58 2003-07-02 22:18:04 peter Revision 1.59 2003-08-09 18:56:54 daniel
* cs_regalloc renamed to cs_regvars to avoid confusion with register
allocator
* Some preventive changes to i386 spillinh code
Revision 1.58 2003/07/02 22:18:04 peter
* paraloc splitted in callerparaloc,calleeparaloc * paraloc splitted in callerparaloc,calleeparaloc
* sparc calling convention updates * sparc calling convention updates

View File

@ -992,7 +992,7 @@ unit rgobj;
var r:Tsuperregister; var r:Tsuperregister;
hr: tregister; hr: tregister;
begin begin
if not(cs_regalloc in aktglobalswitches) then if not(cs_regvars in aktglobalswitches) then
exit; exit;
for r:=firstsaveintreg to lastsaveintreg do for r:=firstsaveintreg to lastsaveintreg do
if (r in is_reg_var_int) and if (r in is_reg_var_int) and
@ -1009,7 +1009,7 @@ unit rgobj;
var var
r: Tregister; r: Tregister;
begin begin
if not(cs_regalloc in aktglobalswitches) then if not(cs_regvars in aktglobalswitches) then
exit; exit;
if firstsavefpureg <> R_NO then if firstsavefpureg <> R_NO then
for r.enum := firstsavefpureg to lastsavefpureg do for r.enum := firstsavefpureg to lastsavefpureg do
@ -2542,7 +2542,12 @@ end.
{ {
$Log$ $Log$
Revision 1.62 2003-08-03 14:09:50 daniel Revision 1.63 2003-08-09 18:56:54 daniel
* cs_regalloc renamed to cs_regvars to avoid confusion with register
allocator
* Some preventive changes to i386 spillinh code
Revision 1.62 2003/08/03 14:09:50 daniel
* Fixed a register allocator bug * Fixed a register allocator bug
* Figured out why -dnewra generates superfluous "mov reg1,reg2" * Figured out why -dnewra generates superfluous "mov reg1,reg2"
statements: changes in location_force. These moves are now no longer statements: changes in location_force. These moves are now no longer

View File

@ -54,7 +54,7 @@ begin
'-' : '-' :
begin begin
initglobalswitches:=initglobalswitches-[cs_optimize,cs_fastoptimize,cs_slowoptimize,cs_littlesize, initglobalswitches:=initglobalswitches-[cs_optimize,cs_fastoptimize,cs_slowoptimize,cs_littlesize,
cs_regalloc,cs_uncertainopts]; cs_regvars,cs_uncertainopts];
FillChar(ParaAlignment,sizeof(ParaAlignment),0); FillChar(ParaAlignment,sizeof(ParaAlignment),0);
end; end;
'a' : 'a' :
@ -66,7 +66,7 @@ begin
'G' : initglobalswitches:=initglobalswitches-[cs_littlesize]; 'G' : initglobalswitches:=initglobalswitches-[cs_littlesize];
'r' : 'r' :
begin begin
initglobalswitches:=initglobalswitches+[cs_regalloc]; initglobalswitches:=initglobalswitches+[cs_regvars];
Simplify_ppu:=false; Simplify_ppu:=false;
end; end;
'u' : initglobalswitches:=initglobalswitches+[cs_uncertainopts]; 'u' : initglobalswitches:=initglobalswitches+[cs_uncertainopts];
@ -129,7 +129,12 @@ initialization
end. end.
{ {
$Log$ $Log$
Revision 1.3 2002-09-07 15:25:14 peter Revision 1.4 2003-08-09 18:56:54 daniel
* cs_regalloc renamed to cs_regvars to avoid confusion with register
allocator
* Some preventive changes to i386 spillinh code
Revision 1.3 2002/09/07 15:25:14 peter
* old logs removed and tabs fixed * old logs removed and tabs fixed
Revision 1.2 2002/08/23 10:08:28 mazen Revision 1.2 2002/08/23 10:08:28 mazen

View File

@ -2017,7 +2017,9 @@ implementation
begin begin
back:=unusedregsint; back:=unusedregsint;
get_insert_pos:=p; get_insert_pos:=p;
while (p<>nil) and (p.typ=ait_regalloc) do while (p<>nil) and not (p.typ in [ait_instruction,ait_label]) do
begin
if p.typ=ait_regalloc then
begin begin
{Rewind the register allocation.} {Rewind the register allocation.}
if Tai_regalloc(p).allocation then if Tai_regalloc(p).allocation then
@ -2041,6 +2043,7 @@ implementation
back:=unusedregsint; back:=unusedregsint;
end; end;
end; end;
end {else writeln('!!!!'^g,byte(p.typ))};
p:=Tai(p.previous); p:=Tai(p.previous);
end; end;
unusedregsint:=back; unusedregsint:=back;
@ -2052,12 +2055,15 @@ implementation
{Forward the register allocation again.} {Forward the register allocation again.}
while (p<>self) do while (p<>self) do
begin begin
if p.typ<>ait_regalloc then if p.typ in [ait_instruction,ait_label] then
internalerror(200305311); internalerror(200305311);
if p.typ=ait_regalloc then
begin
if Tai_regalloc(p).allocation then if Tai_regalloc(p).allocation then
exclude(unusedregsint,Tai_regalloc(p).reg.number shr 8) exclude(unusedregsint,Tai_regalloc(p).reg.number shr 8)
else else
include(unusedregsint,Tai_regalloc(p).reg.number shr 8); include(unusedregsint,Tai_regalloc(p).reg.number shr 8);
end;
p:=Tai(p.next); p:=Tai(p.next);
end; end;
end; end;
@ -2413,7 +2419,12 @@ implementation
end. end.
{ {
$Log$ $Log$
Revision 1.7 2003-07-06 15:31:21 daniel Revision 1.8 2003-08-09 18:56:54 daniel
* cs_regalloc renamed to cs_regvars to avoid confusion with register
allocator
* Some preventive changes to i386 spillinh code
Revision 1.7 2003/07/06 15:31:21 daniel
* Fixed register allocator. *Lots* of fixes. * Fixed register allocator. *Lots* of fixes.
Revision 1.6 2003/06/14 14:53:50 jonas Revision 1.6 2003/06/14 14:53:50 jonas