mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-04-30 18:15:45 +02:00
* Just to update repsitory
This commit is contained in:
parent
674d20ef5e
commit
b44010f639
@ -40,10 +40,9 @@ TYPE
|
||||
{This method is used to pass a parameter, which is located in a register, to a
|
||||
routine. It should give the parameter to the routine, as required by the
|
||||
specific processor ABI. It is overriden for each CPU target.
|
||||
Size : is the size of the operand in the register
|
||||
r : is the register source of the operand
|
||||
nr : is number of that parameter in the routine parameters list starting
|
||||
from one from left to right}
|
||||
Size : is the size of the operand in the register
|
||||
r : is the register source of the operand
|
||||
LocPara : is the location where the parameter will be stored}
|
||||
procedure a_param_reg(list:TAasmOutput;size:tcgsize;r:tregister;const LocPara:TParaLocation);override;
|
||||
procedure a_param_const(list:TAasmOutput;size:tcgsize;a:aword;CONST LocPara:TParaLocation);override;
|
||||
procedure a_param_ref(list:TAasmOutput;size:tcgsize;CONST r:TReference;CONST LocPara:TParaLocation);override;
|
||||
@ -117,8 +116,16 @@ procedure tcgSPARC.a_param_reg(list:TAasmOutput;size:tcgsize;r:tregister;CONST L
|
||||
IF(Size<>OS_32)AND(Size<>OS_S32)
|
||||
THEN
|
||||
InternalError(2002032212);
|
||||
List.Concat(taicpu.op_reg(A_LD,S_L,r));
|
||||
END;
|
||||
with list,LocPara do
|
||||
case Loc of
|
||||
LOC_REGISTER:
|
||||
if r<>Register
|
||||
then
|
||||
Concat(taicpu.op_Reg_Reg_Reg(A_OR,S_L,r,R_G0,Register));
|
||||
else
|
||||
InternalError(2002101002);
|
||||
end;
|
||||
end;
|
||||
procedure tcgSPARC.a_param_const(list:TAasmOutput;size:tcgsize;a:aword;CONST LocPara:TParaLocation);
|
||||
BEGIN
|
||||
IF(Size<>OS_32)AND(Size<>OS_S32)
|
||||
@ -131,36 +138,37 @@ procedure tcgSPARC.a_param_ref(list:TAasmOutput;size:tcgsize;const r:TReference;
|
||||
ref: treference;
|
||||
tmpreg:TRegister;
|
||||
begin
|
||||
case locpara.loc of
|
||||
LOC_REGISTER,LOC_CREGISTER:
|
||||
a_load_ref_reg(list,size,r,locpara.register);
|
||||
LOC_REFERENCE:
|
||||
begin
|
||||
with LocPara do
|
||||
case locpara.loc of
|
||||
LOC_REGISTER,LOC_CREGISTER:
|
||||
a_load_ref_reg(list,size,r,Register);
|
||||
LOC_REFERENCE:
|
||||
begin
|
||||
{Code conventions need the parameters being allocated in %o6+92. See
|
||||
comment on g_stack_frame}
|
||||
if locpara.sp_fixup<92
|
||||
then
|
||||
InternalError(2002081104);
|
||||
reference_reset(ref);
|
||||
ref.base:=locpara.reference.index;
|
||||
ref.offset:=locpara.reference.offset;
|
||||
tmpreg := get_scratch_reg_int(list);
|
||||
a_load_ref_reg(list,size,r,tmpreg);
|
||||
a_load_reg_ref(list,size,tmpreg,ref);
|
||||
free_scratch_reg(list,tmpreg);
|
||||
end;
|
||||
LOC_FPUREGISTER,LOC_CFPUREGISTER:
|
||||
case size of
|
||||
OS_32:
|
||||
a_loadfpu_ref_reg(list,OS_F32,r,locpara.register);
|
||||
OS_64:
|
||||
a_loadfpu_ref_reg(list,OS_F64,r,locpara.register);
|
||||
else
|
||||
internalerror(2002072801);
|
||||
end;
|
||||
else
|
||||
internalerror(2002081103);
|
||||
end;
|
||||
if locpara.sp_fixup<92
|
||||
then
|
||||
InternalError(2002081104);
|
||||
reference_reset(ref);
|
||||
ref.base:=locpara.reference.index;
|
||||
ref.offset:=locpara.reference.offset;
|
||||
tmpreg := get_scratch_reg_int(list);
|
||||
a_load_ref_reg(list,size,r,tmpreg);
|
||||
a_load_reg_ref(list,size,tmpreg,ref);
|
||||
free_scratch_reg(list,tmpreg);
|
||||
end;
|
||||
LOC_FPUREGISTER,LOC_CFPUREGISTER:
|
||||
case size of
|
||||
OS_32:
|
||||
a_loadfpu_ref_reg(list,OS_F32,r,locpara.register);
|
||||
OS_64:
|
||||
a_loadfpu_ref_reg(list,OS_F64,r,locpara.register);
|
||||
else
|
||||
internalerror(2002072801);
|
||||
end;
|
||||
else
|
||||
internalerror(2002081103);
|
||||
end;
|
||||
end;
|
||||
procedure tcgSPARC.a_paramaddr_ref(list:TAasmOutput;CONST r:TReference;CONST LocPara:TParaLocation);
|
||||
VAR
|
||||
@ -1256,7 +1264,10 @@ BEGIN
|
||||
END.
|
||||
{
|
||||
$Log$
|
||||
Revision 1.13 2002-10-10 15:10:39 mazen
|
||||
Revision 1.14 2002-10-10 19:57:51 mazen
|
||||
* Just to update repsitory
|
||||
|
||||
Revision 1.13 2002/10/10 15:10:39 mazen
|
||||
* Internal error fixed, but usually i386 parameter model used
|
||||
|
||||
Revision 1.12 2002/10/08 17:17:03 mazen
|
||||
|
@ -1,12 +1,5 @@
|
||||
{*****************************************************************************}
|
||||
{ File : cpubase.pas }
|
||||
{ Author : Mazen NEIFER }
|
||||
{ Project : Free Pascal Compiler (FPC) }
|
||||
{ Creation date : 2002\04\26 }
|
||||
{ Licence : GPL }
|
||||
{ Bug report : mazen.neifer.01@supaero.org }
|
||||
{*****************************************************************************}
|
||||
{ $Id$
|
||||
{******************************************************************************
|
||||
$Id$
|
||||
Copyright (c) 1998-2000 by Florian Klaempfl and Peter Vreman
|
||||
|
||||
Contains the base types for the Scalable Processor ARChitecture (SPARC)
|
||||
@ -401,7 +394,6 @@ used, because contains a lot of unnessary fields.}
|
||||
|
||||
CONST
|
||||
general_registers = [R_L0..R_L7];
|
||||
|
||||
{ legEND: }
|
||||
{ xxxregs = set of all possibly used registers of that type in the code }
|
||||
{ generator }
|
||||
@ -410,19 +402,16 @@ CONST
|
||||
{ excludes registers which can be only used for parameter }
|
||||
{ passing on ABI's that define this) }
|
||||
{ c_countusableregsxxx = amount of registers in the usableregsxxx set }
|
||||
|
||||
intregs = [R_G0..R_I7];
|
||||
usableregsint = general_registers;
|
||||
IntRegs=[R_L0..R_O7];
|
||||
usableregsint=general_registers;
|
||||
c_countusableregsint = 4;
|
||||
|
||||
fpuregs = [R_F0..R_F31];
|
||||
usableregsfpu = [];
|
||||
c_countusableregsfpu = 0;
|
||||
|
||||
mmregs = [R_G0..R_G7];
|
||||
usableregsmm = [R_G0..R_G7];
|
||||
c_countusableregsmm = 8;
|
||||
|
||||
fpuregs=[R_F0..R_F31];
|
||||
usableregsfpu=[];
|
||||
c_countusableregsfpu=0;
|
||||
mmregs=[];
|
||||
usableregsmm=[];
|
||||
c_countusableregsmm=8;
|
||||
|
||||
firstsaveintreg = R_G0;
|
||||
lastsaveintreg = R_I7;
|
||||
firstsavefpureg = R_F0;
|
||||
@ -468,9 +457,10 @@ function othewise it contains a pointer to the returned result}
|
||||
{There is no accumulator in the SPARC architecture. There are just families of
|
||||
registers. All registers belonging to the same family are identical except in
|
||||
the "global registers" family where GO is different from the others : G0 gives
|
||||
always 0 when it is red and thows away any value written to it}
|
||||
accumulator = R_L0;
|
||||
accumulatorhigh = R_L7;
|
||||
always 0 when it is red and thows away any value written to it.Nevertheless,
|
||||
scalar routine results are returned onto R_O0.}
|
||||
accumulator = R_O0;
|
||||
accumulatorhigh = R_O1;
|
||||
fpu_result_reg =R_F0;
|
||||
mmresultreg =R_G0;
|
||||
{*****************************************************************************}
|
||||
@ -581,7 +571,10 @@ FUNCTION flags_to_cond(CONST f:TResFlags):TAsmCond;
|
||||
END.
|
||||
{
|
||||
$Log$
|
||||
Revision 1.10 2002-10-02 22:20:28 mazen
|
||||
Revision 1.11 2002-10-10 19:57:51 mazen
|
||||
* Just to update repsitory
|
||||
|
||||
Revision 1.10 2002/10/02 22:20:28 mazen
|
||||
+ out registers allocator for the first 6 scalar parameters which must be passed into %o0..%o5
|
||||
|
||||
Revision 1.9 2002/10/01 21:06:29 mazen
|
||||
|
@ -42,22 +42,20 @@ function TSparcParaManager.GetIntParaLoc(nr:longint):TParaLocation;
|
||||
if nr<1
|
||||
then
|
||||
InternalError(2002100806);
|
||||
FillChar(Result,SizeOf(TParaLocation),0);
|
||||
FillChar(GetIntParaLoc,SizeOf(TParaLocation),0);
|
||||
Dec(nr);
|
||||
with Result do
|
||||
with GetIntParaLoc do
|
||||
if nr<6
|
||||
then{The six first parameters are passed into registers}
|
||||
begin
|
||||
loc:=LOC_REGISTER;
|
||||
register:=TRegister(LongInt(R_O0)+nr);
|
||||
WriteLn('-------------------------------------------');
|
||||
register:=TRegister(LongInt(R_i0)+nr);
|
||||
end
|
||||
else{The other parameters are passed into the frame}
|
||||
begin
|
||||
loc:=LOC_REFERENCE;
|
||||
reference.index:=frame_pointer_reg;
|
||||
reference.offset:=-92-(nr-6)*4;
|
||||
WriteLn('+++++++++++++++++++++++++++++++++++++++++++');
|
||||
reference.offset:=-68-nr*4;
|
||||
end;
|
||||
end;
|
||||
function GetParaLoc(p:TDef):TLoc;
|
||||
@ -124,7 +122,7 @@ procedure TSparcParaManager.create_param_loc_info(p:tabstractprocdef);
|
||||
loc : tloc;
|
||||
is_64bit: boolean;
|
||||
begin
|
||||
nextintreg:=R_O0;
|
||||
nextintreg:=R_i0;
|
||||
nextfloatreg:=R_F0;
|
||||
stack_offset:=92;
|
||||
WriteLn('***********************************************');
|
||||
@ -140,7 +138,7 @@ WriteLn('***********************************************');
|
||||
then
|
||||
hp.paraloc.size:=OS_ADDR;
|
||||
is_64bit:=hp.paraloc.size in [OS_64,OS_S64];
|
||||
if NextIntReg<=TRegister(ord(R_O5)-ord(is_64bit))
|
||||
if NextIntReg<=TRegister(ord(R_i5)-ord(is_64bit))
|
||||
then
|
||||
begin
|
||||
WriteLn('Allocating ',std_reg2str[NextIntReg]);
|
||||
@ -156,7 +154,7 @@ WriteLn('***********************************************');
|
||||
end
|
||||
else
|
||||
begin
|
||||
nextintreg:=R_O6;
|
||||
nextintreg:=R_i6;
|
||||
hp.paraloc.loc:=LOC_REFERENCE;
|
||||
hp.paraloc.reference.index:=stack_pointer_reg;
|
||||
hp.paraloc.reference.offset:=stack_offset;
|
||||
@ -239,11 +237,11 @@ function tSparcParaManager.GetFuncRetParaLoc(p:TAbstractProcDef):TParaLocation;
|
||||
begin
|
||||
WriteLn('Allocating i0 as return register');
|
||||
GetFuncRetParaLoc.loc:=LOC_REGISTER;
|
||||
GetFuncRetParaLoc.register:=R_i0;
|
||||
GetFuncRetParaLoc.register:=R_I0;
|
||||
GetFuncRetParaLoc.size:=def_cgsize(p.rettype.def);
|
||||
if GetFuncRetParaLoc.size in [OS_S64,OS_64]
|
||||
then
|
||||
GetFuncRetParaLoc.RegisterHigh:=R_O1;
|
||||
GetFuncRetParaLoc.RegisterHigh:=R_I1;
|
||||
end;
|
||||
floatdef:
|
||||
begin
|
||||
@ -251,8 +249,6 @@ function tSparcParaManager.GetFuncRetParaLoc(p:TAbstractProcDef):TParaLocation;
|
||||
GetFuncRetParaLoc.register:=R_F1;
|
||||
GetFuncRetParaLoc.size:=def_cgsize(p.rettype.def);
|
||||
end;
|
||||
{ smallsets are OS_INT in R3, others are OS_ADDR in R3 -> the same }
|
||||
{ ugly, I know :) (JM) }
|
||||
setdef,
|
||||
variantdef,
|
||||
pointerdef,
|
||||
@ -267,7 +263,7 @@ function tSparcParaManager.GetFuncRetParaLoc(p:TAbstractProcDef):TParaLocation;
|
||||
errordef:
|
||||
begin
|
||||
GetFuncRetParaLoc.loc:=LOC_REGISTER;
|
||||
GetFuncRetParaLoc.register:=R_O0;
|
||||
GetFuncRetParaLoc.register:=R_I0;
|
||||
GetFuncRetParaLoc.size:=OS_ADDR;
|
||||
end;
|
||||
else
|
||||
@ -279,7 +275,10 @@ begin
|
||||
end.
|
||||
{
|
||||
$Log$
|
||||
Revision 1.6 2002-10-10 15:10:39 mazen
|
||||
Revision 1.7 2002-10-10 19:57:51 mazen
|
||||
* Just to update repsitory
|
||||
|
||||
Revision 1.6 2002/10/10 15:10:39 mazen
|
||||
* Internal error fixed, but usually i386 parameter model used
|
||||
|
||||
Revision 1.5 2002/10/09 13:52:19 mazen
|
||||
|
@ -1,20 +1,11 @@
|
||||
{*****************************************************************************}
|
||||
{ File : ncpucall.pas }
|
||||
{ Author : Mazen NEIFER }
|
||||
{ Project : Free Pascal Compiler (FPC) }
|
||||
{ Creation date : 2002\26\26 }
|
||||
{ Last modification date : 2002\07\01 }
|
||||
{ Licence : GPL }
|
||||
{ Bug report : mazen.neifer.01@supaero.org }
|
||||
{*****************************************************************************}
|
||||
{
|
||||
{******************************************************************************
|
||||
$Id$
|
||||
Copyright (c) 1998-2002 by Florian Klaempfl
|
||||
|
||||
Generate SPARC assembler for in call nodes
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published bymethodpointer
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
@ -34,60 +25,60 @@ interface
|
||||
uses
|
||||
symdef,node,ncal,ncgcal;
|
||||
type
|
||||
TSparccallnode = class(tcgcallnode)
|
||||
function pass_1 : tnode;override;
|
||||
TSparcCallNode=class(TCgCallNode)
|
||||
function pass_1:TNode;override;
|
||||
{Under SPARC, the frame pointer is automatically set by the SAVE instruction
|
||||
which is part of the stardrad calling mechanism. This function will do nothing
|
||||
else than adding the function prologue, which is in some case loading the
|
||||
correct value into the frame pointer register!}
|
||||
which is part of the stardrad calling mechanism. This function will do nothing.
|
||||
the frame pointer register is the stack pointer register of the caller, and is
|
||||
set when generating function prologue in cgcpu.tcgSPARC.g_stackframe_entry}
|
||||
procedure load_framepointer;override;
|
||||
end;
|
||||
|
||||
implementation
|
||||
|
||||
uses
|
||||
globtype,systems,
|
||||
cutils,verbose,globals,
|
||||
symconst,symbase,symsym,symtable,defbase,paramgr,
|
||||
uses
|
||||
globtype,systems,
|
||||
cutils,verbose,globals,
|
||||
symconst,symbase,symsym,symtable,defbase,paramgr,
|
||||
{$ifdef GDB}
|
||||
{$ifdef delphi}
|
||||
sysutils,
|
||||
sysutils,
|
||||
{$else}
|
||||
strings,
|
||||
strings,
|
||||
{$endif}
|
||||
gdb,
|
||||
gdb,
|
||||
{$endif GDB}
|
||||
cginfo,cgbase,pass_2,
|
||||
cpuinfo,cpubase,aasmbase,aasmtai,aasmcpu,
|
||||
nmem,nld,ncnv,
|
||||
ncgutil,cgobj,tgobj,regvars,rgobj,rgcpu,cg64f32,cgcpu,cpupi;
|
||||
|
||||
function TSparccallnode.pass_1 : tnode;
|
||||
|
||||
begin
|
||||
result:=inherited pass_1;
|
||||
if assigned(result) then
|
||||
exit;
|
||||
if procdefinition is tprocdef then
|
||||
begin
|
||||
if tprocdef(procdefinition).parast.datasize>TSparcprocinfo(procinfo).maxpushedparasize then
|
||||
TSparcprocinfo(procinfo).maxpushedparasize:=tprocdef(procdefinition).parast.datasize
|
||||
end
|
||||
else
|
||||
begin
|
||||
{!!!!}
|
||||
end;
|
||||
end;
|
||||
cginfo,cgbase,pass_2,
|
||||
cpuinfo,cpubase,aasmbase,aasmtai,aasmcpu,
|
||||
nmem,nld,ncnv,
|
||||
ncgutil,cgobj,tgobj,regvars,rgobj,rgcpu,cg64f32,cgcpu,cpupi;
|
||||
function TSparcCallNode.pass_1:TNode;
|
||||
begin
|
||||
result:=inherited pass_1;
|
||||
if assigned(result)
|
||||
then
|
||||
exit;
|
||||
if ProcDefinition is TProcDef
|
||||
then
|
||||
begin
|
||||
if TProcDef(procdefinition).parast.datasize>TSparcProcInfo(procinfo).maxpushedparasize
|
||||
then
|
||||
TSparcProcInfo(procinfo).maxpushedparasize:=TProcdef(procdefinition).parast.datasize
|
||||
end
|
||||
else
|
||||
InternalError(2002101001);
|
||||
end;
|
||||
procedure TSparcCallNode.load_framepointer;
|
||||
begin
|
||||
exprasmList.concat(TAiCpu.Op_reg_const_reg(A_SAVE,S_L,stack_pointer_reg,-tprocdef(procdefinition).parast.datasize,stack_pointer_reg));
|
||||
begin
|
||||
InternalError(2002101000);
|
||||
end;
|
||||
begin
|
||||
ccallnode:=TSparccallnode;
|
||||
ccallnode:=TSparcCallNode;
|
||||
end.
|
||||
{
|
||||
$Log$
|
||||
Revision 1.3 2002-09-30 19:12:14 mazen
|
||||
Revision 1.4 2002-10-10 19:57:52 mazen
|
||||
* Just to update repsitory
|
||||
|
||||
Revision 1.3 2002/09/30 19:12:14 mazen
|
||||
* function prologue fixed
|
||||
|
||||
Revision 1.2 2002/08/30 13:16:23 mazen
|
||||
|
@ -375,7 +375,8 @@ implementation
|
||||
@second_class_to_intf,
|
||||
@second_char_to_char,
|
||||
@second_nothing, { normal_2_smallset }
|
||||
@second_nothing { dynarray_2_openarray }
|
||||
@second_nothing, { dynarray_2_openarray }
|
||||
@second_nothing
|
||||
);
|
||||
type
|
||||
tprocedureofobject = procedure of object;
|
||||
@ -421,7 +422,10 @@ begin
|
||||
end.
|
||||
{
|
||||
$Log$
|
||||
Revision 1.3 2002-09-07 15:25:14 peter
|
||||
Revision 1.4 2002-10-10 19:57:52 mazen
|
||||
* Just to update repsitory
|
||||
|
||||
Revision 1.3 2002/09/07 15:25:14 peter
|
||||
* old logs removed and tabs fixed
|
||||
|
||||
Revision 1.2 2002/08/30 06:15:27 mazen
|
||||
|
Loading…
Reference in New Issue
Block a user