mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-04-21 08:09:33 +02:00
+ Xtensa: initial implementation of tcgcpu.g_proc_entry
git-svn-id: trunk@44363 -
This commit is contained in:
parent
705218fef1
commit
2a957e77bf
@ -704,14 +704,14 @@ unit i_embed;
|
||||
varalignmin : 0;
|
||||
varalignmax : 4;
|
||||
localalignmin : 4;
|
||||
localalignmax : 4;
|
||||
localalignmax : 16;
|
||||
recordalignmin : 0;
|
||||
recordalignmax : 4;
|
||||
maxCrecordalign : 4
|
||||
);
|
||||
first_parm_offset : 8;
|
||||
stacksize : 262144;
|
||||
stackalign : 4;
|
||||
stacksize : 65536;
|
||||
stackalign : 16;
|
||||
abi : abi_default;
|
||||
llvmdatalayout : 'e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:64:128-a0:0:64-n32-S32';
|
||||
);
|
||||
|
@ -508,10 +508,78 @@ implementation
|
||||
|
||||
|
||||
procedure tcgcpu.g_proc_entry(list : TAsmList; localsize : longint;
|
||||
nostackframe : boolean);
|
||||
nostackframe : boolean);
|
||||
var
|
||||
ref : treference;
|
||||
r : byte;
|
||||
regs : tcpuregisterset;
|
||||
stackmisalignment : pint;
|
||||
regoffset : LongInt;
|
||||
stack_parameters : Boolean;
|
||||
registerarea : PtrInt;
|
||||
begin
|
||||
if target_info.abi=abi_xtensa_windowed then
|
||||
list.Concat(taicpu.op_reg_const(A_ENTRY,NR_STACK_POINTER_REG,32));
|
||||
LocalSize:=align(LocalSize,4);
|
||||
stack_parameters:=current_procinfo.procdef.stack_tainting_parameter(calleeside);
|
||||
|
||||
{ call instruction does not put anything on the stack }
|
||||
registerarea:=0;
|
||||
if not(nostackframe) then
|
||||
begin
|
||||
regs:=rg[R_INTREGISTER].used_in_proc-paramanager.get_volatile_registers_int(pocall_stdcall);
|
||||
a_reg_alloc(list,NR_STACK_POINTER_REG);
|
||||
if current_procinfo.framepointer<>NR_STACK_POINTER_REG then
|
||||
Include(regs,RS_A15);
|
||||
if pi_do_call in current_procinfo.flags then
|
||||
Include(regs,RS_A0);
|
||||
if regs<>[] then
|
||||
begin
|
||||
for r:=RS_A0 to RS_A15 do
|
||||
if r in regs then
|
||||
inc(registerarea,4);
|
||||
end;
|
||||
|
||||
inc(localsize,registerarea);
|
||||
if LocalSize<>0 then
|
||||
begin
|
||||
localsize:=align(localsize,current_settings.alignment.localalignmax);
|
||||
a_reg_alloc(list,NR_STACK_POINTER_REG);
|
||||
list.concat(taicpu.op_reg_reg_const(A_ADDI,NR_STACK_POINTER_REG,NR_STACK_POINTER_REG,-localsize));
|
||||
end;
|
||||
|
||||
reference_reset(ref,4,[]);
|
||||
ref.base:=NR_STACK_POINTER_REG;
|
||||
ref.offset:=localsize;
|
||||
if ref.offset>1024 then
|
||||
begin
|
||||
if ref.offset<=1024+32512 then
|
||||
begin
|
||||
list.concat(taicpu.op_reg_reg_const(A_ADDMI,NR_A8,NR_STACK_POINTER_REG,ref.offset and $fffffc00));
|
||||
ref.offset:=ref.offset and $3ff;
|
||||
ref.base:=NR_A8;
|
||||
end
|
||||
else
|
||||
{ fix me! }
|
||||
Internalerror(2020031101);
|
||||
end;
|
||||
|
||||
if current_procinfo.framepointer<>NR_STACK_POINTER_REG then
|
||||
begin
|
||||
dec(ref.offset,4);
|
||||
list.concat(taicpu.op_reg_ref(A_S32I,NR_A15,ref));
|
||||
a_reg_alloc(list,NR_FRAME_POINTER_REG);
|
||||
list.concat(taicpu.op_reg_reg(A_MOV,NR_A15,NR_STACK_POINTER_REG));
|
||||
end;
|
||||
|
||||
if regs<>[] then
|
||||
begin
|
||||
for r:=RS_A14 downto RS_A0 do
|
||||
if r in regs then
|
||||
begin
|
||||
dec(ref.offset,4);
|
||||
list.concat(taicpu.op_reg_ref(A_S32I,newreg(R_INTREGISTER,r,R_SUBWHOLE),ref));
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
|
||||
|
||||
|
@ -2,6 +2,7 @@
|
||||
'none',
|
||||
'add',
|
||||
'addi',
|
||||
'addmi',
|
||||
'and',
|
||||
'b',
|
||||
'bt',
|
||||
|
@ -2,6 +2,7 @@
|
||||
A_NONE,
|
||||
A_ADD,
|
||||
A_ADDI,
|
||||
A_ADDMI,
|
||||
A_AND,
|
||||
A_Bcc,
|
||||
A_BT,
|
||||
|
Loading…
Reference in New Issue
Block a user