[PATCH] D42178: [Doc] Guideline on adding exception handling support for a target

Wei-Ren Chen via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jan 17 06:28:34 PST 2018


chenwj created this revision.
chenwj added reviewers: t.p.northover, theraven, nemanjai.

This is the first attempt to write down a guideline on adding exception handling support for a target. The content basically bases on the discussion on [1]. If you guys know who is exception handling expert, please add him as the reviewer. Thanks.

[1] http://lists.llvm.org/pipermail/llvm-dev/2018-January/120405.html


https://reviews.llvm.org/D42178

Files:
  docs/ExceptionHandling.rst


Index: docs/ExceptionHandling.rst
===================================================================
--- docs/ExceptionHandling.rst
+++ docs/ExceptionHandling.rst
@@ -839,3 +839,32 @@
 Finally, the funclet pads' unwind destinations cannot form a cycle.  This
 ensures that EH lowering can construct "try regions" with a tree-like
 structure, which funclet-based personalities may require.
+
+Exception Handling support on the target
+=================================================
+
+In order to support exception handling on particular target, there are a few
+items need to be implemented.
+
+* CFI directives
+
+  TargetFrameLowering must emit CFI directives in the prologue to build
+  ``.eh_frame`` section. Unwinder uses the information stored in ``.eh_frame``
+  to unwind stack.
+
+* ``getExceptionPointerRegister`` and ``getExceptionSelectorRegister``
+
+  TargetLowering must implement both functions. The *personality function*
+  passes the *exception structure* and *selector value* to the landing pad
+  through the registers specified by ``getExceptionPointerRegister`` and
+  ``getExceptionSelectorRegister`` respectively.
+
+* ``EH_RETURN``
+
+  The ISD node represents ``__builtin_eh_return``. Depends on your target,
+  you might have to handle ``EH_RETURN`` in TargetLowering.
+
+If you don't leverage the existing runtime (``libstdc++`` and ``libgcc``),
+you have to take a look on `libc++ <https://libcxx.llvm.org/>`_ and
+`libunwind <https://clang.llvm.org/docs/Toolchain.html#unwind-library>`_
+to see what have to be done there.


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D42178.130166.patch
Type: text/x-patch
Size: 1558 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180117/93b342ba/attachment.bin>


More information about the llvm-commits mailing list