mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-22 15:09:20 +02:00
+ added check in GetNextReg(), so it halts with an internal error, if called on
a register, that isn't supposed to have a "next" register allocated git-svn-id: trunk@37185 -
This commit is contained in:
parent
950082f371
commit
c8b351fb67
@ -60,6 +60,9 @@ unit cgobj;
|
|||||||
executionweight : longint;
|
executionweight : longint;
|
||||||
alignment : talignment;
|
alignment : talignment;
|
||||||
rg : array[tregistertype] of trgobj;
|
rg : array[tregistertype] of trgobj;
|
||||||
|
{$if defined(cpu8bitalu) or defined(cpu16bitalu)}
|
||||||
|
has_next_reg: bitpacked array[TSuperRegister] of boolean;
|
||||||
|
{$endif cpu8bitalu or cpu16bitalu}
|
||||||
{$ifdef flowgraph}
|
{$ifdef flowgraph}
|
||||||
aktflownode:word;
|
aktflownode:word;
|
||||||
{$endif}
|
{$endif}
|
||||||
@ -584,6 +587,9 @@ implementation
|
|||||||
|
|
||||||
procedure tcg.init_register_allocators;
|
procedure tcg.init_register_allocators;
|
||||||
begin
|
begin
|
||||||
|
{$if defined(cpu8bitalu) or defined(cpu16bitalu)}
|
||||||
|
fillchar(has_next_reg,sizeof(has_next_reg),0);
|
||||||
|
{$endif cpu8bitalu or cpu16bitalu}
|
||||||
fillchar(rg,sizeof(rg),0);
|
fillchar(rg,sizeof(rg),0);
|
||||||
add_reg_instruction_hook:=@add_reg_instruction;
|
add_reg_instruction_hook:=@add_reg_instruction;
|
||||||
executionweight:=1;
|
executionweight:=1;
|
||||||
@ -595,6 +601,9 @@ implementation
|
|||||||
{ Safety }
|
{ Safety }
|
||||||
fillchar(rg,sizeof(rg),0);
|
fillchar(rg,sizeof(rg),0);
|
||||||
add_reg_instruction_hook:=nil;
|
add_reg_instruction_hook:=nil;
|
||||||
|
{$if defined(cpu8bitalu) or defined(cpu16bitalu)}
|
||||||
|
fillchar(has_next_reg,sizeof(has_next_reg),0);
|
||||||
|
{$endif cpu8bitalu or cpu16bitalu}
|
||||||
end;
|
end;
|
||||||
|
|
||||||
{$ifdef flowgraph}
|
{$ifdef flowgraph}
|
||||||
@ -625,6 +634,7 @@ implementation
|
|||||||
OS_16,OS_S16:
|
OS_16,OS_S16:
|
||||||
begin
|
begin
|
||||||
Result:=getintregister(list, OS_8);
|
Result:=getintregister(list, OS_8);
|
||||||
|
has_next_reg[getsupreg(Result)]:=true;
|
||||||
{ ensure that the high register can be retrieved by
|
{ ensure that the high register can be retrieved by
|
||||||
GetNextReg
|
GetNextReg
|
||||||
}
|
}
|
||||||
@ -634,13 +644,16 @@ implementation
|
|||||||
OS_32,OS_S32:
|
OS_32,OS_S32:
|
||||||
begin
|
begin
|
||||||
Result:=getintregister(list, OS_8);
|
Result:=getintregister(list, OS_8);
|
||||||
|
has_next_reg[getsupreg(Result)]:=true;
|
||||||
tmp1:=getintregister(list, OS_8);
|
tmp1:=getintregister(list, OS_8);
|
||||||
|
has_next_reg[getsupreg(tmp1)]:=true;
|
||||||
{ ensure that the high register can be retrieved by
|
{ ensure that the high register can be retrieved by
|
||||||
GetNextReg
|
GetNextReg
|
||||||
}
|
}
|
||||||
if tmp1<>GetNextReg(Result) then
|
if tmp1<>GetNextReg(Result) then
|
||||||
internalerror(2011021332);
|
internalerror(2011021332);
|
||||||
tmp2:=getintregister(list, OS_8);
|
tmp2:=getintregister(list, OS_8);
|
||||||
|
has_next_reg[getsupreg(tmp2)]:=true;
|
||||||
{ ensure that the upper register can be retrieved by
|
{ ensure that the upper register can be retrieved by
|
||||||
GetNextReg
|
GetNextReg
|
||||||
}
|
}
|
||||||
@ -664,6 +677,7 @@ implementation
|
|||||||
OS_32, OS_S32:
|
OS_32, OS_S32:
|
||||||
begin
|
begin
|
||||||
Result:=getintregister(list, OS_16);
|
Result:=getintregister(list, OS_16);
|
||||||
|
has_next_reg[getsupreg(Result)]:=true;
|
||||||
{ ensure that the high register can be retrieved by
|
{ ensure that the high register can be retrieved by
|
||||||
GetNextReg
|
GetNextReg
|
||||||
}
|
}
|
||||||
@ -723,6 +737,8 @@ implementation
|
|||||||
internalerror(2017091101);
|
internalerror(2017091101);
|
||||||
if getsubreg(r)<>R_SUBWHOLE then
|
if getsubreg(r)<>R_SUBWHOLE then
|
||||||
internalerror(2017091102);
|
internalerror(2017091102);
|
||||||
|
if not has_next_reg[getsupreg(r)] then
|
||||||
|
internalerror(2017091103);
|
||||||
result:=TRegister(longint(r)+1);
|
result:=TRegister(longint(r)+1);
|
||||||
end;
|
end;
|
||||||
{$endif cpu8bitalu or cpu16bitalu}
|
{$endif cpu8bitalu or cpu16bitalu}
|
||||||
|
Loading…
Reference in New Issue
Block a user