summaryrefslogtreecommitdiff
path: root/docs/ExceptionHandling.rst
AgeCommit message (Collapse)Author
2017-09-12Fix broken links to the Itanium CXX ABIVlad Tsyrklevich
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@312985 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-20[docs] Fixing Sphinx warnings to unclog the buildbotRenato Golin
Lots of blocks had "llvm" or "nasm" syntax types but either weren't following the syntax, or the syntax has changed (and sphinx hasn't keep up) or the type doesn't even exist (nasm?). Other documents had :options: what were invalid. I only removed those that had warnings, and left the ones that didn't, in order to follow the principle of least surprise. This is like this for ages, but the buildbot is now failing on errors. It may take a while to upgrade the buildbot's sphinx, if that's even possible, but that shouldn't stop us from getting docs updates (which seem down for quite a while). Also, we're not losing any syntax highlight, since when it doesn't parse, it doesn't colour. Ie. those blocks are not being highlighted anyway. I'm trying to get all docs in one go, so that it's easy to revert later if we do fix, or at least easy to know what's to fix. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@276109 91177308-0d34-0410-b5e6-96231b3b80d8
2016-01-10[WinEH] Disallow cyclic unwindsJoseph Tremoulet
Summary: Funclet-based EH personalities/tables likely can't handle these, and they can't be generated at source, so make them officially illegal in IR as well. Reviewers: andrew.w.kaylor, rnk, majnemer Subscribers: llvm-commits Differential Revision: http://reviews.llvm.org/D15963 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@257274 91177308-0d34-0410-b5e6-96231b3b80d8
2016-01-10[WinEH] Verify consistent funclet unwind exitsJoseph Tremoulet
Summary: A funclet EH pad may be exited by an unwind edge, which may be a cleanupret exiting its cleanuppad, an invoke exiting a funclet, or an unwind out of a nested funclet transitively exiting its parent. Funclet EH personalities require all such exceptional exits from a given funclet to have the same unwind destination, and EH preparation / state numbering / table generation implicitly depends on this. Formalize it as a rule of the IR in the LangRef and verifier. Reviewers: rnk, majnemer, andrew.w.kaylor Subscribers: llvm-commits Differential Revision: http://reviews.llvm.org/D15962 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@257273 91177308-0d34-0410-b5e6-96231b3b80d8
2016-01-10[WinEH] Verify unwind edges against EH pad treeJoseph Tremoulet
Summary: Funclet EH personalities require a tree-like nesting among funclets (enforced by the ParentPad linkage in the IR), and also require that unwind edges conform to certain rules with respect to the tree: - An unwind edge may exit 0 or more ancestor pads - An unwind edge must enter exactly one EH pad, which must be distinct from any exited pads - A cleanupret's edge must exit its cleanuppad Describe these rules in the LangRef, and enforce them in the verifier. Reviewers: rnk, majnemer, andrew.w.kaylor Subscribers: llvm-commits Differential Revision: http://reviews.llvm.org/D15961 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@257272 91177308-0d34-0410-b5e6-96231b3b80d8
2015-12-14[IR] Remove terminatepadDavid Majnemer
It turns out that terminatepad gives little benefit over a cleanuppad which calls the termination function. This is not sufficient to implement fully generic filters but MSVC doesn't support them which makes terminatepad a little over-designed. Depends on D15478. Differential Revision: http://reviews.llvm.org/D15479 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@255522 91177308-0d34-0410-b5e6-96231b3b80d8
2015-12-12Try to appease sphinxDavid Majnemer
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@255429 91177308-0d34-0410-b5e6-96231b3b80d8
2015-12-12[IR] Reformulate LLVM's EH funclet IRDavid Majnemer
While we have successfully implemented a funclet-oriented EH scheme on top of LLVM IR, our scheme has some notable deficiencies: - catchendpad and cleanupendpad are necessary in the current design but they are difficult to explain to others, even to seasoned LLVM experts. - catchendpad and cleanupendpad are optimization barriers. They cannot be split and force all potentially throwing call-sites to be invokes. This has a noticable effect on the quality of our code generation. - catchpad, while similar in some aspects to invoke, is fairly awkward. It is unsplittable, starts a funclet, and has control flow to other funclets. - The nesting relationship between funclets is currently a property of control flow edges. Because of this, we are forced to carefully analyze the flow graph to see if there might potentially exist illegal nesting among funclets. While we have logic to clone funclets when they are illegally nested, it would be nicer if we had a representation which forbade them upfront. Let's clean this up a bit by doing the following: - Instead, make catchpad more like cleanuppad and landingpad: no control flow, just a bunch of simple operands; catchpad would be splittable. - Introduce catchswitch, a control flow instruction designed to model the constraints of funclet oriented EH. - Make funclet scoping explicit by having funclet instructions consume the token produced by the funclet which contains them. - Remove catchendpad and cleanupendpad. Their presence can be inferred implicitly using coloring information. N.B. The state numbering code for the CLR has been updated but the veracity of it's output cannot be spoken for. An expert should take a look to make sure the results are reasonable. Reviewers: rnk, JosephTremoulet, andrew.w.kaylor Differential Revision: http://reviews.llvm.org/D15139 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@255422 91177308-0d34-0410-b5e6-96231b3b80d8
2015-09-08[docs] Fix typo in catchret exampleVedant Kumar
An example usage of catchret omitted the "to" in "to label" in ExceptionHandling.rst. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@247086 91177308-0d34-0410-b5e6-96231b3b80d8
2015-09-08[docs] Update documentation for the landingpad instructionVedant Kumar
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@247062 91177308-0d34-0410-b5e6-96231b3b80d8
2015-09-03[Docs] Fix Sphinx warningJoseph Tremoulet
Title underline was too short. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@246754 91177308-0d34-0410-b5e6-96231b3b80d8
2015-09-03[WinEH] Add llvm.eh.exceptionpointer intrinsicJoseph Tremoulet
Summary: This intrinsic can be used to extract a pointer to the exception caught by a given catchpad. Its argument has token type and must be a `catchpad`. Also clarify ExtendingLLVM documentation regarding overloaded intrinsics. Reviewers: majnemer, andrew.w.kaylor, sanjoy, rnk Subscribers: llvm-commits Differential Revision: http://reviews.llvm.org/D12533 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@246752 91177308-0d34-0410-b5e6-96231b3b80d8
2015-09-03[WinEH] Add cleanupendpad instructionJoseph Tremoulet
Summary: Add a `cleanupendpad` instruction, used to mark exceptional exits out of cleanups (for languages/targets that can abort a cleanup with another exception). The `cleanupendpad` instruction is similar to the `catchendpad` instruction in that it is an EH pad which is the target of unwind edges in the handler and which itself has an unwind edge to the next EH action. The `cleanupendpad` instruction, similar to `cleanupret` has a `cleanuppad` argument indicating which cleanup it exits. The unwind successors of a `cleanuppad`'s `cleanupendpad`s must agree with each other and with its `cleanupret`s. Update WinEHPrepare (and docs/tests) to accomodate `cleanupendpad`. Reviewers: rnk, andrew.w.kaylor, majnemer Subscribers: llvm-commits Differential Revision: http://reviews.llvm.org/D12433 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@246751 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-23[WinEH] Require token linkage in EH pad/ret signaturesJoseph Tremoulet
Summary: WinEHPrepare is going to require that cleanuppad and catchpad produce values of token type which are consumed by any cleanupret or catchret exiting the pad. This change updates the signatures of those operators to require/enforce that the type produced by the pads is token type and that the rets have an appropriate argument. The catchpad argument of a `CatchReturnInst` must be a `CatchPadInst` (and similarly for `CleanupReturnInst`/`CleanupPadInst`). To accommodate that restriction, this change adds a notion of an operator constraint to both LLParser and BitcodeReader, allowing appropriate sentinels to be constructed for forward references and appropriate error messages to be emitted for illegal inputs. Also add a verifier rule (noted in LangRef) that a catchpad with a catchpad predecessor must have no other predecessors; this ensures that WinEHPrepare will see the expected linear relationship between sibling catches on the same try. Lastly, remove some superfluous/vestigial casts from instruction operand setters operating on BasicBlocks. Reviewers: rnk, majnemer Subscribers: llvm-commits Differential Revision: http://reviews.llvm.org/D12108 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@245797 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-06[WinEH] Add documentation motivating the new EH instructionsReid Kleckner
This adds documentation on how to use the new EH instructions added in r243766. Reviewers: majnemer, reames Differential Revision: http://reviews.llvm.org/D11565 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@244267 91177308-0d34-0410-b5e6-96231b3b80d8
2015-07-07Rename llvm.frameescape and llvm.framerecover to localescape and localrecoverReid Kleckner
Summary: Initially, these intrinsics seemed like part of a family of "frame" related intrinsics, but now I think that's more confusing than helpful. Initially, the LangRef specified that this would create a new kind of allocation that would be allocated at a fixed offset from the frame pointer (EBP/RBP). We ended up dropping that design, and leaving the stack frame layout alone. These intrinsics are really about sharing local stack allocations, not frame pointers. I intend to go further and add an `llvm.localaddress()` intrinsic that returns whatever register (EBP, ESI, ESP, RBX) is being used to address locals, which should not be confused with the frame pointer. Naming suggestions at this point are welcome, I'm happy to re-run sed. Reviewers: majnemer, nicholas Subscribers: llvm-commits Differential Revision: http://reviews.llvm.org/D11011 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@241633 91177308-0d34-0410-b5e6-96231b3b80d8
2015-04-03[WinEH] Sink UnwindHelp completely out of IRDavid Majnemer
We don't need to represent UnwindHelp in IR. Instead, we can use the knowledge that we are emitting the parent function to decide if we should create the UnwindHelp stack object. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@234061 91177308-0d34-0410-b5e6-96231b3b80d8
2015-04-02[WinEH] Make llvm.eh.actions use frameescape indices for catch paramsReid Kleckner
This makes it possible to use the same representation of llvm.eh.actions in outlined handlers as we use in the parent function because i32's are just constants that can be copied freely between functions. I had to add a sentinel alloca to the list of child allocas so that we don't try to sink the catch object into the handler. Normally, one would use nullptr for this kind of thing, but TinyPtrVector doesn't support null elements. More than that, it's elements have to have a suitable alignment. Therefore, I settled on this for my sentinel: AllocaInst *getCatchObjectSentinel() { return static_cast<AllocaInst *>(nullptr) + 1; } git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@233947 91177308-0d34-0410-b5e6-96231b3b80d8
2015-03-31[WinEH] Generate .xdata for catch handlersDavid Majnemer
This lets us catch exceptions in simple cases. N.B. Things that do not work include (but are not limited to): - Throwing from within a catch handler. - Catching an object with a named catch parameter. - 'CatchHigh' is fictitious, we aren't sure of its purpose. - We aren't entirely efficient with regards to the number of EH states that we generate. - IP-to-State tables are sensitive to the order of emission. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@233767 91177308-0d34-0410-b5e6-96231b3b80d8
2015-03-30Fix Sphinx warning " Title underline too short.".Rafael Espindola
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@233551 91177308-0d34-0410-b5e6-96231b3b80d8
2015-03-27WinEH: Create a parent frame alloca for HandlerType xdata tablesDavid Majnemer
We don't have any logic to emit those tables yet, so the SDAG lowering of this intrinsic is just a stub. We can see the intrinsic in the prepared IR, though. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@233354 91177308-0d34-0410-b5e6-96231b3b80d8
2015-03-25WinEH: Create an unwind help alloca for __CxxFrameHandler3 xdata tablesReid Kleckner
We don't have any logic to emit those tables yet, so the sdag lowering of this intrinsic is just a stub. We can see the intrinsic in the prepared IR, though. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@233209 91177308-0d34-0410-b5e6-96231b3b80d8
2015-03-12Make llvm.eh.actions an intrinsic and add docs for itReid Kleckner
These docs *don't* match the way WinEHPrepare uses them yet, and verifier support isn't implemented either. The implementation will come after the documentation text is reviewed and agreed upon. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@232003 91177308-0d34-0410-b5e6-96231b3b80d8
2015-03-03Make llvm.eh.begincatch use an outparamReid Kleckner
Ultimately, __CxxFrameHandler3 needs us to put a stack offset in a table, and it will take responsibility for copying the exception object into that slot. Modelling the exception object as an SSA value returned by begincatch isn't going to work in general, so make it use an output parameter. Reviewers: andrew.w.kaylor Differential Revision: http://reviews.llvm.org/D7920 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@231086 91177308-0d34-0410-b5e6-96231b3b80d8
2015-02-26Try to fix a docs link.Nico Weber
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@230672 91177308-0d34-0410-b5e6-96231b3b80d8
2015-02-23Try to fix reST markup for an external link.Nico Weber
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@230200 91177308-0d34-0410-b5e6-96231b3b80d8
2015-02-10fix docs typoNico Weber
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@228741 91177308-0d34-0410-b5e6-96231b3b80d8
2015-02-10Adding support for llvm.eh.begincatch and llvm.eh.endcatch intrinsics and ↵Andrew Kaylor
beginning the documentation of native Windows exception handling. Differential Revision: http://reviews.llvm.org/D7398 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@228733 91177308-0d34-0410-b5e6-96231b3b80d8
2014-03-28Exception handling docs: Clarify how the llvm.eh.* intrinsics are usedMark Seaborn
The non-SJLJ and SJLJ intrinsics are generated by the frontend and backend respectively. Differential Revision: http://llvm-reviews.chandlerc.com/D3010 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@205017 91177308-0d34-0410-b5e6-96231b3b80d8
2014-02-27Exception handling docs: Fix a typoMark Seaborn
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@202354 91177308-0d34-0410-b5e6-96231b3b80d8
2014-02-25Exception handling docs: Describe landingpad clauses' meanings in more detailMark Seaborn
The original text is very terse, so I've expanded on it. Specifically, in the original text: * "The selector value is a positive number if the exception matched a type info" -- It wasn't clear that this meant "if the exception matched a 'catch' clause". * "If nothing is matched, the behavior of the program is `undefined`_." -- It's actually implementation-defined in C++ rather than undefined, as the new text explains. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@202209 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-13Documentation: use monospaced font for intrinsics' namesDmitri Gribenko
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@172360 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-13Fix broken link to LangRefDmitri Gribenko
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@172359 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-12Use more canonical exception-handling link in docs.Tim Northover
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@172325 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-12Fix broken links around Itanium C++ ABI in documentation.Tim Northover
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@172312 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-11docs: Fix long standing linking antipattern.Sean Silva
Before we learned about :doc:, we used :ref: and put a dummy link at the top of each page. Don't do that anymore. This fixes PR14891 as a special case. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@172162 91177308-0d34-0410-b5e6-96231b3b80d8
2012-06-27Sphinxify the exception handling doc.Bill Wendling
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@159254 91177308-0d34-0410-b5e6-96231b3b80d8