From 077d7e85519b4ac1c53bc8de0825da65e44d7425 Mon Sep 17 00:00:00 2001 From: Jonas Maebe Date: Thu, 29 Nov 2018 21:30:53 +0000 Subject: [PATCH] * fixed handling of LLVM invoke instruction in the assembler writer and type inference git-svn-id: branches/debug_eh@40403 - --- compiler/llvm/agllvm.pas | 14 +++++++++++--- compiler/llvm/llvmtype.pas | 5 +++-- 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/compiler/llvm/agllvm.pas b/compiler/llvm/agllvm.pas index 99ad694925..149a389ac3 100644 --- a/compiler/llvm/agllvm.pas +++ b/compiler/llvm/agllvm.pas @@ -570,7 +570,7 @@ implementation end end; la_ret, la_br, la_switch, la_indirectbr, - la_invoke, la_resume, + la_resume, la_unreachable, la_store, la_fence, @@ -581,7 +581,8 @@ implementation begin { instructions that never have a result } end; - la_call: + la_call, + la_invoke: begin if taillvm(hp).oper[1]^.reg<>NR_NO then owner.writer.AsmWrite(getregisterstring(taillvm(hp).oper[1]^.reg)+' = '); @@ -684,9 +685,16 @@ implementation for i:=opstart to taillvm(hp).ops-1 do begin owner.writer.AsmWrite(sep); + { special invoke interjections: "to label X unwind label Y" } + if (op=la_invoke) then + case i of + 5: owner.writer.AsmWrite('to '); + 6: owner.writer.AsmWrite('unwind '); + end; + 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 in [la_call,la_landingpad,la_catch,la_filter]) then + (op in [la_call,la_invoke,la_landingpad,la_catch,la_filter]) then sep :=' ' else sep:=', '; diff --git a/compiler/llvm/llvmtype.pas b/compiler/llvm/llvmtype.pas index cab46a9852..77e6db23f1 100644 --- a/compiler/llvm/llvmtype.pas +++ b/compiler/llvm/llvmtype.pas @@ -196,7 +196,7 @@ implementation (p.oper[opidx]^.ref^.symbol.bind<>AB_TEMP) then begin if (opidx=3) and - (p.llvmopcode=la_call) then + (p.llvmopcode in [la_call,la_invoke]) then record_asmsym_def(p.oper[opidx]^.ref^.symbol,tpointerdef(p.oper[2]^.def).pointeddef,false) { not a named register } else if (p.oper[opidx]^.ref^.refaddr<>addr_full) then @@ -288,7 +288,8 @@ implementation i: longint; begin case p.llvmopcode of - la_call: + la_call, + la_invoke: if p.oper[3]^.typ=top_ref then begin maybe_insert_extern_sym_decl(toplevellist,p.oper[3]^.ref^.symbol,tpointerdef(p.oper[2]^.def).pointeddef);