+ procedures exiting prologue added and stack frame now restored in the delay slot of the return (JMPL) instruction

This commit is contained in:
mazen 2002-10-01 21:35:58 +00:00
parent b2c63fb6ca
commit b5882415a3
3 changed files with 42 additions and 43 deletions

View File

@ -292,14 +292,14 @@ uses
end; end;
constructor taicpu.op_ref_reg(op : tasmop;_size : topsize;const _op1 : treference;_op2 : tregister); constructor taicpu.op_ref_reg(op:tasmop;_size:topsize;const _op1:treference;_op2:tregister);
begin begin
inherited create(op); inherited create(op);
init(_size); init(_size);
ops:=2; ops:=2;
loadref(0,_op1); loadref(0,_op1);
loadreg(1,_op2); loadreg(1,_op2);
end; end;
constructor taicpu.op_ref_ref(op : tasmop;_size : topsize;const _op1,_op2 : treference); constructor taicpu.op_ref_ref(op : tasmop;_size : topsize;const _op1,_op2 : treference);

View File

@ -81,9 +81,9 @@ specific processor ABI. It is overriden for each CPU target.
PROCEDURE a_jmp_cond(list:TAasmOutput;cond:TOpCmp;l:tasmlabel);{ OVERRIDE;} PROCEDURE a_jmp_cond(list:TAasmOutput;cond:TOpCmp;l:tasmlabel);{ OVERRIDE;}
PROCEDURE a_jmp_flags(list:TAasmOutput;CONST f:TResFlags;l:tasmlabel);OVERRIDE; PROCEDURE a_jmp_flags(list:TAasmOutput;CONST f:TResFlags;l:tasmlabel);OVERRIDE;
PROCEDURE g_flags2reg(list:TAasmOutput;Size:TCgSize;CONST f:tresflags;reg:TRegister);OVERRIDE; PROCEDURE g_flags2reg(list:TAasmOutput;Size:TCgSize;CONST f:tresflags;reg:TRegister);OVERRIDE;
PROCEDURE g_stackframe_entry(list:TAasmOutput;localsize:LongInt);OVERRIDE; procedure g_stackframe_entry(list:TAasmOutput;localsize:LongInt);override;
PROCEDURE g_restore_frame_pointer(list:TAasmOutput);OVERRIDE; procedure g_restore_frame_pointer(list:TAasmOutput);override;
PROCEDURE g_return_from_proc(list:TAasmOutput;parasize:aword);OVERRIDE; procedure g_return_from_proc(list:TAasmOutput;parasize:aword);override;
PROCEDURE g_concatcopy(list:TAasmOutput;CONST source,dest:TReference;len:aword;delsource,loadref:boolean);OVERRIDE; PROCEDURE g_concatcopy(list:TAasmOutput;CONST source,dest:TReference;len:aword;delsource,loadref:boolean);OVERRIDE;
class function reg_cgsize(CONST reg:tregister):tcgsize;OVERRIDE; class function reg_cgsize(CONST reg:tregister):tcgsize;OVERRIDE;
PRIVATE PRIVATE
@ -806,9 +806,8 @@ execution of that instrucion is the called function stack pointer}
end; end;
procedure tcgSPARC.g_restore_frame_pointer(list:TAasmOutput); procedure tcgSPARC.g_restore_frame_pointer(list:TAasmOutput);
begin begin
{We use trivial restore, as we set result before} {This function intontionally does nothing as frame pointer is restored in the
with list do delay slot of the return instrucion done in g_return_from_proc}
concat(Taicpu.Op_reg_const_reg(A_RESTORE,S_L,R_G0,0,R_G0));
end; end;
procedure tcgSPARC.g_return_from_proc(list:TAasmOutput;parasize:aword); procedure tcgSPARC.g_return_from_proc(list:TAasmOutput;parasize:aword);
var var
@ -826,8 +825,12 @@ If no inversion we can use just
NOP} NOP}
with list do with list do
begin begin
{Return address is computed by adding 8 to the CALL address saved onto %i6}
reference_reset_base(RetReference,R_I7,8); reference_reset_base(RetReference,R_I7,8);
concat(Taicpu.Op_ref_reg(A_JMPL,S_L,RetReference,R_G0)); concat(Taicpu.Op_ref_reg(A_JMPL,S_L,RetReference,R_G0));
{We use trivial restore in the delay slot of the JMPL instruction, as we
already set result onto %i0}
concat(Taicpu.Op_reg_const_reg(A_RESTORE,S_L,R_G0,0,R_G0));
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);
@ -1079,7 +1082,10 @@ BEGIN
END. END.
{ {
$Log$ $Log$
Revision 1.7 2002-10-01 21:06:29 mazen Revision 1.8 2002-10-01 21:35:58 mazen
+ procedures exiting prologue added and stack frame now restored in the delay slot of the return (JMPL) instruction
Revision 1.7 2002/10/01 21:06:29 mazen
attinst.inc --> strinst.inc attinst.inc --> strinst.inc
Revision 1.6 2002/10/01 17:41:50 florian Revision 1.6 2002/10/01 17:41:50 florian

View File

@ -232,37 +232,30 @@ VAR
{**************************************************************************** {****************************************************************************
TISPARCATTASMOUTPUT TISPARCATTASMOUTPUT
****************************************************************************} ****************************************************************************}
const
const ait_const2str:array[ait_const_32bit..ait_const_8bit]of string[8]=(#9'.long'#9,#9'.short'#9,#9'.byte'#9);
ait_const2str : array[ait_const_32bit..ait_const_8bit] of string[8]= procedure TGasSPARC.WriteInstruction(hp:Tai);
(#9'.long'#9,#9'.short'#9,#9'.byte'#9); var
PROCEDURE TGasSPARC.WriteInstruction(hp:Tai); Op:TAsmOp;
VAR s:STRING;
Op:TAsmOp; i:Integer;
s:STRING; sep:STRING[3];
i:Integer; begin
sep:STRING[3]; if hp.typ<>ait_instruction
BEGIN then
IF hp.typ<>ait_instruction Exit;
THEN taicpu(hp).SetOperandOrder(op_att);
Exit; op:=taicpu(hp).opcode;
taicpu(hp).SetOperandOrder(op_att); {call maybe not translated to call}
op:=taicpu(hp).opcode; s:=#9+std_op2str[op]+cond2str[taicpu(hp).condition];
{ call maybe not translated to call } if is_CallJmp(op)
s:=#9+std_op2str[op]+cond2str[taicpu(hp).condition]; then
IF is_CallJmp(op)
THEN
{ call and jmp need an extra handling } { call and jmp need an extra handling }
{ this code is only called if jmp isn't a labeled instruction } { this code is only called if jmp isn't a labeled instruction }
{ quick hack to overcome a problem with manglednames=255 chars } { quick hack to overcome a problem with manglednames=255 chars }
BEGIN begin
{ IF op<>A_JMPl s:=#9+std_op2str[op]+#9+getopstr_jmp(taicpu(hp).oper[0]);
THEN end
s:=cond2str(op,taicpu(hp).condition)+','
ELSE}
s:=#9'b'#9;
s:=s+getopstr_jmp(taicpu(hp).oper[0]);
END
ELSE ELSE
BEGIN {process operands} BEGIN {process operands}
s:=#9+std_op2str[op]; s:=#9+std_op2str[op];