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.

      + +
      + +