mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-04-14 00:59:30 +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
|
||||
with ref^ do
|
||||
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));
|
||||
if (index <> NR_NO) then
|
||||
if (index <> NR_NO) and
|
||||
(getregtype(index)=regtype) then
|
||||
addreginfo(index,instr.spilling_get_operation_type_ref(counter,index));
|
||||
end;
|
||||
end;
|
||||
@ -2219,6 +2221,7 @@ unit rgobj;
|
||||
begin
|
||||
if regtype in [R_INTREGISTER,R_ADDRESSREGISTER] then
|
||||
begin
|
||||
{ no need to check for the register type here }
|
||||
tryreplacereg(ref^.base);
|
||||
tryreplacereg(ref^.index);
|
||||
end;
|
||||
|
Loading…
Reference in New Issue
Block a user