|
@@ -839,7 +839,7 @@ Note that the Mach-O platform doesn't support COMDATs and ELF only supports
|
|
|
Here is an example of a COMDAT group where a function will only be selected if
|
|
|
the COMDAT key's section is the largest:
|
|
|
|
|
|
-.. code-block:: llvm
|
|
|
+.. code-block:: text
|
|
|
|
|
|
$foo = comdat largest
|
|
|
@foo = global i32 2, comdat($foo)
|
|
@@ -851,7 +851,7 @@ the COMDAT key's section is the largest:
|
|
|
As a syntactic sugar the ``$name`` can be omitted if the name is the same as
|
|
|
the global name:
|
|
|
|
|
|
-.. code-block:: llvm
|
|
|
+.. code-block:: text
|
|
|
|
|
|
$foo = comdat any
|
|
|
@foo = global i32 2, comdat
|
|
@@ -875,7 +875,7 @@ if a collision occurs in the symbol table.
|
|
|
The combined use of COMDATS and section attributes may yield surprising results.
|
|
|
For example:
|
|
|
|
|
|
-.. code-block:: llvm
|
|
|
+.. code-block:: text
|
|
|
|
|
|
$foo = comdat any
|
|
|
$bar = comdat any
|
|
@@ -1205,7 +1205,7 @@ makes the format of the prologue data highly target dependent.
|
|
|
A trivial example of valid prologue data for the x86 architecture is ``i8 144``,
|
|
|
which encodes the ``nop`` instruction:
|
|
|
|
|
|
-.. code-block:: llvm
|
|
|
+.. code-block:: text
|
|
|
|
|
|
define void @f() prologue i8 144 { ... }
|
|
|
|
|
@@ -1213,7 +1213,7 @@ Generally prologue data can be formed by encoding a relative branch instruction
|
|
|
which skips the metadata, as in this example of valid prologue data for the
|
|
|
x86_64 architecture, where the first two bytes encode ``jmp .+10``:
|
|
|
|
|
|
-.. code-block:: llvm
|
|
|
+.. code-block:: text
|
|
|
|
|
|
%0 = type <{ i8, i8, i8* }>
|
|
|
|
|
@@ -2237,7 +2237,7 @@ source file name to the local function name.
|
|
|
|
|
|
The syntax for the source file name is simply:
|
|
|
|
|
|
-.. code-block:: llvm
|
|
|
+.. code-block:: text
|
|
|
|
|
|
source_filename = "/path/to/source.c"
|
|
|
|
|
@@ -2847,7 +2847,7 @@ 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.
|
|
|
|
|
|
-.. code-block:: llvm
|
|
|
+.. code-block:: text
|
|
|
|
|
|
%A = xor undef, undef
|
|
|
|
|
@@ -2899,7 +2899,7 @@ 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.
|
|
|
|
|
|
-.. code-block:: llvm
|
|
|
+.. code-block:: text
|
|
|
|
|
|
a: store undef -> %X
|
|
|
b: store %X -> undef
|
|
@@ -3884,7 +3884,7 @@ their operand. For example:
|
|
|
|
|
|
Metadata nodes that aren't uniqued use the ``distinct`` keyword. For example:
|
|
|
|
|
|
-.. code-block:: llvm
|
|
|
+.. code-block:: text
|
|
|
|
|
|
!0 = distinct !{!"test\00", i32 10}
|
|
|
|
|
@@ -3949,7 +3949,7 @@ fields are tuples containing the debug info to be emitted along with the compile
|
|
|
unit, regardless of code optimizations (some nodes are only emitted if there are
|
|
|
references to them from instructions).
|
|
|
|
|
|
-.. code-block:: llvm
|
|
|
+.. code-block:: text
|
|
|
|
|
|
!0 = !DICompileUnit(language: DW_LANG_C99, file: !1, producer: "clang",
|
|
|
isOptimized: true, flags: "-O2", runtimeVersion: 2,
|
|
@@ -3985,7 +3985,7 @@ DIBasicType
|
|
|
``DIBasicType`` nodes represent primitive types, such as ``int``, ``bool`` and
|
|
|
``float``. ``tag:`` defaults to ``DW_TAG_base_type``.
|
|
|
|
|
|
-.. code-block:: llvm
|
|
|
+.. code-block:: text
|
|
|
|
|
|
!0 = !DIBasicType(name: "unsigned char", size: 8, align: 8,
|
|
|
encoding: DW_ATE_unsigned_char)
|
|
@@ -3994,7 +3994,7 @@ DIBasicType
|
|
|
The ``encoding:`` describes the details of the type. Usually it's one of the
|
|
|
following:
|
|
|
|
|
|
-.. code-block:: llvm
|
|
|
+.. code-block:: text
|
|
|
|
|
|
DW_ATE_address = 1
|
|
|
DW_ATE_boolean = 2
|
|
@@ -4014,7 +4014,7 @@ refers to a tuple; the first operand is the return type, while the rest are the
|
|
|
types of the formal arguments in order. If the first operand is ``null``, that
|
|
|
represents a function with no return value (such as ``void foo() {}`` in C++).
|
|
|
|
|
|
-.. code-block:: llvm
|
|
|
+.. code-block:: text
|
|
|
|
|
|
!0 = !BasicType(name: "int", size: 32, align: 32, DW_ATE_signed)
|
|
|
!1 = !BasicType(name: "char", size: 8, align: 8, DW_ATE_signed_char)
|
|
@@ -4028,7 +4028,7 @@ DIDerivedType
|
|
|
``DIDerivedType`` nodes represent types derived from other types, such as
|
|
|
qualified types.
|
|
|
|
|
|
-.. code-block:: llvm
|
|
|
+.. code-block:: text
|
|
|
|
|
|
!0 = !DIBasicType(name: "unsigned char", size: 8, align: 8,
|
|
|
encoding: DW_ATE_unsigned_char)
|
|
@@ -4037,7 +4037,7 @@ qualified types.
|
|
|
|
|
|
The following ``tag:`` values are valid:
|
|
|
|
|
|
-.. code-block:: llvm
|
|
|
+.. code-block:: text
|
|
|
|
|
|
DW_TAG_member = 13
|
|
|
DW_TAG_pointer_type = 15
|
|
@@ -4089,7 +4089,7 @@ does not have ``flags: DIFlagFwdDecl`` set. LLVM tools that link modules
|
|
|
together will unique such definitions at parse time via the ``identifier:``
|
|
|
field, even if the nodes are ``distinct``.
|
|
|
|
|
|
-.. code-block:: llvm
|
|
|
+.. code-block:: text
|
|
|
|
|
|
!0 = !DIEnumerator(name: "SixKind", value: 7)
|
|
|
!1 = !DIEnumerator(name: "SevenKind", value: 7)
|
|
@@ -4100,7 +4100,7 @@ field, even if the nodes are ``distinct``.
|
|
|
|
|
|
The following ``tag:`` values are valid:
|
|
|
|
|
|
-.. code-block:: llvm
|
|
|
+.. code-block:: text
|
|
|
|
|
|
DW_TAG_array_type = 1
|
|
|
DW_TAG_class_type = 2
|
|
@@ -4219,7 +4219,7 @@ type with an ODR ``identifier:`` and that does not set ``flags: DIFwdDecl``,
|
|
|
then the subprogram declaration is uniqued based only on its ``linkageName:``
|
|
|
and ``scope:``.
|
|
|
|
|
|
-.. code-block:: llvm
|
|
|
+.. code-block:: text
|
|
|
|
|
|
define void @_Z3foov() !dbg !0 {
|
|
|
...
|
|
@@ -4244,7 +4244,7 @@ DILexicalBlock
|
|
|
two lexical blocks at same depth. They are valid targets for ``scope:``
|
|
|
fields.
|
|
|
|
|
|
-.. code-block:: llvm
|
|
|
+.. code-block:: text
|
|
|
|
|
|
!0 = distinct !DILexicalBlock(scope: !1, file: !2, line: 7, column: 35)
|
|
|
|
|
@@ -4290,7 +4290,7 @@ the ``arg:`` field is set to non-zero, then this variable is a subprogram
|
|
|
parameter, and it will be included in the ``variables:`` field of its
|
|
|
:ref:`DISubprogram`.
|
|
|
|
|
|
-.. code-block:: llvm
|
|
|
+.. code-block:: text
|
|
|
|
|
|
!0 = !DILocalVariable(name: "this", arg: 1, scope: !3, file: !2, line: 7,
|
|
|
type: !3, flags: DIFlagArtificial)
|
|
@@ -4313,7 +4313,7 @@ The current supported vocabulary is limited:
|
|
|
- ``DW_OP_bit_piece, 16, 8`` specifies the offset and size (``16`` and ``8``
|
|
|
here, respectively) of the variable piece from the working expression.
|
|
|
|
|
|
-.. code-block:: llvm
|
|
|
+.. code-block:: text
|
|
|
|
|
|
!0 = !DIExpression(DW_OP_deref)
|
|
|
!1 = !DIExpression(DW_OP_plus, 3)
|
|
@@ -4336,7 +4336,7 @@ DIImportedEntity
|
|
|
``DIImportedEntity`` nodes represent entities (such as modules) imported into a
|
|
|
compile unit.
|
|
|
|
|
|
-.. code-block:: llvm
|
|
|
+.. code-block:: text
|
|
|
|
|
|
!2 = !DIImportedEntity(tag: DW_TAG_imported_module, name: "foo", scope: !0,
|
|
|
entity: !1, line: 7)
|
|
@@ -4349,7 +4349,7 @@ The ``name:`` field is the macro identifier, followed by macro parameters when
|
|
|
defining a function-like macro, and the ``value`` field is the token-string
|
|
|
used to expand the macro identifier.
|
|
|
|
|
|
-.. code-block:: llvm
|
|
|
+.. code-block:: text
|
|
|
|
|
|
!2 = !DIMacro(macinfo: DW_MACINFO_define, line: 7, name: "foo(x)",
|
|
|
value: "((x) + 1)")
|
|
@@ -4362,7 +4362,7 @@ DIMacroFile
|
|
|
The ``nodes:`` field is a list of ``DIMacro`` and ``DIMacroFile`` nodes that
|
|
|
appear in the included source file.
|
|
|
|
|
|
-.. code-block:: llvm
|
|
|
+.. code-block:: text
|
|
|
|
|
|
!2 = !DIMacroFile(macinfo: DW_MACINFO_start_file, line: 7, file: !2,
|
|
|
nodes: !3)
|
|
@@ -5660,7 +5660,7 @@ block. Therefore, it must be the only non-phi instruction in the block.
|
|
|
Example:
|
|
|
""""""""
|
|
|
|
|
|
-.. code-block:: llvm
|
|
|
+.. code-block:: text
|
|
|
|
|
|
dispatch1:
|
|
|
%cs1 = catchswitch within none [label %handler0, label %handler1] unwind to caller
|
|
@@ -5711,7 +5711,7 @@ the ``catchret``'s behavior is undefined.
|
|
|
Example:
|
|
|
""""""""
|
|
|
|
|
|
-.. code-block:: llvm
|
|
|
+.. code-block:: text
|
|
|
|
|
|
catchret from %catch label %continue
|
|
|
|
|
@@ -5761,7 +5761,7 @@ It transfers control to ``continue`` or unwinds out of the function.
|
|
|
Example:
|
|
|
""""""""
|
|
|
|
|
|
-.. code-block:: llvm
|
|
|
+.. code-block:: text
|
|
|
|
|
|
cleanupret from %cleanup unwind to caller
|
|
|
cleanupret from %cleanup unwind label %continue
|
|
@@ -5851,7 +5851,7 @@ unsigned and/or signed overflow, respectively, occurs.
|
|
|
Example:
|
|
|
""""""""
|
|
|
|
|
|
-.. code-block:: llvm
|
|
|
+.. code-block:: text
|
|
|
|
|
|
<result> = add i32 4, %var ; yields i32:result = 4 + %var
|
|
|
|
|
@@ -5890,7 +5890,7 @@ optimizations:
|
|
|
Example:
|
|
|
""""""""
|
|
|
|
|
|
-.. code-block:: llvm
|
|
|
+.. code-block:: text
|
|
|
|
|
|
<result> = fadd float 4.0, %var ; yields float:result = 4.0 + %var
|
|
|
|
|
@@ -5942,7 +5942,7 @@ unsigned and/or signed overflow, respectively, occurs.
|
|
|
Example:
|
|
|
""""""""
|
|
|
|
|
|
-.. code-block:: llvm
|
|
|
+.. code-block:: text
|
|
|
|
|
|
<result> = sub i32 4, %var ; yields i32:result = 4 - %var
|
|
|
<result> = sub i32 0, %val ; yields i32:result = -%var
|
|
@@ -5985,7 +5985,7 @@ unsafe floating point optimizations:
|
|
|
Example:
|
|
|
""""""""
|
|
|
|
|
|
-.. code-block:: llvm
|
|
|
+.. code-block:: text
|
|
|
|
|
|
<result> = fsub float 4.0, %var ; yields float:result = 4.0 - %var
|
|
|
<result> = fsub float -0.0, %val ; yields float:result = -%var
|
|
@@ -6039,7 +6039,7 @@ unsigned and/or signed overflow, respectively, occurs.
|
|
|
Example:
|
|
|
""""""""
|
|
|
|
|
|
-.. code-block:: llvm
|
|
|
+.. code-block:: text
|
|
|
|
|
|
<result> = mul i32 4, %var ; yields i32:result = 4 * %var
|
|
|
|
|
@@ -6078,7 +6078,7 @@ unsafe floating point optimizations:
|
|
|
Example:
|
|
|
""""""""
|
|
|
|
|
|
-.. code-block:: llvm
|
|
|
+.. code-block:: text
|
|
|
|
|
|
<result> = fmul float 4.0, %var ; yields float:result = 4.0 * %var
|
|
|
|
|
@@ -6122,7 +6122,7 @@ such, "((a udiv exact b) mul b) == a").
|
|
|
Example:
|
|
|
""""""""
|
|
|
|
|
|
-.. code-block:: llvm
|
|
|
+.. code-block:: text
|
|
|
|
|
|
<result> = udiv i32 4, %var ; yields i32:result = 4 / %var
|
|
|
|
|
@@ -6168,7 +6168,7 @@ a :ref:`poison value <poisonvalues>` if the result would be rounded.
|
|
|
Example:
|
|
|
""""""""
|
|
|
|
|
|
-.. code-block:: llvm
|
|
|
+.. code-block:: text
|
|
|
|
|
|
<result> = sdiv i32 4, %var ; yields i32:result = 4 / %var
|
|
|
|
|
@@ -6207,7 +6207,7 @@ unsafe floating point optimizations:
|
|
|
Example:
|
|
|
""""""""
|
|
|
|
|
|
-.. code-block:: llvm
|
|
|
+.. code-block:: text
|
|
|
|
|
|
<result> = fdiv float 4.0, %var ; yields float:result = 4.0 / %var
|
|
|
|
|
@@ -6249,7 +6249,7 @@ Taking the remainder of a division by zero leads to undefined behavior.
|
|
|
Example:
|
|
|
""""""""
|
|
|
|
|
|
-.. code-block:: llvm
|
|
|
+.. code-block:: text
|
|
|
|
|
|
<result> = urem i32 4, %var ; yields i32:result = 4 % %var
|
|
|
|
|
@@ -6304,7 +6304,7 @@ result of the division and the remainder.)
|
|
|
Example:
|
|
|
""""""""
|
|
|
|
|
|
-.. code-block:: llvm
|
|
|
+.. code-block:: text
|
|
|
|
|
|
<result> = srem i32 4, %var ; yields i32:result = 4 % %var
|
|
|
|
|
@@ -6344,7 +6344,7 @@ to enable otherwise unsafe floating point optimizations:
|
|
|
Example:
|
|
|
""""""""
|
|
|
|
|
|
-.. code-block:: llvm
|
|
|
+.. code-block:: text
|
|
|
|
|
|
<result> = frem float 4.0, %var ; yields float:result = 4.0 % %var
|
|
|
|
|
@@ -6406,7 +6406,7 @@ nsw/nuw bits in (mul %op1, (shl 1, %op2)).
|
|
|
Example:
|
|
|
""""""""
|
|
|
|
|
|
-.. code-block:: llvm
|
|
|
+.. code-block:: text
|
|
|
|
|
|
<result> = shl i32 4, %var ; yields i32: 4 << %var
|
|
|
<result> = shl i32 4, 2 ; yields i32: 16
|
|
@@ -6455,7 +6455,7 @@ non-zero.
|
|
|
Example:
|
|
|
""""""""
|
|
|
|
|
|
-.. code-block:: llvm
|
|
|
+.. code-block:: text
|
|
|
|
|
|
<result> = lshr i32 4, 1 ; yields i32:result = 2
|
|
|
<result> = lshr i32 4, 2 ; yields i32:result = 1
|
|
@@ -6506,7 +6506,7 @@ non-zero.
|
|
|
Example:
|
|
|
""""""""
|
|
|
|
|
|
-.. code-block:: llvm
|
|
|
+.. code-block:: text
|
|
|
|
|
|
<result> = ashr i32 4, 1 ; yields i32:result = 2
|
|
|
<result> = ashr i32 4, 2 ; yields i32:result = 1
|
|
@@ -6558,7 +6558,7 @@ The truth table used for the '``and``' instruction is:
|
|
|
Example:
|
|
|
""""""""
|
|
|
|
|
|
-.. code-block:: llvm
|
|
|
+.. code-block:: text
|
|
|
|
|
|
<result> = and i32 4, %var ; yields i32:result = 4 & %var
|
|
|
<result> = and i32 15, 40 ; yields i32:result = 8
|
|
@@ -6657,7 +6657,7 @@ The truth table used for the '``xor``' instruction is:
|
|
|
Example:
|
|
|
""""""""
|
|
|
|
|
|
-.. code-block:: llvm
|
|
|
+.. code-block:: text
|
|
|
|
|
|
<result> = xor i32 4, %var ; yields i32:result = 4 ^ %var
|
|
|
<result> = xor i32 15, 40 ; yields i32:result = 39
|
|
@@ -6710,7 +6710,7 @@ exceeds the length of ``val``, the results are undefined.
|
|
|
Example:
|
|
|
""""""""
|
|
|
|
|
|
-.. code-block:: llvm
|
|
|
+.. code-block:: text
|
|
|
|
|
|
<result> = extractelement <4 x i32> %vec, i32 0 ; yields i32
|
|
|
|
|
@@ -6752,7 +6752,7 @@ undefined.
|
|
|
Example:
|
|
|
""""""""
|
|
|
|
|
|
-.. code-block:: llvm
|
|
|
+.. code-block:: text
|
|
|
|
|
|
<result> = insertelement <4 x i32> %vec, i32 1, i32 0 ; yields <4 x i32>
|
|
|
|
|
@@ -6800,7 +6800,7 @@ only one vector.
|
|
|
Example:
|
|
|
""""""""
|
|
|
|
|
|
-.. code-block:: llvm
|
|
|
+.. code-block:: text
|
|
|
|
|
|
<result> = shufflevector <4 x i32> %v1, <4 x i32> %v2,
|
|
|
<4 x i32> <i32 0, i32 4, i32 1, i32 5> ; yields <4 x i32>
|
|
@@ -6859,7 +6859,7 @@ the index operands.
|
|
|
Example:
|
|
|
""""""""
|
|
|
|
|
|
-.. code-block:: llvm
|
|
|
+.. code-block:: text
|
|
|
|
|
|
<result> = extractvalue {i32, float} %agg, 0 ; yields i32
|
|
|
|
|
@@ -8126,7 +8126,7 @@ or :ref:`ptrtoint <i_ptrtoint>` instructions first.
|
|
|
Example:
|
|
|
""""""""
|
|
|
|
|
|
-.. code-block:: llvm
|
|
|
+.. code-block:: text
|
|
|
|
|
|
%X = bitcast i8 255 to i8 ; yields i8 :-1
|
|
|
%Y = bitcast i32* %x to sint* ; yields sint*:%x
|
|
@@ -8265,7 +8265,7 @@ as the values being compared. Otherwise, the result is an ``i1``.
|
|
|
Example:
|
|
|
""""""""
|
|
|
|
|
|
-.. code-block:: llvm
|
|
|
+.. code-block:: text
|
|
|
|
|
|
<result> = icmp eq i32 4, 5 ; yields: result=false
|
|
|
<result> = icmp ne float* %X, %X ; yields: result=false
|
|
@@ -8379,7 +8379,7 @@ assumptions to be made about the values of input arguments; namely
|
|
|
Example:
|
|
|
""""""""
|
|
|
|
|
|
-.. code-block:: llvm
|
|
|
+.. code-block:: text
|
|
|
|
|
|
<result> = fcmp oeq float 4.0, 5.0 ; yields: result=false
|
|
|
<result> = fcmp one float 4.0, 5.0 ; yields: result=true
|
|
@@ -8815,7 +8815,7 @@ that does not carry an appropriate :ref:`"funclet" bundle <ob_funclet>`.
|
|
|
Example:
|
|
|
""""""""
|
|
|
|
|
|
-.. code-block:: llvm
|
|
|
+.. code-block:: text
|
|
|
|
|
|
dispatch:
|
|
|
%cs = catchswitch within none [label %handler0] unwind to caller
|
|
@@ -8885,7 +8885,7 @@ that does not carry an appropriate :ref:`"funclet" bundle <ob_funclet>`.
|
|
|
Example:
|
|
|
""""""""
|
|
|
|
|
|
-.. code-block:: llvm
|
|
|
+.. code-block:: text
|
|
|
|
|
|
%tok = cleanuppad within %cs []
|
|
|
|
|
@@ -12481,19 +12481,19 @@ optimistic assumptions made during compilation. The semantics of
|
|
|
``@llvm.experimental.deoptimize`` -- its body is defined to be
|
|
|
equivalent to:
|
|
|
|
|
|
-.. code-block:: llvm
|
|
|
+.. code-block:: text
|
|
|
|
|
|
- define void @llvm.experimental.guard(i1 %pred, <args...>) {
|
|
|
- %realPred = and i1 %pred, undef
|
|
|
- br i1 %realPred, label %continue, label %leave [, !make.implicit !{}]
|
|
|
+ define void @llvm.experimental.guard(i1 %pred, <args...>) {
|
|
|
+ %realPred = and i1 %pred, undef
|
|
|
+ br i1 %realPred, label %continue, label %leave [, !make.implicit !{}]
|
|
|
|
|
|
- leave:
|
|
|
- call void @llvm.experimental.deoptimize(<args...>) [ "deopt"() ]
|
|
|
- ret void
|
|
|
+ leave:
|
|
|
+ call void @llvm.experimental.deoptimize(<args...>) [ "deopt"() ]
|
|
|
+ ret void
|
|
|
|
|
|
- continue:
|
|
|
- ret void
|
|
|
- }
|
|
|
+ continue:
|
|
|
+ ret void
|
|
|
+ }
|
|
|
|
|
|
|
|
|
with the optional ``[, !make.implicit !{}]`` present if and only if it
|