"``anyregcc``" - Dynamic calling convention for code patching
This is a special convention that supports patching an arbitrary code
sequence in place of a call site. This convention forces the call
- arguments into registers but allows them to be dynamcially
+ arguments into registers but allows them to be dynamically
allocated. This can currently only be used with calls to
llvm.experimental.patchpoint because only this intrinsic records
the location of its arguments in a side table. See :doc:`StackMaps`.
"``preserve_mostcc``" - The `PreserveMost` calling convention
- This calling convention attempts to make the code in the caller as little
- intrusive as possible. This calling convention behaves identical to the `C`
+ This calling convention attempts to make the code in the caller as
+ unintrusive as possible. This convention behaves identically to the `C`
calling convention on how arguments and return values are passed, but it
uses a different set of caller/callee-saved registers. This alleviates the
burden of saving and recovering a large register set before and after the
More information about specific metadata nodes recognized by the
optimizers and code generator is found below.
+.. _specialized-metadata:
+
Specialized Metadata Nodes
^^^^^^^^^^^^^^^^^^^^^^^^^^
These aren't inherently debug info centric, but currently all the specialized
metadata nodes are related to debug info.
+.. _MDCompileUnit:
+
MDCompileUnit
"""""""""""""
enums: !2, retainedTypes: !3, subprograms: !4,
globals: !5, imports: !6)
+Compile unit descriptors provide the root scope for objects declared in a
+specific compilation unit. File descriptors are defined using this scope.
+These descriptors are collected by a named metadata ``!llvm.dbg.cu``. They
+keep track of subprograms, global variables, type information, and imported
+entities (declarations and namespaces).
+
+.. _MDFile:
+
MDFile
""""""
!0 = !MDFile(filename: "path/to/file", directory: "/path/to/dir")
+Files are sometimes used in ``scope:`` fields, and are the only valid target
+for ``file:`` fields.
+
.. _MDLocation:
MDBasicType
"""""""""""
-``MDBasicType`` nodes represent primitive types. ``tag:`` defaults to
-``DW_TAG_base_type``.
+``MDBasicType`` nodes represent primitive types, such as ``int``, ``bool`` and
+``float``. ``tag:`` defaults to ``DW_TAG_base_type``.
.. code-block:: llvm
encoding: DW_ATE_unsigned_char)
!1 = !MDBasicType(tag: DW_TAG_unspecified_type, name: "decltype(nullptr)")
+The ``encoding:`` describes the details of the type. Usually it's one of the
+following:
+
+.. code-block:: llvm
+
+ DW_ATE_address = 1
+ DW_ATE_boolean = 2
+ DW_ATE_float = 4
+ DW_ATE_signed = 5
+ DW_ATE_signed_char = 6
+ DW_ATE_unsigned = 7
+ DW_ATE_unsigned_char = 8
+
.. _MDSubroutineType:
MDSubroutineType
!1 = !BasicType(name: "char", size: 8, align: 8, DW_ATE_signed_char)
!2 = !MDSubroutineType(types: !{null, !0, !1}) ; void (int, char)
+.. _MDDerivedType:
+
MDDerivedType
"""""""""""""
!1 = !MDDerivedType(tag: DW_TAG_pointer_type, baseType: !0, size: 32,
align: 32)
+The following ``tag:`` values are valid:
+
+.. code-block:: llvm
+
+ DW_TAG_formal_parameter = 5
+ DW_TAG_member = 13
+ DW_TAG_pointer_type = 15
+ DW_TAG_reference_type = 16
+ DW_TAG_typedef = 22
+ DW_TAG_ptr_to_member_type = 31
+ DW_TAG_const_type = 38
+ DW_TAG_volatile_type = 53
+ DW_TAG_restrict_type = 55
+
+``DW_TAG_member`` is used to define a member of a :ref:`composite type
+<MDCompositeType>` or :ref:`subprogram <MDSubprogram>`. The type of the member
+is the ``baseType:``. The ``offset:`` is the member's bit offset.
+``DW_TAG_formal_parameter`` is used to define a member which is a formal
+argument of a subprogram.
+
+``DW_TAG_typedef`` is used to provide a name for the ``baseType:``.
+
+``DW_TAG_pointer_type``, ``DW_TAG_reference_type``, ``DW_TAG_const_type``,
+``DW_TAG_volatile_type`` and ``DW_TAG_restrict_type`` are used to qualify the
+``baseType:``.
+
+Note that the ``void *`` type is expressed as a type derived from NULL.
+
.. _MDCompositeType:
MDCompositeType
line: 2, size: 32, align: 32, identifier: "_M4Enum",
elements: !{!0, !1, !2})
+The following ``tag:`` values are valid:
+
+.. code-block:: llvm
+
+ DW_TAG_array_type = 1
+ DW_TAG_class_type = 2
+ DW_TAG_enumeration_type = 4
+ DW_TAG_structure_type = 19
+ DW_TAG_union_type = 23
+ DW_TAG_subroutine_type = 21
+ DW_TAG_inheritance = 28
+
+
+For ``DW_TAG_array_type``, the ``elements:`` should be :ref:`subrange
+descriptors <MDSubrange>`, each representing the range of subscripts at that
+level of indexing. The ``DIFlagVector`` flag to ``flags:`` indicates that an
+array type is a native packed vector.
+
+For ``DW_TAG_enumeration_type``, the ``elements:`` should be :ref:`enumerator
+descriptors <MDEnumerator>`, each representing the definition of an enumeration
+value for the set. All enumeration type descriptors are collected in the
+``enums:`` field of the :ref:`compile unit <MDCompileUnit>`.
+
+For ``DW_TAG_structure_type``, ``DW_TAG_class_type``, and
+``DW_TAG_union_type``, the ``elements:`` should be :ref:`derived types
+<MDDerivedType>` with ``tag: DW_TAG_member`` or ``tag: DW_TAG_inheritance``.
+
+.. _MDSubrange:
+
MDSubrange
""""""""""
!1 = !MDSubrange(count: 5, lowerBound: 1) ; array counting from 1
!2 = !MDSubrange(count: -1) ; empty array.
+.. _MDEnumerator:
+
MDEnumerator
""""""""""""
isDefinition: false, variable: i32* @foo,
declaration: !4)
+All global variables should be referenced by the `globals:` field of a
+:ref:`compile unit <MDCompileUnit>`.
+
.. _MDSubprogram:
MDSubprogram
MDLexicalBlock
""""""""""""""
-``MDLexicalBlock`` nodes represent lexical blocks in the source language (a
-scope).
+``MDLexicalBlock`` nodes describe nested blocks within a :ref:`subprogram
+<MDSubprogram>`. The line number and column numbers are used to dinstinguish
+two lexical blocks at same depth. They are valid targets for ``scope:``
+fields.
.. code-block:: llvm
- !0 = !MDLexicalBlock(scope: !1, file: !2, line: 7, column: 35)
+ !0 = distinct !MDLexicalBlock(scope: !1, file: !2, line: 7, column: 35)
+
+Usually lexical blocks are ``distinct`` to prevent node merging based on
+operands.
.. _MDLexicalBlockFile:
``noalias`` metadata can specifically be specified not to alias with some other
collection of memory access instructions that carry ``alias.scope`` metadata.
Each type of metadata specifies a list of scopes where each scope has an id and
-a domain. When evaluating an aliasing query, if for some some domain, the set
+a domain. When evaluating an aliasing query, if for some domain, the set
of scopes with that domain in one instruction's ``alias.scope`` list is a
subset of (or equal to) the set of scopes for that domain in another
instruction's ``noalias`` list, then the two memory accesses are assumed not to
""""""""""
The '``ptrtoint``' instruction takes a ``value`` to cast, which must be
-a a value of type :ref:`pointer <t_pointer>` or a vector of pointers, and a
+a value of type :ref:`pointer <t_pointer>` or a vector of pointers, and a
type to cast it to ``ty2``, which must be an :ref:`integer <t_integer>` or
a vector of integers type.