X-Git-Url: http://demsky.eecs.uci.edu/git/?a=blobdiff_plain;f=docs%2FLangRef.rst;h=96883a8090f4d8c187d5e3fdcd38211932916bc7;hb=508c39393a29d4524d113293bcab0a1c74a2328a;hp=69816cc8141160ce8d97d95cc352d5fb70a6aba9;hpb=d1d53e81f61d4b8379d1c06bb8d3662694168c05;p=oota-llvm.git diff --git a/docs/LangRef.rst b/docs/LangRef.rst index 69816cc8141..96883a8090f 100644 --- a/docs/LangRef.rst +++ b/docs/LangRef.rst @@ -129,9 +129,10 @@ lexical features of LLVM: #. Unnamed temporaries are created when the result of a computation is not assigned to a named value. #. Unnamed temporaries are numbered sequentially (using a per-function - incrementing counter, starting with 0). Note that basic blocks are - included in this numbering. For example, if the entry basic block is not - given a label name, then it will get number 0. + incrementing counter, starting with 0). Note that basic blocks and unnamed + function parameters are included in this numbering. For example, if the + entry basic block is not given a label name and all function parameters are + named, then it will get number 0. It also shows a convention that we follow in this document. When demonstrating instructions, we will follow an instruction with a comment @@ -169,8 +170,8 @@ symbol table entries. Here is an example of the "hello world" module: } ; Named metadata - !1 = metadata !{i32 42} - !foo = !{!1, null} + !0 = metadata !{i32 42, null, metadata !"string"} + !foo = !{!0} This example is made up of a :ref:`global variable ` named "``.str``", an external declaration of the "``puts``" function, a @@ -681,6 +682,14 @@ Syntax:: [unnamed_addr] [fn Attrs] [section "name"] [comdat $] [align N] [gc] [prefix Constant] { ... } +The argument list is a comma seperated sequence of arguments where each +argument is of the following form + +Syntax:: + + [parameter Attrs] [name] + + .. _langref_aliases: Aliases @@ -774,7 +783,7 @@ In a COFF object file, this will create a COMDAT section with selection kind ``IMAGE_COMDAT_SELECT_LARGEST`` containing the contents of the ``@foo`` symbol and another COMDAT section with selection kind ``IMAGE_COMDAT_SELECT_ASSOCIATIVE`` which is associated with the first COMDAT -section and contains the contents of the ``@baz`` symbol. +section and contains the contents of the ``@bar`` symbol. There are some restrictions on the properties of the global object. It, or an alias to it, must have the same name as the COMDAT group when @@ -1749,6 +1758,52 @@ otherwise unsafe floating point operations dramatically change results in floating point (e.g. reassociate). This flag implies all the others. +.. _uselistorder: + +Use-list Order Directives +------------------------- + +Use-list directives encode the in-memory order of each use-list, allowing the +order to be recreated. ```` is a comma-separated list of +indexes that are assigned to the referenced value's uses. The referenced +value's use-list is immediately sorted by these indexes. + +Use-list directives may appear at function scope or global scope. They are not +instructions, and have no effect on the semantics of the IR. When they're at +function scope, they must appear after the terminator of the final basic block. + +If basic blocks have their address taken via ``blockaddress()`` expressions, +``uselistorder_bb`` can be used to reorder their use-lists from outside their +function's scope. + +:Syntax: + +:: + + uselistorder , { } + uselistorder_bb @function, %block { } + +:Examples: + +:: + + define void @foo(i32 %arg1, i32 %arg2) { + entry: + ; ... instructions ... + bb: + ; ... instructions ... + + ; At function scope. + uselistorder i32 %arg1, { 1, 0, 2 } + uselistorder label %bb, { 1, 0 } + } + + ; At global scope. + uselistorder i32* @global, { 1, 2, 0 } + uselistorder i32 7, { 1, 0 } + uselistorder i32 (i32) @bar, { 1, 0 } + uselistorder_bb @foo, %bb, { 5, 1, 3, 2, 0, 4 } + .. _typesystem: Type System @@ -2221,7 +2276,9 @@ constants and smaller complex constants. square brackets (``[]``)). For example: "``[ i32 42, i32 11, i32 74 ]``". Array constants must have :ref:`array type `, and the number and types of elements must - match those specified by the type. + match those specified by the type. As a special case, character array + constants may also be represented as a double-quoted string using the ``c`` + prefix. For example: "``c"Hello World\0A\00"``". **Vector constants** Vector constants are represented with notation similar to vector type definitions (a comma separated list of elements, surrounded by @@ -2338,7 +2395,7 @@ allowed to assume that the '``undef``' operand could be the same as %C = xor %B, %B %D = undef - %E = icmp lt %D, 4 + %E = icmp slt %D, 4 %F = icmp gte %D, 4 Safe: @@ -5020,7 +5077,7 @@ 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} - %agg3 = insertvalue {i32, {float}} %agg1, float %val, 1, 0 ; yields {i32 1, float %val} + %agg3 = insertvalue {i32, {float}} undef, float %val, 1, 0 ; yields {i32 undef, {float %val}} .. _memoryops: @@ -6536,6 +6593,9 @@ This instruction requires several arguments: - The calling conventions of the caller and callee must match. - All ABI-impacting function attributes, such as sret, byval, inreg, returned, and inalloca, must match. + - The callee must be varargs iff the caller is varargs. Bitcasting a + non-varargs function to the appropriate varargs type is legal so + long as the non-varargs prefixes obey the other rules. Tail call optimization for calls marked ``tail`` is guaranteed to occur if the following conditions are met: