* completed thlcgobj.location_force_fpureg(), use it everywhere and removed

ncgutil/thlcg2ll.location_force_fpureg()

git-svn-id: trunk@27071 -
This commit is contained in:
Jonas Maebe 2014-03-10 09:01:05 +00:00
parent 875a7418b3
commit 4065483a50
19 changed files with 39 additions and 71 deletions

View File

@ -142,8 +142,8 @@ interface
begin begin
{ force fpureg as location, left right doesn't matter { force fpureg as location, left right doesn't matter
as both will be in a fpureg } as both will be in a fpureg }
location_force_fpureg(current_asmdata.CurrAsmList,left.location,true); hlcg.location_force_fpureg(current_asmdata.CurrAsmList,left.location,left.resultdef,true);
location_force_fpureg(current_asmdata.CurrAsmList,right.location,true); hlcg.location_force_fpureg(current_asmdata.CurrAsmList,right.location,right.resultdef,true);
location_reset(location,LOC_FPUREGISTER,def_cgsize(resultdef)); location_reset(location,LOC_FPUREGISTER,def_cgsize(resultdef));
location.register:=cg.getfpuregister(current_asmdata.CurrAsmList,location.size); location.register:=cg.getfpuregister(current_asmdata.CurrAsmList,location.size);
@ -258,8 +258,8 @@ interface
begin begin
{ force fpureg as location, left right doesn't matter { force fpureg as location, left right doesn't matter
as both will be in a fpureg } as both will be in a fpureg }
location_force_fpureg(current_asmdata.CurrAsmList,left.location,true); hlcg.location_force_fpureg(current_asmdata.CurrAsmList,left.location,left.resultdef,true);
location_force_fpureg(current_asmdata.CurrAsmList,right.location,true); hlcg.location_force_fpureg(current_asmdata.CurrAsmList,right.location,right.resultdef,true);
cg.a_reg_alloc(current_asmdata.CurrAsmList,NR_DEFAULTFLAGS); cg.a_reg_alloc(current_asmdata.CurrAsmList,NR_DEFAULTFLAGS);
if nodetype in [equaln,unequaln] then if nodetype in [equaln,unequaln] then

View File

@ -75,7 +75,7 @@ implementation
fpu_fpa10, fpu_fpa10,
fpu_fpa11: fpu_fpa11:
begin begin
location_force_fpureg(current_asmdata.CurrAsmList,left.location,true); hlcg.location_force_fpureg(current_asmdata.CurrAsmList,left.location,left.resultdef,true);
location_copy(location,left.location); location_copy(location,left.location);
if left.location.loc=LOC_CFPUREGISTER then if left.location.loc=LOC_CFPUREGISTER then
begin begin

View File

@ -401,7 +401,7 @@ implementation
fpu_fpa10, fpu_fpa10,
fpu_fpa11: fpu_fpa11:
begin begin
location_force_fpureg(current_asmdata.CurrAsmList,left.location,false); hlcg.location_force_fpureg(current_asmdata.CurrAsmList,left.location,left.resultdef,false);
location:=left.location; location:=left.location;
current_asmdata.CurrAsmList.concat(setoppostfix(taicpu.op_reg_reg_const(A_RSF, current_asmdata.CurrAsmList.concat(setoppostfix(taicpu.op_reg_reg_const(A_RSF,
location.register,left.location.register,0), location.register,left.location.register,0),

View File

@ -310,7 +310,6 @@ unit hlcg2ll;
procedure g_local_unwind(list: TAsmList; l: TAsmLabel);override; procedure g_local_unwind(list: TAsmList; l: TAsmLabel);override;
procedure location_force_reg(list:TAsmList;var l:tlocation;src_size,dst_size:tdef;maybeconst:boolean);override; procedure location_force_reg(list:TAsmList;var l:tlocation;src_size,dst_size:tdef;maybeconst:boolean);override;
procedure location_force_fpureg(list:TAsmList;var l: tlocation;size: tdef;maybeconst:boolean);override;
procedure location_force_mem(list:TAsmList;var l:tlocation;size:tdef);override; procedure location_force_mem(list:TAsmList;var l:tlocation;size:tdef);override;
procedure location_force_mmregscalar(list:TAsmList;var l: tlocation;size:tdef;maybeconst:boolean);override; procedure location_force_mmregscalar(list:TAsmList;var l: tlocation;size:tdef;maybeconst:boolean);override;
// procedure location_force_mmreg(list:TAsmList;var l: tlocation;size:tdef;maybeconst:boolean);override; // procedure location_force_mmreg(list:TAsmList;var l: tlocation;size:tdef;maybeconst:boolean);override;
@ -1214,11 +1213,6 @@ implementation
location_freetemp(list,oldloc); location_freetemp(list,oldloc);
end; end;
procedure thlcg2ll.location_force_fpureg(list: TAsmList; var l: tlocation; size: tdef; maybeconst: boolean);
begin
ncgutil.location_force_fpureg(list,l,maybeconst);
end;
procedure thlcg2ll.location_force_mem(list: TAsmList; var l: tlocation; size: tdef); procedure thlcg2ll.location_force_mem(list: TAsmList; var l: tlocation; size: tdef);
var var
r: treference; r: treference;

View File

@ -3669,7 +3669,7 @@ implementation
begin begin
{ if it's in an mm register, store to memory first } { if it's in an mm register, store to memory first }
if (l.loc in [LOC_MMREGISTER,LOC_CMMREGISTER]) then if (l.loc in [LOC_MMREGISTER,LOC_CMMREGISTER]) then
internalerror(2011012903); location_force_mem(list,l,size);
reg:=getfpuregister(list,size); reg:=getfpuregister(list,size);
a_loadfpu_loc_reg(list,size,size,l,reg); a_loadfpu_loc_reg(list,size,size,l,reg);
location_freetemp(list,l); location_freetemp(list,l);

View File

@ -406,8 +406,8 @@ implementation
swapleftright; swapleftright;
// put both operands in a register // put both operands in a register
location_force_fpureg(current_asmdata.CurrAsmList,right.location,true); hlcg.location_force_fpureg(current_asmdata.CurrAsmList,right.location,right.resultdef,true);
location_force_fpureg(current_asmdata.CurrAsmList,left.location,true); hlcg.location_force_fpureg(current_asmdata.CurrAsmList,left.location,left.resultdef,true);
// initialize de result // initialize de result
if not cmpop then if not cmpop then
@ -454,8 +454,8 @@ implementation
} }
{ force fpureg as location, left right doesn't matter { force fpureg as location, left right doesn't matter
as both will be in a fpureg } as both will be in a fpureg }
location_force_fpureg(current_asmdata.CurrAsmList,left.location,true); hlcg.location_force_fpureg(current_asmdata.CurrAsmList,left.location,left.resultdef,true);
location_force_fpureg(current_asmdata.CurrAsmList,right.location,true); hlcg.location_force_fpureg(current_asmdata.CurrAsmList,right.location,right.resultdef,true);
location_reset(location,LOC_FLAGS,OS_NO); location_reset(location,LOC_FLAGS,OS_NO);
location.resflags:=getresflags(true); location.resflags:=getresflags(true);

View File

@ -63,7 +63,7 @@ uses
procinfo, procinfo,
symconst,symdef, symconst,symdef,
ncon, nset, nadd, ncon, nset, nadd,
ncgutil, cgobj; ncgutil, hlcgobj, cgobj;
{***************************************************************************** {*****************************************************************************
tmipsaddnode tmipsaddnode
@ -210,8 +210,8 @@ begin
{ force fpureg as location, left right doesn't matter { force fpureg as location, left right doesn't matter
as both will be in a fpureg } as both will be in a fpureg }
location_force_fpureg(current_asmdata.CurrAsmList, left.location, True); hlcg.location_force_fpureg(current_asmdata.CurrAsmList, left.location, left.resultdef, True);
location_force_fpureg(current_asmdata.CurrAsmList, right.location, True); hlcg.location_force_fpureg(current_asmdata.CurrAsmList, right.location, right.resultdef, True);
location_reset(location, LOC_FPUREGISTER, def_cgsize(resultdef)); location_reset(location, LOC_FPUREGISTER, def_cgsize(resultdef));
location.register:=cg.getfpuregister(current_asmdata.CurrAsmList,location.size); location.register:=cg.getfpuregister(current_asmdata.CurrAsmList,location.size);
@ -271,8 +271,8 @@ begin
if nf_swapped in flags then if nf_swapped in flags then
swapleftright; swapleftright;
location_force_fpureg(current_asmdata.CurrAsmList, left.location, True); hlcg.location_force_fpureg(current_asmdata.CurrAsmList, left.location, left.resultdef, True);
location_force_fpureg(current_asmdata.CurrAsmList, right.location, True); hlcg.location_force_fpureg(current_asmdata.CurrAsmList, right.location, right.resultdef, True);
location_reset(location, LOC_JUMP, OS_NO); location_reset(location, LOC_JUMP, OS_NO);
op:=ops_cmpfloat[left.location.size=OS_F64,nodetype]; op:=ops_cmpfloat[left.location.size=OS_F64,nodetype];

View File

@ -53,7 +53,7 @@ uses
cgbase, pass_2, cgbase, pass_2,
cpubase, paramgr, cpubase, paramgr,
nbas, ncon, ncal, ncnv, nld, nbas, ncon, ncal, ncnv, nld,
ncgutil, cgobj, cgutils; hlcgobj, ncgutil, cgobj, cgutils;
{***************************************************************************** {*****************************************************************************
tMIPSELinlinenode tMIPSELinlinenode
@ -62,7 +62,7 @@ uses
procedure tMIPSELinlinenode.load_fpu_location; procedure tMIPSELinlinenode.load_fpu_location;
begin begin
secondpass(left); secondpass(left);
location_force_fpureg(current_asmdata.CurrAsmList, left.location, True); hlcg.location_force_fpureg(current_asmdata.CurrAsmList, left.location, left.resultdef, True);
location_copy(location, left.location); location_copy(location, left.location);
if left.location.loc = LOC_CFPUREGISTER then if left.location.loc = LOC_CFPUREGISTER then
begin begin

View File

@ -270,7 +270,7 @@ end;
procedure TMIPSunaryminusnode.second_float; procedure TMIPSunaryminusnode.second_float;
begin begin
secondpass(left); secondpass(left);
location_force_fpureg(current_asmdata.CurrAsmList,left.location,true); hlcg.location_force_fpureg(current_asmdata.CurrAsmList,left.location,left.resultdef,true);
location_reset(location,LOC_FPUREGISTER,def_cgsize(resultdef)); location_reset(location,LOC_FPUREGISTER,def_cgsize(resultdef));
location.register:=cg.getfpuregister(current_asmdata.CurrAsmList,location.size); location.register:=cg.getfpuregister(current_asmdata.CurrAsmList,location.size);
case location.size of case location.size of

View File

@ -421,7 +421,7 @@ interface
(left.location.size in [OS_F80,OS_C64]) then (left.location.size in [OS_F80,OS_C64]) then
begin begin
if (left.location.loc in [LOC_CREFERENCE,LOC_REFERENCE]) then if (left.location.loc in [LOC_CREFERENCE,LOC_REFERENCE]) then
location_force_fpureg(current_asmdata.CurrAsmList,left.location,false); hlcg.location_force_fpureg(current_asmdata.CurrAsmList,left.location,left.resultdef,false);
{ round them down to the proper precision } { round them down to the proper precision }
tg.gethltemp(current_asmdata.currasmlist,resultdef,resultdef.size,tt_normal,tr); tg.gethltemp(current_asmdata.currasmlist,resultdef,resultdef.size,tt_normal,tr);
cg.a_loadfpu_reg_ref(current_asmdata.CurrAsmList,left.location.size,location.size,left.location.register,tr); cg.a_loadfpu_reg_ref(current_asmdata.CurrAsmList,left.location.size,location.size,left.location.register,tr);
@ -479,7 +479,7 @@ interface
case expectloc of case expectloc of
LOC_FPUREGISTER: LOC_FPUREGISTER:
begin begin
location_force_fpureg(current_asmdata.CurrAsmList,left.location,false); hlcg.location_force_fpureg(current_asmdata.CurrAsmList,left.location,left.resultdef,false);
location.register:=cg.getfpuregister(current_asmdata.CurrAsmList,location.size); location.register:=cg.getfpuregister(current_asmdata.CurrAsmList,location.size);
cg.a_loadfpu_reg_reg(current_asmdata.CurrAsmList,left.location.size,location.size,left.location.register,location.register); cg.a_loadfpu_reg_reg(current_asmdata.CurrAsmList,left.location.size,location.size,left.location.register,location.register);
end; end;

View File

@ -60,7 +60,6 @@ interface
procedure maketojumpbool(list:TAsmList; p : tnode; loadregvars: tloadregvars); procedure maketojumpbool(list:TAsmList; p : tnode; loadregvars: tloadregvars);
// procedure remove_non_regvars_from_loc(const t: tlocation; var regs:Tsuperregisterset); // procedure remove_non_regvars_from_loc(const t: tlocation; var regs:Tsuperregisterset);
procedure location_force_fpureg(list:TAsmList;var l: tlocation;maybeconst:boolean);
procedure location_force_mmreg(list:TAsmList;var l: tlocation;maybeconst:boolean); procedure location_force_mmreg(list:TAsmList;var l: tlocation;maybeconst:boolean);
procedure location_allocate_register(list:TAsmList;out l: tlocation;def: tdef;constant: boolean); procedure location_allocate_register(list:TAsmList;out l: tlocation;def: tdef;constant: boolean);
@ -486,31 +485,6 @@ implementation
*****************************************************************************} *****************************************************************************}
procedure location_force_fpureg(list:TAsmList;var l: tlocation;maybeconst:boolean);
var
reg : tregister;
href : treference;
begin
if (l.loc<>LOC_FPUREGISTER) and
((l.loc<>LOC_CFPUREGISTER) or (not maybeconst)) then
begin
{ if it's in an mm register, store to memory first }
if (l.loc in [LOC_MMREGISTER,LOC_CMMREGISTER]) then
begin
tg.GetTemp(list,tcgsize2size[l.size],tcgsize2size[l.size],tt_normal,href);
cg.a_loadmm_reg_ref(list,l.size,l.size,l.register,href,mms_movescalar);
location_reset_ref(l,LOC_REFERENCE,l.size,0);
l.reference:=href;
end;
reg:=cg.getfpuregister(list,l.size);
cg.a_loadfpu_loc_reg(list,l.size,l,reg);
location_freetemp(list,l);
location_reset(l,LOC_FPUREGISTER,l.size);
l.register:=reg;
end;
end;
procedure register_maybe_adjust_setbase(list: TAsmList; var l: tlocation; setbase: aint); procedure register_maybe_adjust_setbase(list: TAsmList; var l: tlocation; setbase: aint);
var var
tmpreg: tregister; tmpreg: tregister;

View File

@ -341,8 +341,8 @@ implementation
swapleftright; swapleftright;
// put both operands in a register // put both operands in a register
location_force_fpureg(current_asmdata.CurrAsmList,right.location,true); hlcg.location_force_fpureg(current_asmdata.CurrAsmList,right.location,right.resultdef,true);
location_force_fpureg(current_asmdata.CurrAsmList,left.location,true); hlcg.location_force_fpureg(current_asmdata.CurrAsmList,left.location,left.resultdef,true);
// initialize de result // initialize de result
if not cmpop then if not cmpop then

View File

@ -60,7 +60,7 @@ implementation
defutil, defutil,
cgbase,pass_2, cgbase,pass_2,
cpuinfo,ncgutil, cpuinfo,ncgutil,
cgutils,cgobj,rgobj,tgobj; hlcgobj,cgutils,cgobj,rgobj,tgobj;
{***************************************************************************** {*****************************************************************************
@ -122,7 +122,7 @@ implementation
begin begin
location_reset(location,LOC_FPUREGISTER,def_cgsize(resultdef)); location_reset(location,LOC_FPUREGISTER,def_cgsize(resultdef));
secondpass(left); secondpass(left);
location_force_fpureg(current_asmdata.CurrAsmList,left.location,true); hlcg.location_force_fpureg(current_asmdata.CurrAsmList,left.location,left.resultdef,true);
location.loc := LOC_FPUREGISTER; location.loc := LOC_FPUREGISTER;
location.register := cg.getfpuregister(current_asmdata.CurrAsmList,OS_F64); location.register := cg.getfpuregister(current_asmdata.CurrAsmList,OS_F64);
end; end;
@ -178,7 +178,7 @@ implementation
if (current_settings.cputype < cpu_PPC970) then if (current_settings.cputype < cpu_PPC970) then
internalerror(2007020910); internalerror(2007020910);
secondpass(left); secondpass(left);
location_force_fpureg(current_asmdata.CurrAsmList,left.location,true); hlcg.location_force_fpureg(current_asmdata.CurrAsmList,left.location,left.resultdef,true);
tmpreg:=cg.getfpuregister(current_asmdata.CurrAsmList,OS_F64); tmpreg:=cg.getfpuregister(current_asmdata.CurrAsmList,OS_F64);
current_asmdata.CurrAsmList.concat(taicpu.op_reg_reg(op,tmpreg, current_asmdata.CurrAsmList.concat(taicpu.op_reg_reg(op,tmpreg,
left.location.register)); left.location.register));

View File

@ -56,7 +56,7 @@ interface
cgbase,cgcpu,cgutils, cgbase,cgcpu,cgutils,
cpupara, cpupara,
ncon,nset,nadd, ncon,nset,nadd,
ncgutil,cgobj; hlcgobj, ncgutil,cgobj;
{***************************************************************************** {*****************************************************************************
TSparcAddNode TSparcAddNode
@ -170,8 +170,8 @@ interface
{ force fpureg as location, left right doesn't matter { force fpureg as location, left right doesn't matter
as both will be in a fpureg } as both will be in a fpureg }
location_force_fpureg(current_asmdata.CurrAsmList,left.location,true); hlcg.location_force_fpureg(current_asmdata.CurrAsmList,left.location,left.resultdef,true);
location_force_fpureg(current_asmdata.CurrAsmList,right.location,(left.location.loc<>LOC_CFPUREGISTER)); hlcg.location_force_fpureg(current_asmdata.CurrAsmList,right.location,right.resultdef,(left.location.loc<>LOC_CFPUREGISTER));
location_reset(location,LOC_FPUREGISTER,def_cgsize(resultdef)); location_reset(location,LOC_FPUREGISTER,def_cgsize(resultdef));
if left.location.loc<>LOC_CFPUREGISTER then if left.location.loc<>LOC_CFPUREGISTER then
@ -227,8 +227,8 @@ interface
{ force fpureg as location, left right doesn't matter { force fpureg as location, left right doesn't matter
as both will be in a fpureg } as both will be in a fpureg }
location_force_fpureg(current_asmdata.CurrAsmList,left.location,true); hlcg.location_force_fpureg(current_asmdata.CurrAsmList,left.location,left.resultdef,true);
location_force_fpureg(current_asmdata.CurrAsmList,right.location,true); hlcg.location_force_fpureg(current_asmdata.CurrAsmList,right.location,right.resultdef,true);
location_reset(location,LOC_FLAGS,OS_NO); location_reset(location,LOC_FLAGS,OS_NO);
location.resflags:=getfpuresflags; location.resflags:=getfpuresflags;

View File

@ -217,7 +217,7 @@ implementation
op : tasmop; op : tasmop;
begin begin
location_reset(location,LOC_FPUREGISTER,def_cgsize(resultdef)); location_reset(location,LOC_FPUREGISTER,def_cgsize(resultdef));
location_force_fpureg(current_asmdata.CurrAsmList,left.location,false); hlcg.location_force_fpureg(current_asmdata.CurrAsmList,left.location,left.resultdef,false);
{ Convert value in fpu register from integer to float } { Convert value in fpu register from integer to float }
op:=conv_op[tfloatdef(resultdef).floattype,tfloatdef(left.resultdef).floattype]; op:=conv_op[tfloatdef(resultdef).floattype,tfloatdef(left.resultdef).floattype];
if op=A_NONE then if op=A_NONE then

View File

@ -51,7 +51,7 @@ implementation
cgbase,pass_2, cgbase,pass_2,
cpubase,paramgr, cpubase,paramgr,
nbas,ncon,ncal,ncnv,nld, nbas,ncon,ncal,ncnv,nld,
ncgutil,cgobj,cgutils; hlcgobj,ncgutil,cgobj,cgutils;
{***************************************************************************** {*****************************************************************************
tsparcinlinenode tsparcinlinenode
@ -60,7 +60,7 @@ implementation
procedure tsparcinlinenode.load_fpu_location; procedure tsparcinlinenode.load_fpu_location;
begin begin
secondpass(left); secondpass(left);
location_force_fpureg(current_asmdata.CurrAsmList,left.location,true); hlcg.location_force_fpureg(current_asmdata.CurrAsmList,left.location,left.resultdef,true);
location_copy(location,left.location); location_copy(location,left.location);
if left.location.loc=LOC_CFPUREGISTER then if left.location.loc=LOC_CFPUREGISTER then
begin begin

View File

@ -293,7 +293,7 @@ implementation
procedure tsparcunaryminusnode.second_float; procedure tsparcunaryminusnode.second_float;
begin begin
secondpass(left); secondpass(left);
location_force_fpureg(current_asmdata.CurrAsmList,left.location,true); hlcg.location_force_fpureg(current_asmdata.CurrAsmList,left.location,left.resultdef,true);
location_reset(location,LOC_FPUREGISTER,def_cgsize(resultdef)); location_reset(location,LOC_FPUREGISTER,def_cgsize(resultdef));
location.register:=cg.getfpuregister(current_asmdata.CurrAsmList,location.size); location.register:=cg.getfpuregister(current_asmdata.CurrAsmList,location.size);
case location.size of case location.size of

View File

@ -241,9 +241,9 @@ unit nx86add;
begin begin
if (force_fpureg) then if (force_fpureg) then
begin begin
location_force_fpureg(current_asmdata.CurrAsmList,right.location,false); hlcg.location_force_fpureg(current_asmdata.CurrAsmList,right.location,right.resultdef,false);
if (left.location.loc<>LOC_FPUREGISTER) then if (left.location.loc<>LOC_FPUREGISTER) then
location_force_fpureg(current_asmdata.CurrAsmList,left.location,false) hlcg.location_force_fpureg(current_asmdata.CurrAsmList,left.location,left.resultdef,false)
else else
{ left was on the stack => swap } { left was on the stack => swap }
toggleflag(nf_swapped); toggleflag(nf_swapped);
@ -253,7 +253,7 @@ unit nx86add;
else if (left.location.loc<>LOC_FPUREGISTER) then else if (left.location.loc<>LOC_FPUREGISTER) then
begin begin
if (force_fpureg) then if (force_fpureg) then
location_force_fpureg(current_asmdata.CurrAsmList,left.location,false) hlcg.location_force_fpureg(current_asmdata.CurrAsmList,left.location,left.resultdef,false)
end end
else else
begin begin

View File

@ -281,7 +281,7 @@ implementation
LOC_MMREGISTER,LOC_CMMREGISTER: LOC_MMREGISTER,LOC_CMMREGISTER:
begin begin
location:=lnode.location; location:=lnode.location;
location_force_fpureg(current_asmdata.CurrAsmList,location,false); hlcg.location_force_fpureg(current_asmdata.CurrAsmList,location,resultdef,false);
end; end;
else else
internalerror(309991); internalerror(309991);