* optimized releasing of registers

This commit is contained in:
peter 2003-09-28 13:39:38 +00:00
parent e732233993
commit d77cf79d3b
3 changed files with 49 additions and 22 deletions

View File

@ -252,10 +252,10 @@ interface
case tstringdef(resulttype.def).string_typ of
st_shortstring :
begin
location_release(exprasmlist,left.location);
tg.GetTemp(exprasmlist,256,tt_normal,location.reference);
cg.a_load_loc_ref(exprasmlist,left.location.size,left.location,
location.reference);
location_release(exprasmlist,left.location);
location_freetemp(exprasmlist,left.location);
end;
{ the rest is removed in the resulttype pass and converted to compilerprocs }
@ -511,7 +511,10 @@ end.
{
$Log$
Revision 1.45 2003-08-26 12:43:02 peter
Revision 1.46 2003-09-28 13:39:38 peter
* optimized releasing of registers
Revision 1.45 2003/08/26 12:43:02 peter
* methodpointer fixes
Revision 1.44 2003/06/03 21:11:09 peter

View File

@ -287,12 +287,12 @@ implementation
LOC_CREFERENCE,
LOC_REFERENCE:
begin
location_release(exprasmlist,left.location);
hregister:=rg.getaddressregister(exprasmlist);
if is_class_or_interface(left.resulttype.def) then
cg.a_load_ref_reg(exprasmlist,OS_ADDR,OS_ADDR,left.location.reference,hregister)
else
cg.a_loadaddr_ref_reg(exprasmlist,left.location.reference,hregister);
location_release(exprasmlist,left.location);
location_freetemp(exprasmlist,left.location);
end;
else
@ -535,12 +535,17 @@ implementation
begin
cgsize:=def_cgsize(left.resulttype.def);
if cgsize in [OS_64,OS_S64] then
cg64.a_load64_ref_reg(exprasmlist,
right.location.reference,left.location.register64,false)
begin
cg64.a_load64_ref_reg(exprasmlist,
right.location.reference,left.location.register64,false);
location_release(exprasmlist,right.location);
end
else
cg.a_load_ref_reg(exprasmlist,cgsize,cgsize,
right.location.reference,left.location.register);
location_release(exprasmlist,right.location);
begin
location_release(exprasmlist,right.location);
cg.a_load_ref_reg(exprasmlist,cgsize,cgsize,
right.location.reference,left.location.register);
end;
end;
LOC_CFPUREGISTER :
begin
@ -820,8 +825,8 @@ implementation
if vaddr then
begin
location_force_mem(exprasmlist,hp.left.location);
cg.a_paramaddr_ref(exprasmlist,hp.left.location.reference,paraloc);
location_release(exprasmlist,hp.left.location);
cg.a_paramaddr_ref(exprasmlist,hp.left.location.reference,paraloc);
if freetemp then
location_freetemp(exprasmlist,hp.left.location);
inc(pushedparasize,pointer_size);
@ -842,11 +847,11 @@ implementation
if vaddr then
begin
location_force_mem(exprasmlist,hp.left.location);
location_release(exprasmlist,hp.left.location);
tmpreg:=rg.getaddressregister(exprasmlist);
cg.a_loadaddr_ref_reg(exprasmlist,hp.left.location.reference,tmpreg);
cg.a_load_reg_ref(exprasmlist,OS_ADDR,OS_ADDR,tmpreg,href);
rg.ungetregisterint(exprasmlist,tmpreg);
location_release(exprasmlist,hp.left.location);
cg.a_load_reg_ref(exprasmlist,OS_ADDR,OS_ADDR,tmpreg,href);
if freetemp then
location_freetemp(exprasmlist,hp.left.location);
end
@ -869,7 +874,6 @@ implementation
is_widestring(left.resulttype.def) or
(left.resulttype.def.deftype=variantdef) then
freetemp:=false;
location_release(exprasmlist,hp.left.location);
case hp.left.location.loc of
LOC_FPUREGISTER,
LOC_CFPUREGISTER :
@ -880,14 +884,21 @@ implementation
LOC_REFERENCE,
LOC_CREFERENCE :
begin
location_release(exprasmlist,hp.left.location);
cg.g_concatcopy(exprasmlist,hp.left.location.reference,href,elesize,freetemp,false);
end;
else
begin
if hp.left.location.size in [OS_64,OS_S64] then
cg64.a_load64_loc_ref(exprasmlist,hp.left.location,href)
begin
cg64.a_load64_loc_ref(exprasmlist,hp.left.location,href);
location_release(exprasmlist,hp.left.location);
end
else
cg.a_load_loc_ref(exprasmlist,hp.left.location.size,hp.left.location,href);
begin
location_release(exprasmlist,hp.left.location);
cg.a_load_loc_ref(exprasmlist,hp.left.location.size,hp.left.location,href);
end;
end;
end;
inc(href.offset,elesize);
@ -905,7 +916,10 @@ begin
end.
{
$Log$
Revision 1.84 2003-09-25 21:27:31 peter
Revision 1.85 2003-09-28 13:39:38 peter
* optimized releasing of registers
Revision 1.84 2003/09/25 21:27:31 peter
* rearranged threadvar code so the result register is the same
for the relocated and address loaded variables

View File

@ -635,13 +635,17 @@ implementation
begin
tg.GetTemp(list,TCGSize2Size[l.size],tt_normal,r);
if l.size in [OS_64,OS_S64] then
cg64.a_load64_loc_ref(list,l,r)
begin
cg64.a_load64_loc_ref(list,l,r);
location_release(list,l);
end
else
cg.a_load_loc_ref(list,l.size,l,r);
location_release(list,l);
begin
location_release(list,l);
cg.a_load_loc_ref(list,l.size,l,r);
end;
location_reset(l,LOC_REFERENCE,l.size);
l.reference:=r;
end;
LOC_CREFERENCE,
LOC_REFERENCE : ;
@ -717,6 +721,7 @@ implementation
else
*)
begin
location_release(list,p.location);
{$ifdef i386}
case p.location.loc of
LOC_FPUREGISTER,
@ -769,13 +774,13 @@ implementation
end;
{$endif i386}
end;
location_release(list,p.location);
end
else
begin
{ copy the value on the stack or use normal parameter push? }
if paramanager.copy_value_on_stack(varspez,p.resulttype.def,calloption) then
begin
location_release(list,p.location);
{$ifdef i386}
if not (p.location.loc in [LOC_REFERENCE,LOC_CREFERENCE]) then
internalerror(200204241);
@ -817,9 +822,11 @@ implementation
else
*)
cg64.a_param64_loc(list,p.location,locpara);
location_release(list,p.location);
end
else
begin
location_release(list,p.location);
inc(pushedparasize,alignment);
(*
if calloption=pocall_inline then
@ -837,12 +844,12 @@ implementation
*)
cg.a_param_loc(list,p.location,locpara);
end;
location_release(list,p.location);
end;
{$ifdef SUPPORT_MMX}
LOC_MMXREGISTER,
LOC_CMMXREGISTER:
begin
location_release(list,p.location);
inc(pushedparasize,8);
(*
if calloption=pocall_inline then
@ -2064,7 +2071,10 @@ implementation
end.
{
$Log$
Revision 1.148 2003-09-25 21:28:00 peter
Revision 1.149 2003-09-28 13:39:38 peter
* optimized releasing of registers
Revision 1.148 2003/09/25 21:28:00 peter
* parameter fixes
Revision 1.147 2003/09/23 21:03:59 peter