[PATCH] CodeGen support for x86_64 SEH catch handlers in LLVM

Reid Kleckner rnk at google.com
Tue Jan 13 13:21:54 PST 2015


================
Comment at: lib/CodeGen/AsmPrinter/EHStreamer.h:69
@@ -68,1 +68,3 @@
+    // LPad contains the landing pad start labels. There may be more than one.
+    const LandingPadInfo *LPad;  // zero indicates that there is no landing pad.
     unsigned Action;
----------------
majnemer wrote:
> s/zero/null/ ?
Sure.

================
Comment at: lib/CodeGen/AsmPrinter/Win64Exception.cpp:113
@@ +112,3 @@
+      else
+        report_fatal_error("unexpected personality function");
+    } else {
----------------
majnemer wrote:
> It would probably be nice to twine the unexpected personality function's name.
OK

================
Comment at: lib/CodeGen/AsmPrinter/Win64Exception.cpp:143
@@ +142,3 @@
+///     Continue searching this table or continue unwinding.
+///   EXCEPTION_CONTINUE_EXECUTION (1):
+///     Resume execution at the trapping PC.
----------------
majnemer wrote:
> This should be -1, no?
oops

================
Comment at: lib/CodeGen/AsmPrinter/Win64Exception.cpp:188
@@ +187,3 @@
+    for (int TypeID : CSE.LPad->TypeIds)
+      if (TypeID >= 0)
+        ++NumEntries;
----------------
majnemer wrote:
> What special purpose does zero have here?
Zero is the cleanup typeid, negative numbers are for filters. So this skips filters if present. They don't have defined semantics with the SEH personality function.

================
Comment at: lib/CodeGen/AsmPrinter/Win64Exception.cpp:230-231
@@ +229,4 @@
+      MCSymbol *ClauseLabel = LPad->ClauseLabels[I];
+      assert(TypeID >= 0 && "SEH personality functions don't support filter "
+                            "clauses in landing pads");
+
----------------
majnemer wrote:
> Is this an IR invariant?
No. What should we do with these? We can't really implement filters with the SEH personality function.

================
Comment at: lib/CodeGen/AsmPrinter/Win64Exception.cpp:235
@@ +234,3 @@
+      Asm->OutStreamer.EmitValue(End, 4);
+      if (TypeID == 0)
+        Asm->OutStreamer.EmitIntValue(0, 4);
----------------
majnemer wrote:
> What special purpose does zero have here?
typeid zero is always a cleanup. This doesn't actually implement them correctly, though, it creates a catch-all.

================
Comment at: lib/CodeGen/AsmPrinter/Win64Exception.h:19
@@ -18,1 +18,3 @@
 
+#include <vector>
+
----------------
majnemer wrote:
> Is there a reason behind this change?
Removed

http://reviews.llvm.org/D6300

EMAIL PREFERENCES
  http://reviews.llvm.org/settings/panel/emailpreferences/






More information about the llvm-commits mailing list