mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-16 12:39:24 +02:00
Fix a critical bug in the register allocator (at least for CPUs with seperate address
registers like the M68k): check whether the register type of the base/index register of the instruction's reference is the same as the one we are doing register allocation for. Otherwise the address registers can become corrupted. git-svn-id: trunk@22748 -
This commit is contained in:
parent
75baec5985
commit
2ada9a528b
@ -2056,9 +2056,11 @@ unit rgobj;
|
|||||||
if regtype in [R_INTREGISTER,R_ADDRESSREGISTER] then
|
if regtype in [R_INTREGISTER,R_ADDRESSREGISTER] then
|
||||||
with ref^ do
|
with ref^ do
|
||||||
begin
|
begin
|
||||||
if (base <> NR_NO) then
|
if (base <> NR_NO) and
|
||||||
|
(getregtype(base)=regtype) then
|
||||||
addreginfo(base,instr.spilling_get_operation_type_ref(counter,base));
|
addreginfo(base,instr.spilling_get_operation_type_ref(counter,base));
|
||||||
if (index <> NR_NO) then
|
if (index <> NR_NO) and
|
||||||
|
(getregtype(index)=regtype) then
|
||||||
addreginfo(index,instr.spilling_get_operation_type_ref(counter,index));
|
addreginfo(index,instr.spilling_get_operation_type_ref(counter,index));
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
@ -2219,6 +2221,7 @@ unit rgobj;
|
|||||||
begin
|
begin
|
||||||
if regtype in [R_INTREGISTER,R_ADDRESSREGISTER] then
|
if regtype in [R_INTREGISTER,R_ADDRESSREGISTER] then
|
||||||
begin
|
begin
|
||||||
|
{ no need to check for the register type here }
|
||||||
tryreplacereg(ref^.base);
|
tryreplacereg(ref^.base);
|
||||||
tryreplacereg(ref^.index);
|
tryreplacereg(ref^.index);
|
||||||
end;
|
end;
|
||||||
|
Loading…
Reference in New Issue
Block a user