* function epilogue modified to much SPARC ABIN

This commit is contained in:
mazen 2002-09-30 21:07:13 +00:00
parent 352350e524
commit 3a70e9a021

View File

@ -7,7 +7,10 @@
{ Licence : GPL } { Licence : GPL }
{ Bug report : mazen.neifer.01@supaero.org } { Bug report : mazen.neifer.01@supaero.org }
{*****************************************************************************} {*****************************************************************************}
{ Copyright (c) 1998-2000 by Florian Klaempfl {
Id:
Copyright (c) 1998-2000 by Florian Klaempfl
This program is free software;you can redistribute it and/or modify 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 it under the terms of the GNU General Public License as published by
@ -770,48 +773,58 @@ PROCEDURE tcgSPARC.g_flags2reg(list:TAasmOutput;Size:TCgSize;CONST f:tresflags;r
{ *********** 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);
VAR var
href:TReference; href:TReference;
i:integer; i:integer;
again:tasmlabel; again:tasmlabel;
BEGIN begin
{Reserve space to save register window in case of overflow/underflow} {According the the SPARC ABI the standard stack frame must include :
Inc(LocalSize,16);{located between %o6 and %o6+15} * 16 word save for the in and local registers in case of overflow/underflow.
WITH list DO this save area always must exist at the %o6+0,
* software conventions requires space for the aggregate return value pointer, even if the word is not used,
* althogh the first six words of arguments reside in registers, the standard
stack frame reserves space for them. Arguments beond the sixth reside on the
stack as in the Intel architecture,
* other areas depend on the compiler and the code being compiled. The
standard calling sequence does not define a maximum stack frame size, nor does
it restrict how a language system uses the "unspecified" areas of the standard
stack frame.}
Dec(LocalSize,(16+1+5)*4);
{Althogh the SPARC architecture require only word alignment, software
convention and the operating system require every stack frame to be double word
aligned}
if(LocalSize and $00000003)<>0
then
LocalSize:=(LocalSize and $FFFFFFFC)+4;
with list do
concat(Taicpu.Op_reg_const_reg(A_SAVE,S_L,Stack_Pointer_Reg,localsize,Stack_Pointer_Reg)); concat(Taicpu.Op_reg_const_reg(A_SAVE,S_L,Stack_Pointer_Reg,localsize,Stack_Pointer_Reg));
END; end;
PROCEDURE tcgSPARC.g_restore_frame_pointer(list:TAasmOutput); procedure tcgSPARC.g_restore_frame_pointer(list:TAasmOutput);
BEGIN begin
list.concat(Taicpu.Op_none(A_RESTORE,S_NO)); {We use trivial restore, as we set result before}
END; with list do
PROCEDURE tcgSPARC.g_return_from_proc(list:TAasmOutput;parasize:aword); concat(Taicpu.Op_reg_const_reg(A_RESTORE,S_L,R_G0,0,R_G0));
BEGIN end;
procedure tcgSPARC.g_return_from_proc(list:TAasmOutput;parasize:aword);
var
RetReference:TReference;
begin
{ Routines with the poclearstack flag set use only a ret } { Routines with the poclearstack flag set use only a ret }
{ also routines with parasize=0 } { also routines with parasize=0 }
WITH List DO with list do
(*IF(po_clearstack IN aktprocdef.procoptions) begin
THEN reference_reset_base(RetReference,R_I7,8);
{ complex return values are removed from stack in C code PM } concat(Taicpu.Op_ref_reg(A_JMPL,S_L,RetReference,R_G0));
IF ret_in_param(aktprocdef.rettype.def) if(parasize<>0)
THEN then
Concat(Taicpu.Op_const(A_RET,S_NO,4))
ELSE
Concat(Taicpu.Op_none(A_RET,S_NO))
ELSE*)
IF(parasize=0)
THEN
Concat(Taicpu.Op_none(A_RET,S_NO))
ELSE
BEGIN
{ parameters are limited to 65535 bytes because } { parameters are limited to 65535 bytes because }
{ ret allows only imm16 } { ret allows only imm16 }
IF(parasize>65535) IF(parasize>65535)
THEN THEN
CGMessage(cg_e_parasize_too_big); CGMessage(cg_e_parasize_too_big);
Concat(Taicpu.Op_const(A_RET,S_NO,parasize)); end
END; end;
END;
PROCEDURE tcgSPARC.a_loadaddr_ref_reg(list:TAasmOutput;CONST ref:TReference;r:tregister); PROCEDURE tcgSPARC.a_loadaddr_ref_reg(list:TAasmOutput;CONST ref:TReference;r:tregister);
@ -1060,3 +1073,6 @@ PROCEDURE tcgSPARC.floatstore(list:TAasmOutput;t:tcgsize;CONST ref:TReference);
BEGIN BEGIN
cg:=tcgSPARC.create; cg:=tcgSPARC.create;
END. END.
{
$Log:
}