* generate shorter code on 8-bit and 16-bit CPUs in thlcg2ll.location_force_reg,

when converting a LOC_JUMP location to a (OS_INT<x<=32)-bit reg location
  (the optimization is similar to r26314, but is for non 64-bit destinations).

git-svn-id: trunk@26315 -
This commit is contained in:
nickysn 2013-12-29 19:07:35 +00:00
parent 9ec84d1259
commit f69a76b5b1

View File

@ -1021,7 +1021,7 @@ implementation
hl: tasmlabel;
oldloc : tlocation;
const_location: boolean;
dst_cgsize: tcgsize;
dst_cgsize,tmpsize: tcgsize;
begin
oldloc:=l;
dst_cgsize:=def_cgsize(dst_size);
@ -1152,13 +1152,21 @@ implementation
{$endif cpuflags}
LOC_JUMP :
begin
tmpsize:=dst_cgsize;
{$if defined(cpu8bitalu) or defined(cpu16bitalu)}
if TCGSize2Size[dst_cgsize]>TCGSize2Size[OS_INT] then
tmpsize:=OS_INT;
{$endif}
cg.a_label(list,current_procinfo.CurrTrueLabel);
cg.a_load_const_reg(list,dst_cgsize,1,hregister);
cg.a_load_const_reg(list,tmpsize,1,hregister);
current_asmdata.getjumplabel(hl);
cg.a_jmp_always(list,hl);
cg.a_label(list,current_procinfo.CurrFalseLabel);
cg.a_load_const_reg(list,dst_cgsize,0,hregister);
cg.a_load_const_reg(list,tmpsize,0,hregister);
cg.a_label(list,hl);
{$if defined(cpu8bitalu) or defined(cpu16bitalu)}
cg.a_load_reg_reg(list,tmpsize,dst_cgsize,hregister,hregister);
{$endif}
end;
else
begin