summaryrefslogtreecommitdiffstats
path: root/docs/ExceptionHandling.rst
diff options
context:
space:
mode:
authorJoseph Tremoulet <jotrem@microsoft.com>2015-08-23 00:26:33 +0000
committerJoseph Tremoulet <jotrem@microsoft.com>2015-08-23 00:26:33 +0000
commitd4a765f88a484e8d91af957bc2c63fe35395f5ac (patch)
tree584bd8dd8689a71548ad5c9127898691a22a346a /docs/ExceptionHandling.rst
parent8647351e06ac5e6f2be850210b47c017fd2e54a0 (diff)
[WinEH] Require token linkage in EH pad/ret signatures
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
Diffstat (limited to 'docs/ExceptionHandling.rst')
-rw-r--r--docs/ExceptionHandling.rst31
1 files changed, 15 insertions, 16 deletions
diff --git a/docs/ExceptionHandling.rst b/docs/ExceptionHandling.rst
index 87465343dfef..fce875b9b8ab 100644
--- a/docs/ExceptionHandling.rst
+++ b/docs/ExceptionHandling.rst
@@ -614,20 +614,19 @@ specifications with one combined instruction. All potentially throwing calls in
a ``noexcept`` function should transitively unwind to a terminateblock. Throw
specifications are not implemented by MSVC, and are not yet supported.
-Each of these new EH pad instructions has a label operand that indicates which
+Each of these new EH pad instructions has a way to identify which
action should be considered after this action. The ``catchpad`` and
-``terminatepad`` instructions are terminators, and this label is considered to
-be an unwind destination analogous to the unwind destination of an invoke. The
+``terminatepad`` instructions are terminators, and have a label operand considered
+to be an unwind destination analogous to the unwind destination of an invoke. The
``cleanuppad`` instruction is different from the other two in that it is not a
-terminator, and this label operand is not an edge in the CFG. The code inside a
-cleanuppad runs before transferring control to the next action, so the
-``cleanupret`` instruction is the instruction that unwinds to the next EH pad.
-All of these "unwind edges" may refer to a basic block that contains an EH pad
-instruction, or they may simply unwind to the caller. Unwinding to the caller
-has roughly the same semantics as the ``resume`` instruction in the
-``landingpad`` model. When inlining through an invoke, instructions that unwind
-to the caller are hooked up to unwind to the unwind destination of the call
-site.
+terminator. The code inside a cleanuppad runs before transferring control to the
+next action, so the ``cleanupret`` instruction is the instruction that holds a
+label operand and unwinds to the next EH pad. All of these "unwind edges" may
+refer to a basic block that contains an EH pad instruction, or they may simply
+unwind to the caller. Unwinding to the caller has roughly the same semantics as
+the ``resume`` instruction in the ``landingpad`` model. When inlining through an
+invoke, instructions that unwind to the caller are hooked up to unwind to the
+unwind destination of the call site.
Putting things together, here is a hypothetical lowering of some C++ that uses
all of the new IR instructions:
@@ -674,17 +673,17 @@ all of the new IR instructions:
; EH scope code, ordered innermost to outermost:
lpad.cleanup: ; preds = %invoke.cont
- cleanuppad [label %lpad.catch]
+ %cleanup = cleanuppad []
call void @"\01??_DCleanup@@QEAA@XZ"(%struct.Cleanup* nonnull %obj) nounwind
- cleanupret unwind label %lpad.catch
+ cleanupret %cleanup unwind label %lpad.catch
lpad.catch: ; preds = %entry, %lpad.cleanup
- catchpad void [%rtti.TypeDescriptor2* @"\01??_R0H@8", i32 0, i32* %e]
+ %catch = catchpad [%rtti.TypeDescriptor2* @"\01??_R0H@8", i32 0, i32* %e]
to label %catch unwind label %lpad.terminate
catch: ; preds = %lpad.catch
%9 = load i32, i32* %e, align 4
- catchret label %return
+ catchret %catch label %return
lpad.terminate:
terminatepad [void ()* @"\01?terminate@@YAXXZ"]