* moved llvm-specific code from aasmtai to aasmllvm

* call add_reg_instruction_hook() for top_para parameters

git-svn-id: trunk@30423 -
This commit is contained in:
Jonas Maebe 2015-04-04 14:28:57 +00:00
parent 2ef753faae
commit 3279cc052a
2 changed files with 54 additions and 8 deletions

View File

@ -781,8 +781,8 @@ interface
procedure loadlocal(opidx:longint;s:pointer;sofs:longint;indexreg:tregister;scale:byte;getoffset,forceref:boolean); procedure loadlocal(opidx:longint;s:pointer;sofs:longint;indexreg:tregister;scale:byte;getoffset,forceref:boolean);
procedure loadref(opidx:longint;const r:treference); procedure loadref(opidx:longint;const r:treference);
procedure loadreg(opidx:longint;r:tregister); procedure loadreg(opidx:longint;r:tregister);
procedure loadoper(opidx:longint;o:toper); procedure loadoper(opidx:longint;o:toper); virtual;
procedure clearop(opidx:longint); procedure clearop(opidx:longint); virtual;
procedure freeop(opidx:longint); procedure freeop(opidx:longint);
{ register allocator } { register allocator }
function is_same_reg_move(regtype: Tregistertype):boolean;virtual; function is_same_reg_move(regtype: Tregistertype):boolean;virtual;
@ -2701,12 +2701,6 @@ implementation
top_wstring: top_wstring:
donewidestring(pwstrval); donewidestring(pwstrval);
{$endif jvm} {$endif jvm}
{$ifdef llvm}
top_para:
paras.free;
top_tai:
ai.free;
{$endif llvm}
end; end;
typ:=top_none; typ:=top_none;
end; end;

View File

@ -106,6 +106,8 @@ interface
{ e.g. dst = call retsize reg (paras) } { e.g. dst = call retsize reg (paras) }
constructor call_size_reg_paras(dst: tregister;retsize: tdef;reg:tregister;paras: tfplist); constructor call_size_reg_paras(dst: tregister;retsize: tdef;reg:tregister;paras: tfplist);
procedure loadoper(opidx: longint; o: toper); override;
procedure clearop(opidx: longint); override;
procedure loadtai(opidx: longint; _ai: tai); procedure loadtai(opidx: longint; _ai: tai);
procedure loaddef(opidx: longint; _def: tdef); procedure loaddef(opidx: longint; _def: tdef);
procedure loadsingle(opidx: longint; _sval: single); procedure loadsingle(opidx: longint; _sval: single);
@ -252,6 +254,46 @@ uses
end; end;
procedure taillvm.loadoper(opidx: longint; o: toper);
var
i: longint;
callpara: pllvmcallpara;
begin
inherited;
if o.typ=top_para then
begin
oper[opidx]^.paras:=tfplist.create;
for i:=0 to o.paras.count-1 do
begin
new(callpara);
callpara^:=pllvmcallpara(o.paras[i])^;
oper[opidx]^.paras.add(callpara);
if (callpara^.loc in [LOC_REGISTER,LOC_FPUREGISTER,LOC_MMREGISTER]) and
assigned(add_reg_instruction_hook) then
add_reg_instruction_hook(self,callpara^.reg);
end;
end;
end;
procedure taillvm.clearop(opidx: longint);
var
i: longint;
begin
case oper[opidx]^.typ of
top_para:
begin
for i:=0 to oper[opidx]^.paras.count-1 do
dispose(pllvmcallpara(oper[opidx]^.paras[i]));
oper[opidx]^.paras.free;
end;
top_tai:
oper[opidx]^.ai.free;
end;
inherited;
end;
procedure taillvm.loadtai(opidx: longint; _ai: tai); procedure taillvm.loadtai(opidx: longint; _ai: tai);
begin begin
allocate_oper(opidx+1); allocate_oper(opidx+1);
@ -345,12 +387,22 @@ uses
procedure taillvm.loadparas(opidx: longint; _paras: tfplist); procedure taillvm.loadparas(opidx: longint; _paras: tfplist);
var
callpara: pllvmcallpara;
i: longint;
begin begin
allocate_oper(opidx+1); allocate_oper(opidx+1);
with oper[opidx]^ do with oper[opidx]^ do
begin begin
clearop(opidx); clearop(opidx);
paras:=_paras; paras:=_paras;
for i:=0 to _paras.count-1 do
begin
callpara:=pllvmcallpara(_paras[i]);
if (callpara^.loc in [LOC_REGISTER,LOC_FPUREGISTER,LOC_MMREGISTER]) and
assigned(add_reg_instruction_hook) then
add_reg_instruction_hook(self,callpara^.reg);
end;
typ:=top_para; typ:=top_para;
end; end;
end; end;