aboutsummaryrefslogtreecommitdiff
path: root/llvm/docs/ExceptionHandling.rst
AgeCommit message (Collapse)AuthorFilesLines
2016-07-20[docs] Fixing Sphinx warnings to unclog the buildbotRenato Golin1-4/+4
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. llvm-svn: 276109
2016-01-10[WinEH] Disallow cyclic unwindsJoseph Tremoulet1-0/+4
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 llvm-svn: 257274
2016-01-10[WinEH] Verify consistent funclet unwind exitsJoseph Tremoulet1-0/+17
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 llvm-svn: 257273
2016-01-10[WinEH] Verify unwind edges against EH pad treeJoseph Tremoulet1-0/+43
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 llvm-svn: 257272
2015-12-14[IR] Remove terminatepadDavid Majnemer1-12/+9
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 llvm-svn: 255522
2015-12-12Try to appease sphinxDavid Majnemer1-0/+1
llvm-svn: 255429
2015-12-12[IR] Reformulate LLVM's EH funclet IRDavid Majnemer1-49/+102
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 llvm-svn: 255422
2015-09-08[docs] Fix typo in catchret exampleVedant Kumar1-1/+1
An example usage of catchret omitted the "to" in "to label" in ExceptionHandling.rst. llvm-svn: 247086
2015-09-08[docs] Update documentation for the landingpad instructionVedant Kumar1-5/+5
llvm-svn: 247062
2015-09-03[Docs] Fix Sphinx warningJoseph Tremoulet1-1/+1
Title underline was too short. llvm-svn: 246754
2015-09-03[WinEH] Add llvm.eh.exceptionpointer intrinsicJoseph Tremoulet1-0/+14
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 llvm-svn: 246752
2015-09-03[WinEH] Add cleanupendpad instructionJoseph Tremoulet1-11/+32
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 llvm-svn: 246751
2015-08-23[WinEH] Require token linkage in EH pad/ret signaturesJoseph Tremoulet1-16/+15
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 llvm-svn: 245797
2015-08-06[WinEH] Add documentation motivating the new EH instructionsReid Kleckner1-150/+205
This adds documentation on how to use the new EH instructions added in r243766. Reviewers: majnemer, reames Differential Revision: http://reviews.llvm.org/D11565 llvm-svn: 244267
2015-07-07Rename llvm.frameescape and llvm.framerecover to localescape and localrecoverReid Kleckner1-6/+6
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 llvm-svn: 241633
2015-04-03[WinEH] Sink UnwindHelp completely out of IRDavid Majnemer1-12/+0
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. llvm-svn: 234061
2015-04-02[WinEH] Make llvm.eh.actions use frameescape indices for catch paramsReid Kleckner1-12/+16
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; } llvm-svn: 233947
2015-03-31[WinEH] Generate .xdata for catch handlersDavid Majnemer1-11/+0
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. llvm-svn: 233767
2015-03-30Fix Sphinx warning " Title underline too short.".Rafael Espindola1-1/+1
llvm-svn: 233551
2015-03-27WinEH: Create a parent frame alloca for HandlerType xdata tablesDavid Majnemer1-0/+11
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. llvm-svn: 233354
2015-03-25WinEH: Create an unwind help alloca for __CxxFrameHandler3 xdata tablesReid Kleckner1-0/+12
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. llvm-svn: 233209
2015-03-12Make llvm.eh.actions an intrinsic and add docs for itReid Kleckner1-0/+41
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. llvm-svn: 232003
2015-03-03Make llvm.eh.begincatch use an outparamReid Kleckner1-6/+6
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 llvm-svn: 231086
2015-02-26Try to fix a docs link.Nico Weber1-3/+3
llvm-svn: 230672
2015-02-23Try to fix reST markup for an external link.Nico Weber1-1/+1
llvm-svn: 230200
2015-02-10fix docs typoNico Weber1-1/+1
llvm-svn: 228741
2015-02-10Adding support for llvm.eh.begincatch and llvm.eh.endcatch intrinsics and ↵Andrew Kaylor1-0/+170
beginning the documentation of native Windows exception handling. Differential Revision: http://reviews.llvm.org/D7398 llvm-svn: 228733
2014-03-28Exception handling docs: Clarify how the llvm.eh.* intrinsics are usedMark Seaborn1-4/+13
The non-SJLJ and SJLJ intrinsics are generated by the frontend and backend respectively. Differential Revision: http://llvm-reviews.chandlerc.com/D3010 llvm-svn: 205017
2014-02-27Exception handling docs: Fix a typoMark Seaborn1-1/+1
llvm-svn: 202354
2014-02-25Exception handling docs: Describe landingpad clauses' meanings in more detailMark Seaborn1-6/+55
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. llvm-svn: 202209
2013-01-13Documentation: use monospaced font for intrinsics' namesDmitri Gribenko1-10/+10
llvm-svn: 172360
2013-01-13Fix broken link to LangRefDmitri Gribenko1-11/+10
llvm-svn: 172359
2013-01-12Use more canonical exception-handling link in docs.Tim Northover1-1/+1
llvm-svn: 172325
2013-01-12Fix broken links around Itanium C++ ABI in documentation.Tim Northover1-3/+3
llvm-svn: 172312
2013-01-11docs: Fix long standing linking antipattern.Sean Silva1-2/+0
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. llvm-svn: 172162
2012-06-27Sphinxify the exception handling doc.Bill Wendling1-0/+367
llvm-svn: 159254