mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-22 21:10:11 +02:00
* fixed several regvar related bugs for non-i386. make cycle with -Or now
works for ppc
This commit is contained in:
parent
fefdcc6331
commit
0357f71e14
@ -180,6 +180,7 @@ implementation
|
|||||||
|
|
||||||
var
|
var
|
||||||
hl,otlabel,oflabel : tasmlabel;
|
hl,otlabel,oflabel : tasmlabel;
|
||||||
|
{$ifdef i386}
|
||||||
org_regvar_loaded_other,
|
org_regvar_loaded_other,
|
||||||
then_regvar_loaded_other,
|
then_regvar_loaded_other,
|
||||||
else_regvar_loaded_other : regvarother_booleanarray;
|
else_regvar_loaded_other : regvarother_booleanarray;
|
||||||
@ -189,6 +190,7 @@ implementation
|
|||||||
org_list,
|
org_list,
|
||||||
then_list,
|
then_list,
|
||||||
else_list : taasmoutput;
|
else_list : taasmoutput;
|
||||||
|
{$endif i386}
|
||||||
|
|
||||||
begin
|
begin
|
||||||
location_reset(location,LOC_VOID,OS_NO);
|
location_reset(location,LOC_VOID,OS_NO);
|
||||||
@ -202,7 +204,7 @@ implementation
|
|||||||
{$endif}
|
{$endif}
|
||||||
secondpass(left);
|
secondpass(left);
|
||||||
|
|
||||||
|
{$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_regalloc in aktglobalswitches then
|
||||||
@ -210,13 +212,16 @@ implementation
|
|||||||
org_list := exprasmlist;
|
org_list := exprasmlist;
|
||||||
exprasmlist := taasmoutput.create;
|
exprasmlist := taasmoutput.create;
|
||||||
end;
|
end;
|
||||||
|
{$endif i386}
|
||||||
maketojumpbool(exprasmlist,left,lr_dont_load_regvars);
|
maketojumpbool(exprasmlist,left,lr_dont_load_regvars);
|
||||||
|
|
||||||
|
{$ifdef i386}
|
||||||
if cs_regalloc in aktglobalswitches then
|
if cs_regalloc 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;
|
||||||
end;
|
end;
|
||||||
|
{$endif i386}
|
||||||
|
|
||||||
if assigned(right) then
|
if assigned(right) then
|
||||||
begin
|
begin
|
||||||
@ -227,6 +232,7 @@ implementation
|
|||||||
secondpass(right);
|
secondpass(right);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
{$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_regalloc in aktglobalswitches then
|
||||||
@ -238,6 +244,7 @@ implementation
|
|||||||
then_list := exprasmlist;
|
then_list := exprasmlist;
|
||||||
exprasmlist := taasmoutput.create;
|
exprasmlist := taasmoutput.create;
|
||||||
end;
|
end;
|
||||||
|
{$endif i386}
|
||||||
|
|
||||||
if assigned(t1) then
|
if assigned(t1) then
|
||||||
begin
|
begin
|
||||||
@ -245,10 +252,15 @@ implementation
|
|||||||
begin
|
begin
|
||||||
objectlibrary.getlabel(hl);
|
objectlibrary.getlabel(hl);
|
||||||
{ do go back to if line !! }
|
{ do go back to if line !! }
|
||||||
|
{$ifdef i386}
|
||||||
if not(cs_regalloc in aktglobalswitches) then
|
if not(cs_regalloc in aktglobalswitches) then
|
||||||
|
{$endif i386}
|
||||||
aktfilepos:=exprasmList.getlasttaifilepos^
|
aktfilepos:=exprasmList.getlasttaifilepos^
|
||||||
|
{$ifdef i386}
|
||||||
else
|
else
|
||||||
aktfilepos:=then_list.getlasttaifilepos^;
|
aktfilepos:=then_list.getlasttaifilepos^
|
||||||
|
{$endif i386}
|
||||||
|
;
|
||||||
cg.a_jmp_always(exprasmlist,hl);
|
cg.a_jmp_always(exprasmlist,hl);
|
||||||
end;
|
end;
|
||||||
cg.a_label(exprasmlist,falselabel);
|
cg.a_label(exprasmlist,falselabel);
|
||||||
@ -256,6 +268,7 @@ implementation
|
|||||||
rg.cleartempgen;
|
rg.cleartempgen;
|
||||||
{$endif}
|
{$endif}
|
||||||
secondpass(t1);
|
secondpass(t1);
|
||||||
|
{$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_regalloc in aktglobalswitches then
|
||||||
@ -265,11 +278,13 @@ implementation
|
|||||||
else_list := exprasmlist;
|
else_list := exprasmlist;
|
||||||
exprasmlist := taasmoutput.create;
|
exprasmlist := taasmoutput.create;
|
||||||
end;
|
end;
|
||||||
|
{$endif i386}
|
||||||
if assigned(right) then
|
if assigned(right) then
|
||||||
cg.a_label(exprasmlist,hl);
|
cg.a_label(exprasmlist,hl);
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
begin
|
begin
|
||||||
|
{$ifdef i386}
|
||||||
if cs_regalloc in aktglobalswitches then
|
if cs_regalloc in aktglobalswitches then
|
||||||
begin
|
begin
|
||||||
else_regvar_loaded_int := rg.regvar_loaded_int;
|
else_regvar_loaded_int := rg.regvar_loaded_int;
|
||||||
@ -277,6 +292,7 @@ implementation
|
|||||||
else_list := exprasmlist;
|
else_list := exprasmlist;
|
||||||
exprasmlist := taasmoutput.create;
|
exprasmlist := taasmoutput.create;
|
||||||
end;
|
end;
|
||||||
|
{$endif i386}
|
||||||
cg.a_label(exprasmlist,falselabel);
|
cg.a_label(exprasmlist,falselabel);
|
||||||
end;
|
end;
|
||||||
if not(assigned(right)) then
|
if not(assigned(right)) then
|
||||||
@ -284,6 +300,7 @@ implementation
|
|||||||
cg.a_label(exprasmlist,truelabel);
|
cg.a_label(exprasmlist,truelabel);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
{$ifdef i386}
|
||||||
if cs_regalloc in aktglobalswitches then
|
if cs_regalloc 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 }
|
||||||
@ -316,6 +333,7 @@ implementation
|
|||||||
exprasmlist.free;
|
exprasmlist.free;
|
||||||
exprasmlist := org_list;
|
exprasmlist := org_list;
|
||||||
end;
|
end;
|
||||||
|
{$endif i386}
|
||||||
truelabel:=otlabel;
|
truelabel:=otlabel;
|
||||||
falselabel:=oflabel;
|
falselabel:=oflabel;
|
||||||
end;
|
end;
|
||||||
@ -1403,7 +1421,11 @@ begin
|
|||||||
end.
|
end.
|
||||||
{
|
{
|
||||||
$Log$
|
$Log$
|
||||||
Revision 1.64 2003-05-26 21:17:17 peter
|
Revision 1.65 2003-05-30 18:55:21 jonas
|
||||||
|
* fixed several regvar related bugs for non-i386. make cycle with -Or now
|
||||||
|
works for ppc
|
||||||
|
|
||||||
|
Revision 1.64 2003/05/26 21:17:17 peter
|
||||||
* procinlinenode removed
|
* procinlinenode removed
|
||||||
* aktexit2label removed, fast exit removed
|
* aktexit2label removed, fast exit removed
|
||||||
+ tcallnode.inlined_pass_2 added
|
+ tcallnode.inlined_pass_2 added
|
||||||
|
@ -40,10 +40,12 @@ interface
|
|||||||
procedure load_regvar_reg(asml: TAAsmoutput; reg: tregister);
|
procedure load_regvar_reg(asml: TAAsmoutput; reg: tregister);
|
||||||
procedure load_all_regvars(asml: TAAsmoutput);
|
procedure load_all_regvars(asml: TAAsmoutput);
|
||||||
|
|
||||||
|
{$ifdef i386}
|
||||||
procedure sync_regvars_other(list1, list2: taasmoutput; const regvarsloaded1,
|
procedure sync_regvars_other(list1, list2: taasmoutput; const regvarsloaded1,
|
||||||
regvarsloaded2: regvarother_booleanarray);
|
regvarsloaded2: regvarother_booleanarray);
|
||||||
procedure sync_regvars_int(list1, list2: taasmoutput; const regvarsloaded1,
|
procedure sync_regvars_int(list1, list2: taasmoutput; const regvarsloaded1,
|
||||||
regvarsloaded2: Tsupregset);
|
regvarsloaded2: Tsupregset);
|
||||||
|
{$endif i386}
|
||||||
|
|
||||||
implementation
|
implementation
|
||||||
|
|
||||||
@ -154,7 +156,7 @@ implementation
|
|||||||
new(regvarinfo);
|
new(regvarinfo);
|
||||||
fillchar(regvarinfo^,sizeof(regvarinfo^),0);
|
fillchar(regvarinfo^,sizeof(regvarinfo^),0);
|
||||||
current_procdef.regvarinfo := regvarinfo;
|
current_procdef.regvarinfo := regvarinfo;
|
||||||
if (p.registers32<4) then
|
if (p.registers32<maxvarregs) then
|
||||||
begin
|
begin
|
||||||
parasym:=false;
|
parasym:=false;
|
||||||
symtablestack.foreach_static({$ifdef FPCPROCVAR}@{$endif}searchregvars,@parasym);
|
symtablestack.foreach_static({$ifdef FPCPROCVAR}@{$endif}searchregvars,@parasym);
|
||||||
@ -197,8 +199,10 @@ implementation
|
|||||||
|
|
||||||
regvarinfo^.regvars[i].reg.enum:=R_INTREGISTER;
|
regvarinfo^.regvars[i].reg.enum:=R_INTREGISTER;
|
||||||
regvarinfo^.regvars[i].reg.number:=(varregs[i] shl 8) or cgsize2subreg(siz);
|
regvarinfo^.regvars[i].reg.number:=(varregs[i] shl 8) or cgsize2subreg(siz);
|
||||||
|
{$ifdef i386}
|
||||||
{ procedure uses this register }
|
{ procedure uses this register }
|
||||||
include(rg.usedintinproc,varregs[i]);
|
include(rg.usedintinproc,varregs[i]);
|
||||||
|
{$endif i386}
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
begin
|
begin
|
||||||
@ -253,6 +257,7 @@ implementation
|
|||||||
r.enum:=R_ST0;
|
r.enum:=R_ST0;
|
||||||
regvarinfo^.fpuregvars[i].reg:=trgcpu(rg).correct_fpuregister(r,i);
|
regvarinfo^.fpuregvars[i].reg:=trgcpu(rg).correct_fpuregister(r,i);
|
||||||
{$else i386}
|
{$else i386}
|
||||||
|
regvarinfo^.fpuregvars[i].reg.enum:=fpuvarregs[i];
|
||||||
rg.makeregvarother(regvarinfo^.fpuregvars[i].reg);
|
rg.makeregvarother(regvarinfo^.fpuregvars[i].reg);
|
||||||
{$endif i386}
|
{$endif i386}
|
||||||
end;
|
end;
|
||||||
@ -271,6 +276,7 @@ implementation
|
|||||||
regvarinfo: pregvarinfo;
|
regvarinfo: pregvarinfo;
|
||||||
vsym: tvarsym;
|
vsym: tvarsym;
|
||||||
begin
|
begin
|
||||||
|
{$ifdef i386}
|
||||||
regvarinfo := pregvarinfo(current_procdef.regvarinfo);
|
regvarinfo := pregvarinfo(current_procdef.regvarinfo);
|
||||||
if not assigned(regvarinfo) then
|
if not assigned(regvarinfo) then
|
||||||
exit;
|
exit;
|
||||||
@ -321,6 +327,7 @@ implementation
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
{$endif i386}
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure load_regvar(asml: TAAsmoutput; vsym: tvarsym);
|
procedure load_regvar(asml: TAAsmoutput; vsym: tvarsym);
|
||||||
@ -330,6 +337,9 @@ implementation
|
|||||||
r,
|
r,
|
||||||
reg : tregister;
|
reg : tregister;
|
||||||
begin
|
begin
|
||||||
|
{$ifndef i386}
|
||||||
|
exit;
|
||||||
|
{$endif i386}
|
||||||
reg:=vsym.reg;
|
reg:=vsym.reg;
|
||||||
if reg.enum=R_INTREGISTER then
|
if reg.enum=R_INTREGISTER then
|
||||||
begin
|
begin
|
||||||
@ -472,7 +482,7 @@ implementation
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
{$ifdef i386}
|
||||||
procedure sync_regvars_other(list1, list2: taasmoutput; const regvarsloaded1,
|
procedure sync_regvars_other(list1, list2: taasmoutput; const regvarsloaded1,
|
||||||
regvarsloaded2: regvarother_booleanarray);
|
regvarsloaded2: regvarother_booleanarray);
|
||||||
var
|
var
|
||||||
@ -510,6 +520,7 @@ implementation
|
|||||||
load_regvar_reg(list1,r);
|
load_regvar_reg(list1,r);
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
{$endif i386}
|
||||||
|
|
||||||
|
|
||||||
procedure cleanup_regvars(asml: TAAsmoutput);
|
procedure cleanup_regvars(asml: TAAsmoutput);
|
||||||
@ -544,7 +555,7 @@ implementation
|
|||||||
end
|
end
|
||||||
else
|
else
|
||||||
begin
|
begin
|
||||||
reg.number:=(r.number and not $ff) or cgsize2subreg(OS_INT);
|
reg.number:=(reg.number and not $ff) or cgsize2subreg(OS_INT);
|
||||||
r:=reg;
|
r:=reg;
|
||||||
convert_register_to_enum(r);
|
convert_register_to_enum(r);
|
||||||
if r.enum>lastreg then
|
if r.enum>lastreg then
|
||||||
@ -561,7 +572,11 @@ end.
|
|||||||
|
|
||||||
{
|
{
|
||||||
$Log$
|
$Log$
|
||||||
Revision 1.51 2003-05-23 14:27:35 peter
|
Revision 1.52 2003-05-30 18:55:21 jonas
|
||||||
|
* fixed several regvar related bugs for non-i386. make cycle with -Or now
|
||||||
|
works for ppc
|
||||||
|
|
||||||
|
Revision 1.51 2003/05/23 14:27:35 peter
|
||||||
* remove some unit dependencies
|
* remove some unit dependencies
|
||||||
* current_procinfo changes to store more info
|
* current_procinfo changes to store more info
|
||||||
|
|
||||||
|
@ -1109,11 +1109,13 @@ unit rgobj;
|
|||||||
var regi:Tsuperregister;
|
var regi:Tsuperregister;
|
||||||
|
|
||||||
begin
|
begin
|
||||||
|
{$ifdef i386}
|
||||||
for regi:=firstsaveintreg to lastsaveintreg do
|
for regi:=firstsaveintreg to lastsaveintreg do
|
||||||
begin
|
begin
|
||||||
if (regi in s) then
|
if (regi in s) then
|
||||||
inc(reg_pushes_int[regi],t_times*2);
|
inc(reg_pushes_int[regi],t_times*2);
|
||||||
end;
|
end;
|
||||||
|
{$endif i386}
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure trgobj.incrementotherregisterpushed(const s:Tregisterset);
|
procedure trgobj.incrementotherregisterpushed(const s:Tregisterset);
|
||||||
@ -1122,6 +1124,7 @@ unit rgobj;
|
|||||||
regi : Toldregister;
|
regi : Toldregister;
|
||||||
|
|
||||||
begin
|
begin
|
||||||
|
{$ifdef i386}
|
||||||
if firstsavefpureg <> R_NO then
|
if firstsavefpureg <> R_NO then
|
||||||
for regi:=firstsavefpureg to lastsavefpureg do
|
for regi:=firstsavefpureg to lastsavefpureg do
|
||||||
begin
|
begin
|
||||||
@ -1134,6 +1137,7 @@ unit rgobj;
|
|||||||
if (regi in s) then
|
if (regi in s) then
|
||||||
inc(reg_pushes_other[regi],t_times*2);
|
inc(reg_pushes_other[regi],t_times*2);
|
||||||
end;
|
end;
|
||||||
|
{$endif i386}
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
@ -1169,9 +1173,12 @@ unit rgobj;
|
|||||||
{$ifndef newra}
|
{$ifndef newra}
|
||||||
dec(countunusedregsint);
|
dec(countunusedregsint);
|
||||||
{$endif}
|
{$endif}
|
||||||
exclude(usableregsint,reg shl 8);
|
exclude(usableregsint,reg);
|
||||||
exclude(unusedregsint,reg shl 8);
|
exclude(unusedregsint,reg);
|
||||||
include(is_reg_var_int,reg);
|
include(is_reg_var_int,reg);
|
||||||
|
{$ifndef i386}
|
||||||
|
include(usedintbyproc,reg);
|
||||||
|
{$endif not i386}
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure trgobj.makeregvarother(reg: tregister);
|
procedure trgobj.makeregvarother(reg: tregister);
|
||||||
@ -1186,6 +1193,9 @@ unit rgobj;
|
|||||||
dec(countunusedregsfpu);
|
dec(countunusedregsfpu);
|
||||||
exclude(usableregsfpu,reg.enum);
|
exclude(usableregsfpu,reg.enum);
|
||||||
exclude(unusedregsfpu,reg.enum);
|
exclude(unusedregsfpu,reg.enum);
|
||||||
|
{$ifndef i386}
|
||||||
|
include(usedbyproc,reg.enum);
|
||||||
|
{$endif not i386}
|
||||||
end
|
end
|
||||||
else if reg.enum in mmregs then
|
else if reg.enum in mmregs then
|
||||||
begin
|
begin
|
||||||
@ -1193,6 +1203,9 @@ unit rgobj;
|
|||||||
dec(countunusedregsmm);
|
dec(countunusedregsmm);
|
||||||
exclude(usableregsmm,reg.enum);
|
exclude(usableregsmm,reg.enum);
|
||||||
exclude(unusedregsmm,reg.enum);
|
exclude(unusedregsmm,reg.enum);
|
||||||
|
{$ifndef i386}
|
||||||
|
include(usedbyproc,reg.enum);
|
||||||
|
{$endif not i386}
|
||||||
end;
|
end;
|
||||||
is_reg_var_other[reg.enum]:=true;
|
is_reg_var_other[reg.enum]:=true;
|
||||||
end;
|
end;
|
||||||
@ -2038,7 +2051,11 @@ end.
|
|||||||
|
|
||||||
{
|
{
|
||||||
$Log$
|
$Log$
|
||||||
Revision 1.45 2003-05-30 12:36:13 jonas
|
Revision 1.46 2003-05-30 18:55:21 jonas
|
||||||
|
* fixed several regvar related bugs for non-i386. make cycle with -Or now
|
||||||
|
works for ppc
|
||||||
|
|
||||||
|
Revision 1.45 2003/05/30 12:36:13 jonas
|
||||||
* use as little different registers on the ppc until newra is released,
|
* use as little different registers on the ppc until newra is released,
|
||||||
since every used register must be saved
|
since every used register must be saved
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user