From f78faf84a85262bf76295dfc5d85e1e7a942a4f2 Mon Sep 17 00:00:00 2001 From: Bill Wendling Date: Tue, 2 Aug 2011 21:52:38 +0000 Subject: Add the documentation for the 'landingpad' instruction. Improve the 'invoke' instruction's documentation to reference the landingpad and resume instructions. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@136729 91177308-0d34-0410-b5e6-96231b3b80d8 --- docs/LangRef.html | 94 ++++++++++++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 90 insertions(+), 4 deletions(-) (limited to 'docs') diff --git a/docs/LangRef.html b/docs/LangRef.html index dce39c5ac3..1c3cc89724 100644 --- a/docs/LangRef.html +++ b/docs/LangRef.html @@ -202,6 +202,7 @@
  • 'select' Instruction
  • 'call' Instruction
  • 'va_arg' Instruction
  • +
  • 'landingpad' Instruction
  • @@ -3256,6 +3257,17 @@ IfUnequal: instruction, control is interrupted and continued at the dynamically nearest "exception" label.

    +

    The 'exception' label is a + landing pad for the + exception. As such, 'exception' label is required to have the + "landingpad" instruction, which contains + the information about about the behavior of the program after unwinding + happens, as its first non-PHI instruction. The restrictions on the + "landingpad" instruction's tightly couples it to the + "invoke" instruction, so that the important information contained + within the "landingpad" instruction can't be lost through normal + code motion.

    +
    Arguments:

    This instruction requires several arguments:

    @@ -3372,17 +3384,18 @@ that the invoke/unwind semantics are likely to change in future versions.

    successors.

    Arguments:
    -

    The 'resume' instruction's argument must have the same type as the - result of any 'landingpad' instruction in the same function.

    +

    The 'resume' instruction requires one argument, which must have the + same type as the result of the 'landingpad' instruction which + interrupted the unwinding.

    Semantics:

    The 'resume' instruction resumes propagation of an existing (in-flight) exception whose unwinding was interrupted with - a landingpad instruction.

    + a landingpad instruction.

    Example:
    - resume { i8*, i32 } %exn
    +  resume { i8*, i32 } %exn
     
    @@ -5970,6 +5983,79 @@ freestanding environments and non-C-based languages.

    + +

    + 'landingpad' Instruction +

    + +
    + +
    Syntax:
    +
    +  <resultval> = landingpad <somety> personality <type> <pers_fn> cleanup? <clause>+
    +  <clause> := catch <type> <value>
    +  <clause> := filter <type> <value>
    +
    + +
    Overview:
    +

    The 'landingpad' instruction is used by + LLVM's exception handling + system to specify that a basic block is a landing pad — one where + the exception lands, and corresponds to the code found in the + catch portion of a try/catch sequence. It + defines values supplied by the personality function (pers_fn) upon + re-entry to the function. The resultval has the + type somety.

    + +
    Arguments:
    +

    This instruction takes a pers_fn value. This is the personality + function associated with the unwinding mechanism. The optional + cleanup flag indicates that the landing pad block is a cleanup.

    + +

    A clause begins with the clause type — catch + or filter — and contains a list of global variables + representing the "types" that may be caught or filtered respectively. The + 'landingpad' instruction must contain at least + one clause or the cleanup flag.

    + +
    Semantics:
    +

    The 'landingpad' instruction defines the values which are set by the + personality function (pers_fn) upon re-entry to the function, and + therefore the "result type" of the landingpad instruction. As with + calling conventions, how the personality function results are represented in + LLVM IR is target specific.

    + +

    The landingpad instruction has several restrictions:

    + + + +
    Example:
    +
    +  ;; A landing pad which can catch an integer.
    +  %res = landingpad { i8*, i32 } personality i32 (...)* @__gxx_personality_v0
    +           catch i8** @_ZTIi
    +  ;; A landing pad that is a cleanup.
    +  %res = landingpad { i8*, i32 } personality i32 (...)* @__gxx_personality_v0
    +           cleanup  
    +  ;; A landing pad which can catch an integer and can only throw a double.
    +  %res = landingpad { i8*, i32 } personality i32 (...)* @__gxx_personality_v0
    +           catch i8** @_ZTIi
    +           filter i8** @_ZTId
    +
    + +
    + -- cgit v1.2.3