+ support for creating and writing LLVM landingpad instructions

git-svn-id: trunk@35161 -
This commit is contained in:
Jonas Maebe 2016-12-18 13:57:42 +00:00
parent 28e5636daa
commit 4b9179636b
4 changed files with 30 additions and 2 deletions

View File

@ -105,6 +105,8 @@ interface
constructor getelementptr_reg_tai_size_const(dst:tregister;const ai:tai;indextype:tdef;index1:ptrint;indirect:boolean);
constructor blockaddress(fun, lab: tasmsymbol);
constructor landingpad(dst:tregister;def:tdef;firstclause:taillvm);
constructor exceptclause(op:tllvmop;def:tdef;kind:TAsmSymbol;nextclause:taillvm);
{ e.g. dst = call retsize name (paras) }
constructor call_size_name_paras(callpd: tdef; dst: tregister;retsize: tdef;name:tasmsymbol;paras: tfplist);
@ -1034,6 +1036,26 @@ uses
end;
constructor taillvm.landingpad(dst: tregister; def: tdef; firstclause: taillvm);
begin
create_llvm(la_landingpad);
ops:=3;
loadreg(0,dst);
loaddef(1,def);
loadtai(2,firstclause);
end;
constructor taillvm.exceptclause(op: tllvmop; def: tdef; kind: TAsmSymbol; nextclause: taillvm);
begin
create_llvm(op);
ops:=3;
loaddef(0,def);
loadsymbol(1,kind,0);
loadtai(2,nextclause);
end;
constructor taillvm.call_size_name_paras(callpd: tdef; dst: tregister; retsize: tdef; name:tasmsymbol; paras: tfplist);
begin
create_llvm(la_call);

View File

@ -575,7 +575,9 @@ implementation
la_store,
la_fence,
la_cmpxchg,
la_atomicrmw:
la_atomicrmw,
la_catch,
la_filter:
begin
{ instructions that never have a result }
end;
@ -684,7 +686,7 @@ implementation
owner.writer.AsmWrite(sep);
owner.writer.AsmWrite(getopstr(taillvm(hp).oper[i]^,op in [la_load,la_store]));
if (taillvm(hp).oper[i]^.typ in [top_def,top_cond,top_fpcond]) or
(op=la_call) then
(op in [la_call,la_landingpad,la_catch,la_filter]) then
sep :=' '
else
sep:=', ';

View File

@ -60,6 +60,8 @@ interface
'blockaddress',
{ fpc pseudo opcodes }
'type', { type definition }
'catch', { catch exception }
'filter', { exception filter }
'invalid1', { la_x_to_inttoptr }
'invalid2', { la_ptrtoint_to_x }
'asm' { la_asmblock }

View File

@ -68,6 +68,8 @@ interface
la_blockaddress,
{ fpc pseudo opcodes }
la_type, { type definition }
la_catch, { catch clause of a landingpad }
la_filter, { filter clause of a landingpad }
la_x_to_inttoptr, { have to convert something first to int before it can be converted to a pointer }
la_ptrtoint_to_x, { have to convert a pointer first to int before it can be converted to something else }
la_asmblock