* also integrated the getnextreg() implementation for 8-bit and 16-bit alus from

the avr and i8086 code generators into the base tcg class

git-svn-id: trunk@37182 -
This commit is contained in:
nickysn 2017-09-11 15:47:39 +00:00
parent cf28b202eb
commit db09759763
3 changed files with 15 additions and 22 deletions

View File

@ -47,7 +47,6 @@ unit cgcpu;
function getaddressregister(list:TAsmList):TRegister;override;
function GetHigh(const r : TRegister) : TRegister;inline;
function GetNextReg(const r: TRegister): TRegister;override;
function GetOffsetReg(const r: TRegister;ofs : shortint): TRegister;override;
function GetOffsetReg64(const r,rhi: TRegister;ofs : shortint): TRegister;override;
@ -168,12 +167,6 @@ unit cgcpu;
end;
function tcgavr.GetNextReg(const r: TRegister): TRegister;
begin
result:=TRegister(longint(r)+1);
end;
function tcgavr.GetOffsetReg(const r: TRegister;ofs : shortint): TRegister;
begin
result:=TRegister(longint(r)+ofs);

View File

@ -91,7 +91,7 @@ unit cgobj;
{$if defined(cpu8bitalu) or defined(cpu16bitalu)}
{# returns the next virtual register }
function GetNextReg(const r: TRegister): TRegister;virtual;abstract;
function GetNextReg(const r: TRegister): TRegister;virtual;
{$endif cpu8bitalu or cpu16bitalu}
{$ifdef cpu8bitalu}
{# returns the register with the offset of ofs of a continuous set of register starting with r }
@ -714,6 +714,20 @@ implementation
end;
{$if defined(cpu8bitalu) or defined(cpu16bitalu)}
function tcg.GetNextReg(const r: TRegister): TRegister;
begin
if getsupreg(r)<first_int_imreg then
internalerror(2013051401);
if getregtype(r)<>R_INTREGISTER then
internalerror(2017091101);
if getsubreg(r)<>R_SUBWHOLE then
internalerror(2017091102);
result:=TRegister(longint(r)+1);
end;
{$endif cpu8bitalu or cpu16bitalu}
function Tcg.makeregsize(list:TAsmList;reg:Tregister;size:Tcgsize):Tregister;
var
subreg:Tsubregister;

View File

@ -41,8 +41,6 @@ unit cgcpu;
procedure init_register_allocators;override;
procedure do_register_allocation(list:TAsmList;headertai:tai);override;
function GetNextReg(const r: TRegister): TRegister;override;
procedure a_call_name(list : TAsmList;const s : string; weak: boolean);override;
procedure a_call_name_far(list : TAsmList;const s : string; weak: boolean);
procedure a_call_name_static(list : TAsmList;const s : string);override;
@ -158,18 +156,6 @@ unit cgcpu;
end;
function tcg8086.GetNextReg(const r: TRegister): TRegister;
begin
if getsupreg(r)<first_int_imreg then
internalerror(2013051401);
if getregtype(r)<>R_INTREGISTER then
internalerror(2017091101);
if getsubreg(r)<>R_SUBW then
internalerror(2017091102);
result:=TRegister(longint(r)+1);
end;
procedure tcg8086.a_call_name(list: TAsmList; const s: string; weak: boolean);
begin
if current_settings.x86memorymodel in x86_far_code_models then