X-Git-Url: http://demsky.eecs.uci.edu/git/?a=blobdiff_plain;f=docs%2FLangRef.html;h=95b89fcc4e5105f0a27cdbcbf0f5c9ab1d8668bf;hb=424641ef83fbb99640d3e2758148a9d3ea2b3830;hp=5bf06851e6e4bd44efc620f2bf07167fb81ebffa;hpb=2eddfef0df48beb34e38010bc2eac7f8b988b607;p=oota-llvm.git diff --git a/docs/LangRef.html b/docs/LangRef.html index 5bf06851e6e..95b89fcc4e5 100644 --- a/docs/LangRef.html +++ b/docs/LangRef.html @@ -12,7 +12,7 @@ -
LLVM Language Reference Manual
+

LLVM Language Reference Manual

  1. Abstract
  2. Introduction
  3. @@ -24,6 +24,8 @@
    1. 'private' Linkage
    2. 'linker_private' Linkage
    3. +
    4. 'linker_private_weak' Linkage
    5. +
    6. 'linker_private_weak_def_auto' Linkage
    7. 'internal' Linkage
    8. 'available_externally' Linkage
    9. 'linkonce' Linkage
    10. @@ -50,6 +52,7 @@
    11. Module-Level Inline Assembly
    12. Data Layout
    13. Pointer Aliasing Rules
    14. +
    15. Volatile Memory Accesses
  4. Type System @@ -59,6 +62,7 @@
    1. Integer Type
    2. Floating Point Types
    3. +
    4. X86mmx Type
    5. Void Type
    6. Label Type
    7. Metadata Type
    8. @@ -71,7 +75,6 @@
    9. Array Type
    10. Structure Type
    11. Packed Structure Type
    12. -
    13. Union Type
    14. Vector Type
  5. @@ -89,6 +92,7 @@
  6. Complex Constants
  7. Global Variable and Function Addresses
  8. Undefined Values
  9. +
  10. Trap Values
  11. Addresses of Basic Blocks
  12. Constant Expressions
@@ -222,7 +226,7 @@
  • 'llvm.stackrestore' Intrinsic
  • 'llvm.prefetch' Intrinsic
  • 'llvm.pcmarker' Intrinsic
  • -
  • llvm.readcyclecounter' Intrinsic
  • +
  • 'llvm.readcyclecounter' Intrinsic
  • Standard C Library Intrinsics @@ -235,6 +239,8 @@
  • 'llvm.sin.*' Intrinsic
  • 'llvm.cos.*' Intrinsic
  • 'llvm.pow.*' Intrinsic
  • +
  • 'llvm.exp.*' Intrinsic
  • +
  • 'llvm.log.*' Intrinsic
  • Bit Manipulation Intrinsics @@ -255,6 +261,12 @@
  • 'llvm.umul.with.overflow.* Intrinsics
  • +
  • Half Precision Floating Point Intrinsics +
      +
    1. 'llvm.convert.to.fp16' Intrinsic
    2. +
    3. 'llvm.convert.from.fp16' Intrinsic
    4. +
    +
  • Debugger intrinsics
  • Exception Handling intrinsics
  • Trampoline Intrinsic @@ -311,10 +323,10 @@ -
    Abstract
    +

    Abstract

    -
    +

    This document is a reference manual for the LLVM assembly language. LLVM is a Static Single Assignment (SSA) based representation that provides type @@ -325,10 +337,10 @@

    - +

    Introduction

    -
    +

    The LLVM code representation is designed to be used in three different forms: as an in-memory compiler IR, as an on-disk bitcode representation (suitable @@ -349,23 +361,21 @@ variable is never accessed outside of the current function, allowing it to be promoted to a simple SSA value instead of a memory location.

    -
    - - +

    + Well-Formedness +

    -
    +

    It is important to note that this document describes 'well formed' LLVM assembly language. There is a difference between what the parser accepts and what is considered 'well formed'. For example, the following instruction is syntactically okay, but not well formed:

    -
    -
    +
     %x = add i32 1, %x
     
    -

    because the definition of %x does not dominate all of its uses. The LLVM infrastructure provides a verification pass that may be used to verify @@ -376,13 +386,15 @@

    +
    + - +

    Identifiers

    -
    +

    LLVM identifiers come in two basic types: global and local. Global identifiers (functions, global variables) begin with the '@' @@ -428,29 +440,23 @@

    The easy way:

    -
    -
    +
     %result = mul i32 %X, 8
     
    -

    After strength reduction:

    -
    -
    +
     %result = shl i32 %X, i8 3
     
    -

    And the hard way:

    -
    -
    +
     %0 = add i32 %X, %X           ; yields {i32}:%0
     %1 = add i32 %0, %0           ; yields {i32}:%1
     %result = add i32 %1, %1
     
    -

    This last way of multiplying %X by 8 illustrates several important lexical features of LLVM:

    @@ -473,14 +479,15 @@
    - +

    High Level Structure

    - +
    - +

    + Module Structure +

    -
    +

    LLVM programs are composed of "Module"s, each of which is a translation unit of the input programs. Each module consists of functions, global variables, @@ -489,28 +496,27 @@ forward declarations, and merges symbol table entries. Here is an example of the "hello world" module:

    -
    -
    -; Declare the string constant as a global constant.
    -@.LC0 = internal constant [13 x i8] c"hello world\0A\00"    ; [13 x i8]*
    +
    +; Declare the string constant as a global constant. 
    +@.LC0 = internal constant [13 x i8] c"hello world\0A\00"      ; [13 x i8]* 
     
    -; External declaration of the puts function
    -declare i32 @puts(i8 *)                                     ; i32(i8 *)* 
    +; External declaration of the puts function 
    +declare i32 @puts(i8*)                                      ; i32 (i8*)*  
     
     ; Definition of main function
    -define i32 @main() {                                        ; i32()* 
    -  ; Convert [13 x i8]* to i8  *...
    -  %cast210 = getelementptr [13 x i8]* @.LC0, i64 0, i64 0   ; i8 *
    +define i32 @main() {   ; i32()*  
    +  ; Convert [13 x i8]* to i8  *... 
    +  %cast210 = getelementptr [13 x i8]* @.LC0, i64 0, i64 0   ; i8* 
     
    -  ; Call puts function to write out the string to stdout.
    -  call i32 @puts(i8 * %cast210)                             ; i32
    -  ret i32 0
    } + ; Call puts function to write out the string to stdout.  + call i32 @puts(i8* %cast210) ; i32  + ret i32 0  +} ; Named metadata !1 = metadata !{i32 41} !foo = !{!1, null}
    -

    This example is made up of a global variable named ".LC0", an external declaration of the "puts" function, @@ -527,31 +533,44 @@ define i32 @main() { ; i32()*

    - + -
    +

    All Global Variables and Functions have one of the following types of linkage:

    private
    -
    Global values with private linkage are only directly accessible by objects - in the current module. In particular, linking code into a module with an - private global value may cause the private to be renamed as necessary to - avoid collisions. Because the symbol is private to the module, all - references can be updated. This doesn't show up in any symbol table in the - object file.
    +
    Global values with "private" linkage are only directly accessible + by objects in the current module. In particular, linking code into a + module with an private global value may cause the private to be renamed as + necessary to avoid collisions. Because the symbol is private to the + module, all references can be updated. This doesn't show up in any symbol + table in the object file.
    linker_private
    -
    Similar to private, but the symbol is passed through the assembler and - removed by the linker after evaluation. Note that (unlike private - symbols) linker_private symbols are subject to coalescing by the linker: - weak symbols get merged and redefinitions are rejected. However, unlike - normal strong symbols, they are removed by the linker from the final - linked image (executable or dynamic library).
    +
    Similar to private, but the symbol is passed through the + assembler and evaluated by the linker. Unlike normal strong symbols, they + are removed by the linker from the final linked image (executable or + dynamic library).
    + +
    linker_private_weak
    +
    Similar to "linker_private", but the symbol is weak. Note that + linker_private_weak symbols are subject to coalescing by the + linker. The symbols are removed by the linker from the final linked image + (executable or dynamic library).
    + +
    linker_private_weak_def_auto
    +
    Similar to "linker_private_weak", but it's known that the address + of the object is not taken. For instance, functions that had an inline + definition, but the compiler decided not to inline it. Note, + unlike linker_private and linker_private_weak, + linker_private_weak_def_auto may have only default + visibility. The symbols are removed by the linker from the final linked + image (executable or dynamic library).
    internal
    Similar to private, but the value shows as a local symbol @@ -615,8 +634,8 @@ define i32 @main() { ; i32()*
    weak_odr
    Some languages allow differing globals to be merged, such as two functions with different semantics. Other languages, such as C++, ensure - that only equivalent globals are ever merged (the "one definition rule" - - "ODR"). Such languages can use the linkonce_odr + that only equivalent globals are ever merged (the "one definition rule" + — "ODR"). Such languages can use the linkonce_odr and weak_odr linkage types to indicate that the global will only be merged with equivalent globals. These linkage types are otherwise the same as their non-odr versions.
    @@ -663,11 +682,11 @@ define i32 @main() { ; i32()*
    - + -
    +

    LLVM functions, calls and invokes can all have an optional calling @@ -691,9 +710,9 @@ define i32 @main() { ; i32()* target, without having to conform to an externally specified ABI (Application Binary Interface). Tail calls can only be optimized - when this convention is used. This calling convention does not - support varargs and requires the prototype of all callees to exactly match - the prototype of the function definition. + when this or the GHC convention is used. This calling convention + does not support varargs and requires the prototype of all callees to + exactly match the prototype of the function definition.

    "coldcc" - The cold calling convention:
    This calling convention attempts to make code in the caller as efficient @@ -703,6 +722,26 @@ define i32 @main() { ; i32()* does not support varargs and requires the prototype of all callees to exactly match the prototype of the function definition.
    +
    "cc 10" - GHC convention:
    +
    This calling convention has been implemented specifically for use by the + Glasgow Haskell Compiler (GHC). + It passes everything in registers, going to extremes to achieve this by + disabling callee save registers. This calling convention should not be + used lightly but only for specific situations such as an alternative to + the register pinning performance technique often used when + implementing functional programming languages.At the moment only X86 + supports this convention and it has the following limitations: +
      +
    • On X86-32 only supports up to 4 bit type parameters. No + floating point types are supported.
    • +
    • On X86-64 only supports up to 10 bit type parameters and + 6 floating point parameters.
    • +
    + This calling convention supports + tail call optimization but + requires both the caller and callee are using it. +
    +
    "cc <n>" - Numbered convention:
    Any calling convention may be specified by number, allowing target-specific calling conventions to be used. Target specific calling @@ -716,11 +755,11 @@ define i32 @main() { ; i32()*
    - + -
    +

    All Global Variables and Functions have one of the following visibility styles:

    @@ -750,24 +789,22 @@ define i32 @main() { ; i32()*
    - + -
    +

    LLVM IR allows you to specify name aliases for certain types. This can make it easier to read the IR and make the IR more condensed (particularly when recursive types are involved). An example of a name specification is:

    -
    -
    +
     %mytype = type { %mytype*, i32 }
     
    -

    You may give a name to any type except - "void". Type name aliases may be used anywhere a type + "void". Type name aliases may be used anywhere a type is expected with the syntax "%mytype".

    Note that type names are aliases for the structural type that they indicate, @@ -783,11 +820,11 @@ define i32 @main() { ; i32()*

    - + -
    +

    Global variables define regions of memory allocated at compilation time instead of run-time. Global variables may optionally be initialized, may @@ -814,6 +851,13 @@ define i32 @main() { ; i32()* region of memory, and all memory objects in LLVM are accessed through pointers.

    +

    Global variables can be marked with unnamed_addr which indicates + that the address is not significant, only the content. Constants marked + like this can be merged with other constants if they have the same + initializer. Note that a constant with significant address can + be merged with a unnamed_addr constant, the result being a + constant whose address is significant.

    +

    A global variable may be declared to reside in a target-specific numbered address space. For targets that support them, address spaces may affect how optimizations are performed and/or what target instructions are used to @@ -823,35 +867,38 @@ define i32 @main() { ; i32()*

    LLVM allows an explicit section to be specified for globals. If the target supports it, it will emit globals to the section specified.

    -

    An explicit alignment may be specified for a global. If not present, or if - the alignment is set to zero, the alignment of the global is set by the - target to whatever it feels convenient. If an explicit alignment is - specified, the global is forced to have at least that much alignment. All - alignments must be a power of 2.

    +

    An explicit alignment may be specified for a global, which must be a power + of 2. If not present, or if the alignment is set to zero, the alignment of + the global is set by the target to whatever it feels convenient. If an + explicit alignment is specified, the global is forced to have exactly that + alignment. Targets and optimizers are not allowed to over-align the global + if the global has an assigned section. In this case, the extra alignment + could be observable: for example, code could assume that the globals are + densely packed in their section and try to iterate over them as an array, + alignment padding would break this iteration.

    For example, the following defines a global in a numbered address space with an initializer, section, and alignment:

    -
    -
    +
     @G = addrspace(5) constant float 1.0, section "foo", align 4
     
    -
    - + -
    +
    -

    LLVM function definitions consist of the "define" keyord, an +

    LLVM function definitions consist of the "define" keyword, an optional linkage type, an optional visibility style, an optional - calling convention, a return type, an optional + calling convention, + an optional unnamed_addr attribute, a return type, an optional parameter attribute for the return type, a function name, a (possibly empty) argument list (each with optional parameter attributes), optional @@ -862,7 +909,8 @@ define i32 @main() { ; i32()*

    LLVM function declarations consist of the "declare" keyword, an optional linkage type, an optional visibility style, an optional - calling convention, a return type, an optional + calling convention, + an optional unnamed_addr attribute, a return type, an optional parameter attribute for the return type, a function name, a possibly empty list of arguments, an optional alignment, and an optional garbage collector name.

    @@ -888,25 +936,26 @@ define i32 @main() { ; i32()* specified, the function is forced to have at least that much alignment. All alignments must be a power of 2.

    +

    If the unnamed_addr attribute is given, the address is know to not + be significant and two identical functions can be merged

    . +
    Syntax:
    -
    -
    +
     define [linkage] [visibility]
            [cconv] [ret attrs]
            <ResultType> @<FunctionName> ([argument list])
            [fn Attrs] [section "name"] [align N]
            [gc] { ... }
     
    -
    -
    +

    Aliases -

    + -
    +

    Aliases act as "second name" for the aliasee value (which can be either function, global variable, another alias or bitcast of global value). Aliases @@ -914,39 +963,41 @@ define [linkage] [visibility] optional visibility style.

    Syntax:
    -
    -
    +
     @<Name> = alias [Linkage] [Visibility] <AliaseeTy> @<Aliasee>
     
    -
    - + -
    +

    Named metadata is a collection of metadata. Metadata - nodes (but not metadata strings) and null are the only valid operands for + nodes (but not metadata strings) are the only valid operands for a named metadata.

    Syntax:
    -
    -
    +
    +; Some unnamed metadata nodes, which are referenced by the named metadata.
    +!0 = metadata !{metadata !"zero"}
     !1 = metadata !{metadata !"one"}
    -!name = !{null, !1}
    +!2 = metadata !{metadata !"two"}
    +; A named metadata.
    +!name = !{!0, !1, !2}
     
    -
    - +

    + Parameter Attributes +

    -
    +

    The return type and each parameter of a function type may have a set of parameter attributes associated with them. Parameter attributes are @@ -959,13 +1010,11 @@ define [linkage] [visibility] multiple parameter attributes are needed, they are space separated. For example:

    -
    -
    +
     declare i32 @printf(i8* noalias nocapture, ...)
     declare i32 @atoi(i8 zeroext)
     declare signext i8 @returns_signed_char()
     
    -

    Note that any attributes for the function result (nounwind, readonly) come immediately after the argument list.

    @@ -975,13 +1024,15 @@ declare signext i8 @returns_signed_char()
    zeroext
    This indicates to the code generator that the parameter or return value - should be zero-extended to a 32-bit value by the caller (for a parameter) - or the callee (for a return value).
    + should be zero-extended to the extent required by the target's ABI (which + is usually 32-bits, but is 8-bits for a i1 on x86-64) by the caller (for a + parameter) or the callee (for a return value).
    signext
    This indicates to the code generator that the parameter or return value - should be sign-extended to a 32-bit value by the caller (for a parameter) - or the callee (for a return value).
    + should be sign-extended to the extent required by the target's ABI (which + is usually 32-bits) by the caller (for a parameter) or the callee (for a + return value).
    inreg
    This indicates that this parameter or return value should be treated in a @@ -991,8 +1042,9 @@ declare signext i8 @returns_signed_char() registers). Use of this attribute is target-specific.
    byval
    -
    This indicates that the pointer parameter should really be passed by value - to the function. The attribute implies that a hidden copy of the pointee +

    This indicates that the pointer parameter should really be passed by + value to the function. The attribute implies that a hidden copy of the + pointee is made between the caller and the callee, so the callee is unable to modify the value in the callee. This attribute is only valid on LLVM pointer arguments. It is generally used to pass structs and arrays by @@ -1000,12 +1052,15 @@ declare signext i8 @returns_signed_char() to belong to the caller not the callee (for example, readonly functions should not write to byval parameters). This is not a valid attribute for return - values. The byval attribute also supports specifying an alignment with - the align attribute. This has a target-specific effect on the code - generator that usually indicates a desired alignment for the synthesized - stack slot.

    - -
    sret
    + values.

    + +

    The byval attribute also supports specifying an alignment with + the align attribute. It indicates the alignment of the stack slot to + form and the known alignment of the pointer specified to the call site. If + the alignment is not specified, then the code generator makes a + target-specific assumption.

    + +
    sret
    This indicates that the pointer parameter specifies the address of a structure that is the return value of the function in the source program. This pointer must be guaranteed by the caller to be valid: loads and @@ -1013,22 +1068,34 @@ declare signext i8 @returns_signed_char() may only be applied to the first parameter. This is not a valid attribute for return values.
    -
    noalias
    -
    This indicates that the pointer does not alias any global or any other - parameter. The caller is responsible for ensuring that this is the - case. On a function return value, noalias additionally indicates - that the pointer does not alias any other pointers visible to the - caller. For further details, please see the discussion of the NoAlias - response in - alias - analysis.
    - -
    nocapture
    +
    noalias
    +
    This indicates that pointer values + based on the argument or return + value do not alias pointer values which are not based on it, + ignoring certain "irrelevant" dependencies. + For a call to the parent function, dependencies between memory + references from before or after the call and from those during the call + are "irrelevant" to the noalias keyword for the arguments and + return value used in that call. + The caller shares the responsibility with the callee for ensuring that + these requirements are met. + For further details, please see the discussion of the NoAlias response in + alias analysis.
    +
    + Note that this definition of noalias is intentionally + similar to the definition of restrict in C99 for function + arguments, though it is slightly weaker. +
    + For function return values, C99's restrict is not meaningful, + while LLVM's noalias is. +
    + +
    nocapture
    This indicates that the callee does not make any copies of the pointer that outlive the callee itself. This is not a valid attribute for return values.
    -
    nest
    +
    nest
    This indicates that the pointer parameter can be excised using the trampoline intrinsics. This is not a valid attribute for return values.
    @@ -1037,20 +1104,18 @@ declare signext i8 @returns_signed_char()
    - + -
    +

    Each function may specify a garbage collector name, which is simply a string:

    -
    -
    +
     define void @f() gc "name" { ... }
     
    -

    The compiler declares the supported values of name. Specifying a collector which will cause the compiler to alter its output in order to @@ -1059,11 +1124,11 @@ define void @f() gc "name" { ... }

    - + -
    +

    Function attributes are set to communicate additional information about a function. Function attributes are considered to be part of the function, not @@ -1073,14 +1138,12 @@ define void @f() gc "name" { ... }

    Function attributes are simple keywords that follow the type specified. If multiple attributes are needed, they are space separated. For example:

    -
    -
    +
     define void @f() noinline { ... }
     define void @f() alwaysinline { ... }
     define void @f() alwaysinline optsize { ... }
     define void @f() optsize { ... }
     
    -
    alignstack(<n>)
    @@ -1093,20 +1156,34 @@ define void @f() optsize { ... } function into callers whenever possible, ignoring any active inlining size threshold for this caller. +
    hotpatch
    +
    This attribute indicates that the function should be 'hotpatchable', + meaning the function can be patched and/or hooked even while it is + loaded into memory. On x86, the function prologue will be preceded + by six bytes of padding and will begin with a two-byte instruction. + Most of the functions in the Windows system DLLs in Windows XP SP2 or + higher were compiled in this fashion.
    +
    inlinehint
    This attribute indicates that the source code contained a hint that inlining this function is desirable (such as the "inline" keyword in C/C++). It is just a hint; it imposes no requirements on the inliner.
    +
    naked
    +
    This attribute disables prologue / epilogue emission for the function. + This can have very system-specific consequences.
    + +
    noimplicitfloat
    +
    This attributes disables implicit floating point instructions.
    +
    noinline
    This attribute indicates that the inliner should never inline this function in any situation. This attribute may not be used together with the alwaysinline attribute.
    -
    optsize
    -
    This attribute suggests that optimization passes and code generator passes - make choices that keep the code size of this function low, and otherwise - do optimizations specifically to reduce code size.
    +
    noredzone
    +
    This attribute indicates that the code generator should not use a red + zone, even if the target-specific ABI normally permits it.
    noreturn
    This function attribute indicates that the function never returns @@ -1118,6 +1195,11 @@ define void @f() optsize { ... } unwind or exceptional control flow. If the function does unwind, its runtime behavior is undefined.
    +
    optsize
    +
    This attribute suggests that optimization passes and code generator passes + make choices that keep the code size of this function low, and otherwise + do optimizations specifically to reduce code size.
    +
    readnone
    This attribute indicates that the function computes its result (or decides to unwind an exception) based strictly on its arguments, without @@ -1160,39 +1242,26 @@ define void @f() optsize { ... } function that doesn't have an sspreq attribute or which has an ssp attribute, then the resulting function will have an sspreq attribute.
    - -
    noredzone
    -
    This attribute indicates that the code generator should not use a red - zone, even if the target-specific ABI normally permits it.
    - -
    noimplicitfloat
    -
    This attributes disables implicit floating point instructions.
    - -
    naked
    -
    This attribute disables prologue / epilogue emission for the function. - This can have very system-specific consequences.
    - + -
    +

    Modules may contain "module-level inline asm" blocks, which corresponds to the GCC "file scope inline asm" blocks. These blocks are internally concatenated by LLVM and treated as a single unit, but may be separated in the .ll file if desired. The syntax is very simple:

    -
    -
    +
     module asm "inline asm code goes here"
     module asm "more can go here"
     
    -

    The strings can contain any character by escaping non-printable characters. The escape sequence used is simply "\xx" where "xx" is the two digit hex code @@ -1204,21 +1273,19 @@ module asm "more can go here"

    - + -
    +

    A module may specify a target specific data layout string that specifies how data is to be laid out in memory. The syntax for the data layout is simply:

    -
    -
    +
     target datalayout = "layout specification"
     
    -

    The layout specification consists of a list of specifications separated by the minus sign character ('-'). Each specification starts with @@ -1251,8 +1318,10 @@ target datalayout = "layout specification"

    fsize:abi:pref
    This specifies the alignment for a floating point type of a given bit - size. The value of size must be either 32 (float) or 64 - (double).
    + size. Only values of size that are supported by the target + will work. 32 (float) and 64 (double) are supported on all targets; + 80 or 128 (different flavors of long double) are also supported on some + targets.
    asize:abi:pref
    This specifies the alignment for an aggregate type of a given bit @@ -1271,7 +1340,7 @@ target datalayout = "layout specification"

    When constructing the data layout for a given target, LLVM starts with a - default set of specifications which are then (possibly) overriden by the + default set of specifications which are then (possibly) overridden by the specifications in the datalayout keyword. The default specifications are given in this list:

    @@ -1316,11 +1385,11 @@ target datalayout = "layout specification"
    - + -
    +

    Any memory access must be done through a pointer value associated with an address range of the memory access, otherwise the behavior @@ -1328,34 +1397,46 @@ is undefined. Pointer values are associated with address ranges according to the following rules:

      -
    • A pointer value formed from a - getelementptr instruction - is associated with the addresses associated with the first operand - of the getelementptr.
    • +
    • A pointer value is associated with the addresses associated with + any value it is based on.
    • An address of a global variable is associated with the address range of the variable's storage.
    • The result value of an allocation instruction is associated with the address range of the allocated storage.
    • A null pointer in the default address-space is associated with no address.
    • -
    • A pointer value formed by an - inttoptr is associated with all - address ranges of all pointer values that contribute (directly or - indirectly) to the computation of the pointer's value.
    • -
    • The result value of a - bitcast is associated with all - addresses associated with the operand of the bitcast.
    • An integer constant other than zero or a pointer value returned from a function not defined within LLVM may be associated with address ranges allocated through mechanisms other than those provided by LLVM. Such ranges shall not overlap with any ranges of addresses allocated by mechanisms provided by LLVM.
    • -
    + + +

    A pointer value is based on another pointer value according + to the following rules:

    + +
      +
    • A pointer value formed from a + getelementptr operation + is based on the first operand of the getelementptr.
    • +
    • The result value of a + bitcast is based on the operand + of the bitcast.
    • +
    • A pointer value formed by an + inttoptr is based on all + pointer values that contribute (directly or indirectly) to the + computation of the pointer's value.
    • +
    • The "based on" relationship is transitive.
    • +
    + +

    Note that this definition of "based" is intentionally + similar to the definition of "based" in C99, though it is + slightly weaker.

    LLVM IR does not associate types with memory. The result type of a load merely indicates the size and alignment of the memory from which to load, as well as the -interpretation of the value. The first operand of a +interpretation of the value. The first operand type of a store similarly only indicates the size and alignment of the store.

    @@ -1367,11 +1448,31 @@ to implement type-based alias analysis.

    + +

    + Volatile Memory Accesses +

    + +
    + +

    Certain memory accesses, such as loads, stores, and llvm.memcpys may be marked volatile. +The optimizers must not change the number of volatile operations or change their +order of execution relative to other volatile operations. The optimizers +may change the order of volatile operations relative to non-volatile +operations. This is not Java's "volatile" and has no cross-thread +synchronization behavior.

    + +
    + +
    + - +

    Type System

    -
    +

    The LLVM type system is one of the most important features of the intermediate representation. Being typed enables a number of optimizations @@ -1381,13 +1482,12 @@ to implement type-based alias analysis.

    and transformations that are not feasible to perform on normal three address code representations.

    -
    - - +

    + Type Classifications +

    -
    +

    The types fall into a few useful classifications:

    @@ -1409,7 +1509,6 @@ Classifications
    pointer, vector, structure, - union, array, label, metadata. @@ -1419,7 +1518,9 @@ Classifications
    primitive label, void, + integer, floating point, + x86mmx, metadata. @@ -1429,7 +1530,6 @@ Classifications
    pointer, structure, packed structure, - union, vector, opaque. @@ -1444,19 +1544,21 @@ Classifications
    - +

    + Primitive Types +

    -
    +

    The primitive types are the fundamental building blocks of the LLVM system.

    -
    - - +

    + Integer Type +

    -
    +
    Overview:

    The integer type is a very simple type that simply specifies an arbitrary @@ -1490,9 +1592,11 @@ Classifications

    - +

    + Floating Point Types +

    -
    +
    @@ -1508,9 +1612,28 @@ Classifications - +

    + X86mmx Type +

    + +
    + +
    Overview:
    +

    The x86mmx type represents a value held in an MMX register on an x86 machine. The operations allowed on it are quite limited: parameters and return values, load and store, and bitcast. User-specified MMX instructions are represented as intrinsic or asm calls with arguments and/or results of this type. There are no arrays, vectors or constants of this type.

    + +
    Syntax:
    +
    +  x86mmx
    +
    + +
    + + +

    + Void Type +

    -
    +
    Overview:

    The void type does not represent any value and has no size.

    @@ -1523,9 +1646,11 @@ Classifications
    - +

    + Label Type +

    -
    +
    Overview:

    The label type represents code labels.

    @@ -1538,9 +1663,11 @@ Classifications
    - +

    + Metadata Type +

    -
    +
    Overview:

    The metadata type represents embedded metadata. No derived types may be @@ -1554,11 +1681,14 @@ Classifications

    + - +

    + Derived Types +

    -
    +

    The real power in LLVM comes from the derived types in the system. This is what allows a programmer to represent arrays, functions, pointers, and other @@ -1568,26 +1698,26 @@ Classifications

    of another array.

    -
    - - +

    + Aggregate Types +

    -
    +

    Aggregate Types are a subset of derived types that can contain multiple member types. Arrays, - structs, vectors and - unions are aggregate types.

    - -
    + structs, and vectors are + aggregate types.

    - +

    + Array Type +

    -
    +
    Overview:

    The array type is a very simple derived type that arranges elements @@ -1643,16 +1773,16 @@ Classifications

    - +

    + Function Type +

    -
    +
    Overview:

    The function type can be thought of as a function signature. It consists of a return type and a list of formal parameter types. The return type of a - function type is a scalar type, a void type, a struct type, or a union - type. If the return type is a struct type then all struct elements must be - of first class types, and the struct must have at least one element.

    + function type is a first class type or a void type.

    Syntax:
    @@ -1664,7 +1794,7 @@ Classifications 
    which indicates that the function takes a variable number of arguments. Variable argument functions can access their arguments with the variable argument handling intrinsic - functions. '<returntype>' is a any type except + functions. '<returntype>' is any type except label.

    Examples:
    @@ -1674,12 +1804,11 @@ Classifications
    - @@ -1699,9 +1828,11 @@ Classifications - +

    + Structure Type +

    -
    +
    Overview:

    The structure type is used to represent a collection of data members together @@ -1737,10 +1868,11 @@ Classifications

    - +

    + Packed Structure Type +

    -
    +
    Overview:

    The packed structure type is used to represent a collection of data members @@ -1775,56 +1907,11 @@ Classifications

    - - -
    - -
    Overview:
    -

    A union type describes an object with size and alignment suitable for - an object of any one of a given set of types (also known as an "untagged" - union). It is similar in concept and usage to a - struct, except that all members of the union - have an offset of zero. The elements of a union may be any type that has a - size. Unions must have at least one member - empty unions are not allowed. -

    - -

    The size of the union as a whole will be the size of its largest member, - and the alignment requirements of the union as a whole will be the largest - alignment requirement of any member.

    - -

    Union members are accessed using 'load and - 'store' by getting a pointer to a field with - the 'getelementptr' instruction. - Since all members are at offset zero, the getelementptr instruction does - not affect the address, only the type of the resulting pointer.

    - -
    Syntax:
    -
    -  union { <type list> }
    -
    - -
    Examples:
    -
    function taking an i32, returning an i32
    float (i16 signext, i32 *) * + float (i16, i32 *) * Pointer to a function that takes - an i16 that should be sign extended and a - pointer to i32, returning - float. + an i16 and a pointer to i32, + returning float.
    i32 (i8*, ...)
    - - - - - - - -
    union { i32, i32*, float }A union of three types: an i32, a pointer to - an i32, and a float.
    - union { float, i32 (i32) * }A union, where the first element is a float and the - second element is a pointer to a - function that takes an i32, returning - an i32.
    - -
    - - - +

    + Pointer Type +

    -
    +
    Overview:

    The pointer type is used to specify memory locations. @@ -1851,7 +1938,7 @@ Classifications

    href="#t_array">array of four i32 values. - i32 (i32 *) * + i32 (i32*) * A pointer to a function that takes an i32*, returning an i32. @@ -1866,9 +1953,11 @@ Classifications
    - +

    + Vector Type +

    -
    +
    Overview:

    A vector type is a simple derived type that represents a vector of elements. @@ -1882,8 +1971,9 @@ Classifications

    < <# elements> x <elementtype> > -

    The number of elements is a constant integer value; elementtype may be any - integer or floating point type.

    +

    The number of elements is a constant integer value larger than 0; elementtype + may be any integer or floating point type. Vectors of size zero are not + allowed, and pointers are not allowed as the element type.

    Examples:
    @@ -1904,8 +1994,11 @@ Classifications - -
    +

    + Opaque Type +

    + +
    Overview:

    Opaque types are used to represent unknown types in the system. This @@ -1928,12 +2021,14 @@ Classifications

    + + - + -
    +
    Overview:

    An "up reference" allows you to refer to a lexically enclosing type without @@ -1976,21 +2071,23 @@ Classifications

    + + - +

    Constants

    -
    +

    LLVM has several different basic types of constants. This section describes them all and their syntax.

    -
    - - +

    + Simple Constants +

    -
    +
    Boolean constants
    @@ -2039,15 +2136,16 @@ Classifications
    they match the long double format on your target. All hexadecimal formats are big-endian (sign bit at the left).

    +

    There are no constants of type x86mmx.

    - + -
    +

    Complex constants are a (potentially recursive) combination of simple constants and smaller complex constants.

    @@ -2062,14 +2160,6 @@ Classifications
    the number and types of elements must match those specified by the type. -
    Union constants
    -
    Union constants are represented with notation similar to a structure with - a single element - that is, a single typed element surrounded - by braces ({})). For example: "{ i32 4 }". The - union type can be initialized with a single-element - struct as long as the type of the struct element matches the type of - one of the union members.
    -
    Array constants
    Array constants are represented with notation similar to array type definitions (a comma separated list of elements, surrounded by square @@ -2105,11 +2195,11 @@ Classifications
    - + -
    +

    The addresses of global variables and functions are always implicitly valid @@ -2118,24 +2208,25 @@ Classifications

    have pointer type. For example, the following is a legal LLVM file:

    -
    -
    +
     @X = global i32 17
     @Y = global i32 42
     @Z = global [2 x i32*] [ i32* @X, i32* @Y ]
     
    -
    - -
    +

    + Undefined Values +

    + +

    The string 'undef' can be used anywhere a constant is expected, and indicates that the user of the value may receive an unspecified bit-pattern. - Undefined values may be of any type (other than label or void) and be used - anywhere a constant is permitted.

    + Undefined values may be of any type (other than 'label' + or 'void') and be used anywhere a constant is permitted.

    Undefined values are useful because they indicate to the compiler that the program is well defined no matter what value is used. This gives the @@ -2143,8 +2234,7 @@ Classifications

    surprising) transformations that are valid (in pseudo IR):

    -
    -
    +
       %A = add %X, undef
       %B = sub %X, undef
       %C = xor %X, undef
    @@ -2153,13 +2243,11 @@ Safe:
       %B = undef
       %C = undef
     
    -

    This is safe because all of the output bits are affected by the undef bits. -Any output bit can have a zero or one depending on the input bits.

    + Any output bit can have a zero or one depending on the input bits.

    -
    -
    +
       %A = or %X, undef
       %B = and %X, undef
     Safe:
    @@ -2169,19 +2257,18 @@ Unsafe:
       %A = undef
       %B = undef
     
    -

    These logical operations have bits that are not always affected by the input. -For example, if "%X" has a zero bit, then the output of the 'and' operation will -always be a zero, no matter what the corresponding bit from the undef is. As -such, it is unsafe to optimize or assume that the result of the and is undef. -However, it is safe to assume that all bits of the undef could be 0, and -optimize the and to 0. Likewise, it is safe to assume that all the bits of -the undef operand to the or could be set, allowing the or to be folded to --1.

    - -
    -
    +   For example, if %X has a zero bit, then the output of the
    +   'and' operation will always be a zero for that bit, no matter what
    +   the corresponding bit from the 'undef' is. As such, it is unsafe to
    +   optimize or assume that the result of the 'and' is 'undef'.
    +   However, it is safe to assume that all bits of the 'undef' could be
    +   0, and optimize the 'and' to 0. Likewise, it is safe to assume that
    +   all the bits of the 'undef' operand to the 'or' could be
    +   set, allowing the 'or' to be folded to -1.

    + +
       %A = select undef, %X, %Y
       %B = select undef, 42, %Y
       %C = select %X, %Y, undef
    @@ -2194,18 +2281,17 @@ Unsafe:
       %B = undef
       %C = undef
     
    -
    -

    This set of examples show that undefined select (and conditional branch) -conditions can go "either way" but they have to come from one of the two -operands. In the %A example, if %X and %Y were both known to have a clear low -bit, then %A would have to have a cleared low bit. However, in the %C example, -the optimizer is allowed to assume that the undef operand could be the same as -%Y, allowing the whole select to be eliminated.

    +

    This set of examples shows that undefined 'select' (and conditional + branch) conditions can go either way, but they have to come from one + of the two operands. In the %A example, if %X and + %Y were both known to have a clear low bit, then %A would + have to have a cleared low bit. However, in the %C example, the + optimizer is allowed to assume that the 'undef' operand could be the + same as %Y, allowing the whole 'select' to be + eliminated.

    - -
    -
    +
       %A = xor undef, undef
     
       %B = undef
    @@ -2223,64 +2309,190 @@ Safe:
       %E = undef
       %F = undef
     
    -
    -

    This example points out that two undef operands are not necessarily the same. -This can be surprising to people (and also matches C semantics) where they -assume that "X^X" is always zero, even if X is undef. This isn't true for a -number of reasons, but the short answer is that an undef "variable" can -arbitrarily change its value over its "live range". This is true because the -"variable" doesn't actually have a live range. Instead, the value is -logically read from arbitrary registers that happen to be around when needed, -so the value is not necessarily consistent over time. In fact, %A and %C need -to have the same semantics or the core LLVM "replace all uses with" concept -would not hold.

    +

    This example points out that two 'undef' operands are not + necessarily the same. This can be surprising to people (and also matches C + semantics) where they assume that "X^X" is always zero, even + if X is undefined. This isn't true for a number of reasons, but the + short answer is that an 'undef' "variable" can arbitrarily change + its value over its "live range". This is true because the variable doesn't + actually have a live range. Instead, the value is logically read + from arbitrary registers that happen to be around when needed, so the value + is not necessarily consistent over time. In fact, %A and %C + need to have the same semantics or the core LLVM "replace all uses with" + concept would not hold.

    -
    -
    +
       %A = fdiv undef, %X
       %B = fdiv %X, undef
     Safe:
       %A = undef
     b: unreachable
     
    -

    These examples show the crucial difference between an undefined -value and undefined behavior. An undefined value (like undef) is -allowed to have an arbitrary bit-pattern. This means that the %A operation -can be constant folded to undef because the undef could be an SNaN, and fdiv is -not (currently) defined on SNaN's. However, in the second example, we can make -a more aggressive assumption: because the undef is allowed to be an arbitrary -value, we are allowed to assume that it could be zero. Since a divide by zero -has undefined behavior, we are allowed to assume that the operation -does not execute at all. This allows us to delete the divide and all code after -it: since the undefined operation "can't happen", the optimizer can assume that -it occurs in dead code. -

    - -
    -
    +  value and undefined behavior. An undefined value (like
    +  'undef') is allowed to have an arbitrary bit-pattern. This means that
    +  the %A operation can be constant folded to 'undef', because
    +  the 'undef' could be an SNaN, and fdiv is not (currently)
    +  defined on SNaN's. However, in the second example, we can make a more
    +  aggressive assumption: because the undef is allowed to be an
    +  arbitrary value, we are allowed to assume that it could be zero. Since a
    +  divide by zero has undefined behavior, we are allowed to assume that
    +  the operation does not execute at all. This allows us to delete the divide and
    +  all code after it. Because the undefined operation "can't happen", the
    +  optimizer can assume that it occurs in dead code.

    + +
     a:  store undef -> %X
     b:  store %X -> undef
     Safe:
     a: <deleted>
     b: unreachable
     
    + +

    These examples reiterate the fdiv example: a store of an + undefined value can be assumed to not have any effect; we can assume that the + value is overwritten with bits that happen to match what was already there. + However, a store to an undefined location could clobber arbitrary + memory, therefore, it has undefined behavior.

    +
    -

    These examples reiterate the fdiv example: a store "of" an undefined value -can be assumed to not have any effect: we can assume that the value is -overwritten with bits that happen to match what was already there. However, a -store "to" an undefined location could clobber arbitrary memory, therefore, it -has undefined behavior.

    + +

    + Trap Values +

    + +
    + +

    Trap values are similar to undef values, however + instead of representing an unspecified bit pattern, they represent the + fact that an instruction or constant expression which cannot evoke side + effects has nevertheless detected a condition which results in undefined + behavior.

    + +

    There is currently no way of representing a trap value in the IR; they + only exist when produced by operations such as + add with the nsw flag.

    + +

    Trap value behavior is defined in terms of value dependence:

    + +
      +
    • Values other than phi nodes depend on + their operands.
    • + +
    • Phi nodes depend on the operand corresponding + to their dynamic predecessor basic block.
    • + +
    • Function arguments depend on the corresponding actual argument values in + the dynamic callers of their functions.
    • + +
    • Call instructions depend on the + ret instructions that dynamically transfer + control back to them.
    • + +
    • Invoke instructions depend on the + ret, unwind, + or exception-throwing call instructions that dynamically transfer control + back to them.
    • + +
    • Non-volatile loads and stores depend on the most recent stores to all of the + referenced memory addresses, following the order in the IR + (including loads and stores implied by intrinsics such as + @llvm.memcpy.)
    • + + + + + +
    • An instruction with externally visible side effects depends on the most + recent preceding instruction with externally visible side effects, following + the order in the IR. (This includes + volatile operations.)
    • + +
    • An instruction control-depends on a + terminator instruction + if the terminator instruction has multiple successors and the instruction + is always executed when control transfers to one of the successors, and + may not be executed when control is transferred to another.
    • + +
    • Additionally, an instruction also control-depends on a terminator + instruction if the set of instructions it otherwise depends on would be + different if the terminator had transferred control to a different + successor.
    • + +
    • Dependence is transitive.
    • + +
    + +

    Whenever a trap value is generated, all values which depend on it evaluate + to trap. If they have side effects, the evoke their side effects as if each + operand with a trap value were undef. If they have externally-visible side + effects, the behavior is undefined.

    + +

    Here are some examples:

    + +
    +entry:
    +  %trap = sub nuw i32 0, 1           ; Results in a trap value.
    +  %still_trap = and i32 %trap, 0     ; Whereas (and i32 undef, 0) would return 0.
    +  %trap_yet_again = getelementptr i32* @h, i32 %still_trap
    +  store i32 0, i32* %trap_yet_again  ; undefined behavior
    +
    +  store i32 %trap, i32* @g           ; Trap value conceptually stored to memory.
    +  %trap2 = load i32* @g              ; Returns a trap value, not just undef.
    +
    +  volatile store i32 %trap, i32* @g  ; External observation; undefined behavior.
    +
    +  %narrowaddr = bitcast i32* @g to i16*
    +  %wideaddr = bitcast i32* @g to i64*
    +  %trap3 = load i16* %narrowaddr     ; Returns a trap value.
    +  %trap4 = load i64* %wideaddr       ; Returns a trap value.
    +
    +  %cmp = icmp slt i32 %trap, 0       ; Returns a trap value.
    +  br i1 %cmp, label %true, label %end ; Branch to either destination.
    +
    +true:
    +  volatile store i32 0, i32* @g      ; This is control-dependent on %cmp, so
    +                                     ; it has undefined behavior.
    +  br label %end
    +
    +end:
    +  %p = phi i32 [ 0, %entry ], [ 1, %true ]
    +                                     ; Both edges into this PHI are
    +                                     ; control-dependent on %cmp, so this
    +                                     ; always results in a trap value.
    +
    +  volatile store i32 0, i32* @g      ; This would depend on the store in %true
    +                                     ; if %cmp is true, or the store in %entry
    +                                     ; otherwise, so this is undefined behavior.
    +
    +  br i1 %cmp, label %second_true, label %second_end
    +                                     ; The same branch again, but this time the
    +                                     ; true block doesn't have side effects.
    +
    +second_true:
    +  ; No side effects!
    +  ret void
    +
    +second_end:
    +  volatile store i32 0, i32* @g      ; This time, the instruction always depends
    +                                     ; on the store in %end. Also, it is
    +                                     ; control-equivalent to %end, so this is
    +                                     ; well-defined (again, ignoring earlier
    +                                     ; undefined behavior in this example).
    +
    - -
    +

    + Addresses of Basic Blocks +

    + +

    blockaddress(@function, %block)

    @@ -2289,133 +2501,143 @@ has undefined behavior.

    the address of the entry block is illegal.

    This value only has defined behavior when used as an operand to the - 'indirectbr' instruction or for comparisons - against null. Pointer equality tests between labels addresses is undefined - behavior - though, again, comparison against null is ok, and no label is - equal to the null pointer. This may also be passed around as an opaque - pointer sized value as long as the bits are not inspected. This allows - ptrtoint and arithmetic to be performed on these values so long as - the original value is reconstituted before the indirectbr.

    + 'indirectbr' instruction, or for + comparisons against null. Pointer equality tests between labels addresses + results in undefined behavior — though, again, comparison against null + is ok, and no label is equal to the null pointer. This may be passed around + as an opaque pointer sized value as long as the bits are not inspected. This + allows ptrtoint and arithmetic to be performed on these values so + long as the original value is reconstituted before the indirectbr + instruction.

    -

    Finally, some targets may provide defined semantics when - using the value as the operand to an inline assembly, but that is target - specific. -

    +

    Finally, some targets may provide defined semantics when using the value as + the operand to an inline assembly, but that is target specific.

    - +

    + Constant Expressions +

    -
    +

    Constant expressions are used to allow expressions involving other constants to be used as constants. Constant expressions may be of any first class type and may involve any LLVM operation that does not have side effects (e.g. load and call are not - supported). The following is the syntax for constant expressions:

    + supported). The following is the syntax for constant expressions:

    -
    trunc ( CST to TYPE )
    +
    trunc (CST to TYPE)
    Truncate a constant to another type. The bit size of CST must be larger than the bit size of TYPE. Both types must be integers.
    -
    zext ( CST to TYPE )
    +
    zext (CST to TYPE)
    Zero extend a constant to another type. The bit size of CST must be - smaller or equal to the bit size of TYPE. Both types must be - integers.
    + smaller than the bit size of TYPE. Both types must be integers. -
    sext ( CST to TYPE )
    +
    sext (CST to TYPE)
    Sign extend a constant to another type. The bit size of CST must be - smaller or equal to the bit size of TYPE. Both types must be - integers.
    + smaller than the bit size of TYPE. Both types must be integers. -
    fptrunc ( CST to TYPE )
    +
    fptrunc (CST to TYPE)
    Truncate a floating point constant to another floating point type. The size of CST must be larger than the size of TYPE. Both types must be floating point.
    -
    fpext ( CST to TYPE )
    +
    fpext (CST to TYPE)
    Floating point extend a constant to another type. The size of CST must be smaller or equal to the size of TYPE. Both types must be floating point.
    -
    fptoui ( CST to TYPE )
    +
    fptoui (CST to TYPE)
    Convert a floating point constant to the corresponding unsigned integer constant. TYPE must be a scalar or vector integer type. CST must be of scalar or vector floating point type. Both CST and TYPE must be scalars, or vectors of the same number of elements. If the value won't fit in the integer type, the results are undefined.
    -
    fptosi ( CST to TYPE )
    +
    fptosi (CST to TYPE)
    Convert a floating point constant to the corresponding signed integer constant. TYPE must be a scalar or vector integer type. CST must be of scalar or vector floating point type. Both CST and TYPE must be scalars, or vectors of the same number of elements. If the value won't fit in the integer type, the results are undefined.
    -
    uitofp ( CST to TYPE )
    +
    uitofp (CST to TYPE)
    Convert an unsigned integer constant to the corresponding floating point constant. TYPE must be a scalar or vector floating point type. CST must be of scalar or vector integer type. Both CST and TYPE must be scalars, or vectors of the same number of elements. If the value won't fit in the floating point type, the results are undefined.
    -
    sitofp ( CST to TYPE )
    +
    sitofp (CST to TYPE)
    Convert a signed integer constant to the corresponding floating point constant. TYPE must be a scalar or vector floating point type. CST must be of scalar or vector integer type. Both CST and TYPE must be scalars, or vectors of the same number of elements. If the value won't fit in the floating point type, the results are undefined.
    -
    ptrtoint ( CST to TYPE )
    +
    ptrtoint (CST to TYPE)
    Convert a pointer typed constant to the corresponding integer constant TYPE must be an integer type. CST must be of pointer type. The CST value is zero extended, truncated, or unchanged to make it fit in TYPE.
    -
    inttoptr ( CST to TYPE )
    +
    inttoptr (CST to TYPE)
    Convert a integer constant to a pointer constant. TYPE must be a pointer type. CST must be of integer type. The CST value is zero extended, truncated, or unchanged to make it fit in a pointer size. This one is really dangerous!
    -
    bitcast ( CST to TYPE )
    +
    bitcast (CST to TYPE)
    Convert a constant, CST, to another TYPE. The constraints of the operands are the same as those for the bitcast instruction.
    -
    getelementptr ( CSTPTR, IDX0, IDX1, ... )
    -
    getelementptr inbounds ( CSTPTR, IDX0, IDX1, ... )
    +
    getelementptr (CSTPTR, IDX0, IDX1, ...)
    +
    getelementptr inbounds (CSTPTR, IDX0, IDX1, ...)
    Perform the getelementptr operation on constants. As with the getelementptr instruction, the index list may have zero or more indexes, which are required to make sense for the type of "CSTPTR".
    -
    select ( COND, VAL1, VAL2 )
    +
    select (COND, VAL1, VAL2)
    Perform the select operation on constants.
    -
    icmp COND ( VAL1, VAL2 )
    +
    icmp COND (VAL1, VAL2)
    Performs the icmp operation on constants.
    -
    fcmp COND ( VAL1, VAL2 )
    +
    fcmp COND (VAL1, VAL2)
    Performs the fcmp operation on constants.
    -
    extractelement ( VAL, IDX )
    +
    extractelement (VAL, IDX)
    Perform the extractelement operation on constants.
    -
    insertelement ( VAL, ELT, IDX )
    +
    insertelement (VAL, ELT, IDX)
    Perform the insertelement operation on constants.
    -
    shufflevector ( VEC1, VEC2, IDXMASK )
    +
    shufflevector (VEC1, VEC2, IDXMASK)
    Perform the shufflevector operation on constants.
    -
    OPCODE ( LHS, RHS )
    +
    extractvalue (VAL, IDX0, IDX1, ...)
    +
    Perform the extractvalue operation on + constants. The index list is interpreted in a similar manner as indices in + a 'getelementptr' operation. At least one + index value must be specified.
    + +
    insertvalue (VAL, ELT, IDX0, IDX1, ...)
    +
    Perform the insertvalue operation on + constants. The index list is interpreted in a similar manner as indices in + a 'getelementptr' operation. At least one + index value must be specified.
    + +
    OPCODE (LHS, RHS)
    Perform the specified operation of the LHS and RHS constants. OPCODE may be any of the binary or bitwise binary operations. The constraints @@ -2425,16 +2647,18 @@ has undefined behavior.

    +
    + - +

    Other Values

    - +
    - + -
    +

    LLVM supports inline assembler expressions (as opposed to Module-Level Inline Assembly) through the use of @@ -2445,31 +2669,25 @@ has undefined behavior.

    containing the asm needs to align its stack conservatively. An example inline assembler expression is:

    -
    -
    +
     i32 (i32) asm "bswap $0", "=r,r"
     
    -

    Inline assembler expressions may only be used as the callee operand of a call instruction. Thus, typically we have:

    -
    -
    +
     %X = call i32 asm "bswap $0", "=r,r"(i32 %Y)
     
    -

    Inline asms with side effects not visible in the constraint list must be marked as having side effects. This is done through the use of the 'sideeffect' keyword, like so:

    -
    -
    +
     call void asm sideeffect "eieio", ""()
     
    -

    In some cases inline asms will contain code that will not work unless the stack is aligned in some way, such as calls or SSE instructions on x86, @@ -2478,11 +2696,9 @@ call void asm sideeffect "eieio", ""() contain and should generate its usual stack alignment code in the prologue if the 'alignstack' keyword is present:

    -
    -
    +
     call void asm alignstack "eieio", ""()
     
    -

    If both keywords appear the 'sideeffect' keyword must come first.

    @@ -2492,14 +2708,39 @@ call void asm alignstack "eieio", ""() etc need to be documented). This is probably best done by reference to another document that covers inline asm from a holistic perspective.

    +

    +Inline Asm Metadata +

    + +
    + +

    The call instructions that wrap inline asm nodes may have a "!srcloc" MDNode + attached to it that contains a list of constant integers. If present, the + code generator will use the integer as the location cookie value when report + errors through the LLVMContext error reporting mechanisms. This allows a + front-end to correlate backend errors that occur with inline asm back to the + source code that produced it. For example:

    + +
    +call void asm sideeffect "something bad", ""(), !srcloc !42
    +...
    +!42 = !{ i32 1234567 }
    +
    + +

    It is up to the front-end to make sense of the magic numbers it places in the + IR. If the MDNode contains multiple constants, the code generator will use + the one that corresponds to the line of the asm that the error occurs on.

    +
    - - -
    + +

    + Metadata Nodes and Metadata Strings +

    + +

    LLVM IR allows metadata to be attached to instructions in the program that can convey extra information about the code to the optimizers and code @@ -2521,15 +2762,34 @@ call void asm alignstack "eieio", ""() metadata nodes, which can be looked up in the module symbol table. For example: "!foo = metadata !{!4, !3}". +

    Metadata can be used as function arguments. Here llvm.dbg.value + function is using two metadata arguments.

    + +
    +
    +call void @llvm.dbg.value(metadata !24, i64 0, metadata !25)
    +
    +
    + +

    Metadata can be attached with an instruction. Here metadata !21 is + attached with add instruction using !dbg identifier.

    + +
    +
    +%indvar.next = add i64 %indvar, 1, !dbg !21
    +
    +
    + +
    - + - +

    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 @@ -2537,11 +2797,11 @@ section and all globals that start with "llvm." are reserved for use by LLVM.

    - + -
    +

    The @llvm.used global is an array with i8* element type which has appending linkage. This array contains a list of @@ -2572,11 +2832,13 @@ object file to prevent the assembler and linker from molesting the symbol.

    - +

    + + The 'llvm.compiler.used' Global Variable + +

    -
    +

    The @llvm.compiler.used directive is the same as the @llvm.used directive, except that it only prevents the compiler from @@ -2590,33 +2852,43 @@ should not be exposed to source languages.

    - - -
    + -

    TODO: Describe this.

    +
    +
    +%0 = type { i32, void ()* }
    +@llvm.global_ctors = appending global [1 x %0] [%0 { i32 65535, void ()* @ctor }]
    +
    +

    The @llvm.global_ctors array contains a list of constructor functions and associated priorities. The functions referenced by this array will be called in ascending order of priority (i.e. lowest first) when the module is loaded. The order of functions with the same priority is not defined. +

    - + -
    +
    +
    +%0 = type { i32, void ()* }
    +@llvm.global_dtors = appending global [1 x %0] [%0 { i32 65535, void ()* @dtor }]
    +
    -

    TODO: Describe this.

    +

    The @llvm.global_dtors array contains a list of destructor functions and associated priorities. The functions referenced by this array will be called in descending order of priority (i.e. highest first) when the module is loaded. The order of functions with the same priority is not defined. +

    +
    - +

    Instruction Reference

    -
    +

    The LLVM instruction set consists of several different classifications of instructions: terminator @@ -2625,13 +2897,12 @@ should not be exposed to source languages.

    memory instructions, and other instructions.

    -
    - - +

    + Terminator Instructions +

    -
    +

    As mentioned previously, every basic block in a program ends with a "Terminator" instruction, which indicates which @@ -2640,7 +2911,7 @@ Instructions

    control flow, not values (the one exception being the 'invoke' instruction).

    -

    There are six different terminator instructions: the +

    There are seven different terminator instructions: the 'ret' instruction, the 'br' instruction, the 'switch' instruction, the @@ -2649,13 +2920,12 @@ Instructions

    'unwind' instruction, and the 'unreachable' instruction.

    -
    - - +

    + 'ret' Instruction +

    -
    +
    Syntax:
    @@ -2701,9 +2971,11 @@ Instruction 
    - +

    + 'br' Instruction +

    -
    +
    Syntax:
    @@ -2742,11 +3014,11 @@ IfUnequal:
     
    - + -
    +
    Syntax:
    @@ -2797,11 +3069,11 @@ IfUnequal:
     
     
     
    -
    +
     
    -
    +
    Syntax:
    @@ -2845,11 +3117,11 @@ IfUnequal:
     
     
     
    -
    +
     
    -
    +
    Syntax:
    @@ -2888,9 +3160,10 @@ IfUnequal:
           function to be invoked. 
     
       
  • 'function args': argument list whose types match the function - signature argument types. If the function signature indicates the - function accepts a variable number of arguments, the extra arguments can - be specified.
  • + signature argument types and parameter attributes. All arguments must be + of first class type. If the function + signature indicates the function 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.
  • @@ -2934,10 +3207,11 @@ that the invoke/unwind semantics are likely to change in future versions.

    - +

    + 'unwind' Instruction +

    -
    +
    Syntax:
    @@ -2965,10 +3239,11 @@ that the invoke/unwind semantics are likely to change in future versions.

    - +

    + 'unreachable' Instruction +

    -
    +
    Syntax:
    @@ -2986,10 +3261,14 @@ Instruction 
    +
    + - +

    + Binary Operations +

    -
    +

    Binary operators are used to do most of the computation in a program. They require two operands of the same type, execute an operation on them, and @@ -2999,14 +3278,12 @@ Instruction

    There are several different binary operators:

    -
    - - + -
    +
    Syntax:
    @@ -3036,7 +3313,8 @@ Instruction 

    nuw and nsw stand for "No Unsigned Wrap" and "No Signed Wrap", respectively. If the nuw and/or nsw keywords are present, the result value of the add - is undefined if unsigned and/or signed overflow, respectively, occurs.

    + is a trap value if unsigned and/or signed overflow, + respectively, occurs.

    Example:
    @@ -3046,11 +3324,11 @@ Instruction 
    - + -
    +
    Syntax:
    @@ -3076,11 +3354,11 @@ Instruction 
    - + -
    +
    Syntax:
    @@ -3116,7 +3394,8 @@ Instruction 

    nuw and nsw stand for "No Unsigned Wrap" and "No Signed Wrap", respectively. If the nuw and/or nsw keywords are present, the result value of the sub - is undefined if unsigned and/or signed overflow, respectively, occurs.

    + is a trap value if unsigned and/or signed overflow, + respectively, occurs.

    Example:
    @@ -3127,11 +3406,11 @@ Instruction 
    - + -
    +
    Syntax:
    @@ -3163,11 +3442,11 @@ Instruction 
    - + -
    +
    Syntax:
    @@ -3202,7 +3481,8 @@ Instruction 

    nuw and nsw stand for "No Unsigned Wrap" and "No Signed Wrap", respectively. If the nuw and/or nsw keywords are present, the result value of the mul - is undefined if unsigned and/or signed overflow, respectively, occurs.

    + is a trap value if unsigned and/or signed overflow, + respectively, occurs.

    Example:
    @@ -3212,11 +3492,11 @@ Instruction 
    - + -
    +
    Syntax:
    @@ -3242,14 +3522,16 @@ Instruction 
    - +

    + 'udiv' Instruction +

    -
    +
    Syntax:
    -  <result> = udiv <ty> <op1>, <op2>   ; yields {ty}:result
    +  <result> = udiv <ty> <op1>, <op2>         ; yields {ty}:result
    +  <result> = udiv exact <ty> <op1>, <op2>   ; yields {ty}:result
     
    Overview:
    @@ -3268,6 +3550,11 @@ Instruction

    Division by zero leads to undefined behavior.

    +

    If the exact keyword is present, the result value of the + udiv is a trap value if %op1 is not a + multiple of %op2 (as such, "((a udiv exact b) mul b) == a").

    + +
    Example:
       <result> = udiv i32 4, %var          ; yields {i32}:result = 4 / %var
    @@ -3276,10 +3563,11 @@ Instruction 
    - +

    + 'sdiv' Instruction +

    -
    +
    Syntax:
    @@ -3307,8 +3595,8 @@ Instruction 
    a 32-bit division of -2147483648 by -1.

    If the exact keyword is present, the result value of the - sdiv is undefined if the result would be rounded or if overflow - would occur.

    + sdiv is a trap value if the result would + be rounded.

    Example:
    @@ -3318,10 +3606,11 @@ Instruction 
    - +

    + 'fdiv' Instruction +

    -
    +
    Syntax:
    @@ -3347,10 +3636,11 @@ Instruction 
    - +

    + 'urem' Instruction +

    -
    +
    Syntax:
    @@ -3384,11 +3674,11 @@ Instruction 
    - + -
    +
    Syntax:
    @@ -3408,9 +3698,10 @@ Instruction 
    Semantics:

    This instruction returns the remainder of a division (where the result - has the same sign as the dividend, op1), not the modulo - operator (where the result has the same sign as the divisor, op2) of - a value. For more information about the difference, + is either zero or has the same sign as the dividend, op1), not the + modulo operator (where the result is either zero or has the same sign + as the divisor, op2) of a value. + For more information about the difference, see The Math Forum. For a table of how this is implemented in various languages, please see @@ -3434,10 +3725,11 @@ Instruction

    - +

    + 'frem' Instruction +

    -
    +
    Syntax:
    @@ -3464,11 +3756,14 @@ Instruction 
    +
    + - +

    + Bitwise Binary Operations +

    -
    +

    Bitwise binary operators are used to do various forms of bit-twiddling in a program. They are generally very efficient instructions and can commonly be @@ -3476,17 +3771,19 @@ Operations

    same type, execute an operation on them, and produce a single value. The resulting value is the same type as its operands.

    -
    - - +

    + 'shl' Instruction +

    -
    +
    Syntax:
    -  <result> = shl <ty> <op1>, <op2>   ; yields {ty}:result
    +  <result> = shl <ty> <op1>, <op2>           ; yields {ty}:result
    +  <result> = shl nuw <ty> <op1>, <op2>       ; yields {ty}:result
    +  <result> = shl nsw <ty> <op1>, <op2>       ; yields {ty}:result
    +  <result> = shl nuw nsw <ty> <op1>, <op2>   ; yields {ty}:result
     
    Overview:
    @@ -3506,6 +3803,14 @@ Instruction
    vectors, each vector element of op1 is shifted by the corresponding shift amount in op2.

    +

    If the nuw keyword is present, then the shift produces a + trap value if it shifts out any non-zero bits. If + the nsw keyword is present, then the shift produces a + trap value if it shifts out any bits that disagree + with the resultant sign bit. As such, NUW/NSW have the same semantics as + they would if the shift were expressed as a mul instruction with the same + nsw/nuw bits in (mul %op1, (shl 1, %op2)).

    +
    Example:
       <result> = shl i32 4, %var   ; yields {i32}: 4 << %var
    @@ -3518,14 +3823,16 @@ Instruction 
    - +

    + 'lshr' Instruction +

    -
    +
    Syntax:
    -  <result> = lshr <ty> <op1>, <op2>   ; yields {ty}:result
    +  <result> = lshr <ty> <op1>, <op2>         ; yields {ty}:result
    +  <result> = lshr exact <ty> <op1>, <op2>   ; yields {ty}:result
     
    Overview:
    @@ -3545,6 +3852,11 @@ Instruction
    vectors, each vector element of op1 is shifted by the corresponding shift amount in op2.

    +

    If the exact keyword is present, the result value of the + lshr is a trap value if any of the bits + shifted out are non-zero.

    + +
    Example:
       <result> = lshr i32 4, 1   ; yields {i32}:result = 2
    @@ -3558,13 +3870,16 @@ Instruction 
    - -
    +

    + 'ashr' Instruction +

    + +
    Syntax:
    -  <result> = ashr <ty> <op1>, <op2>   ; yields {ty}:result
    +  <result> = ashr <ty> <op1>, <op2>         ; yields {ty}:result
    +  <result> = ashr exact <ty> <op1>, <op2>   ; yields {ty}:result
     
    Overview:
    @@ -3585,6 +3900,10 @@ Instruction
    the arguments are vectors, each vector element of op1 is shifted by the corresponding shift amount in op2.

    +

    If the exact keyword is present, the result value of the + ashr is a trap value if any of the bits + shifted out are non-zero.

    +
    Example:
       <result> = ashr i32 4, 1   ; yields {i32}:result = 2
    @@ -3598,10 +3917,11 @@ Instruction 
    - +

    + 'and' Instruction +

    -
    +
    Syntax:
    @@ -3658,9 +3978,11 @@ Instruction 
    - +

    + 'or' Instruction +

    -
    +
    Syntax:
    @@ -3719,10 +4041,11 @@ Instruction 
    - +

    + 'xor' Instruction +

    -
    +
    Syntax:
    @@ -3782,12 +4105,14 @@ Instruction 
    +
    + - + -
    +

    LLVM supports several instructions to represent vector operations in a target-independent manner. These instructions cover the element-access and @@ -3796,14 +4121,12 @@ Instruction

    will want to use target-specific intrinsics to take full advantage of a specific target.

    -
    - - + -
    +
    Syntax:
    @@ -3835,11 +4158,11 @@ Instruction 
    - + -
    +
    Syntax:
    @@ -3871,11 +4194,11 @@ Instruction 
    - + -
    +
    Syntax:
    @@ -3918,24 +4241,24 @@ Instruction 
    +
    + - + -
    +

    LLVM supports several instructions for working with aggregate values.

    -
    - - + -
    +
    Syntax:
    @@ -3948,10 +4271,18 @@ Instruction 
    Arguments:

    The first operand of an 'extractvalue' instruction is a value - of struct, union or + of struct or array type. The operands are constant indices to specify which value to extract in a similar manner as indices in a 'getelementptr' instruction.

    +

    The major differences to getelementptr indexing are:

    +
      +
    • Since the value being indexed is not a pointer, the first index is + omitted and assumed to be zero.
    • +
    • At least one index must be specified.
    • +
    • Not only struct indices but also array indices must be in + bounds.
    • +
    Semantics:

    The result is the value at the position in the aggregate specified by the @@ -3965,15 +4296,15 @@ Instruction

    - + -
    +
    Syntax:
    -  <result> = insertvalue <aggregate type> <val>, <ty> <elt>, <idx>    ; yields <aggregate type>
    +  <result> = insertvalue <aggregate type> <val>, <ty> <elt>, <idx>{, }*    ; yields <aggregate type>
     
    Overview:
    @@ -3982,11 +4313,11 @@ Instruction
    Arguments:

    The first operand of an 'insertvalue' instruction is a value - of struct, union or + of struct or array type. The second operand is a first-class value to insert. The following operands are constant indices indicating the position at which to insert the value in a similar manner as indices in a - 'getelementptr' instruction. The + 'extractvalue' instruction. The value to insert must have the same type as the value identified by the indices.

    @@ -3997,37 +4328,37 @@ Instruction
    Example:
    -  %agg1 = insertvalue {i32, float} undef, i32 1, 0         ; yields {i32 1, float undef}
    -  %agg2 = insertvalue {i32, float} %agg1, float %val, 1    ; yields {i32 1, float %val}
    +  %agg1 = insertvalue {i32, float} undef, i32 1, 0              ; yields {i32 1, float undef}
    +  %agg2 = insertvalue {i32, float} %agg1, float %val, 1         ; yields {i32 1, float %val}
    +  %agg3 = insertvalue {i32, {float}} %agg1, float %val, 1, 0    ; yields {i32 1, float %val}
     
    +
    - + -
    +

    A key design point of an SSA-based representation is how it represents memory. In LLVM, no memory locations are in SSA form, which makes things very simple. This section describes how to read, write, and allocate memory in LLVM.

    -
    - - + -
    +
    Syntax:
    -  <result> = alloca <type>[, i32 <NumElements>][, align <alignment>]     ; yields {type*}:result
    +  <result> = alloca <type>[, <ty> <NumElements>][, align <alignment>]     ; yields {type*}:result
     
    Overview:
    @@ -4070,16 +4401,17 @@ Instruction
    - +

    + 'load' Instruction +

    -
    +
    Syntax:
    -  <result> = load <ty>* <pointer>[, align <alignment>][, !nontemporal !]
    -  <result> = volatile load <ty>* <pointer>[, align <alignment>][, !nontemporal !]
    -  ! = !{ i32 1 }
    +  <result> = load <ty>* <pointer>[, align <alignment>][, !nontemporal !<index>]
    +  <result> = volatile load <ty>* <pointer>[, align <alignment>][, !nontemporal !<index>]
    +  !<index> = !{ i32 1 }
     
    Overview:
    @@ -4090,25 +4422,24 @@ Instruction
    from which to load. The pointer must point to a first class type. If the load is marked as volatile, then the optimizer is not allowed to modify the - number or order of execution of this load with other - volatile load and store - instructions.

    + number or order of execution of this load with other volatile operations.

    -

    The optional constant "align" argument specifies the alignment of the +

    The optional constant align argument specifies the alignment of the operation (that is, the alignment of the memory address). A value of 0 or an - omitted "align" argument means that the operation has the preferential + omitted align argument means that the operation has the preferential alignment for the target. It is the responsibility of the code emitter to ensure that the alignment information is correct. Overestimating the - alignment results in an undefined behavior. Underestimating the alignment may + alignment results in undefined behavior. Underestimating the alignment may produce less efficient code. An alignment of 1 is always safe.

    -

    The optional !nontemporal metadata must reference a single metatadata - name corresponding to a metadata node with one i32 entry of - value 1. The existance of the !nontemporal metatadata on the - instruction tells the optimizer and code generator that this load is - not expected to be reused in the cache. The code generator may - select special instructions to save cache bandwidth, such as the - MOVNT intruction on x86.

    +

    The optional !nontemporal metadata must reference a single + metatadata name <index> corresponding to a metadata node with + one i32 entry of value 1. The existence of + the !nontemporal metatadata on the instruction tells the optimizer + and code generator that this load is not expected to be reused in the cache. + The code generator may select special instructions to save cache bandwidth, + such as the MOVNT instruction on x86.

    Semantics:

    The location of memory pointed to is loaded. If the value being loaded is of @@ -4129,15 +4460,16 @@ Instruction

    - +

    + 'store' Instruction +

    -
    +
    Syntax:
    -  store <ty> <value>, <ty>* <pointer>[, align <alignment>][, !nontemporal !]                   ; yields {void}
    -  volatile store <ty> <value>, <ty>* <pointer>[, align <alignment>][, !nontemporal !]          ; yields {void}
    +  store <ty> <value>, <ty>* <pointer>[, align <alignment>][, !nontemporal !<index>]                   ; yields {void}
    +  volatile store <ty> <value>, <ty>* <pointer>[, align <alignment>][, !nontemporal !<index>]          ; yields {void}
     
    Overview:
    @@ -4148,11 +4480,10 @@ Instruction
    and an address at which to store it. The type of the '<pointer>' operand must be a pointer to the first class type of the - '<value>' operand. If the store is marked - as volatile, then the optimizer is not allowed to modify the number - or order of execution of this store with other - volatile load and store - instructions.

    + '<value>' operand. If the store is marked as + volatile, then the optimizer is not allowed to modify the number or + order of execution of this store with other volatile operations.

    The optional constant "align" argument specifies the alignment of the operation (that is, the alignment of the memory address). A value of 0 or an @@ -4163,12 +4494,12 @@ Instruction

    produce less efficient code. An alignment of 1 is always safe.

    The optional !nontemporal metadata must reference a single metatadata - name corresponding to a metadata node with one i32 entry of - value 1. The existance of the !nontemporal metatadata on the + name <index> corresponding to a metadata node with one i32 entry of + value 1. The existence of the !nontemporal metatadata on the instruction tells the optimizer and code generator that this load is not expected to be reused in the cache. The code generator may select special instructions to save cache bandwidth, such as the - MOVNT intruction on x86.

    + MOVNT instruction on x86.

    Semantics:
    @@ -4191,11 +4522,11 @@ Instruction
    - + -
    +
    Syntax:
    @@ -4217,12 +4548,12 @@ Instruction 
    indexes a value of the type pointed to (not necessarily the value directly pointed to, since the first index can be non-zero), etc. The first type indexed into must be a pointer value, subsequent types can be arrays, - vectors, structs and unions. Note that subsequent types being indexed into + vectors, and structs. Note that subsequent types being indexed into can never be pointers, since that would require loading the pointer before continuing calculation.

    The type of each index argument depends on the type it is indexing into. - When indexing into a (optionally packed) structure or union, only i32 + When indexing into a (optionally packed) structure, only i32 integer constants are allowed. When indexing into an array, pointer or vector, integers of any width are allowed, and they are not required to be constant.

    @@ -4230,8 +4561,7 @@ Instruction

    For example, let's consider a C code fragment and how it gets compiled to LLVM:

    -
    -
    +
     struct RT {
       char A;
       int B[10][20];
    @@ -4247,12 +4577,10 @@ int *foo(struct ST *s) {
       return &s[1].Z.B[5][13];
     }
     
    -

    The LLVM code generated by the GCC frontend is:

    -
    -
    +
     %RT = type { i8 , [10 x [20 x i32]], i8  }
     %ST = type { i32, double, %RT }
     
    @@ -4262,7 +4590,6 @@ entry:
       ret i32* %reg
     }
     
    -
    Semantics:

    In the example above, the first index is indexing into the '%ST*' @@ -4291,13 +4618,14 @@ entry:

    If the inbounds keyword is present, the result value of the - getelementptr is undefined if the base pointer is not an - in bounds address of an allocated object, or if any of the addresses - that would be formed by successive addition of the offsets implied by the - indices to the base address with infinitely precise arithmetic are not an - in bounds address of that allocated object. - The in bounds addresses for an allocated object are all the addresses - that point into the object, plus the address one byte past the end.

    + getelementptr is a trap value if the + base pointer is not an in bounds address of an allocated object, + or if any of the addresses that would be formed by successive addition of + the offsets implied by the indices to the base address with infinitely + precise arithmetic are not an in bounds address of that allocated + object. The in bounds addresses for an allocated object are all + the addresses that point into the object, plus the address one byte past + the end.

    If the inbounds keyword is not present, the offsets are added to the base address with silently-wrapping two's complement arithmetic, and @@ -4324,23 +4652,25 @@ entry:

    - - -
    + +

    + Conversion Operations +

    + +

    The instructions in this category are the conversion instructions (casting) which all take a single operand and a type. They perform various bit conversions on the operand.

    -
    - - -
    + + +
    Syntax:
    @@ -4352,12 +4682,12 @@ entry:
        type ty2.

    Arguments:
    -

    The 'trunc' instruction takes a value to trunc, which must - be an integer type, and a type that specifies the - size and type of the result, which must be - an integer type. The bit size of value must - be larger than the bit size of ty2. Equal sized types are not - allowed.

    +

    The 'trunc' instruction takes a value to trunc, and a type to trunc it to. + Both types must be of integer types, or vectors + of the same number of integers. + The bit size of the value must be larger than + the bit size of the destination type, ty2. + Equal sized types are not allowed.

    Semantics:

    The 'trunc' instruction truncates the high order bits @@ -4367,18 +4697,20 @@ entry:

    Example:
    -  %X = trunc i32 257 to i8              ; yields i8:1
    -  %Y = trunc i32 123 to i1              ; yields i1:true
    -  %Z = trunc i32 122 to i1              ; yields i1:false
    +  %X = trunc i32 257 to i8                        ; yields i8:1
    +  %Y = trunc i32 123 to i1                        ; yields i1:true
    +  %Z = trunc i32 122 to i1                        ; yields i1:false
    +  %W = trunc <2 x i16> <i16 8, i16 7> to <2 x i8> ; yields <i8 8, i8 7>
     
    - -
    + + +
    Syntax:
    @@ -4391,10 +4723,11 @@ entry:
     
     
     
    Arguments:
    -

    The 'zext' instruction takes a value to cast, which must be of - integer type, and a type to cast it to, which must - also be of integer type. The bit size of the - value must be smaller than the bit size of the destination type, +

    The 'zext' instruction takes a value to cast, and a type to cast it to. + Both types must be of integer types, or vectors + of the same number of integers. + The bit size of the value must be smaller than + the bit size of the destination type, ty2.

    Semantics:
    @@ -4407,15 +4740,17 @@ entry:
       %X = zext i32 257 to i64              ; yields i64:257
       %Y = zext i1 true to i32              ; yields i32:1
    +  %Z = zext <2 x i16> <i16 8, i16 7> to <2 x i32> ; yields <i32 8, i32 7>
     
    - -
    + + +
    Syntax:
    @@ -4426,10 +4761,11 @@ entry:
     

    The 'sext' sign extends value to the type ty2.

    Arguments:
    -

    The 'sext' instruction takes a value to cast, which must be of - integer type, and a type to cast it to, which must - also be of integer type. The bit size of the - value must be smaller than the bit size of the destination type, +

    The 'sext' instruction takes a value to cast, and a type to cast it to. + Both types must be of integer types, or vectors + of the same number of integers. + The bit size of the value must be smaller than + the bit size of the destination type, ty2.

    Semantics:
    @@ -4443,16 +4779,17 @@ entry:
       %X = sext i8  -1 to i16              ; yields i16   :65535
       %Y = sext i1 true to i32             ; yields i32:-1
    +  %Z = sext <2 x i16> <i16 8, i16 7> to <2 x i32> ; yields <i32 8, i32 7>
     
    - + -
    +
    Syntax:
    @@ -4486,10 +4823,11 @@ entry:
     
    - -
    + + +
    Syntax:
    @@ -4515,17 +4853,18 @@ entry:
     
     
    Example:
    -  %X = fpext float 3.1415 to double        ; yields double:3.1415
    -  %Y = fpext float 1.0 to float            ; yields float:1.0 (no-op)
    +  %X = fpext float 3.125 to double         ; yields double:3.125000e+00
    +  %Y = fpext double %X to fp128            ; yields fp128:0xL00000000000000004000900000000000
     
    - -
    + + +
    Syntax:
    @@ -4559,10 +4898,11 @@ entry:
     
    - -
    + + +
    Syntax:
    @@ -4597,10 +4937,11 @@ entry:
     
    - -
    + + +
    Syntax:
    @@ -4633,10 +4974,11 @@ entry:
     
    - -
    + + +
    Syntax:
    @@ -4668,10 +5010,11 @@ entry:
     
    - -
    + + +
    Syntax:
    @@ -4705,10 +5048,11 @@ entry:
     
    - -
    + + +
    Syntax:
    @@ -4742,10 +5086,11 @@ entry:
     
    - -
    + + +
    Syntax:
    @@ -4784,21 +5129,24 @@ entry:
     
     
    +
    + - +

    + Other Operations +

    -
    +

    The instructions in this category are the "miscellaneous" instructions, which defy better classification.

    -
    - - +

    + 'icmp' Instruction +

    -
    +
    Syntax:
    @@ -4897,10 +5245,11 @@ entry:
     
    - +

    + 'fcmp' Instruction +

    -
    +
    Syntax:
    @@ -4964,7 +5313,7 @@ entry:
           op1 is equal to op2.
     
       
  • ogt: yields true if both operands are not a QNAN and - op1 is greather than op2.
  • + op1 is greater than op2.
  • oge: yields true if both operands are not a QNAN and op1 is greater than or equal to op2.
  • @@ -5017,11 +5366,11 @@ entry:
    - + -
    +
    Syntax:
    @@ -5065,11 +5414,11 @@ Loop:       ; Infinite loop that counts from 0 on up...
     
    - + -
    +
    Syntax:
    @@ -5108,11 +5457,11 @@ Loop:       ; Infinite loop that counts from 0 on up...
     
    - + -
    +
    Syntax:
    @@ -5132,15 +5481,18 @@ Loop:       ; Infinite loop that counts from 0 on up...
           a ret instruction.  If the "tail" marker is
           present, the function call is eligible for tail call optimization,
           but might not in fact be
    -      optimized into a jump.  As of this writing, the extra requirements for
    -      a call to actually be optimized are:
    +      optimized into a jump.  The code generator may optimize calls marked
    +      "tail" with either 1) automatic 
    +      sibling call optimization when the caller and callee have
    +      matching signatures, or 2) forced tail call optimization when the
    +      following extra requirements are met:
           
    • Caller and callee both have the calling convention fastcc.
    • The call is in tail position (ret immediately follows call and ret uses value of call or is void).
    • Option -tailcallopt is enabled, - or llvm::PerformTailCallOpt is true.
    • + or llvm::GuaranteedTailCallOpt is true.
    • Platform specific constraints are met.
    @@ -5171,10 +5523,10 @@ Loop: ; Infinite loop that counts from 0 on up... to function value.
  • 'function args': argument list whose types match the function - signature argument types. All arguments must be of - first class type. If the function signature - indicates the function accepts a variable number of arguments, the extra - arguments can be specified.
  • + signature argument types and parameter attributes. All arguments must be + of first class type. If the function + signature indicates the function accepts a variable number of arguments, + the extra arguments can be specified.
  • The optional function attributes list. Only 'noreturn', 'nounwind', 'readonly' and @@ -5192,7 +5544,7 @@ Loop: ; Infinite loop that counts from 0 on up...
    Example:
       %retval = call i32 @test(i32 %argc)
    -  call i32 (i8 *, ...)* @printf(i8 * %msg, i32 12, i8 42)      ; yields i32
    +  call i32 (i8*, ...)* @printf(i8* %msg, i32 12, i8 42)        ; yields i32
       %X = tail call i32 @foo()                                    ; yields i32
       %Y = tail call fastcc i32 @foo()  ; yields i32
       call void %foo(i8 97 signext)
    @@ -5209,16 +5561,16 @@ Loop:       ; Infinite loop that counts from 0 on up...
     standard C99 library as being the C99 library functions, and may perform
     optimizations or generate code for them under that assumption.  This is
     something we'd like to change in the future to provide better support for
    -freestanding environments and non-C-based langauges.

    +freestanding environments and non-C-based languages.

  • - + -
    +
    Syntax:
    @@ -5259,11 +5611,15 @@ freestanding environments and non-C-based langauges.

    +
    + +
    + - +

    Intrinsic Functions

    -
    +

    LLVM supports the notion of an "intrinsic function". These functions have well known names and semantics and are required to follow certain @@ -5306,14 +5662,12 @@ freestanding environments and non-C-based langauges.

    To learn how to add an intrinsic function, please see the Extending LLVM Guide.

    -
    - - + -
    +

    Variable argument support is defined in LLVM with the va_arg instruction and these three @@ -5329,8 +5683,7 @@ freestanding environments and non-C-based langauges.

    instruction and the variable argument handling intrinsic functions are used.

    -
    -
    +
     define i32 @test(i32 %X, ...) {
       ; Initialize variable argument processing
       %ap = alloca i8*
    @@ -5355,17 +5708,14 @@ declare void @llvm.va_start(i8*)
     declare void @llvm.va_copy(i8*, i8*)
     declare void @llvm.va_end(i8*)
     
    -
    - -
    - + -
    +
    Syntax:
    @@ -5391,11 +5741,11 @@ declare void @llvm.va_end(i8*)
     
    - + -
    +
    Syntax:
    @@ -5422,11 +5772,11 @@ declare void @llvm.va_end(i8*)
     
    - + -
    +
    Syntax:
    @@ -5452,12 +5802,14 @@ declare void @llvm.va_end(i8*)
     
     
    +
    + - + -
    +

    LLVM support for Accurate Garbage Collection (GC) requires the implementation and generation of these @@ -5472,14 +5824,12 @@ LLVM.

    The garbage collection intrinsics only operate on objects in the generic address space (address space zero).

    -
    - - + -
    +
    Syntax:
    @@ -5506,11 +5856,11 @@ LLVM.

    - + -
    +
    Syntax:
    @@ -5538,11 +5888,11 @@ LLVM.

    - + -
    +
    Syntax:
    @@ -5569,24 +5919,24 @@ LLVM.

    +
    + - + -
    +

    These intrinsics are provided by LLVM to expose special features that may only be implemented with code generator support.

    -
    - - + -
    +
    Syntax:
    @@ -5617,15 +5967,15 @@ LLVM.

    - + -
    +
    Syntax:
    -  declare i8 *@llvm.frameaddress(i32 <level>)
    +  declare i8* @llvm.frameaddress(i32 <level>)
     
    Overview:
    @@ -5651,15 +6001,15 @@ LLVM.

    - + -
    +
    Syntax:
    -  declare i8 *@llvm.stacksave()
    +  declare i8* @llvm.stacksave()
     
    Overview:
    @@ -5681,15 +6031,15 @@ LLVM.

    - + -
    +
    Syntax:
    -  declare void @llvm.stackrestore(i8 * %ptr)
    +  declare void @llvm.stackrestore(i8* %ptr)
     
    Overview:
    @@ -5706,11 +6056,11 @@ LLVM.

    - + -
    +
    Syntax:
    @@ -5739,11 +6089,11 @@ LLVM.

    - + -
    +
    Syntax:
    @@ -5765,20 +6115,20 @@ LLVM.

    Semantics:

    This intrinsic does not modify the behavior of the program. Backends that do - not support this intrinisic may ignore it.

    + not support this intrinsic may ignore it.

    - + -
    +
    Syntax:
    -  declare i64 @llvm.readcyclecounter( )
    +  declare i64 @llvm.readcyclecounter()
     
    Overview:
    @@ -5796,40 +6146,37 @@ LLVM.

    +
    + - + -
    +

    LLVM provides intrinsics for a few important standard C library functions. These intrinsics allow source-language front-ends to pass information about the alignment of the pointer arguments to the code generator, providing opportunity for more efficient code generation.

    -
    - - + -
    +
    Syntax:

    This is an overloaded intrinsic. You can use llvm.memcpy on any - integer bit width. Not all targets support all bit widths however.

    + integer bit width and for different address spaces. Not all targets support + all bit widths however.

    -  declare void @llvm.memcpy.i8(i8 * <dest>, i8 * <src>,
    -                               i8 <len>, i32 <align>)
    -  declare void @llvm.memcpy.i16(i8 * <dest>, i8 * <src>,
    -                                i16 <len>, i32 <align>)
    -  declare void @llvm.memcpy.i32(i8 * <dest>, i8 * <src>,
    -                                i32 <len>, i32 <align>)
    -  declare void @llvm.memcpy.i64(i8 * <dest>, i8 * <src>,
    -                                i64 <len>, i32 <align>)
    +  declare void @llvm.memcpy.p0i8.p0i8.i32(i8* <dest>, i8* <src>,
    +                                          i32 <len>, i32 <align>, i1 <isvolatile>)
    +  declare void @llvm.memcpy.p0i8.p0i8.i64(i8* <dest>, i8* <src>,
    +                                          i64 <len>, i32 <align>, i1 <isvolatile>)
     
    Overview:
    @@ -5837,19 +6184,28 @@ LLVM.

    source location to the destination location.

    Note that, unlike the standard libc function, the llvm.memcpy.* - intrinsics do not return a value, and takes an extra alignment argument.

    + intrinsics do not return a value, takes extra alignment/isvolatile arguments + and the pointers can be in specified address spaces.

    Arguments:
    +

    The first argument is a pointer to the destination, the second is a pointer to the source. The third argument is an integer argument specifying the - number of bytes to copy, and the fourth argument is the alignment of the - source and destination locations.

    + number of bytes to copy, the fourth argument is the alignment of the + source and destination locations, and the fifth is a boolean indicating a + volatile access.

    -

    If the call to this intrinisic has an alignment value that is not 0 or 1, +

    If the call to this intrinsic has an alignment value that is not 0 or 1, then the caller guarantees that both the source and destination pointers are aligned to that boundary.

    +

    If the isvolatile parameter is true, the + llvm.memcpy call is a volatile operation. + The detailed access behavior is not very cleanly specified and it is unwise + to depend on it.

    +
    Semantics:
    +

    The 'llvm.memcpy.*' intrinsics copy a block of memory from the source location to the destination location, which are not allowed to overlap. It copies "len" bytes of memory over. If the argument is known to @@ -5859,25 +6215,22 @@ LLVM.

    - + -
    +
    Syntax:

    This is an overloaded intrinsic. You can use llvm.memmove on any integer bit - width. Not all targets support all bit widths however.

    + width and for different address space. Not all targets support all bit + widths however.

    -  declare void @llvm.memmove.i8(i8 * <dest>, i8 * <src>,
    -                                i8 <len>, i32 <align>)
    -  declare void @llvm.memmove.i16(i8 * <dest>, i8 * <src>,
    -                                 i16 <len>, i32 <align>)
    -  declare void @llvm.memmove.i32(i8 * <dest>, i8 * <src>,
    -                                 i32 <len>, i32 <align>)
    -  declare void @llvm.memmove.i64(i8 * <dest>, i8 * <src>,
    -                                 i64 <len>, i32 <align>)
    +  declare void @llvm.memmove.p0i8.p0i8.i32(i8* <dest>, i8* <src>,
    +                                           i32 <len>, i32 <align>, i1 <isvolatile>)
    +  declare void @llvm.memmove.p0i8.p0i8.i64(i8* <dest>, i8* <src>,
    +                                           i64 <len>, i32 <align>, i1 <isvolatile>)
     
    Overview:
    @@ -5887,19 +6240,28 @@ LLVM.

    overlap.

    Note that, unlike the standard libc function, the llvm.memmove.* - intrinsics do not return a value, and takes an extra alignment argument.

    + intrinsics do not return a value, takes extra alignment/isvolatile arguments + and the pointers can be in specified address spaces.

    Arguments:
    +

    The first argument is a pointer to the destination, the second is a pointer to the source. The third argument is an integer argument specifying the - number of bytes to copy, and the fourth argument is the alignment of the - source and destination locations.

    + number of bytes to copy, the fourth argument is the alignment of the + source and destination locations, and the fifth is a boolean indicating a + volatile access.

    -

    If the call to this intrinisic has an alignment value that is not 0 or 1, +

    If the call to this intrinsic has an alignment value that is not 0 or 1, then the caller guarantees that the source and destination pointers are aligned to that boundary.

    +

    If the isvolatile parameter is true, the + llvm.memmove call is a volatile operation. + The detailed access behavior is not very cleanly specified and it is unwise + to depend on it.

    +
    Semantics:
    +

    The 'llvm.memmove.*' intrinsics copy a block of memory from the source location to the destination location, which may overlap. It copies "len" bytes of memory over. If the argument is known to be aligned to some @@ -5909,25 +6271,22 @@ LLVM.

    - + -
    +
    Syntax:

    This is an overloaded intrinsic. You can use llvm.memset on any integer bit - width. Not all targets support all bit widths however.

    + width and for different address spaces. However, not all targets support all + bit widths.

    -  declare void @llvm.memset.i8(i8 * <dest>, i8 <val>,
    -                               i8 <len>, i32 <align>)
    -  declare void @llvm.memset.i16(i8 * <dest>, i8 <val>,
    -                                i16 <len>, i32 <align>)
    -  declare void @llvm.memset.i32(i8 * <dest>, i8 <val>,
    -                                i32 <len>, i32 <align>)
    -  declare void @llvm.memset.i64(i8 * <dest>, i8 <val>,
    -                                i64 <len>, i32 <align>)
    +  declare void @llvm.memset.p0i8.i32(i8* <dest>, i8 <val>,
    +                                     i32 <len>, i32 <align>, i1 <isvolatile>)
    +  declare void @llvm.memset.p0i8.i64(i8* <dest>, i8 <val>,
    +                                     i64 <len>, i32 <align>, i1 <isvolatile>)
     
    Overview:
    @@ -5935,18 +6294,24 @@ LLVM.

    particular byte value.

    Note that, unlike the standard libc function, the llvm.memset - intrinsic does not return a value, and takes an extra alignment argument.

    + intrinsic does not return a value and takes extra alignment/volatile + arguments. Also, the destination can be in an arbitrary address space.

    Arguments:

    The first argument is a pointer to the destination to fill, the second is the - byte value to fill it with, the third argument is an integer argument + byte value with which to fill it, the third argument is an integer argument specifying the number of bytes to fill, and the fourth argument is the known - alignment of destination location.

    + alignment of the destination location.

    -

    If the call to this intrinisic has an alignment value that is not 0 or 1, +

    If the call to this intrinsic has an alignment value that is not 0 or 1, then the caller guarantees that the destination pointer is aligned to that boundary.

    +

    If the isvolatile parameter is true, the + llvm.memset call is a volatile operation. + The detailed access behavior is not very cleanly specified and it is unwise + to depend on it.

    +
    Semantics:

    The 'llvm.memset.*' intrinsics fill "len" bytes of memory starting at the destination location. If the argument is known to be aligned to some @@ -5956,11 +6321,11 @@ LLVM.

    - + -
    +
    Syntax:

    This is an overloaded intrinsic. You can use llvm.sqrt on any @@ -5994,11 +6359,11 @@ LLVM.

    - + -
    +
    Syntax:

    This is an overloaded intrinsic. You can use llvm.powi on any @@ -6030,11 +6395,11 @@ LLVM.

    - + -
    +
    Syntax:

    This is an overloaded intrinsic. You can use llvm.sin on any @@ -6064,11 +6429,11 @@ LLVM.

    - + -
    +
    Syntax:

    This is an overloaded intrinsic. You can use llvm.cos on any @@ -6098,11 +6463,11 @@ LLVM.

    - + -
    +
    Syntax:

    This is an overloaded intrinsic. You can use llvm.pow on any @@ -6132,24 +6497,90 @@ LLVM.

    +
    + + +

    + 'llvm.exp.*' Intrinsic +

    + +
    + +
    Syntax:
    +

    This is an overloaded intrinsic. You can use llvm.exp on any + floating point or vector of floating point type. Not all targets support all + types however.

    + +
    +  declare float     @llvm.exp.f32(float  %Val)
    +  declare double    @llvm.exp.f64(double %Val)
    +  declare x86_fp80  @llvm.exp.f80(x86_fp80  %Val)
    +  declare fp128     @llvm.exp.f128(fp128 %Val)
    +  declare ppc_fp128 @llvm.exp.ppcf128(ppc_fp128  %Val)
    +
    + +
    Overview:
    +

    The 'llvm.exp.*' intrinsics perform the exp function.

    + +
    Arguments:
    +

    The argument and return value are floating point numbers of the same + type.

    + +
    Semantics:
    +

    This function returns the same values as the libm exp functions + would, and handles error conditions in the same way.

    + +
    + + +

    + 'llvm.log.*' Intrinsic +

    + +
    + +
    Syntax:
    +

    This is an overloaded intrinsic. You can use llvm.log on any + floating point or vector of floating point type. Not all targets support all + types however.

    + +
    +  declare float     @llvm.log.f32(float  %Val)
    +  declare double    @llvm.log.f64(double %Val)
    +  declare x86_fp80  @llvm.log.f80(x86_fp80  %Val)
    +  declare fp128     @llvm.log.f128(fp128 %Val)
    +  declare ppc_fp128 @llvm.log.ppcf128(ppc_fp128  %Val)
    +
    + +
    Overview:
    +

    The 'llvm.log.*' intrinsics perform the log function.

    + +
    Arguments:
    +

    The argument and return value are floating point numbers of the same + type.

    + +
    Semantics:
    +

    This function returns the same values as the libm log functions + would, and handles error conditions in the same way.

    + +
    + - + -
    +

    LLVM provides intrinsics for a few important bit manipulation operations. These allow efficient code generation for some algorithms.

    -
    - - + -
    +
    Syntax:

    This is an overloaded intrinsic function. You can use bswap on any integer @@ -6180,11 +6611,11 @@ LLVM.

    - + -
    +
    Syntax:

    This is an overloaded intrinsic. You can use llvm.ctpop on any integer bit @@ -6212,11 +6643,11 @@ LLVM.

    - + -
    +
    Syntax:

    This is an overloaded intrinsic. You can use llvm.ctlz on any @@ -6246,11 +6677,11 @@ LLVM.

    - + -
    +
    Syntax:

    This is an overloaded intrinsic. You can use llvm.cttz on any @@ -6279,23 +6710,25 @@ LLVM.

    +
    + - + -
    +

    LLVM provides intrinsics for some arithmetic with overflow operations.

    -
    - - +

    + + 'llvm.sadd.with.overflow.*' Intrinsics + +

    -
    +
    Syntax:

    This is an overloaded intrinsic. You can use llvm.sadd.with.overflow @@ -6337,11 +6770,13 @@ LLVM.

    - +

    + + 'llvm.uadd.with.overflow.*' Intrinsics + +

    -
    +
    Syntax:

    This is an overloaded intrinsic. You can use llvm.uadd.with.overflow @@ -6382,11 +6817,13 @@ LLVM.

    - +

    + + 'llvm.ssub.with.overflow.*' Intrinsics + +

    -
    +
    Syntax:

    This is an overloaded intrinsic. You can use llvm.ssub.with.overflow @@ -6428,11 +6865,13 @@ LLVM.

    - +

    + + 'llvm.usub.with.overflow.*' Intrinsics + +

    -
    +
    Syntax:

    This is an overloaded intrinsic. You can use llvm.usub.with.overflow @@ -6474,11 +6913,13 @@ LLVM.

    - +

    + + 'llvm.smul.with.overflow.*' Intrinsics + +

    -
    +
    Syntax:

    This is an overloaded intrinsic. You can use llvm.smul.with.overflow @@ -6521,11 +6962,13 @@ LLVM.

    - +

    + + 'llvm.umul.with.overflow.*' Intrinsics + +

    -
    +
    Syntax:

    This is an overloaded intrinsic. You can use llvm.umul.with.overflow @@ -6566,12 +7009,110 @@ LLVM.

    +
    + -
    - Debugger Intrinsics +

    + Half Precision Floating Point Intrinsics +

    + +
    + +

    Half precision floating point is a storage-only format. This means that it is + a dense encoding (in memory) but does not support computation in the + format.

    + +

    This means that code must first load the half-precision floating point + value as an i16, then convert it to float with llvm.convert.from.fp16. + Computation can then be performed on the float value (including extending to + double etc). To store the value back to memory, it is first converted to + float if needed, then converted to i16 with + llvm.convert.to.fp16, then + storing as an i16 value.

    + + +

    + + 'llvm.convert.to.fp16' Intrinsic + +

    + +
    + +
    Syntax:
    +
    +  declare i16 @llvm.convert.to.fp16(f32 %a)
    +
    + +
    Overview:
    +

    The 'llvm.convert.to.fp16' intrinsic function performs + a conversion from single precision floating point format to half precision + floating point format.

    + +
    Arguments:
    +

    The intrinsic function contains single argument - the value to be + converted.

    + +
    Semantics:
    +

    The 'llvm.convert.to.fp16' intrinsic function performs + a conversion from single precision floating point format to half precision + floating point format. The return value is an i16 which + contains the converted number.

    + +
    Examples:
    +
    +  %res = call i16 @llvm.convert.to.fp16(f32 %a)
    +  store i16 %res, i16* @x, align 2
    +
    + +
    + + +

    + + 'llvm.convert.from.fp16' Intrinsic + +

    + +
    + +
    Syntax:
    +
    +  declare f32 @llvm.convert.from.fp16(i16 %a)
    +
    + +
    Overview:
    +

    The 'llvm.convert.from.fp16' intrinsic function performs + a conversion from half precision floating point format to single precision + floating point format.

    + +
    Arguments:
    +

    The intrinsic function contains single argument - the value to be + converted.

    + +
    Semantics:
    +

    The 'llvm.convert.from.fp16' intrinsic function performs a + conversion from half single precision floating point format to single + precision floating point format. The input half-float value is represented by + an i16 value.

    + +
    Examples:
    +
    +  %a = load i16* @x, align 2
    +  %res = call f32 @llvm.convert.from.fp16(i16 %a)
    +
    + +
    +
    -
    + +

    + Debugger Intrinsics +

    + +

    The LLVM debugger intrinsics (which all start with llvm.dbg. prefix), are described in @@ -6581,11 +7122,11 @@ LLVM.

    - + -
    +

    The LLVM exception handling intrinsics (which all start with llvm.eh. prefix), are described in @@ -6595,14 +7136,15 @@ LLVM.

    - + -
    +

    This intrinsic makes it possible to excise one parameter, marked with - the nest attribute, from a function. The result is a callable + the nest attribute, from a function. + The result is a callable function pointer lacking the nest parameter - the caller does not need to provide a value for it. Instead, the value to use is stored in advance in a "trampoline", a block of memory usually allocated on the stack, which also @@ -6614,26 +7156,24 @@ LLVM.

    pointer has signature i32 (i32, i32)*. It can be created as follows:

    -
    -
    +
       %tramp = alloca [10 x i8], align 4 ; size and alignment only correct for X86
       %tramp1 = getelementptr [10 x i8]* %tramp, i32 0, i32 0
    -  %p = call i8* @llvm.init.trampoline( i8* %tramp1, i8* bitcast (i32 (i8* nest , i32, i32)* @f to i8*), i8* %nval )
    +  %p = call i8* @llvm.init.trampoline(i8* %tramp1, i8* bitcast (i32 (i8* nest , i32, i32)* @f to i8*), i8* %nval)
       %fp = bitcast i8* %p to i32 (i32, i32)*
     
    -
    - -

    The call %val = call i32 %fp( i32 %x, i32 %y ) is then equivalent - to %val = call i32 %f( i8* %nval, i32 %x, i32 %y ).

    -
    +

    The call %val = call i32 %fp(i32 %x, i32 %y) is then equivalent + to %val = call i32 %f(i8* %nval, i32 %x, i32 %y).

    - +

    + + 'llvm.init.trampoline' Intrinsic + +

    -
    +
    Syntax:
    @@ -6670,12 +7210,14 @@ LLVM.

    +
    + - + -
    +

    These intrinsic functions expand the "universal IR" of LLVM to represent hardware constructs for atomic operations and memory synchronization. This @@ -6695,16 +7237,15 @@ LLVM.

    No one model or paradigm should be selected above others unless the hardware itself ubiquitously does so.

    -
    - - -
    + + +
    Syntax:
    -  declare void @llvm.memory.barrier( i1 <ll>, i1 <ls>, i1 <sl>, i1 <ss>, i1 <device> )
    +  declare void @llvm.memory.barrier(i1 <ll>, i1 <ls>, i1 <sl>, i1 <ss>, i1 <device>)
     
    Overview:
    @@ -6714,7 +7255,7 @@ LLVM.

    Arguments:

    The llvm.memory.barrier intrinsic requires five boolean arguments. The first four arguments enables a specific barrier as listed below. The - fith argument specifies that the barrier applies to io or device or uncached + fifth argument specifies that the barrier applies to io or device or uncached memory.

      @@ -6761,7 +7302,7 @@ LLVM.

      store i32 4, %ptr %result1 = load i32* %ptr ; yields {i32}:result1 = 4 - call void @llvm.memory.barrier( i1 false, i1 true, i1 false, i1 false ) + call void @llvm.memory.barrier(i1 false, i1 true, i1 false, i1 false) ; guarantee the above finishes store i32 8, %ptr ; before this begins @@ -6769,11 +7310,11 @@ LLVM.

    - + -
    +
    Syntax:

    This is an overloaded intrinsic. You can use llvm.atomic.cmp.swap on @@ -6781,10 +7322,10 @@ LLVM.

    support all bit widths however.

    -  declare i8 @llvm.atomic.cmp.swap.i8.p0i8( i8* <ptr>, i8 <cmp>, i8 <val> )
    -  declare i16 @llvm.atomic.cmp.swap.i16.p0i16( i16* <ptr>, i16 <cmp>, i16 <val> )
    -  declare i32 @llvm.atomic.cmp.swap.i32.p0i32( i32* <ptr>, i32 <cmp>, i32 <val> )
    -  declare i64 @llvm.atomic.cmp.swap.i64.p0i64( i64* <ptr>, i64 <cmp>, i64 <val> )
    +  declare i8 @llvm.atomic.cmp.swap.i8.p0i8(i8* <ptr>, i8 <cmp>, i8 <val>)
    +  declare i16 @llvm.atomic.cmp.swap.i16.p0i16(i16* <ptr>, i16 <cmp>, i16 <val>)
    +  declare i32 @llvm.atomic.cmp.swap.i32.p0i32(i32* <ptr>, i32 <cmp>, i32 <val>)
    +  declare i64 @llvm.atomic.cmp.swap.i64.p0i64(i64* <ptr>, i64 <cmp>, i64 <val>)
     
    Overview:
    @@ -6813,13 +7354,13 @@ LLVM.

    store i32 4, %ptr %val1 = add i32 4, 4 -%result1 = call i32 @llvm.atomic.cmp.swap.i32.p0i32( i32* %ptr, i32 4, %val1 ) +%result1 = call i32 @llvm.atomic.cmp.swap.i32.p0i32(i32* %ptr, i32 4, %val1) ; yields {i32}:result1 = 4 %stored1 = icmp eq i32 %result1, 4 ; yields {i1}:stored1 = true %memval1 = load i32* %ptr ; yields {i32}:memval1 = 8 %val2 = add i32 1, 1 -%result2 = call i32 @llvm.atomic.cmp.swap.i32.p0i32( i32* %ptr, i32 5, %val2 ) +%result2 = call i32 @llvm.atomic.cmp.swap.i32.p0i32(i32* %ptr, i32 5, %val2) ; yields {i32}:result2 = 8 %stored2 = icmp eq i32 %result2, 5 ; yields {i1}:stored2 = false @@ -6829,20 +7370,21 @@ LLVM.

    - -
    + + +
    Syntax:

    This is an overloaded intrinsic. You can use llvm.atomic.swap on any integer bit width. Not all targets support all bit widths however.

    -  declare i8 @llvm.atomic.swap.i8.p0i8( i8* <ptr>, i8 <val> )
    -  declare i16 @llvm.atomic.swap.i16.p0i16( i16* <ptr>, i16 <val> )
    -  declare i32 @llvm.atomic.swap.i32.p0i32( i32* <ptr>, i32 <val> )
    -  declare i64 @llvm.atomic.swap.i64.p0i64( i64* <ptr>, i64 <val> )
    +  declare i8 @llvm.atomic.swap.i8.p0i8(i8* <ptr>, i8 <val>)
    +  declare i16 @llvm.atomic.swap.i16.p0i16(i16* <ptr>, i16 <val>)
    +  declare i32 @llvm.atomic.swap.i32.p0i32(i32* <ptr>, i32 <val>)
    +  declare i64 @llvm.atomic.swap.i64.p0i64(i64* <ptr>, i64 <val>)
     
    Overview:
    @@ -6869,13 +7411,13 @@ LLVM.

    store i32 4, %ptr %val1 = add i32 4, 4 -%result1 = call i32 @llvm.atomic.swap.i32.p0i32( i32* %ptr, i32 %val1 ) +%result1 = call i32 @llvm.atomic.swap.i32.p0i32(i32* %ptr, i32 %val1) ; yields {i32}:result1 = 4 %stored1 = icmp eq i32 %result1, 4 ; yields {i1}:stored1 = true %memval1 = load i32* %ptr ; yields {i32}:memval1 = 8 %val2 = add i32 1, 1 -%result2 = call i32 @llvm.atomic.swap.i32.p0i32( i32* %ptr, i32 %val2 ) +%result2 = call i32 @llvm.atomic.swap.i32.p0i32(i32* %ptr, i32 %val2) ; yields {i32}:result2 = 8 %stored2 = icmp eq i32 %result2, 8 ; yields {i1}:stored2 = true @@ -6885,22 +7427,21 @@ LLVM.

    - - -
    +
    Syntax:

    This is an overloaded intrinsic. You can use llvm.atomic.load.add on any integer bit width. Not all targets support all bit widths however.

    -  declare i8 @llvm.atomic.load.add.i8..p0i8( i8* <ptr>, i8 <delta> )
    -  declare i16 @llvm.atomic.load.add.i16..p0i16( i16* <ptr>, i16 <delta> )
    -  declare i32 @llvm.atomic.load.add.i32..p0i32( i32* <ptr>, i32 <delta> )
    -  declare i64 @llvm.atomic.load.add.i64..p0i64( i64* <ptr>, i64 <delta> )
    +  declare i8 @llvm.atomic.load.add.i8.p0i8(i8* <ptr>, i8 <delta>)
    +  declare i16 @llvm.atomic.load.add.i16.p0i16(i16* <ptr>, i16 <delta>)
    +  declare i32 @llvm.atomic.load.add.i32.p0i32(i32* <ptr>, i32 <delta>)
    +  declare i64 @llvm.atomic.load.add.i64.p0i64(i64* <ptr>, i64 <delta>)
     
    Overview:
    @@ -6923,11 +7464,11 @@ LLVM.

    %mallocP = tail call i8* @malloc(i32 ptrtoint (i32* getelementptr (i32* null, i32 1) to i32)) %ptr = bitcast i8* %mallocP to i32* store i32 4, %ptr -%result1 = call i32 @llvm.atomic.load.add.i32.p0i32( i32* %ptr, i32 4 ) +%result1 = call i32 @llvm.atomic.load.add.i32.p0i32(i32* %ptr, i32 4) ; yields {i32}:result1 = 4 -%result2 = call i32 @llvm.atomic.load.add.i32.p0i32( i32* %ptr, i32 2 ) +%result2 = call i32 @llvm.atomic.load.add.i32.p0i32(i32* %ptr, i32 2) ; yields {i32}:result2 = 8 -%result3 = call i32 @llvm.atomic.load.add.i32.p0i32( i32* %ptr, i32 5 ) +%result3 = call i32 @llvm.atomic.load.add.i32.p0i32(i32* %ptr, i32 5) ; yields {i32}:result3 = 10 %memval1 = load i32* %ptr ; yields {i32}:memval1 = 15 @@ -6935,12 +7476,11 @@ LLVM.

    - - -
    +
    Syntax:

    This is an overloaded intrinsic. You can use llvm.atomic.load.sub on @@ -6948,10 +7488,10 @@ LLVM.

    support all bit widths however.

    -  declare i8 @llvm.atomic.load.sub.i8.p0i32( i8* <ptr>, i8 <delta> )
    -  declare i16 @llvm.atomic.load.sub.i16.p0i32( i16* <ptr>, i16 <delta> )
    -  declare i32 @llvm.atomic.load.sub.i32.p0i32( i32* <ptr>, i32 <delta> )
    -  declare i64 @llvm.atomic.load.sub.i64.p0i32( i64* <ptr>, i64 <delta> )
    +  declare i8 @llvm.atomic.load.sub.i8.p0i32(i8* <ptr>, i8 <delta>)
    +  declare i16 @llvm.atomic.load.sub.i16.p0i32(i16* <ptr>, i16 <delta>)
    +  declare i32 @llvm.atomic.load.sub.i32.p0i32(i32* <ptr>, i32 <delta>)
    +  declare i64 @llvm.atomic.load.sub.i64.p0i32(i64* <ptr>, i64 <delta>)
     
    Overview:
    @@ -6975,11 +7515,11 @@ LLVM.

    %mallocP = tail call i8* @malloc(i32 ptrtoint (i32* getelementptr (i32* null, i32 1) to i32)) %ptr = bitcast i8* %mallocP to i32* store i32 8, %ptr -%result1 = call i32 @llvm.atomic.load.sub.i32.p0i32( i32* %ptr, i32 4 ) +%result1 = call i32 @llvm.atomic.load.sub.i32.p0i32(i32* %ptr, i32 4) ; yields {i32}:result1 = 8 -%result2 = call i32 @llvm.atomic.load.sub.i32.p0i32( i32* %ptr, i32 2 ) +%result2 = call i32 @llvm.atomic.load.sub.i32.p0i32(i32* %ptr, i32 2) ; yields {i32}:result2 = 4 -%result3 = call i32 @llvm.atomic.load.sub.i32.p0i32( i32* %ptr, i32 5 ) +%result3 = call i32 @llvm.atomic.load.sub.i32.p0i32(i32* %ptr, i32 5) ; yields {i32}:result3 = 2 %memval1 = load i32* %ptr ; yields {i32}:memval1 = -3 @@ -6987,14 +7527,25 @@ LLVM.

    - - -
    +

    + + 'llvm.atomic.load.and.*' Intrinsic + +
    + + 'llvm.atomic.load.nand.*' Intrinsic + +
    + + 'llvm.atomic.load.or.*' Intrinsic + +
    + + 'llvm.atomic.load.xor.*' Intrinsic + +

    + +
    Syntax:

    These are overloaded intrinsics. You can @@ -7004,31 +7555,31 @@ LLVM.

    widths however.

    -  declare i8 @llvm.atomic.load.and.i8.p0i8( i8* <ptr>, i8 <delta> )
    -  declare i16 @llvm.atomic.load.and.i16.p0i16( i16* <ptr>, i16 <delta> )
    -  declare i32 @llvm.atomic.load.and.i32.p0i32( i32* <ptr>, i32 <delta> )
    -  declare i64 @llvm.atomic.load.and.i64.p0i64( i64* <ptr>, i64 <delta> )
    +  declare i8 @llvm.atomic.load.and.i8.p0i8(i8* <ptr>, i8 <delta>)
    +  declare i16 @llvm.atomic.load.and.i16.p0i16(i16* <ptr>, i16 <delta>)
    +  declare i32 @llvm.atomic.load.and.i32.p0i32(i32* <ptr>, i32 <delta>)
    +  declare i64 @llvm.atomic.load.and.i64.p0i64(i64* <ptr>, i64 <delta>)
     
    -  declare i8 @llvm.atomic.load.or.i8.p0i8( i8* <ptr>, i8 <delta> )
    -  declare i16 @llvm.atomic.load.or.i16.p0i16( i16* <ptr>, i16 <delta> )
    -  declare i32 @llvm.atomic.load.or.i32.p0i32( i32* <ptr>, i32 <delta> )
    -  declare i64 @llvm.atomic.load.or.i64.p0i64( i64* <ptr>, i64 <delta> )
    +  declare i8 @llvm.atomic.load.or.i8.p0i8(i8* <ptr>, i8 <delta>)
    +  declare i16 @llvm.atomic.load.or.i16.p0i16(i16* <ptr>, i16 <delta>)
    +  declare i32 @llvm.atomic.load.or.i32.p0i32(i32* <ptr>, i32 <delta>)
    +  declare i64 @llvm.atomic.load.or.i64.p0i64(i64* <ptr>, i64 <delta>)
     
    -  declare i8 @llvm.atomic.load.nand.i8.p0i32( i8* <ptr>, i8 <delta> )
    -  declare i16 @llvm.atomic.load.nand.i16.p0i32( i16* <ptr>, i16 <delta> )
    -  declare i32 @llvm.atomic.load.nand.i32.p0i32( i32* <ptr>, i32 <delta> )
    -  declare i64 @llvm.atomic.load.nand.i64.p0i32( i64* <ptr>, i64 <delta> )
    +  declare i8 @llvm.atomic.load.nand.i8.p0i32(i8* <ptr>, i8 <delta>)
    +  declare i16 @llvm.atomic.load.nand.i16.p0i32(i16* <ptr>, i16 <delta>)
    +  declare i32 @llvm.atomic.load.nand.i32.p0i32(i32* <ptr>, i32 <delta>)
    +  declare i64 @llvm.atomic.load.nand.i64.p0i32(i64* <ptr>, i64 <delta>)
     
    -  declare i8 @llvm.atomic.load.xor.i8.p0i32( i8* <ptr>, i8 <delta> )
    -  declare i16 @llvm.atomic.load.xor.i16.p0i32( i16* <ptr>, i16 <delta> )
    -  declare i32 @llvm.atomic.load.xor.i32.p0i32( i32* <ptr>, i32 <delta> )
    -  declare i64 @llvm.atomic.load.xor.i64.p0i32( i64* <ptr>, i64 <delta> )
    +  declare i8 @llvm.atomic.load.xor.i8.p0i32(i8* <ptr>, i8 <delta>)
    +  declare i16 @llvm.atomic.load.xor.i16.p0i32(i16* <ptr>, i16 <delta>)
    +  declare i32 @llvm.atomic.load.xor.i32.p0i32(i32* <ptr>, i32 <delta>)
    +  declare i64 @llvm.atomic.load.xor.i64.p0i32(i64* <ptr>, i64 <delta>)
     
    Overview:
    @@ -7053,13 +7604,13 @@ LLVM.

    %mallocP = tail call i8* @malloc(i32 ptrtoint (i32* getelementptr (i32* null, i32 1) to i32)) %ptr = bitcast i8* %mallocP to i32* store i32 0x0F0F, %ptr -%result0 = call i32 @llvm.atomic.load.nand.i32.p0i32( i32* %ptr, i32 0xFF ) +%result0 = call i32 @llvm.atomic.load.nand.i32.p0i32(i32* %ptr, i32 0xFF) ; yields {i32}:result0 = 0x0F0F -%result1 = call i32 @llvm.atomic.load.and.i32.p0i32( i32* %ptr, i32 0xFF ) +%result1 = call i32 @llvm.atomic.load.and.i32.p0i32(i32* %ptr, i32 0xFF) ; yields {i32}:result1 = 0xFFFFFFF0 -%result2 = call i32 @llvm.atomic.load.or.i32.p0i32( i32* %ptr, i32 0F ) +%result2 = call i32 @llvm.atomic.load.or.i32.p0i32(i32* %ptr, i32 0F) ; yields {i32}:result2 = 0xF0 -%result3 = call i32 @llvm.atomic.load.xor.i32.p0i32( i32* %ptr, i32 0F ) +%result3 = call i32 @llvm.atomic.load.xor.i32.p0i32(i32* %ptr, i32 0F) ; yields {i32}:result3 = FF %memval1 = load i32* %ptr ; yields {i32}:memval1 = F0 @@ -7067,14 +7618,25 @@ LLVM.

    - - -
    +

    + + 'llvm.atomic.load.max.*' Intrinsic + +
    + + 'llvm.atomic.load.min.*' Intrinsic + +
    + + 'llvm.atomic.load.umax.*' Intrinsic + +
    + + 'llvm.atomic.load.umin.*' Intrinsic + +

    + +
    Syntax:

    These are overloaded intrinsics. You can use llvm.atomic.load_max, @@ -7083,31 +7645,31 @@ LLVM.

    address spaces. Not all targets support all bit widths however.

    -  declare i8 @llvm.atomic.load.max.i8.p0i8( i8* <ptr>, i8 <delta> )
    -  declare i16 @llvm.atomic.load.max.i16.p0i16( i16* <ptr>, i16 <delta> )
    -  declare i32 @llvm.atomic.load.max.i32.p0i32( i32* <ptr>, i32 <delta> )
    -  declare i64 @llvm.atomic.load.max.i64.p0i64( i64* <ptr>, i64 <delta> )
    +  declare i8 @llvm.atomic.load.max.i8.p0i8(i8* <ptr>, i8 <delta>)
    +  declare i16 @llvm.atomic.load.max.i16.p0i16(i16* <ptr>, i16 <delta>)
    +  declare i32 @llvm.atomic.load.max.i32.p0i32(i32* <ptr>, i32 <delta>)
    +  declare i64 @llvm.atomic.load.max.i64.p0i64(i64* <ptr>, i64 <delta>)
     
    -  declare i8 @llvm.atomic.load.min.i8.p0i8( i8* <ptr>, i8 <delta> )
    -  declare i16 @llvm.atomic.load.min.i16.p0i16( i16* <ptr>, i16 <delta> )
    -  declare i32 @llvm.atomic.load.min.i32..p0i32( i32* <ptr>, i32 <delta> )
    -  declare i64 @llvm.atomic.load.min.i64..p0i64( i64* <ptr>, i64 <delta> )
    +  declare i8 @llvm.atomic.load.min.i8.p0i8(i8* <ptr>, i8 <delta>)
    +  declare i16 @llvm.atomic.load.min.i16.p0i16(i16* <ptr>, i16 <delta>)
    +  declare i32 @llvm.atomic.load.min.i32.p0i32(i32* <ptr>, i32 <delta>)
    +  declare i64 @llvm.atomic.load.min.i64.p0i64(i64* <ptr>, i64 <delta>)
     
    -  declare i8 @llvm.atomic.load.umax.i8.p0i8( i8* <ptr>, i8 <delta> )
    -  declare i16 @llvm.atomic.load.umax.i16.p0i16( i16* <ptr>, i16 <delta> )
    -  declare i32 @llvm.atomic.load.umax.i32.p0i32( i32* <ptr>, i32 <delta> )
    -  declare i64 @llvm.atomic.load.umax.i64.p0i64( i64* <ptr>, i64 <delta> )
    +  declare i8 @llvm.atomic.load.umax.i8.p0i8(i8* <ptr>, i8 <delta>)
    +  declare i16 @llvm.atomic.load.umax.i16.p0i16(i16* <ptr>, i16 <delta>)
    +  declare i32 @llvm.atomic.load.umax.i32.p0i32(i32* <ptr>, i32 <delta>)
    +  declare i64 @llvm.atomic.load.umax.i64.p0i64(i64* <ptr>, i64 <delta>)
     
    -  declare i8 @llvm.atomic.load.umin.i8..p0i8( i8* <ptr>, i8 <delta> )
    -  declare i16 @llvm.atomic.load.umin.i16.p0i16( i16* <ptr>, i16 <delta> )
    -  declare i32 @llvm.atomic.load.umin.i32..p0i32( i32* <ptr>, i32 <delta> )
    -  declare i64 @llvm.atomic.load.umin.i64..p0i64( i64* <ptr>, i64 <delta> )
    +  declare i8 @llvm.atomic.load.umin.i8.p0i8(i8* <ptr>, i8 <delta>)
    +  declare i16 @llvm.atomic.load.umin.i16.p0i16(i16* <ptr>, i16 <delta>)
    +  declare i32 @llvm.atomic.load.umin.i32.p0i32(i32* <ptr>, i32 <delta>)
    +  declare i64 @llvm.atomic.load.umin.i64.p0i64(i64* <ptr>, i64 <delta>)
     
    Overview:
    @@ -7132,38 +7694,37 @@ LLVM.

    %mallocP = tail call i8* @malloc(i32 ptrtoint (i32* getelementptr (i32* null, i32 1) to i32)) %ptr = bitcast i8* %mallocP to i32* store i32 7, %ptr -%result0 = call i32 @llvm.atomic.load.min.i32.p0i32( i32* %ptr, i32 -2 ) +%result0 = call i32 @llvm.atomic.load.min.i32.p0i32(i32* %ptr, i32 -2) ; yields {i32}:result0 = 7 -%result1 = call i32 @llvm.atomic.load.max.i32.p0i32( i32* %ptr, i32 8 ) +%result1 = call i32 @llvm.atomic.load.max.i32.p0i32(i32* %ptr, i32 8) ; yields {i32}:result1 = -2 -%result2 = call i32 @llvm.atomic.load.umin.i32.p0i32( i32* %ptr, i32 10 ) +%result2 = call i32 @llvm.atomic.load.umin.i32.p0i32(i32* %ptr, i32 10) ; yields {i32}:result2 = 8 -%result3 = call i32 @llvm.atomic.load.umax.i32.p0i32( i32* %ptr, i32 30 ) +%result3 = call i32 @llvm.atomic.load.umax.i32.p0i32(i32* %ptr, i32 30) ; yields {i32}:result3 = 8 %memval1 = load i32* %ptr ; yields {i32}:memval1 = 30
    +
    - + -
    +

    This class of intrinsics exists to information about the lifetime of memory objects and ranges where variables are immutable.

    -
    - - + -
    +
    Syntax:
    @@ -7189,11 +7750,11 @@ LLVM.

    - + -
    +
    Syntax:
    @@ -7218,15 +7779,15 @@ LLVM.

    - + -
    +
    Syntax:
    -  declare {}* @llvm.invariant.start(i64 <size>, i8* nocapture <ptr>) readonly
    +  declare {}* @llvm.invariant.start(i64 <size>, i8* nocapture <ptr>)
     
    Overview:
    @@ -7246,11 +7807,11 @@ LLVM.

    - + -
    +
    Syntax:
    @@ -7272,28 +7833,28 @@ LLVM.

    +
    + - + -
    +

    This class of intrinsics is designed to be generic and has no specific purpose.

    -
    - - + -
    +
    Syntax:
    -  declare void @llvm.var.annotation(i8* <val>, i8* <str>, i8* <str>, i32  <int> )
    +  declare void @llvm.var.annotation(i8* <val>, i8* <str>, i8* <str>, i32  <int>)
     
    Overview:
    @@ -7313,22 +7874,22 @@ LLVM.

    - + -
    +
    Syntax:

    This is an overloaded intrinsic. You can use 'llvm.annotation' on any integer bit width.

    -  declare i8 @llvm.annotation.i8(i8 <val>, i8* <str>, i8* <str>, i32  <int> )
    -  declare i16 @llvm.annotation.i16(i16 <val>, i8* <str>, i8* <str>, i32  <int> )
    -  declare i32 @llvm.annotation.i32(i32 <val>, i8* <str>, i8* <str>, i32  <int> )
    -  declare i64 @llvm.annotation.i64(i64 <val>, i8* <str>, i8* <str>, i32  <int> )
    -  declare i256 @llvm.annotation.i256(i256 <val>, i8* <str>, i8* <str>, i32  <int> )
    +  declare i8 @llvm.annotation.i8(i8 <val>, i8* <str>, i8* <str>, i32  <int>)
    +  declare i16 @llvm.annotation.i16(i16 <val>, i8* <str>, i8* <str>, i32  <int>)
    +  declare i32 @llvm.annotation.i32(i32 <val>, i8* <str>, i8* <str>, i32  <int>)
    +  declare i64 @llvm.annotation.i64(i64 <val>, i8* <str>, i8* <str>, i32  <int>)
    +  declare i256 @llvm.annotation.i256(i256 <val>, i8* <str>, i8* <str>, i32  <int>)
     
    Overview:
    @@ -7349,11 +7910,11 @@ LLVM.

    - + -
    +
    Syntax:
    @@ -7374,15 +7935,15 @@ LLVM.

    - + -
    +
    Syntax:
    -  declare void @llvm.stackprotector( i8* <guard>, i8** <slot> )
    +  declare void @llvm.stackprotector(i8* <guard>, i8** <slot>)
     
    Overview:
    @@ -7401,45 +7962,48 @@ LLVM.

    the AllocaInst stack slot to be before local variables on the stack. This is to ensure that if a local variable on the stack is overwritten, it will destroy the value of the guard. When the function exits, - the guard on the stack is checked against the original guard. If they're + the guard on the stack is checked against the original guard. If they are different, then the program aborts by calling the __stack_chk_fail() function.

    - + -
    +
    Syntax:
    -  declare i32 @llvm.objectsize.i32( i8* <object>, i1 <type> )
    -  declare i64 @llvm.objectsize.i64( i8* <object>, i1 <type> )
    +  declare i32 @llvm.objectsize.i32(i8* <object>, i1 <type>)
    +  declare i64 @llvm.objectsize.i64(i8* <object>, i1 <type>)
     
    Overview:
    -

    The llvm.objectsize intrinsic is designed to provide information - to the optimizers to discover at compile time either a) when an - operation like memcpy will either overflow a buffer that corresponds to - an object, or b) to determine that a runtime check for overflow isn't - necessary. An object in this context means an allocation of a - specific class, structure, array, or other object.

    +

    The llvm.objectsize intrinsic is designed to provide information to + the optimizers to determine at compile time whether a) an operation (like + memcpy) will overflow a buffer that corresponds to an object, or b) that a + runtime check for overflow isn't necessary. An object in this context means + an allocation of a specific class, structure, array, or other object.

    Arguments:
    -

    The llvm.objectsize intrinsic takes two arguments. The first +

    The llvm.objectsize intrinsic takes two arguments. The first argument is a pointer to or into the object. The second argument - is a boolean 0 or 1. This argument determines whether you want the - maximum (0) or minimum (1) bytes remaining. This needs to be a literal 0 or + is a boolean 0 or 1. This argument determines whether you want the + maximum (0) or minimum (1) bytes remaining. This needs to be a literal 0 or 1, variables are not allowed.

    Semantics:

    The llvm.objectsize intrinsic is lowered to either a constant - representing the size of the object concerned or i32/i64 -1 or 0 - (depending on the type argument if the size cannot be determined - at compile time.

    + representing the size of the object concerned, or i32/i64 -1 or 0, + depending on the type argument, if the size cannot be determined at + compile time.

    + +
    + +
    @@ -7452,7 +8016,7 @@ LLVM.

    src="http://www.w3.org/Icons/valid-html401-blue" alt="Valid HTML 4.01"> Chris Lattner
    - The LLVM Compiler Infrastructure
    + The LLVM Compiler Infrastructure
    Last modified: $Date$