MIRLangRef: Add documentation for the subregister indices.
authorAlex Lorenz <arphaman@gmail.com>
Tue, 8 Sep 2015 11:39:47 +0000 (11:39 +0000)
committerAlex Lorenz <arphaman@gmail.com>
Tue, 8 Sep 2015 11:39:47 +0000 (11:39 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@247005 91177308-0d34-0410-b5e6-96231b3b80d8

docs/MIRLangRef.rst

index d3c9f828bb3359ddf2910b2086cbdcf16af11568..a5f8c8c743ab2829b79f1b3fcd434dbb4a691190 100644 (file)
@@ -380,7 +380,8 @@ Register Operands
 The :ref:`register <registers>` primitive is used to represent the register
 machine operands. The register operands can also have optional
 :ref:`register flags <register-flags>`,
 The :ref:`register <registers>` primitive is used to represent the register
 machine operands. The register operands can also have optional
 :ref:`register flags <register-flags>`,
-a subregister index, and a reference to the tied register operand.
+:ref:`a subregister index <subregister-indices>`,
+and a reference to the tied register operand.
 The full syntax of a register operand is shown below:
 
 .. code-block:: llvm
 The full syntax of a register operand is shown below:
 
 .. code-block:: llvm
@@ -435,6 +436,23 @@ corresponding internal ``llvm::RegState`` representation:
    * - ``debug-use``
      - ``RegState::Debug``
 
    * - ``debug-use``
      - ``RegState::Debug``
 
+.. _subregister-indices:
+
+Subregister Indices
+~~~~~~~~~~~~~~~~~~~
+
+The register machine operands can reference a portion of a register by using
+the subregister indices. The example below shows an instance of the ``COPY``
+pseudo instruction that uses the X86 ``sub_8bit`` subregister index to copy 8
+lower bits from the 32-bit virtual register 0 to the 8-bit virtual register 1:
+
+.. code-block:: llvm
+
+    %1 = COPY %0:sub_8bit
+
+The names of the subregister indices are target specific, and are typically
+defined in the target's ``*RegisterInfo.td`` file.
+
 Global Value Operands
 ^^^^^^^^^^^^^^^^^^^^^
 
 Global Value Operands
 ^^^^^^^^^^^^^^^^^^^^^
 
@@ -458,7 +476,6 @@ the '@' prefix, like in the following examples: ``@0``, ``@989``.
    are missing.
 .. TODO: Describe the syntax for the bundled instructions.
 .. TODO: Describe the syntax for virtual register YAML definitions.
    are missing.
 .. TODO: Describe the syntax for the bundled instructions.
 .. TODO: Describe the syntax for virtual register YAML definitions.
-.. TODO: Describe the syntax of the subregisters.
 .. TODO: Describe the machine function's YAML flag attributes.
 .. TODO: Describe the syntax for the external symbol and register
    mask machine operands.
 .. TODO: Describe the machine function's YAML flag attributes.
 .. TODO: Describe the syntax for the external symbol and register
    mask machine operands.