From 5a9007a58b7ab063402b98124fb160530ddaf2dc Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Thu, 28 Aug 2003 22:12:25 +0000 Subject: [PATCH] Document the llvm.unwind intrinsic. Clarify the documentation for the invoke instruction llvm-svn: 8196 --- docs/LangRef.html | 64 ++++++++++++++++++++++++++++++++++------------- 1 file changed, 46 insertions(+), 18 deletions(-) diff --git a/docs/LangRef.html b/docs/LangRef.html index 79cb30eaeba..4b5b9c2cab0 100644 --- a/docs/LangRef.html +++ b/docs/LangRef.html @@ -81,6 +81,7 @@
  • 'llvm.va_start' Intrinsic
  • 'llvm.va_end' Intrinsic
  • 'llvm.va_copy' Intrinsic +
  • 'llvm.unwind' Intrinsic @@ -741,13 +742,14 @@ conditional branches, or with a lookup table.

    Overview:
    -The 'invoke' instruction is used to cause control flow to transfer to a -specified function, with the possibility of control flow transfer to either the -'normal label' label or the 'exception label'. The 'call' instruction is closely related, but guarantees -that control flow either never returns from the called function, or that it -returns to the instruction following the 'call' -instruction.

    +The 'invoke' instruction causes control to transfer to a specified +function, with the possibility of control flow transfer to either the +'normal label' label or the 'exception label'. If the callee +function invokes the "ret" instruction, control +flow will return to the "normal" label. If the callee (or any indirect callees) +calls the "llvm.unwind" intrinsic, control is +interrupted, and continued at the "except" label.

    +

    Arguments:
    @@ -757,7 +759,7 @@ This instruction requires several arguments:

  • 'ptr to function ty': shall be the signature of the pointer to function value being invoked. In most cases, this is a direct function invocation, but indirect invokes are just as possible, branching off -an arbitrary pointer to function value.

    +an arbitrary pointer to function value.

  • 'function ptr val': An LLVM value containing a pointer to a function to be invoked. @@ -769,26 +771,26 @@ accepts a variable number of arguments, the extra arguments can be specified.
  • 'normal label': the label reached when the called function executes a 'ret' instruction. -
  • 'exception label': the label reached when an exception is thrown. +
  • 'exception label': the label reached when a callee calls the llvm.unwind intrinsic.
    Semantics:
    This instruction is designed to operate as a standard 'call' instruction in most regards. The primary -difference is that it associates a label with the function invocation that may -be accessed via the runtime library provided by the execution environment. This -instruction is used in languages with destructors to ensure that proper cleanup -is performed in the case of either a longjmp or a thrown exception. -Additionally, this is important for implementation of 'catch' clauses -in high-level languages that support them.

    +difference is that it establishes an association with a label, which is used by the runtime library to unwind the stack.

    - +This instruction is used in languages with destructors to ensure that proper +cleanup is performed in the case of either a longjmp or a thrown +exception. Additionally, this is important for implementation of +'catch' clauses in high-level languages that support them.

    Example:
       %retval = invoke int %Test(int 15)
    -              to label %Continue except label %TestCleanup     ; {int}:retval set
    +              to label %Continue
    +              except label %TestCleanup     ; {int}:retval set
     
    @@ -1801,6 +1803,32 @@ because the llvm.va_begin intrinsic may be arbitrarily complex and require memory allocation, for example.

    + +


    'llvm.unwind' Intrinsic

    @@ -1811,7 +1839,7 @@ arbitrarily complex and require memory allocation, for example.

    Chris Lattner
    -Last modified: Mon Jul 14 12:12:22 CDT 2003 +Last modified: Thu Aug 28 17:11:50 CDT 2003