From 857755c2a57562e050f11d84ff1658c6175ed813 Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Mon, 20 Jul 2009 05:55:19 +0000 Subject: [PATCH] document llvm.used and llvm.metadata. Stub out llvm.global_[cd]tors git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@76396 91177308-0d34-0410-b5e6-96231b3b80d8 --- docs/LangRef.html | 79 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 79 insertions(+) diff --git a/docs/LangRef.html b/docs/LangRef.html index 84a1012ca75..910fc5c6514 100644 --- a/docs/LangRef.html +++ b/docs/LangRef.html @@ -91,6 +91,15 @@
  • Inline Assembler Expressions
  • +
  • Intrinsic Global Variables +
      +
    1. The 'llvm.used' Global Variable
    2. +
    3. The 'llvm.global_ctors' + Global Variable
    4. +
    5. The 'llvm.global_dtors' + Global Variable
    6. +
    +
  • Instruction Reference
    1. Terminator Instructions @@ -2150,6 +2159,76 @@ call void asm sideeffect "eieio", ""() + + + + + +

      LLVM has a number of "magic" global variables that contain data that affect +code generation or other IR semantics. These are documented here. All globals +of this sort should have a section specified as "llvm.metadata". This section +and all globals that start with "llvm." are reserved for LLVM.

      + + + + +
      + +

      The @llvm.used global is an array with i8* element type which has appending linkage. This array contains a list of +pointers to global variables and functions which may optionally have a pointer +cast formed of bitcast or getelementptr. For example, a legal use of it is:

      + +
      +  @X = global i8 4
      +  @Y = global i32 123
      +
      +  @llvm.used = appending global [2 x i8*] [
      +     i8* @X,
      +     i8* bitcast (i32* @Y to i8*)
      +  ], section "llvm.metadata"
      +
      + +

      If a global variable appears in the @llvm.used list, then the +compiler, assembler, and linker are required to treat the symbol as if there is +a reference to the global that it cannot see. For example, if a variable has +internal linkage and no references other than that from the @llvm.used +list, it cannot be deleted. This is commonly used to represent references from +inline asms and other things the compiler cannot "see", and corresponds to +"attribute((used))" in GNU C.

      + +

      On some targets, the code generator must emit a directive to the assembler or +object file to prevent the assembler and linker from molesting the symbol.

      + +
      + + + + +
      + +

      TODO: Describe this.

      + +
      + + + + +
      + +

      TODO: Describe this.

      + +
      + + -- 2.34.1