* refactored the segment-in-integer-register reference support, so it's handled in make_simple_ref, instead of all over the place in the code generator

git-svn-id: trunk@24752 -
This commit is contained in:
nickysn 2013-06-01 22:18:09 +00:00
parent b2729613c2
commit ec76b2cf40
4 changed files with 10 additions and 62 deletions

View File

@ -346,13 +346,6 @@ unit cgcpu;
tmpref:=ref;
make_simple_ref(list,tmpref);
if (tmpref.segment<>NR_NO) and (not is_segment_reg(tmpref.segment)) then
begin
list.concat(taicpu.op_reg(A_PUSH,S_W,tmpref.segment));
list.concat(taicpu.op_reg(A_POP,S_W,NR_ES));
tmpref.segment:=NR_ES;
end;
if size in [OS_64, OS_S64] then
internalerror(2013050801);
if size in [OS_32, OS_S32] then
@ -498,13 +491,6 @@ unit cgcpu;
make_simple_ref(list,tmpref);
check_register_size(size,reg);
if (tmpref.segment<>NR_NO) and (not is_segment_reg(tmpref.segment)) then
begin
list.concat(taicpu.op_reg(A_PUSH,S_W,tmpref.segment));
list.concat(taicpu.op_reg(A_POP,S_W,NR_ES));
tmpref.segment:=NR_ES;
end;
if size in [OS_64, OS_S64] then
internalerror(2013030902);
@ -536,13 +522,6 @@ unit cgcpu;
make_simple_ref(list,tmpref);
check_register_size(size,reg);
if (tmpref.segment<>NR_NO) and (not is_segment_reg(tmpref.segment)) then
begin
list.concat(taicpu.op_reg(A_PUSH,S_W,tmpref.segment));
list.concat(taicpu.op_reg(A_POP,S_W,NR_ES));
tmpref.segment:=NR_ES;
end;
if size in [OS_64, OS_S64] then
internalerror(2013050803);
@ -853,13 +832,6 @@ unit cgcpu;
tmpref:=ref;
make_simple_ref(list,tmpref);
if (tmpref.segment<>NR_NO) and (not is_segment_reg(tmpref.segment)) then
begin
list.concat(taicpu.op_reg(A_PUSH,S_W,tmpref.segment));
list.concat(taicpu.op_reg(A_POP,S_W,NR_ES));
tmpref.segment:=NR_ES;
end;
if tosize in [OS_S32,OS_32] then
begin
a_load_const_ref(list,OS_16,longint(a and $ffff),tmpref);
@ -882,13 +854,6 @@ unit cgcpu;
make_simple_ref(list,tmpref);
check_register_size(fromsize,reg);
if (tmpref.segment<>NR_NO) and (not is_segment_reg(tmpref.segment)) then
begin
list.concat(taicpu.op_reg(A_PUSH,S_W,tmpref.segment));
list.concat(taicpu.op_reg(A_POP,S_W,NR_ES));
tmpref.segment:=NR_ES;
end;
case tosize of
OS_8,OS_S8:
if fromsize in [OS_8,OS_S8] then
@ -973,13 +938,6 @@ unit cgcpu;
{ if tcgsize2size[tosize]<=tcgsize2size[fromsize] then
fromsize:=tosize;}
if (tmpref.segment<>NR_NO) and (not is_segment_reg(tmpref.segment)) then
begin
list.concat(taicpu.op_reg(A_PUSH,S_W,tmpref.segment));
list.concat(taicpu.op_reg(A_POP,S_W,NR_ES));
tmpref.segment:=NR_ES;
end;
case tosize of
OS_8,OS_S8:
if fromsize in [OS_8,OS_S8] then

View File

@ -556,12 +556,6 @@ interface
begin
tcgx86(cg).make_simple_ref(current_asmdata.CurrAsmList,right.location.reference);
href:=right.location.reference;
if (href.segment<>NR_NO) and (not is_segment_reg(href.segment)) then
begin
current_asmdata.CurrAsmList.concat(taicpu.op_reg(A_PUSH,S_W,href.segment));
current_asmdata.CurrAsmList.concat(taicpu.op_reg(A_POP,S_W,NR_ES));
href.segment:=NR_ES;
end;
inc(href.offset,2);
emit_ref_reg(A_CMP,S_W,href,GetNextReg(left.location.register));
firstjmp32bitcmp;

View File

@ -576,7 +576,15 @@ unit cgx86;
{ let the register allocator find a suitable register for the reference }
list.Concat(Taicpu.op_reg_reg(A_MOV, S_W, NR_SP, href.base));
ref:=href;
end
end;
{ if there is a segment in an int register, move it to ES }
if (ref.segment<>NR_NO) and (not is_segment_reg(ref.segment)) then
begin
list.concat(taicpu.op_reg(A_PUSH,S_W,ref.segment));
list.concat(taicpu.op_reg(A_POP,S_W,NR_ES));
ref.segment:=NR_ES;
end;
{$endif}
end;

View File

@ -249,9 +249,6 @@ unit nx86add;
procedure tx86addnode.emit_op_right_left(op:TAsmOp;opsize:TCgsize);
var
tmpref: treference;
{$ifdef x86_64}
tmpreg : tregister;
{$endif x86_64}
begin
if (right.location.loc in [LOC_CSUBSETREG,LOC_SUBSETREG,LOC_SUBSETREF,LOC_CSUBSETREF]) then
hlcg.location_force_reg(current_asmdata.CurrAsmList,right.location,right.resultdef,right.resultdef,true);
@ -264,16 +261,7 @@ unit nx86add;
LOC_CREFERENCE :
begin
tcgx86(cg).make_simple_ref(current_asmdata.CurrAsmList,right.location.reference);
tmpref:=right.location.reference;
{$ifdef i8086}
if (tmpref.segment<>NR_NO) and (not is_segment_reg(tmpref.segment)) then
begin
current_asmdata.CurrAsmList.concat(taicpu.op_reg(A_PUSH,S_W,tmpref.segment));
current_asmdata.CurrAsmList.concat(taicpu.op_reg(A_POP,S_W,NR_ES));
tmpref.segment:=NR_ES;
end;
{$endif i8086}
current_asmdata.CurrAsmList.concat(taicpu.op_ref_reg(op,TCGSize2Opsize[opsize],tmpref,left.location.register));
current_asmdata.CurrAsmList.concat(taicpu.op_ref_reg(op,TCGSize2Opsize[opsize],right.location.reference,left.location.register));
end;
LOC_CONSTANT :
begin