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++ `_ and +`libunwind `_ +to see what have to be done there.