* basic sparc64 calling convention handling and stack frame handling fixed

git-svn-id: trunk@36518 -
This commit is contained in:
florian 2017-06-18 15:49:21 +00:00
parent ac16c90357
commit 3c72115e30
7 changed files with 89 additions and 6 deletions

1
.gitattributes vendored
View File

@ -689,6 +689,7 @@ compiler/sparc64/rsp64sri.inc svneol=native#text/pascal
compiler/sparc64/rsp64stab.inc svneol=native#text/pascal
compiler/sparc64/rsp64std.inc svneol=native#text/pascal
compiler/sparc64/rsp64sup.inc svneol=native#text/pascal
compiler/sparc64/tgcpu.pas svneol=native#text/plain
compiler/sparcgen/aasmcpu.pas svneol=native#text/plain
compiler/sparcgen/aoptcpu.pas svneol=native#text/plain
compiler/sparcgen/aoptcpub.pas svneol=native#text/plain

View File

@ -34,6 +34,8 @@ implementation
ncpuadd,ncpucall,ncpumat,ncpuinln,ncpucnv,ncpuset,
{ this not really a node }
rgcpu,
{ this neither }
tgcpu,
{ symtable }
symcpu,
aasmdef;

View File

@ -0,0 +1,53 @@
{
Copyright (C) 1998-2000 by Florian Klaempfl
This unit handles the temporary variables stuff for sparc64
This program is free software; you can redistribute it and/or modify
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.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
****************************************************************************
}
{
This unit handles the temporary variables stuff for i8086.
}
unit tgcpu;
{$i fpcdefs.inc}
interface
uses
tgobj,globtype,aasmdata,cgutils,symtype;
type
ttgsparc64 = class(ttgobj)
protected
procedure alloctemp(list: TAsmList; size: asizeint; alignment: shortint; temptype: ttemptype; def: tdef; fini: boolean; out ref: treference);override;
end;
implementation
uses
cpubase;
procedure ttgsparc64.alloctemp(list: TAsmList; size: asizeint; alignment: shortint; temptype: ttemptype; def: tdef; fini: boolean; out ref: treference);
begin
inherited;
inc(ref.offset,STACK_BIAS);
end;
begin
tgobjclass:=ttgsparc64;
end.

View File

@ -305,6 +305,10 @@ uses
}
std_param_align = 4; { for 32-bit version only }
{$ifdef SPARC64}
STACK_BIAS = 2047;
{$endif SPARC64}
{*****************************************************************************
CPU Dependent Constants

View File

@ -32,12 +32,17 @@ interface
globtype,
aasmdata,
symdef,
hlcg2ll;
hlcg2ll,
cgutils,
tgobj;
type
thlcgcpu = class(thlcg2ll)
procedure g_intf_wrapper(list: TAsmList; procdef: tprocdef; const labelname: string; ioffset: longint);override;
procedure a_jmp_external_name(list: TAsmList; const externalname: TSymStr);override;
{$ifdef SPARC64}
procedure temp_to_ref(p: ptemprecord; out ref: treference);override;
{$endif SPARC64}
end;
procedure create_hlcodegen;
@ -49,7 +54,7 @@ implementation
aasmbase,aasmtai,aasmcpu,
parabase,
symconst,symtype,symsym,
cgbase,cgutils,cgobj,hlcgobj,cpubase,cgcpu;
cgbase,cgobj,hlcgobj,cpubase,cgcpu;
procedure thlcgcpu.g_intf_wrapper(list: TAsmList; procdef: tprocdef; const labelname: string; ioffset: longint);
@ -133,6 +138,15 @@ implementation
end;
{$ifdef SPARC64}
procedure thlcgcpu.temp_to_ref(p : ptemprecord; out ref : treference);
begin
inherited;
inc(ref.offset,STACK_BIAS);
end;
{$endif SPARC64}
procedure create_hlcodegen;
begin
hlcg:=thlcgcpu.create;

View File

@ -251,11 +251,18 @@ implementation
if vo_is_funcret in hp.varoptions then
begin
paraloc^.loc:=LOC_REFERENCE;
{$ifdef SPARC64}
paraloc^.reference.offset:=128;
{$else SPARC64}
paraloc^.reference.offset:=64;
{$endif SPARC64}
if side=callerside then
paraloc^.reference.index:=NR_STACK_POINTER_REG
else
paraloc^.reference.index:=NR_FRAME_POINTER_REG;
paraloc^.reference.offset:=64;
{$ifdef SPARC64}
inc(paraloc^.reference.offset,STACK_BIAS);
{$endif SPARC64}
end
{ In case of po_delphi_nested_cc, the parent frame pointer
is always passed on the stack. }
@ -270,12 +277,14 @@ implementation
else
begin
paraloc^.loc:=LOC_REFERENCE;
paraloc^.reference.offset:=target_info.first_parm_offset+parasize;
if side=callerside then
paraloc^.reference.index:=NR_STACK_POINTER_REG
else
paraloc^.reference.index:=NR_FRAME_POINTER_REG;
paraloc^.reference.offset:=target_info.first_parm_offset+parasize;
{$ifdef SPARC64}
inc(paraloc^.reference.offset,STACK_BIAS);
{$endif SPARC64}
if (target_info.endian=endian_big) and
(paralen<tcgsize2size[OS_INT]) and
(paradef.typ<>recorddef) then

View File

@ -551,7 +551,7 @@ unit i_linux;
recordalignmax : 16;
maxCrecordalign : 16
);
first_parm_offset : 92;
first_parm_offset : 176;
stacksize : 16*1024*1024;
stackalign : 16;
abi : abi_default;