* fixed support of nSparcInline

This commit is contained in:
mazen 2002-11-25 19:21:49 +00:00
parent 6a52e7a9e5
commit eca8ef3436
3 changed files with 86 additions and 60 deletions

View File

@ -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_call_name(list:TAasmOutput;CONST s:string);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_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;
@ -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_flags(list:TAasmOutput;CONST f:TResFlags;l:tasmlabel);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_restore_frame_pointer(list:TAasmOutput);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_none(A_NOP));
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 ********************}
procedure tcgSPARC.a_load_const_reg(list:TAasmOutput;size:TCGSize;a:aword;reg:TRegister);
BEGIN
@ -803,7 +812,28 @@ procedure tcgSPARC.g_flags2reg(list:TAasmOutput;Size:TCgSize;CONST f:tresflags;r
THEN
a_load_reg_reg(list,OS_8,OS_8,hreg,reg);
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 ************ }
procedure tcgSPARC.g_stackframe_entry(list:TAasmOutput;LocalSize:LongInt);
@ -1253,7 +1283,10 @@ BEGIN
END.
{
$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
* merged isconvertable and is_equal into compare_defs(_ext)
* made operator search faster by walking the list only once

View File

@ -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$
Copyright (c) 2000 by Florian Klaempfl
@ -27,18 +18,18 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
****************************************************************************}
UNIT cpunode;
*****************************************************************************}
unit CpuNode;
{$INCLUDE fpcdefs.inc}
INTERFACE
interface
{This unit is used to define the specific CPU implementations. All needed
actions are included in the INITALIZATION part of these units. This explains
the behaviour of such a unit having just a USES clause!}
IMPLEMENTATION
USES
implementation
uses
ncgbas,ncgflw,ncgcnv,ncgld,ncgmem,ncgcon,{ncgset,}
naddcpu,ncpucall,{n386con,n386cnv,n386flw,n386mat,n386mem,}
{n386set,n386inl,n386opt,}ncpucnv,
{n386set,}ncpuinline,{n386opt,}ncpucnv,
{ this not really a node }
{nSPARCobj,}rgcpu;
END.
end.

View File

@ -40,7 +40,6 @@ type
implementation
uses
verbose,
globtype,
cpuinfo,cginfo,cgbase,
defutil;
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);
var
nextintreg,nextfloatreg:tregister;
stack_offset : aword;
hp : tparaitem;
loc : tloc;
is_64bit: boolean;
stack_offset:aword;
hp:tparaitem;
loc:tloc;
is_64bit:boolean;
begin
nextintreg:=R_i0;
nextintreg:=R_O0;
nextfloatreg:=R_F0;
stack_offset:=92;
WriteLn('***********************************************');
hp:=TParaItem(p.para.First);
while assigned(hp) do
begin
@ -147,7 +145,6 @@ WriteLn('***********************************************');
if NextIntReg<=TRegister(ord(R_i5)-ord(is_64bit))
then
begin
WriteLn('Allocating ',std_reg2str[NextIntReg]);
hp.paraloc.loc:=LOC_REGISTER;
hp.paraloc.registerlow:=NextIntReg;
inc(NextIntReg);
@ -173,36 +170,39 @@ WriteLn('***********************************************');
end;
LOC_FPUREGISTER:
begin
if hp.paratyp in [vs_var,vs_out] then
begin
if nextintreg<=R_O5 then
begin
hp.paraloc.size:=OS_ADDR;
hp.paraloc.loc:=LOC_REGISTER;
hp.paraloc.register:=nextintreg;
inc(nextintreg);
end
else
begin
{!!!!!!!}
hp.paraloc.size:=def_cgsize(hp.paratype.def);
internalerror(2002071006);
end;
end
else if nextfloatreg<=R_F10 then
begin
hp.paraloc.size:=def_cgsize(hp.paratype.def);
hp.paraloc.loc:=LOC_FPUREGISTER;
hp.paraloc.register:=nextfloatreg;
inc(nextfloatreg);
end
else
begin
{!!!!!!!}
hp.paraloc.size:=def_cgsize(hp.paratype.def);
internalerror(2002071004);
end;
end;
if hp.paratyp in [vs_var,vs_out]
then
begin
if NextIntReg<=R_O5
then
begin
hp.paraloc.size:=OS_ADDR;
hp.paraloc.loc:=LOC_REGISTER;
hp.paraloc.register:=nextintreg;
inc(nextintreg);
end
else
begin
{!!!!!!!}
WriteLn('NextIntReg=',std_reg2str[NextIntReg]);
hp.paraloc.size:=def_cgsize(hp.paratype.def);
internalerror(2002071006);
end;
end
else if nextfloatreg<=R_F10 then
begin
hp.paraloc.size:=def_cgsize(hp.paratype.def);
hp.paraloc.loc:=LOC_FPUREGISTER;
hp.paraloc.register:=nextfloatreg;
inc(nextfloatreg);
end
else
begin
{!!!!!!!}
hp.paraloc.size:=def_cgsize(hp.paratype.def);
internalerror(2002071004);
end;
end;
LOC_REFERENCE:
begin
hp.paraloc.size:=OS_ADDR;
@ -242,9 +242,8 @@ function tSparcParaManager.GetFuncRetParaLoc(p:TAbstractProcDef):TParaLocation;
case p.rettype.def.deftype of
orddef,enumdef:
begin
WriteLn('Allocating i0 as return register');
loc:=LOC_REGISTER;
register:=R_I0;
register:=return_result_reg;
size:=def_cgsize(p.rettype.def);
if size in [OS_S64,OS_64]
then
@ -283,7 +282,10 @@ begin
end.
{
$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
* merged isconvertable and is_equal into compare_defs(_ext)
* made operator search faster by walking the list only once