+ ignore the source segment, when the destination cgpara is a near pointer in

tcg8086.a_loadaddr_ref_cgpara

git-svn-id: trunk@27715 -
This commit is contained in:
nickysn 2014-05-01 21:56:04 +00:00
parent c9f8703679
commit c9c29a3cd4

View File

@ -1027,7 +1027,6 @@ unit cgcpu;
procedure tcg8086.a_loadaddr_ref_cgpara(list : TAsmList;const r : treference;const cgpara : tcgpara); procedure tcg8086.a_loadaddr_ref_cgpara(list : TAsmList;const r : treference;const cgpara : tcgpara);
var var
tmpreg : tregister; tmpreg : tregister;
opsize : topsize;
tmpref : treference; tmpref : treference;
begin begin
with r do with r do
@ -1123,34 +1122,38 @@ unit cgcpu;
else else
begin begin
cgpara.check_simple_location; cgpara.check_simple_location;
opsize:=tcgsize2opsize[OS_ADDR]; tmpref:=r;
if (segment=NR_NO) and (base=NR_NO) and (index=NR_NO) then tmpref.segment:=NR_NO;
with tmpref do
begin begin
if assigned(symbol) then if (base=NR_NO) and (index=NR_NO) then
begin begin
if current_settings.cputype < cpu_186 then if assigned(symbol) then
begin begin
tmpreg:=getaddressregister(list); if current_settings.cputype < cpu_186 then
a_loadaddr_ref_reg(list,r,tmpreg); begin
list.concat(taicpu.op_reg(A_PUSH,opsize,tmpreg)); tmpreg:=getaddressregister(list);
a_loadaddr_ref_reg(list,tmpref,tmpreg);
list.concat(taicpu.op_reg(A_PUSH,S_W,tmpreg));
end
else
list.concat(Taicpu.Op_sym_ofs(A_PUSH,S_W,symbol,offset));
end end
else else
list.concat(Taicpu.Op_sym_ofs(A_PUSH,opsize,symbol,offset)); push_const(list,OS_16,offset);
end end
else if (base=NR_NO) and (index<>NR_NO) and
(offset=0) and (scalefactor=0) and (symbol=nil) then
list.concat(Taicpu.Op_reg(A_PUSH,S_W,index))
else if (base<>NR_NO) and (index=NR_NO) and
(offset=0) and (symbol=nil) then
list.concat(Taicpu.Op_reg(A_PUSH,S_W,base))
else else
push_const(list,OS_ADDR,offset); begin
end tmpreg:=getaddressregister(list);
else if (segment=NR_NO) and (base=NR_NO) and (index<>NR_NO) and a_loadaddr_ref_reg(list,tmpref,tmpreg);
(offset=0) and (scalefactor=0) and (symbol=nil) then list.concat(taicpu.op_reg(A_PUSH,S_W,tmpreg));
list.concat(Taicpu.Op_reg(A_PUSH,opsize,index)) end;
else if (segment=NR_NO) and (base<>NR_NO) and (index=NR_NO) and
(offset=0) and (symbol=nil) then
list.concat(Taicpu.Op_reg(A_PUSH,opsize,base))
else
begin
tmpreg:=getaddressregister(list);
a_loadaddr_ref_reg(list,r,tmpreg);
list.concat(taicpu.op_reg(A_PUSH,opsize,tmpreg));
end; end;
end; end;
end end