* started to fix stack frame generation on MIPS(EL)

git-svn-id: trunk@21118 -
This commit is contained in:
florian 2012-04-29 16:58:19 +00:00
parent 9c845e9f76
commit aadeba4d1a
5 changed files with 51 additions and 39 deletions

View File

@ -1177,6 +1177,14 @@ implementation
else
AsmWriteln(tai_symbol(hp).sym.name);
end;
if target_info.system in [system_mipsel_linux,system_mips_linux] then
begin
AsmWrite(#9'.ent'#9);
if replaceforbidden then
AsmWriteln(ReplaceForbiddenAsmSymbolChars(tai_symbol(hp).sym.name))
else
AsmWriteln(tai_symbol(hp).sym.name);
end;
if (target_info.system = system_powerpc64_linux) and
(tai_symbol(hp).sym.typ = AT_FUNCTION) then
begin
@ -1247,7 +1255,12 @@ implementation
AsmWriteLn(#9'.thumb_func');
end;
{$endif arm}
{$if defined(alpha)}
ait_ent:
begin
AsmWriteLn(#9'.ent'#9+tai_ent(hp).Name);
end;
{$endif alpha}
ait_symbol_end :
begin
if tf_needs_symbol_size in target_info.flags then

View File

@ -38,6 +38,7 @@ const
O_MOV_DEST = 1;
type
{ taicpu }
taicpu = class(tai_cpu_abstract_sym)
delayslot_annulled: boolean; { conditinal opcode with ,a }
constructor op_none(op: tasmop);
@ -54,6 +55,7 @@ type
constructor op_reg_reg_ref(op: tasmop; _op1, _op2: tregister; const _op3: treference);
constructor op_reg_reg_const(op: tasmop; _op1, _op2: tregister; _op3: aint);
constructor op_reg_const_reg(op: tasmop; _op1: tregister; _op2: aint; _op3: tregister);
{ this is for Jmp instructions }
constructor op_sym(op: tasmop; _op1: tasmsymbol);
@ -84,8 +86,6 @@ implementation
taicpu Constructors
*****************************************************************************}
constructor taicpu.op_none(op: tasmop);
begin
inherited Create(op);
@ -153,24 +153,35 @@ end;
constructor taicpu.op_reg_reg_ref(op: tasmop; _op1, _op2: tregister; const _op3: treference);
begin
inherited create(op);
ops := 3;
loadreg(0, _op1);
loadreg(1, _op2);
loadref(2, _op3);
begin
inherited create(op);
ops := 3;
loadreg(0, _op1);
loadreg(1, _op2);
loadref(2, _op3);
end;
constructor taicpu.op_reg_reg_const(op: tasmop; _op1, _op2: tregister; _op3: aint);
begin
inherited create(op);
ops := 3;
loadreg(0, _op1);
loadreg(1, _op2);
loadconst(2, _op3);
begin
inherited create(op);
ops := 3;
loadreg(0, _op1);
loadreg(1, _op2);
loadconst(2, _op3);
end;
constructor taicpu.op_reg_const_reg(op: tasmop; _op1: tregister; _op2: aint;
_op3: tregister);
begin
inherited create(op);
ops := 3;
loadreg(0, _op1);
loadconst(1, _op2);
loadreg(2, _op3);
end;
constructor taicpu.op_sym(op: tasmop; _op1: tasmsymbol);
begin

View File

@ -1347,55 +1347,46 @@ var
instr: taicpu;
begin
{
if STK2_dummy <> 0 then
begin
list.concat(Taicpu.Op_reg_reg_const(A_P_STK2, STK2_PTR, STK2_PTR, -STK2_dummy));
end;
}
LocalSize := align(LocalSize, 8);
a_reg_alloc(list,NR_STACK_POINTER_REG);
if current_procinfo.framepointer<>NR_STACK_POINTER_REG then
a_reg_alloc(list,NR_FRAME_POINTER_REG);
if nostackframe then
exit;
usesfpr := False;
if not (po_assembler in current_procinfo.procdef.procoptions) then
case target_info.abi of
abi_powerpc_aix:
firstfpureg := RS_F14;
abi_powerpc_sysv:
firstfpureg := RS_F14;
abi_default:
firstfpureg := RS_F14;
else
internalerror(2003122903);
end;
for regcounter := firstfpureg to RS_F31 do
usesfpr := False;
for regcounter := RS_F20 to RS_F30 do
begin
if regcounter in rg[R_FPUREGISTER].used_in_proc then
begin
usesfpr := True;
firstregfpu := regcounter;
break;
end;
end;
usesgpr := False;
if not (po_assembler in current_procinfo.procdef.procoptions) then
for regcounter2 := RS_R13 to RS_R31 do
for regcounter2 := RS_R0 to RS_R31 do
begin
if regcounter2 in rg[R_INTREGISTER].used_in_proc then
begin
usesgpr := True;
firstreggpr := regcounter2;
break;
end;
end;
LocalSize := align(LocalSize, 8);
cgcpu_calc_stackframe_size := LocalSize;
list.concat(Taicpu.Op_reg_reg_const(A_P_FRAME, NR_FRAME_POINTER_REG, NR_R31, LocalSize));
list.concat(Taicpu.Op_reg_const_reg(A_P_FRAME, NR_FRAME_POINTER_REG, LocalSize, NR_R31));
list.concat(Taicpu.op_none(A_P_SET_NOREORDER));
list.concat(Taicpu.op_none(A_P_SET_NOMACRO));
// list.concat(taicpu.op_
list.concat(Taicpu.Op_reg_reg_const(A_P_SW, NR_FRAME_POINTER_REG, NR_STACK_POINTER_REG, -LocalSize));
list.concat(Taicpu.Op_reg_reg_const(A_P_SW, NR_R31, NR_STACK_POINTER_REG, -LocalSize + 4));
list.concat(Taicpu.op_reg_reg(A_MOVE, NR_FRAME_POINTER_REG, NR_STACK_POINTER_REG));

View File

@ -175,9 +175,6 @@ unit cpugas;
s := #9 + gas_op2str[A_ADDIU] + #9 + getopstr(taicpu(hp).oper[0]^)+ ',' + getopstr(taicpu(hp).oper[1]^) + ',' + s1;
owner.AsmWriteLn(s);
end;
A_P_FRAME:
begin
end;
A_P_SET_MACRO:
begin
s := #9 + '.set' + #9 + 'macro';

View File

@ -5,7 +5,7 @@
'p_set_nomacro',
'p_set_macro',
'p_set_reorder',
'p_frame',
'.frame',
'p_mask',
'p_fmask',
'p_sw',