summaryrefslogtreecommitdiff
path: root/docs
diff options
context:
space:
mode:
authorFrancis Visoiu Mistrih <francisvm@yahoo.com>2017-12-08 22:53:21 +0000
committerFrancis Visoiu Mistrih <francisvm@yahoo.com>2017-12-08 22:53:21 +0000
commite28484a720d79c2fd53882301a070c1e13e381a2 (patch)
treeb84ee289db82858ba55ab99b3d3306cf052cb344 /docs
parentd4ac46318e0dd3dd650a77bb3350d8172b83804c (diff)
[CodeGen] Move printing MO_Immediate operands to MachineOperand::print
Work towards the unification of MIR and debug output by refactoring the interfaces. Add support for operand subreg index as an immediate to debug printing and use ::print in the MIRPrinter. Differential Review: https://reviews.llvm.org/D40965 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@320209 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'docs')
-rw-r--r--docs/MIRLangRef.rst29
1 files changed, 29 insertions, 0 deletions
diff --git a/docs/MIRLangRef.rst b/docs/MIRLangRef.rst
index e217b792e62..562b11a6d18 100644
--- a/docs/MIRLangRef.rst
+++ b/docs/MIRLangRef.rst
@@ -430,6 +430,35 @@ immediate machine operand ``-42``:
%eax = MOV32ri -42
+An immediate operand is also used to represent a subregister index when the
+machine instruction has one of the following opcodes:
+
+- ``EXTRACT_SUBREG``
+
+- ``INSERT_SUBREG``
+
+- ``REG_SEQUENCE``
+
+- ``SUBREG_TO_REG``
+
+In case this is true, the Machine Operand is printed according to the target.
+
+For example:
+
+In AArch64RegisterInfo.td:
+
+.. code-block:: text
+
+ def sub_32 : SubRegIndex<32>;
+
+If the third operand is an immediate with the value ``15`` (target-dependent
+value), based on the instruction's opcode and the operand's index the operand
+will be printed as ``%subreg.sub_32``:
+
+.. code-block:: text
+
+ %1:gpr64 = SUBREG_TO_REG 0, %0, %subreg.sub_32
+
For integers > 64bit, we use a special machine operand, ``MO_CImmediate``,
which stores the immediate in a ``ConstantInt`` using an ``APInt`` (LLVM's
arbitrary precision integers).