Bläddra i källkod

* fixed handling of LLVM invoke instruction in the assembler writer and
type inference

git-svn-id: branches/debug_eh@40403 -

Jonas Maebe 6 år sedan
förälder
incheckning
077d7e8551
2 ändrade filer med 14 tillägg och 5 borttagningar
  1. 11 3
      compiler/llvm/agllvm.pas
  2. 3 2
      compiler/llvm/llvmtype.pas

+ 11 - 3
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:=', ';

+ 3 - 2
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);