* use j.l in external wrappers, this is not save yet as A15 might contain

an argument: externals need to be called with call4 if they use all
    parameter registers, this needs to be implemented

git-svn-id: trunk@44837 -
This commit is contained in:
florian 2020-04-19 07:37:45 +00:00
parent a49a776307
commit 2edec13a0f
4 changed files with 20 additions and 2 deletions

View File

@ -78,6 +78,7 @@ uses
constructor op_sym(op : tasmop;_op1 : tasmsymbol);
constructor op_sym_ofs(op : tasmop;_op1 : tasmsymbol;_op1ofs:aint);
constructor op_reg_sym(op : tasmop;_op1 : tregister;_op2:tasmsymbol);
constructor op_sym_reg(op: tasmop; _op1: tasmsymbol; _op2: tregister);
constructor op_reg_const_sym(op : tasmop;_op1 : tregister;_op2:aint;_op3:tasmsymbol);
constructor op_reg_reg_sym(op : tasmop;_op1, _op2 : tregister;_op3:tasmsymbol);
constructor op_reg_sym_ofs(op : tasmop;_op1 : tregister;_op2:tasmsymbol;_op2ofs : aint);
@ -369,6 +370,14 @@ uses cutils, cclasses;
loadsymbol(1,_op2,0);
end;
constructor taicpu.op_sym_reg(op: tasmop; _op1: tasmsymbol; _op2: tregister);
begin
inherited create(op);
ops:=2;
loadsymbol(0,_op1,0);
loadreg(1,_op2);
end;
constructor taicpu.op_reg_const_sym(op: tasmop; _op1: tregister; _op2: aint; _op3: tasmsymbol);
begin
inherited create(op);

View File

@ -573,8 +573,10 @@ implementation
procedure tcgcpu.a_jmp_name(list : TAsmList; const s : string);
var
ai : taicpu;
tmpreg: TRegister;
begin
ai:=TAiCpu.op_sym(A_J,current_asmdata.RefAsmSymbol(s,AT_FUNCTION));
{ for now, we use A15 here, however, this is not save as it might contain an argument }
ai:=TAiCpu.op_sym_reg(A_J_L,current_asmdata.RefAsmSymbol(s,AT_FUNCTION),NR_A15);
ai.is_jmp:=true;
list.Concat(ai);
end;
@ -811,7 +813,12 @@ implementation
var
ai : taicpu;
begin
ai:=taicpu.op_sym(A_J,l);
if l.bind in [AB_GLOBAL] then
{ for now, we use A15 here, however, this is not save as it might contain an argument, I have not figured out a
solution yet }
ai:=taicpu.op_sym_reg(A_J_L,l,NR_A15)
else
ai:=taicpu.op_sym(A_J,l);
ai.is_jmp:=true;
list.concat(ai);
end;

View File

@ -26,6 +26,7 @@
'l32r',
'lsi',
'j',
'j.l',
'mov',
'mov.s',
'movnez',

View File

@ -26,6 +26,7 @@ A_L32I,
A_L32R,
A_LSI,
A_J,
A_J_L,
A_MOV,
A_MOV_S,
A_MOVNEZ,