* Xtensa: fixes spilling

git-svn-id: trunk@44677 -
This commit is contained in:
florian 2020-04-10 19:41:46 +00:00
parent 1cebf9f183
commit b9cc9f2e8a
2 changed files with 45 additions and 17 deletions
compiler/xtensa

View File

@ -425,13 +425,17 @@ uses cutils, cclasses;
function taicpu.spilling_get_operation_type(opnr: longint): topertype;
begin
result := operand_read;
if opnr=0 then
result := operand_write
else
result := operand_read;
case opcode of
A_MOV:
if opnr=0 then
result:=operand_write
else
result:=operand_read;
A_S8I,
A_S16I,
A_S32I,
A_SSI,
A_Bcc:
result := operand_read;
else
;
end;
@ -448,9 +452,9 @@ uses cutils, cclasses;
begin
case getregtype(r) of
R_INTREGISTER:
result:=taicpu.op_reg_reg_const(A_L32I,r,ref.base,ref.offset);
result:=taicpu.op_reg_ref(A_L32I,r,ref);
R_FPUREGISTER:
result:=taicpu.op_reg_reg_const(A_LSI,r,ref.base,ref.offset);
result:=taicpu.op_reg_ref(A_LSI,r,ref);
else
internalerror(2020030701);
end;
@ -461,9 +465,9 @@ uses cutils, cclasses;
begin
case getregtype(r) of
R_INTREGISTER:
result:=taicpu.op_reg_reg_const(A_S32I,r,ref.base,ref.offset);
result:=taicpu.op_reg_ref(A_S32I,r,ref);
R_FPUREGISTER:
result:=taicpu.op_reg_reg_const(A_SSI,r,ref.base,ref.offset);
result:=taicpu.op_reg_ref(A_SSI,r,ref);
else
internalerror(2020030701);
end;

View File

@ -52,14 +52,34 @@ implementation
cgobj;
procedure trgcpu.do_spill_read(list: TAsmList; pos: tai; const spilltemp: treference; tempreg: tregister; orgsupreg: tsuperregister);
var
op: TAsmOp;
begin
do_spill_op(list,A_L32I,pos,spilltemp,tempreg,orgsupreg);
case getregtype(tempreg) of
R_FPUREGISTER:
op:=A_LSI;
R_INTREGISTER:
op:=A_L32I;
else
Internalerror(2020041001);
end;
do_spill_op(list,op,pos,spilltemp,tempreg,orgsupreg);
end;
procedure trgcpu.do_spill_written(list: TAsmList; pos: tai; const spilltemp: treference; tempreg: tregister; orgsupreg: tsuperregister);
var
op: TAsmOp;
begin
do_spill_op(list,A_S32I,pos,spilltemp,tempreg,orgsupreg);
case getregtype(tempreg) of
R_FPUREGISTER:
op:=A_SSI;
R_INTREGISTER:
op:=A_S32I;
else
Internalerror(2020041002);
end;
do_spill_op(list,op,pos,spilltemp,tempreg,orgsupreg);
end;
@ -78,10 +98,12 @@ implementation
helplist:=TAsmList.create;
if getregtype(tempreg)=R_INTREGISTER then
if isload then
hreg:=tempreg
else
hreg:=getregisterinline(helplist,[R_SUBWHOLE])
begin
if isload then
hreg:=tempreg
else
hreg:=getregisterinline(helplist,[R_SUBWHOLE]);
end
else
hreg:=cg.getintregister(helplist,OS_ADDR);
@ -95,6 +117,8 @@ implementation
tmpref.offset:=spilltemp.offset mod 256;
helpins:=taicpu.op_reg_ref(op,tempreg,tmpref);
if getregtype(tempreg)=R_INTREGISTER then
ungetregisterinline(helplist,hreg);
helplist.concat(helpins);
list.insertlistafter(pos,helplist);
helplist.free;
@ -102,7 +126,7 @@ implementation
else if isload then
inherited do_spill_read(list,pos,spilltemp,tempreg,orgsupreg)
else
inherited do_spill_written(list,pos,spilltemp,tempreg,orgsupreg)
inherited do_spill_written(list,pos,spilltemp,tempreg,orgsupreg);
end;