* 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

View File

@ -425,13 +425,17 @@ uses cutils, cclasses;
function taicpu.spilling_get_operation_type(opnr: longint): topertype; function taicpu.spilling_get_operation_type(opnr: longint): topertype;
begin begin
result := operand_read;
case opcode of
A_MOV:
if opnr=0 then if opnr=0 then
result := operand_write result := operand_write
else else
result := operand_read; result := operand_read;
case opcode of
A_S8I,
A_S16I,
A_S32I,
A_SSI,
A_Bcc:
result := operand_read;
else else
; ;
end; end;
@ -448,9 +452,9 @@ uses cutils, cclasses;
begin begin
case getregtype(r) of case getregtype(r) of
R_INTREGISTER: 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: 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 else
internalerror(2020030701); internalerror(2020030701);
end; end;
@ -461,9 +465,9 @@ uses cutils, cclasses;
begin begin
case getregtype(r) of case getregtype(r) of
R_INTREGISTER: 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: 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 else
internalerror(2020030701); internalerror(2020030701);
end; end;

View File

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