mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-14 12:49:09 +02:00
+ MIPS: support replacement spilling for mov.s, mov.d and (partially) mtc1 instructions.
git-svn-id: trunk@28530 -
This commit is contained in:
parent
5655baa23a
commit
3b06465322
@ -131,22 +131,50 @@ implementation
|
|||||||
result:=false;
|
result:=false;
|
||||||
{ Replace 'move orgreg,src' with 'sw src,spilltemp'
|
{ Replace 'move orgreg,src' with 'sw src,spilltemp'
|
||||||
and 'move dst,orgreg' with 'lw dst,spilltemp' }
|
and 'move dst,orgreg' with 'lw dst,spilltemp' }
|
||||||
{ TODO: A_MOV_S and A_MOV_D for float registers are also replaceable }
|
|
||||||
if (instr.opcode<>A_MOVE) or (abs(spilltemp.offset)>32767) then
|
if (not (instr.opcode in [A_MOVE,A_MOV_S,A_MOV_D,A_MTC1])) or (abs(spilltemp.offset)>32767) then
|
||||||
exit;
|
exit;
|
||||||
if (instr.ops<>2) or
|
if (instr.ops<>2) or
|
||||||
(instr.oper[0]^.typ<>top_reg) or
|
(instr.oper[0]^.typ<>top_reg) or
|
||||||
(instr.oper[1]^.typ<>top_reg) or
|
(instr.oper[1]^.typ<>top_reg) then
|
||||||
(getregtype(instr.oper[0]^.reg)<>regtype) or
|
|
||||||
(getregtype(instr.oper[1]^.reg)<>regtype) then
|
|
||||||
InternalError(2013061001);
|
InternalError(2013061001);
|
||||||
|
if (getregtype(instr.oper[0]^.reg)<>regtype) or
|
||||||
|
(getregtype(instr.oper[1]^.reg)<>regtype) then
|
||||||
|
begin
|
||||||
|
if (instr.opcode=A_MTC1) then
|
||||||
|
begin
|
||||||
|
{ TODO: MTC1 src,orgreg ==> SW src,0/4(spilltemp) (endian-dependent!!) }
|
||||||
|
if (regtype=R_FPUREGISTER) then
|
||||||
|
exit;
|
||||||
|
end
|
||||||
|
else
|
||||||
|
InternalError(2013061003);
|
||||||
|
end;
|
||||||
if get_alias(getsupreg(instr.oper[1]^.reg))=orgreg then
|
if get_alias(getsupreg(instr.oper[1]^.reg))=orgreg then
|
||||||
begin
|
begin
|
||||||
instr.opcode:=A_LW;
|
case instr.opcode of
|
||||||
|
A_MOVE: instr.opcode:=A_LW;
|
||||||
|
A_MOV_S: instr.opcode:=A_LWC1;
|
||||||
|
A_MOV_D: instr.opcode:=A_LDC1;
|
||||||
|
else
|
||||||
|
InternalError(2013061004);
|
||||||
|
end;
|
||||||
end
|
end
|
||||||
else if get_alias(getsupreg(instr.oper[0]^.reg))=orgreg then
|
else if get_alias(getsupreg(instr.oper[0]^.reg))=orgreg then
|
||||||
begin
|
begin
|
||||||
instr.opcode:=A_SW;
|
case instr.opcode of
|
||||||
|
A_MOVE: instr.opcode:=A_SW;
|
||||||
|
A_MOV_S: instr.opcode:=A_SWC1;
|
||||||
|
A_MOV_D: instr.opcode:=A_SDC1;
|
||||||
|
A_MTC1:
|
||||||
|
begin
|
||||||
|
if (getregtype(instr.oper[0]^.reg)<>R_INTREGISTER) then
|
||||||
|
InternalError(2013061006);
|
||||||
|
instr.opcode:=A_LWC1;
|
||||||
|
end
|
||||||
|
else
|
||||||
|
InternalError(2013061005);
|
||||||
|
end;
|
||||||
instr.oper[0]^:=instr.oper[1]^;
|
instr.oper[0]^:=instr.oper[1]^;
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
|
Loading…
Reference in New Issue
Block a user