mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-20 18:29:27 +02:00
+ implemented abi compliant handling of strucutured functions results on sparc platform
This commit is contained in:
parent
ed7084e0b6
commit
fcfbc935a1
@ -69,6 +69,7 @@ interface
|
|||||||
procedure pop_parasize(pop_size:longint);virtual;
|
procedure pop_parasize(pop_size:longint);virtual;
|
||||||
procedure extra_interrupt_code;virtual;
|
procedure extra_interrupt_code;virtual;
|
||||||
procedure extra_call_code;virtual;
|
procedure extra_call_code;virtual;
|
||||||
|
procedure extra_post_call_code;virtual;
|
||||||
procedure do_syscall;virtual;abstract;
|
procedure do_syscall;virtual;abstract;
|
||||||
public
|
public
|
||||||
procedure pass_2;override;
|
procedure pass_2;override;
|
||||||
@ -476,6 +477,11 @@ implementation
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
procedure tcgcallnode.extra_post_call_code;
|
||||||
|
begin
|
||||||
|
end;
|
||||||
|
|
||||||
|
|
||||||
procedure tcgcallnode.pop_parasize(pop_size:longint);
|
procedure tcgcallnode.pop_parasize(pop_size:longint);
|
||||||
begin
|
begin
|
||||||
end;
|
end;
|
||||||
@ -896,6 +902,7 @@ implementation
|
|||||||
{ call method }
|
{ call method }
|
||||||
extra_call_code;
|
extra_call_code;
|
||||||
cg.a_call_reg(exprasmlist,pvreg);
|
cg.a_call_reg(exprasmlist,pvreg);
|
||||||
|
extra_post_call_code;
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
begin
|
begin
|
||||||
@ -924,6 +931,7 @@ implementation
|
|||||||
extra_interrupt_code;
|
extra_interrupt_code;
|
||||||
extra_call_code;
|
extra_call_code;
|
||||||
cg.a_call_name(exprasmlist,tprocdef(procdefinition).mangledname);
|
cg.a_call_name(exprasmlist,tprocdef(procdefinition).mangledname);
|
||||||
|
extra_post_call_code;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
end
|
end
|
||||||
@ -961,6 +969,7 @@ implementation
|
|||||||
extra_interrupt_code;
|
extra_interrupt_code;
|
||||||
extra_call_code;
|
extra_call_code;
|
||||||
cg.a_call_reg(exprasmlist,pvreg);
|
cg.a_call_reg(exprasmlist,pvreg);
|
||||||
|
extra_post_call_code;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
{ Need to remove the parameters from the stack? }
|
{ Need to remove the parameters from the stack? }
|
||||||
@ -1247,7 +1256,10 @@ begin
|
|||||||
end.
|
end.
|
||||||
{
|
{
|
||||||
$Log$
|
$Log$
|
||||||
Revision 1.192 2005-01-04 16:36:51 peter
|
Revision 1.193 2005-01-07 16:22:54 florian
|
||||||
|
+ implemented abi compliant handling of strucutured functions results on sparc platform
|
||||||
|
|
||||||
|
Revision 1.192 2005/01/04 16:36:51 peter
|
||||||
* release temps in array constructor
|
* release temps in array constructor
|
||||||
|
|
||||||
Revision 1.191 2005/01/02 16:58:48 peter
|
Revision 1.191 2005/01/02 16:58:48 peter
|
||||||
|
@ -51,9 +51,9 @@ unit parabase;
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
TCGPara = object
|
TCGPara = object
|
||||||
|
Location : PCGParalocation;
|
||||||
Alignment : ShortInt;
|
Alignment : ShortInt;
|
||||||
Size : TCGSize; { Size of the parameter included in all locations }
|
Size : TCGSize; { Size of the parameter included in all locations }
|
||||||
Location : PCGParalocation;
|
|
||||||
constructor init;
|
constructor init;
|
||||||
destructor done;
|
destructor done;
|
||||||
procedure reset;
|
procedure reset;
|
||||||
@ -251,7 +251,10 @@ end.
|
|||||||
|
|
||||||
{
|
{
|
||||||
$Log$
|
$Log$
|
||||||
Revision 1.6 2004-11-22 22:01:19 peter
|
Revision 1.7 2005-01-07 16:22:54 florian
|
||||||
|
+ implemented abi compliant handling of strucutured functions results on sparc platform
|
||||||
|
|
||||||
|
Revision 1.6 2004/11/22 22:01:19 peter
|
||||||
* fixed varargs
|
* fixed varargs
|
||||||
* replaced dynarray with tlist
|
* replaced dynarray with tlist
|
||||||
|
|
||||||
|
@ -121,7 +121,7 @@ implementation
|
|||||||
uses
|
uses
|
||||||
globals,verbose,systems,cutils,
|
globals,verbose,systems,cutils,
|
||||||
symdef,paramgr,
|
symdef,paramgr,
|
||||||
tgobj,cpupi;
|
tgobj,procinfo,cpupi;
|
||||||
|
|
||||||
|
|
||||||
{****************************************************************************
|
{****************************************************************************
|
||||||
@ -952,19 +952,44 @@ implementation
|
|||||||
|
|
||||||
|
|
||||||
procedure TCgSparc.g_proc_exit(list : taasmoutput;parasize:longint;nostackframe:boolean);
|
procedure TCgSparc.g_proc_exit(list : taasmoutput;parasize:longint;nostackframe:boolean);
|
||||||
|
var
|
||||||
|
hr : treference;
|
||||||
begin
|
begin
|
||||||
if nostackframe then
|
if paramanager.ret_in_param(current_procinfo.procdef.rettype.def,current_procinfo.procdef.proccalloption) then
|
||||||
begin
|
begin
|
||||||
{ Here we need to use RETL instead of RET so it uses %o7 }
|
reference_reset(hr);
|
||||||
list.concat(Taicpu.op_none(A_RETL));
|
hr.offset:=12;
|
||||||
list.concat(Taicpu.op_none(A_NOP))
|
hr.refaddr:=addr_full;
|
||||||
|
if nostackframe then
|
||||||
|
begin
|
||||||
|
hr.base:=NR_O7;
|
||||||
|
list.concat(taicpu.op_ref_reg(A_JMPL,hr,NR_G0));
|
||||||
|
list.concat(Taicpu.op_none(A_NOP))
|
||||||
|
end
|
||||||
|
else
|
||||||
|
begin
|
||||||
|
{ We use trivial restore in the delay slot of the JMPL instruction, as we
|
||||||
|
already set result onto %i0 }
|
||||||
|
hr.base:=NR_I7;
|
||||||
|
list.concat(taicpu.op_ref_reg(A_JMPL,hr,NR_G0));
|
||||||
|
list.concat(Taicpu.op_none(A_RESTORE));
|
||||||
|
end;
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
begin
|
begin
|
||||||
{ We use trivial restore in the delay slot of the JMPL instruction, as we
|
if nostackframe then
|
||||||
already set result onto %i0 }
|
begin
|
||||||
list.concat(Taicpu.op_none(A_RET));
|
{ Here we need to use RETL instead of RET so it uses %o7 }
|
||||||
list.concat(Taicpu.op_none(A_RESTORE));
|
list.concat(Taicpu.op_none(A_RETL));
|
||||||
|
list.concat(Taicpu.op_none(A_NOP))
|
||||||
|
end
|
||||||
|
else
|
||||||
|
begin
|
||||||
|
{ We use trivial restore in the delay slot of the JMPL instruction, as we
|
||||||
|
already set result onto %i0 }
|
||||||
|
list.concat(Taicpu.op_none(A_RET));
|
||||||
|
list.concat(Taicpu.op_none(A_RESTORE));
|
||||||
|
end;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -1316,7 +1341,10 @@ begin
|
|||||||
end.
|
end.
|
||||||
{
|
{
|
||||||
$Log$
|
$Log$
|
||||||
Revision 1.100 2005-01-01 13:19:09 florian
|
Revision 1.101 2005-01-07 16:22:54 florian
|
||||||
|
+ implemented abi compliant handling of strucutured functions results on sparc platform
|
||||||
|
|
||||||
|
Revision 1.100 2005/01/01 13:19:09 florian
|
||||||
* improved code generation for OP_MUL/OP_IMUL
|
* improved code generation for OP_MUL/OP_IMUL
|
||||||
|
|
||||||
Revision 1.99 2004/12/18 15:48:06 florian
|
Revision 1.99 2004/12/18 15:48:06 florian
|
||||||
|
@ -258,7 +258,17 @@ implementation
|
|||||||
paraloc^.size:=OS_32
|
paraloc^.size:=OS_32
|
||||||
else
|
else
|
||||||
paraloc^.size:=paracgsize;
|
paraloc^.size:=paracgsize;
|
||||||
if (intparareg<=high(tparasupregs)) then
|
{ ret in param? }
|
||||||
|
if vo_is_funcret in hp.varoptions then
|
||||||
|
begin
|
||||||
|
paraloc^.loc:=LOC_REFERENCE;
|
||||||
|
if side=callerside then
|
||||||
|
paraloc^.reference.index:=NR_STACK_POINTER_REG
|
||||||
|
else
|
||||||
|
paraloc^.reference.index:=NR_FRAME_POINTER_REG;
|
||||||
|
paraloc^.reference.offset:=64;
|
||||||
|
end
|
||||||
|
else if (intparareg<=high(tparasupregs)) then
|
||||||
begin
|
begin
|
||||||
paraloc^.loc:=LOC_REGISTER;
|
paraloc^.loc:=LOC_REGISTER;
|
||||||
paraloc^.register:=newreg(R_INTREGISTER,hparasupregs^[intparareg],R_SUBWHOLE);
|
paraloc^.register:=newreg(R_INTREGISTER,hparasupregs^[intparareg],R_SUBWHOLE);
|
||||||
@ -317,7 +327,10 @@ begin
|
|||||||
end.
|
end.
|
||||||
{
|
{
|
||||||
$Log$
|
$Log$
|
||||||
Revision 1.51 2004-11-22 22:01:19 peter
|
Revision 1.52 2005-01-07 16:22:54 florian
|
||||||
|
+ implemented abi compliant handling of strucutured functions results on sparc platform
|
||||||
|
|
||||||
|
Revision 1.51 2004/11/22 22:01:19 peter
|
||||||
* fixed varargs
|
* fixed varargs
|
||||||
* replaced dynarray with tlist
|
* replaced dynarray with tlist
|
||||||
|
|
||||||
|
@ -31,20 +31,36 @@ interface
|
|||||||
|
|
||||||
type
|
type
|
||||||
tsparccallnode = class(tcgcallnode)
|
tsparccallnode = class(tcgcallnode)
|
||||||
|
procedure extra_post_call_code;override;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
implementation
|
implementation
|
||||||
|
|
||||||
uses
|
uses
|
||||||
|
cpubase,
|
||||||
|
aasmtai,
|
||||||
|
aasmcpu,
|
||||||
|
paramgr,
|
||||||
ncal;
|
ncal;
|
||||||
|
|
||||||
|
|
||||||
|
procedure tsparccallnode.extra_post_call_code;
|
||||||
|
begin
|
||||||
|
if paramanager.ret_in_param(procdefinition.rettype.def,procdefinition.proccalloption) then
|
||||||
|
exprasmlist.concat(taicpu.op_const(A_UNIMP,procdefinition.rettype.def.size and $fff));
|
||||||
|
end;
|
||||||
|
|
||||||
|
|
||||||
begin
|
begin
|
||||||
ccallnode:=TSparcCallNode;
|
ccallnode:=TSparcCallNode;
|
||||||
end.
|
end.
|
||||||
{
|
{
|
||||||
$Log$
|
$Log$
|
||||||
Revision 1.14 2004-06-20 08:55:32 florian
|
Revision 1.15 2005-01-07 16:22:54 florian
|
||||||
|
+ implemented abi compliant handling of strucutured functions results on sparc platform
|
||||||
|
|
||||||
|
Revision 1.14 2004/06/20 08:55:32 florian
|
||||||
* logs truncated
|
* logs truncated
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -36,7 +36,7 @@ A_SWAP,A_SWAPA,A_Ticc,A_TADDcc,A_TSUBcc,A_TADDccTV,A_TSUBccTV,
|
|||||||
A_TA,A_Txx,
|
A_TA,A_Txx,
|
||||||
A_UDIV,A_UDIVcc,
|
A_UDIV,A_UDIVcc,
|
||||||
A_UMUL,A_UMULcc,
|
A_UMUL,A_UMULcc,
|
||||||
A_UNMP,
|
A_UNIMP,
|
||||||
A_WRASR,A_WRY,A_WRPSR,A_WRWIM,A_WRTBR,
|
A_WRASR,A_WRY,A_WRPSR,A_WRWIM,A_WRTBR,
|
||||||
A_XNOR,A_XNORcc,
|
A_XNOR,A_XNORcc,
|
||||||
A_XOR,A_XORcc,
|
A_XOR,A_XORcc,
|
||||||
@ -74,7 +74,10 @@ A_FABSq
|
|||||||
|
|
||||||
{
|
{
|
||||||
$Log$
|
$Log$
|
||||||
Revision 1.15 2004-10-03 12:42:22 florian
|
Revision 1.16 2005-01-07 16:22:54 florian
|
||||||
|
+ implemented abi compliant handling of strucutured functions results on sparc platform
|
||||||
|
|
||||||
|
Revision 1.15 2004/10/03 12:42:22 florian
|
||||||
* made sqrt, sqr and abs internal for the sparc
|
* made sqrt, sqr and abs internal for the sparc
|
||||||
|
|
||||||
Revision 1.14 2004/06/20 08:55:32 florian
|
Revision 1.14 2004/06/20 08:55:32 florian
|
||||||
|
@ -34,7 +34,7 @@
|
|||||||
'ta','t',
|
'ta','t',
|
||||||
'udiv','udivcc',
|
'udiv','udivcc',
|
||||||
'umul','umulcc',
|
'umul','umulcc',
|
||||||
'unmp',
|
'unimp',
|
||||||
'wrasr','wry','wrpsr','wrwim','wrtbr',
|
'wrasr','wry','wrpsr','wrwim','wrtbr',
|
||||||
'xnor','xnorcc',
|
'xnor','xnorcc',
|
||||||
'xor','xorcc',
|
'xor','xorcc',
|
||||||
@ -70,7 +70,10 @@
|
|||||||
'fabsd','fabsq'
|
'fabsd','fabsq'
|
||||||
{
|
{
|
||||||
$Log$
|
$Log$
|
||||||
Revision 1.14 2004-10-03 12:42:22 florian
|
Revision 1.15 2005-01-07 16:22:54 florian
|
||||||
|
+ implemented abi compliant handling of strucutured functions results on sparc platform
|
||||||
|
|
||||||
|
Revision 1.14 2004/10/03 12:42:22 florian
|
||||||
* made sqrt, sqr and abs internal for the sparc
|
* made sqrt, sqr and abs internal for the sparc
|
||||||
|
|
||||||
Revision 1.13 2004/06/20 08:55:32 florian
|
Revision 1.13 2004/06/20 08:55:32 florian
|
||||||
|
Loading…
Reference in New Issue
Block a user