mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-11 09:46:11 +02:00
* fixing return value variable address
This commit is contained in:
parent
d86ca64b17
commit
37247e8cde
@ -27,10 +27,10 @@ uses
|
|||||||
cutils,
|
cutils,
|
||||||
cgbase,cpuinfo;
|
cgbase,cpuinfo;
|
||||||
type
|
type
|
||||||
TSparcprocinfo=class(TProcInfo)
|
TSparcProcInfo=class(TProcInfo)
|
||||||
{overall size of allocated stack space, currently this is used for the
|
{overall size of allocated stack space, currently this is used for the
|
||||||
PowerPC only}
|
PowerPC only}
|
||||||
localsize:aword;
|
LocalSize:aword;
|
||||||
{max of space need for parameters, currently used by the PowerPC port only}
|
{max of space need for parameters, currently used by the PowerPC port only}
|
||||||
maxpushedparasize:aword;
|
maxpushedparasize:aword;
|
||||||
constructor create;override;
|
constructor create;override;
|
||||||
@ -57,33 +57,45 @@ constructor TSparcprocinfo.create;
|
|||||||
begin
|
begin
|
||||||
inherited create;
|
inherited create;
|
||||||
maxpushedparasize:=0;
|
maxpushedparasize:=0;
|
||||||
localsize:=0;
|
LocalSize:=0;
|
||||||
end;
|
end;
|
||||||
procedure TSparcprocinfo.after_header;
|
procedure TSparcprocinfo.after_header;
|
||||||
begin
|
begin
|
||||||
{Reserve the stack for copying parameters passeѕ into registers}
|
{First 16 words are in the frame are used to save registers in case of a
|
||||||
|
register overflow/underflow}
|
||||||
|
{The 17th word is used to save the address of the variable which will
|
||||||
|
receive the return value of the called function}
|
||||||
|
Return_Offset:=-64;{16*4}
|
||||||
procdef.parast.address_fixup:=(16+1)*4;
|
procdef.parast.address_fixup:=(16+1)*4;
|
||||||
|
{Reserve the stack for copying parameters passed into registers. By default
|
||||||
|
we reserve space for the 6 input registers even if the function had less
|
||||||
|
parameters.}
|
||||||
|
procdef.localst.address_fixup:=6*4+(16+1)*4;
|
||||||
end;
|
end;
|
||||||
procedure TSparcProcInfo.after_pass1;
|
procedure TSparcProcInfo.after_pass1;
|
||||||
begin
|
begin
|
||||||
if(procdef.parast.datasize>6*4)
|
with ProcDef do
|
||||||
|
begin
|
||||||
|
if parast.datasize>6*4
|
||||||
then
|
then
|
||||||
procdef.localst.address_fixup:=procdef.parast.datasize+(16+1)*4
|
localst.address_fixup:=parast.address_fixup+parast.datasize;
|
||||||
else
|
firsttemp_offset:=localst.address_fixup+localst.datasize;
|
||||||
procdef.localst.address_fixup:=6*4+(16+1)*4;
|
WriteLn('Parameter copies start at: %i6+'+tostr(parast.address_fixup));
|
||||||
procinfo.firsttemp_offset:=procdef.localst.address_fixup+procdef.localst.datasize;
|
WriteLn('Locals start at: %o6+'+tostr(localst.address_fixup));
|
||||||
WriteLn('Parameter copies start at: %i6+'+tostr(procdef.parast.address_fixup));
|
WriteLn('Temp. space start: %o6+'+tostr(firsttemp_offset));
|
||||||
WriteLn('Locals start at: %o6+'+tostr(procdef.localst.address_fixup));
|
|
||||||
WriteLn('Temp. space start: %o6+'+tostr(procinfo.firsttemp_offset));
|
|
||||||
tg.firsttemp:=procinfo.firsttemp_offset;
|
tg.firsttemp:=procinfo.firsttemp_offset;
|
||||||
tg.lasttemp:=procinfo.firsttemp_offset;
|
tg.lasttemp:=procinfo.firsttemp_offset;
|
||||||
end;
|
end;
|
||||||
|
end;
|
||||||
begin
|
begin
|
||||||
cprocinfo:=TSparcProcInfo;
|
cprocinfo:=TSparcProcInfo;
|
||||||
end.
|
end.
|
||||||
{
|
{
|
||||||
$Log$
|
$Log$
|
||||||
Revision 1.6 2002-11-10 19:07:46 mazen
|
Revision 1.7 2002-11-14 21:42:08 mazen
|
||||||
|
* fixing return value variable address
|
||||||
|
|
||||||
|
Revision 1.6 2002/11/10 19:07:46 mazen
|
||||||
* SPARC calling mechanism almost OK (as in GCC./mppcsparc )
|
* SPARC calling mechanism almost OK (as in GCC./mppcsparc )
|
||||||
|
|
||||||
Revision 1.5 2002/11/03 20:22:40 mazen
|
Revision 1.5 2002/11/03 20:22:40 mazen
|
||||||
|
@ -35,21 +35,15 @@ set when generating function prologue in cgcpu.tcgSPARC.g_stackframe_entry}
|
|||||||
end;
|
end;
|
||||||
implementation
|
implementation
|
||||||
uses
|
uses
|
||||||
globtype,systems,
|
systems,
|
||||||
cutils,verbose,globals,
|
cutils,verbose,globals,
|
||||||
symconst,symbase,symsym,symtable,defbase,paramgr,
|
paramgr,
|
||||||
{$ifdef GDB}
|
{$ifdef GDB}
|
||||||
{$ifdef delphi}
|
|
||||||
sysutils,
|
|
||||||
{$else}
|
|
||||||
strings,
|
|
||||||
{$endif}
|
|
||||||
gdb,
|
gdb,
|
||||||
{$endif GDB}
|
{$endif GDB}
|
||||||
cginfo,cgbase,pass_2,
|
cgbase,
|
||||||
cpuinfo,cpubase,aasmbase,aasmtai,aasmcpu,
|
|
||||||
nmem,nld,ncnv,
|
nmem,nld,ncnv,
|
||||||
ncgutil,cgobj,tgobj,regvars,rgobj,rgcpu,cg64f32,cgcpu,cpupi;
|
cgobj,tgobj,rgobj,rgcpu,cgcpu,cpupi;
|
||||||
function TSparcCallNode.pass_1:TNode;
|
function TSparcCallNode.pass_1:TNode;
|
||||||
begin
|
begin
|
||||||
result:=inherited pass_1;
|
result:=inherited pass_1;
|
||||||
@ -75,7 +69,10 @@ begin
|
|||||||
end.
|
end.
|
||||||
{
|
{
|
||||||
$Log$
|
$Log$
|
||||||
Revision 1.4 2002-10-10 19:57:52 mazen
|
Revision 1.5 2002-11-14 21:42:08 mazen
|
||||||
|
* fixing return value variable address
|
||||||
|
|
||||||
|
Revision 1.4 2002/10/10 19:57:52 mazen
|
||||||
* Just to update repsitory
|
* Just to update repsitory
|
||||||
|
|
||||||
Revision 1.3 2002/09/30 19:12:14 mazen
|
Revision 1.3 2002/09/30 19:12:14 mazen
|
||||||
|
Loading…
Reference in New Issue
Block a user