mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-12 22:14:25 +02:00
* fixed support of nSparcInline
This commit is contained in:
parent
6a52e7a9e5
commit
eca8ef3436
@ -40,6 +40,9 @@ specific processor ABI. It is overriden for each CPU target.
|
|||||||
procedure a_paramaddr_ref(list:TAasmOutput;CONST r:TReference;CONST LocPara:TParaLocation);override;
|
procedure a_paramaddr_ref(list:TAasmOutput;CONST r:TReference;CONST LocPara:TParaLocation);override;
|
||||||
procedure a_call_name(list:TAasmOutput;CONST s:string);override;
|
procedure a_call_name(list:TAasmOutput;CONST s:string);override;
|
||||||
procedure a_call_ref(list:TAasmOutput;CONST ref:TReference);override;
|
procedure a_call_ref(list:TAasmOutput;CONST ref:TReference);override;
|
||||||
|
{Branch Instruction}
|
||||||
|
procedure a_jmp_always(List:TAasmOutput;l:TAsmLabel);override;
|
||||||
|
{General purpose instyructions}
|
||||||
procedure a_op_const_reg(list:TAasmOutput;Op:TOpCG;a:AWord;reg:TRegister);override;
|
procedure a_op_const_reg(list:TAasmOutput;Op:TOpCG;a:AWord;reg:TRegister);override;
|
||||||
procedure a_op_const_ref(list:TAasmOutput;Op:TOpCG;size:TCGSize;a:AWord;CONST ref:TReference);override;
|
procedure a_op_const_ref(list:TAasmOutput;Op:TOpCG;size:TCGSize;a:AWord;CONST ref:TReference);override;
|
||||||
procedure a_op_reg_reg(list:TAasmOutput;Op:TOpCG;size:TCGSize;src, dst:TRegister);override;
|
procedure a_op_reg_reg(list:TAasmOutput;Op:TOpCG;size:TCGSize;src, dst:TRegister);override;
|
||||||
@ -71,6 +74,7 @@ specific processor ABI. It is overriden for each CPU target.
|
|||||||
procedure a_jmp_cond(list:TAasmOutput;cond:TOpCmp;l:tasmlabel);{ override;}
|
procedure a_jmp_cond(list:TAasmOutput;cond:TOpCmp;l:tasmlabel);{ override;}
|
||||||
procedure a_jmp_flags(list:TAasmOutput;CONST f:TResFlags;l:tasmlabel);override;
|
procedure a_jmp_flags(list:TAasmOutput;CONST f:TResFlags;l:tasmlabel);override;
|
||||||
procedure g_flags2reg(list:TAasmOutput;Size:TCgSize;CONST f:tresflags;reg:TRegister);override;
|
procedure g_flags2reg(list:TAasmOutput;Size:TCgSize;CONST f:tresflags;reg:TRegister);override;
|
||||||
|
procedure g_overflowCheck(List:TAasmOutput;const p:TNode);override;
|
||||||
procedure g_stackframe_entry(list:TAasmOutput;localsize:LongInt);override;
|
procedure g_stackframe_entry(list:TAasmOutput;localsize:LongInt);override;
|
||||||
procedure g_restore_frame_pointer(list:TAasmOutput);override;
|
procedure g_restore_frame_pointer(list:TAasmOutput);override;
|
||||||
procedure g_return_from_proc(list:TAasmOutput;parasize:aword);override;
|
procedure g_return_from_proc(list:TAasmOutput;parasize:aword);override;
|
||||||
@ -205,6 +209,11 @@ procedure tcgSPARC.a_call_ref(list:TAasmOutput;CONST ref:TReference);
|
|||||||
list.concat(taicpu.op_ref(A_CALL,ref));
|
list.concat(taicpu.op_ref(A_CALL,ref));
|
||||||
list.concat(taicpu.op_none(A_NOP));
|
list.concat(taicpu.op_none(A_NOP));
|
||||||
END;
|
END;
|
||||||
|
{********************** branch instructions ********************}
|
||||||
|
procedure TCgSPARC.a_jmp_always(List:TAasmOutput;l:TAsmLabel);
|
||||||
|
begin
|
||||||
|
List.Concat(TAiCpu.op_sym(A_BA,S_NO,objectlibrary.newasmsymbol(l.name)));
|
||||||
|
end;
|
||||||
{********************** load instructions ********************}
|
{********************** load instructions ********************}
|
||||||
procedure tcgSPARC.a_load_const_reg(list:TAasmOutput;size:TCGSize;a:aword;reg:TRegister);
|
procedure tcgSPARC.a_load_const_reg(list:TAasmOutput;size:TCGSize;a:aword;reg:TRegister);
|
||||||
BEGIN
|
BEGIN
|
||||||
@ -803,7 +812,28 @@ procedure tcgSPARC.g_flags2reg(list:TAasmOutput;Size:TCgSize;CONST f:tresflags;r
|
|||||||
THEN
|
THEN
|
||||||
a_load_reg_reg(list,OS_8,OS_8,hreg,reg);
|
a_load_reg_reg(list,OS_8,OS_8,hreg,reg);
|
||||||
END;
|
END;
|
||||||
|
procedure TCgSparc.g_overflowCheck(List:TAasmOutput;const p:TNode);
|
||||||
|
var
|
||||||
|
hl:TAsmLabel;
|
||||||
|
begin
|
||||||
|
if not(cs_check_overflow in aktlocalswitches)
|
||||||
|
then
|
||||||
|
exit;
|
||||||
|
objectlibrary.getlabel(hl);
|
||||||
|
if not((p.resulttype.def.deftype=pointerdef) or
|
||||||
|
((p.resulttype.def.deftype=orddef) and
|
||||||
|
(torddef(p.resulttype.def).typ in [u64bit,u16bit,u32bit,u8bit,uchar,
|
||||||
|
bool8bit,bool16bit,bool32bit])))
|
||||||
|
then
|
||||||
|
begin
|
||||||
|
list.concat(taicpu.op_reg(A_NONE,R_NONE));
|
||||||
|
a_jmp_always(list,hl)
|
||||||
|
end
|
||||||
|
else
|
||||||
|
a_jmp_cond(list,OC_NONE,hl);
|
||||||
|
a_call_name(list,'FPC_OVERFLOW');
|
||||||
|
a_label(list,hl);
|
||||||
|
end;
|
||||||
{ *********** entry/exit code and address loading ************ }
|
{ *********** entry/exit code and address loading ************ }
|
||||||
|
|
||||||
procedure tcgSPARC.g_stackframe_entry(list:TAasmOutput;LocalSize:LongInt);
|
procedure tcgSPARC.g_stackframe_entry(list:TAasmOutput;LocalSize:LongInt);
|
||||||
@ -1253,7 +1283,10 @@ BEGIN
|
|||||||
END.
|
END.
|
||||||
{
|
{
|
||||||
$Log$
|
$Log$
|
||||||
Revision 1.25 2002-11-25 17:43:28 peter
|
Revision 1.26 2002-11-25 19:21:49 mazen
|
||||||
|
* fixed support of nSparcInline
|
||||||
|
|
||||||
|
Revision 1.25 2002/11/25 17:43:28 peter
|
||||||
* splitted defbase in defutil,symutil,defcmp
|
* splitted defbase in defutil,symutil,defcmp
|
||||||
* merged isconvertable and is_equal into compare_defs(_ext)
|
* merged isconvertable and is_equal into compare_defs(_ext)
|
||||||
* made operator search faster by walking the list only once
|
* made operator search faster by walking the list only once
|
||||||
|
@ -1,13 +1,4 @@
|
|||||||
{*****************************************************************************}
|
{******************************************************************************
|
||||||
{ File : cpunode.pas }
|
|
||||||
{ Author : Mazen NEIFER }
|
|
||||||
{ Project : Free Pascal Compiler (FPC) }
|
|
||||||
{ Creation date : 2002\26\26 }
|
|
||||||
{ Last modification date : 2002\07\14 }
|
|
||||||
{ Licence : GPL }
|
|
||||||
{ Bug report : mazen.neifer.01@supaero.org }
|
|
||||||
{*****************************************************************************}
|
|
||||||
{
|
|
||||||
$Id$
|
$Id$
|
||||||
Copyright (c) 2000 by Florian Klaempfl
|
Copyright (c) 2000 by Florian Klaempfl
|
||||||
|
|
||||||
@ -27,18 +18,18 @@
|
|||||||
along with this program; if not, write to the Free Software
|
along with this program; if not, write to the Free Software
|
||||||
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||||
|
|
||||||
****************************************************************************}
|
*****************************************************************************}
|
||||||
UNIT cpunode;
|
unit CpuNode;
|
||||||
{$INCLUDE fpcdefs.inc}
|
{$INCLUDE fpcdefs.inc}
|
||||||
INTERFACE
|
interface
|
||||||
{This unit is used to define the specific CPU implementations. All needed
|
{This unit is used to define the specific CPU implementations. All needed
|
||||||
actions are included in the INITALIZATION part of these units. This explains
|
actions are included in the INITALIZATION part of these units. This explains
|
||||||
the behaviour of such a unit having just a USES clause!}
|
the behaviour of such a unit having just a USES clause!}
|
||||||
IMPLEMENTATION
|
implementation
|
||||||
USES
|
uses
|
||||||
ncgbas,ncgflw,ncgcnv,ncgld,ncgmem,ncgcon,{ncgset,}
|
ncgbas,ncgflw,ncgcnv,ncgld,ncgmem,ncgcon,{ncgset,}
|
||||||
naddcpu,ncpucall,{n386con,n386cnv,n386flw,n386mat,n386mem,}
|
naddcpu,ncpucall,{n386con,n386cnv,n386flw,n386mat,n386mem,}
|
||||||
{n386set,n386inl,n386opt,}ncpucnv,
|
{n386set,}ncpuinline,{n386opt,}ncpucnv,
|
||||||
{ this not really a node }
|
{ this not really a node }
|
||||||
{nSPARCobj,}rgcpu;
|
{nSPARCobj,}rgcpu;
|
||||||
END.
|
end.
|
||||||
|
@ -40,7 +40,6 @@ type
|
|||||||
implementation
|
implementation
|
||||||
uses
|
uses
|
||||||
verbose,
|
verbose,
|
||||||
globtype,
|
|
||||||
cpuinfo,cginfo,cgbase,
|
cpuinfo,cginfo,cgbase,
|
||||||
defutil;
|
defutil;
|
||||||
function TSparcParaManager.GetIntParaLoc(nr:longint):TParaLocation;
|
function TSparcParaManager.GetIntParaLoc(nr:longint):TParaLocation;
|
||||||
@ -123,15 +122,14 @@ push_addr_param for the def is true}
|
|||||||
procedure TSparcParaManager.create_param_loc_info(p:tabstractprocdef);
|
procedure TSparcParaManager.create_param_loc_info(p:tabstractprocdef);
|
||||||
var
|
var
|
||||||
nextintreg,nextfloatreg:tregister;
|
nextintreg,nextfloatreg:tregister;
|
||||||
stack_offset : aword;
|
stack_offset:aword;
|
||||||
hp : tparaitem;
|
hp:tparaitem;
|
||||||
loc : tloc;
|
loc:tloc;
|
||||||
is_64bit: boolean;
|
is_64bit:boolean;
|
||||||
begin
|
begin
|
||||||
nextintreg:=R_i0;
|
nextintreg:=R_O0;
|
||||||
nextfloatreg:=R_F0;
|
nextfloatreg:=R_F0;
|
||||||
stack_offset:=92;
|
stack_offset:=92;
|
||||||
WriteLn('***********************************************');
|
|
||||||
hp:=TParaItem(p.para.First);
|
hp:=TParaItem(p.para.First);
|
||||||
while assigned(hp) do
|
while assigned(hp) do
|
||||||
begin
|
begin
|
||||||
@ -147,7 +145,6 @@ WriteLn('***********************************************');
|
|||||||
if NextIntReg<=TRegister(ord(R_i5)-ord(is_64bit))
|
if NextIntReg<=TRegister(ord(R_i5)-ord(is_64bit))
|
||||||
then
|
then
|
||||||
begin
|
begin
|
||||||
WriteLn('Allocating ',std_reg2str[NextIntReg]);
|
|
||||||
hp.paraloc.loc:=LOC_REGISTER;
|
hp.paraloc.loc:=LOC_REGISTER;
|
||||||
hp.paraloc.registerlow:=NextIntReg;
|
hp.paraloc.registerlow:=NextIntReg;
|
||||||
inc(NextIntReg);
|
inc(NextIntReg);
|
||||||
@ -173,36 +170,39 @@ WriteLn('***********************************************');
|
|||||||
end;
|
end;
|
||||||
LOC_FPUREGISTER:
|
LOC_FPUREGISTER:
|
||||||
begin
|
begin
|
||||||
if hp.paratyp in [vs_var,vs_out] then
|
if hp.paratyp in [vs_var,vs_out]
|
||||||
begin
|
then
|
||||||
if nextintreg<=R_O5 then
|
begin
|
||||||
begin
|
if NextIntReg<=R_O5
|
||||||
hp.paraloc.size:=OS_ADDR;
|
then
|
||||||
hp.paraloc.loc:=LOC_REGISTER;
|
begin
|
||||||
hp.paraloc.register:=nextintreg;
|
hp.paraloc.size:=OS_ADDR;
|
||||||
inc(nextintreg);
|
hp.paraloc.loc:=LOC_REGISTER;
|
||||||
end
|
hp.paraloc.register:=nextintreg;
|
||||||
else
|
inc(nextintreg);
|
||||||
begin
|
end
|
||||||
{!!!!!!!}
|
else
|
||||||
hp.paraloc.size:=def_cgsize(hp.paratype.def);
|
begin
|
||||||
internalerror(2002071006);
|
{!!!!!!!}
|
||||||
end;
|
WriteLn('NextIntReg=',std_reg2str[NextIntReg]);
|
||||||
end
|
hp.paraloc.size:=def_cgsize(hp.paratype.def);
|
||||||
else if nextfloatreg<=R_F10 then
|
internalerror(2002071006);
|
||||||
begin
|
end;
|
||||||
hp.paraloc.size:=def_cgsize(hp.paratype.def);
|
end
|
||||||
hp.paraloc.loc:=LOC_FPUREGISTER;
|
else if nextfloatreg<=R_F10 then
|
||||||
hp.paraloc.register:=nextfloatreg;
|
begin
|
||||||
inc(nextfloatreg);
|
hp.paraloc.size:=def_cgsize(hp.paratype.def);
|
||||||
end
|
hp.paraloc.loc:=LOC_FPUREGISTER;
|
||||||
else
|
hp.paraloc.register:=nextfloatreg;
|
||||||
begin
|
inc(nextfloatreg);
|
||||||
{!!!!!!!}
|
end
|
||||||
hp.paraloc.size:=def_cgsize(hp.paratype.def);
|
else
|
||||||
internalerror(2002071004);
|
begin
|
||||||
end;
|
{!!!!!!!}
|
||||||
end;
|
hp.paraloc.size:=def_cgsize(hp.paratype.def);
|
||||||
|
internalerror(2002071004);
|
||||||
|
end;
|
||||||
|
end;
|
||||||
LOC_REFERENCE:
|
LOC_REFERENCE:
|
||||||
begin
|
begin
|
||||||
hp.paraloc.size:=OS_ADDR;
|
hp.paraloc.size:=OS_ADDR;
|
||||||
@ -242,9 +242,8 @@ function tSparcParaManager.GetFuncRetParaLoc(p:TAbstractProcDef):TParaLocation;
|
|||||||
case p.rettype.def.deftype of
|
case p.rettype.def.deftype of
|
||||||
orddef,enumdef:
|
orddef,enumdef:
|
||||||
begin
|
begin
|
||||||
WriteLn('Allocating i0 as return register');
|
|
||||||
loc:=LOC_REGISTER;
|
loc:=LOC_REGISTER;
|
||||||
register:=R_I0;
|
register:=return_result_reg;
|
||||||
size:=def_cgsize(p.rettype.def);
|
size:=def_cgsize(p.rettype.def);
|
||||||
if size in [OS_S64,OS_64]
|
if size in [OS_S64,OS_64]
|
||||||
then
|
then
|
||||||
@ -283,7 +282,10 @@ begin
|
|||||||
end.
|
end.
|
||||||
{
|
{
|
||||||
$Log$
|
$Log$
|
||||||
Revision 1.11 2002-11-25 17:43:28 peter
|
Revision 1.12 2002-11-25 19:21:49 mazen
|
||||||
|
* fixed support of nSparcInline
|
||||||
|
|
||||||
|
Revision 1.11 2002/11/25 17:43:28 peter
|
||||||
* splitted defbase in defutil,symutil,defcmp
|
* splitted defbase in defutil,symutil,defcmp
|
||||||
* merged isconvertable and is_equal into compare_defs(_ext)
|
* merged isconvertable and is_equal into compare_defs(_ext)
|
||||||
* made operator search faster by walking the list only once
|
* made operator search faster by walking the list only once
|
||||||
|
Loading…
Reference in New Issue
Block a user