* Splling function devided to sub functions to make it easy to understand.

This commit is just to allow easy diffs to validate the migration (hint use -w)
This commit is contained in:
mazen 2003-10-29 14:05:45 +00:00
parent 874ae30de5
commit 2d061f8108

View File

@ -1750,18 +1750,15 @@ implementation
var unusedregsint:Tsuperregisterset;
const spilltemplist:Tspill_temp_list): boolean;
var
i:byte;
supreg, reg1, reg2, reg3: Tsuperregister;
helpreg:Tregister;
helpins:Tai;
op:Tasmop;
pos:Tai;
wasload: boolean;
procedure DoSpill2RegInstructions;
begin
spill_registers:=false;
if (ops = 2) and
(oper[1]^.typ=top_ref) and
if (oper[1]^.typ=top_ref) and
{ oper[1] can also be ref in case of "lis r3,symbol@ha" or so }
spilling_decode_loadstore(opcode,op,wasload) then
begin
@ -1807,10 +1804,10 @@ implementation
loadreg(0,helpreg);
rgunget(list,helpins,helpreg);
forward_allocation(tai(helpins.next),unusedregsint);
{
{
writeln('spilling!');
list.insertafter(tai_comment.Create(strpnew('Spilling!')),helpins);
}
}
end;
{ now the registers used in the reference }
@ -1832,10 +1829,10 @@ implementation
oper[1]^.ref^.base:=helpreg;
rgunget(list,helpins,helpreg);
forward_allocation(Tai(helpins.next),unusedregsint);
{
{
writeln('spilling!');
list.insertafter(tai_comment.Create(strpnew('Spilling!')),helpins);
}
}
end;
{ b) index }
@ -1856,19 +1853,18 @@ implementation
oper[1]^.ref^.index:=helpreg;
rgunget(list,helpins,helpreg);
forward_allocation(Tai(helpins.next),unusedregsint);
{
{
writeln('spilling!');
list.insertafter(tai_comment.Create(strpnew('Spilling!')),helpins);
}
}
end;
end;
{ load/store is done }
exit;
end;
{ all other instructions the compiler generates are the same (I hope): }
{ operand 0 is a register and is the destination, the others are sources }
{ and can be either registers or constants }
{ exception: branches (is_jmp isn't always set for them) }
procedure DoSpill3RegInstructions;
var
i:byte;
begin
if oper[0]^.typ <> top_reg then
exit;
reg1 := getsupreg(oper[0]^.reg);
@ -1907,10 +1903,10 @@ implementation
loadreg(0,helpreg);
rgunget(list,helpins,helpreg);
forward_allocation(tai(helpins.next),unusedregsint);
{
{
writeln('spilling!');
list.insertafter(tai_comment.Create(strpnew('Spilling!')),helpins);
}
}
end;
for i := 1 to 2 do
@ -1939,13 +1935,30 @@ implementation
loadreg(i,helpreg);
rgunget(list,helpins,helpreg);
forward_allocation(tai(helpins.next),unusedregsint);
{
{
writeln('spilling!');
list.insertafter(tai_comment.Create(strpnew('Spilling!')),helpins);
}
}
end;
end;
end;
begin
spill_registers:=false;
case ops of
0,1:
Exit;
2:
DoSpill2RegInstructions;
3:
{all other instructions the compiler generates are the same (I hope): }
{operand 0 is a register and is the destination, the others are sources}
{and can be either registers or constants }
{exception: branches (is_jmp isn't always set for them) }
DoSpill3RegInstructions;
else
InternalError(2003102900);
end;
end;
{ ---------------------------------------------------------------------
@ -2140,7 +2153,11 @@ implementation
end.
{
$Log$
Revision 1.48 2003-10-24 17:39:41 peter
Revision 1.49 2003-10-29 14:05:45 mazen
* Splling function devided to sub functions to make it easy to understand.
This commit is just to allow easy diffs to validate the migration (hint use -w)
Revision 1.48 2003/10/24 17:39:41 peter
* asmnode.get_position now inserts a marker
Revision 1.47 2003/10/23 14:44:07 peter