* when a i8086 reference uses only one register, choose it from the set [BX,BP,SI,DI] as it can be treated either as a base or an index, depending on what's convenient

git-svn-id: trunk@25183 -
This commit is contained in:
nickysn 2013-07-29 21:03:10 +00:00
parent 5b6e50c9da
commit 42e82c9de3

View File

@ -87,6 +87,27 @@ implementation
if taicpu(p).oper[i]^.typ=top_ref then
begin
href:=taicpu(p).oper[i]^.ref^;
{ in case there's exactly one register used, we can treat it
as either base or index and choose it from the larger set
of registers [BX, BP, SI, DI] }
if (href.base<>NR_NO) xor (href.index<>NR_NO) then
begin
if (href.base<>NR_NO) and (getsupreg(href.base)>=first_int_imreg) then
begin
add_edge(getsupreg(href.base),RS_AX);
add_edge(getsupreg(href.base),RS_CX);
add_edge(getsupreg(href.base),RS_DX);
end;
if (href.index<>NR_NO) and (getsupreg(href.index)>=first_int_imreg) then
begin
add_edge(getsupreg(href.index),RS_AX);
add_edge(getsupreg(href.index),RS_CX);
add_edge(getsupreg(href.index),RS_DX);
end;
end
else
begin
{ base is chosen from the set [BX, BP] }
if (href.base<>NR_NO) and (getsupreg(href.base)>=first_int_imreg) then
begin
add_edge(getsupreg(href.base),RS_AX);
@ -95,6 +116,7 @@ implementation
add_edge(getsupreg(href.base),RS_SI);
add_edge(getsupreg(href.base),RS_DI);
end;
{ index is chosen from the set [SI, DI] }
if (href.index<>NR_NO) and (getsupreg(href.index)>=first_int_imreg) then
begin
add_edge(getsupreg(href.index),RS_AX);
@ -107,5 +129,6 @@ implementation
end;
end;
end;
end;
end.