From c84690975acd7c5f43e4c44d4653a9f7e384ba8f Mon Sep 17 00:00:00 2001 From: Francis Visoiu Mistrih Date: Wed, 13 Dec 2017 10:30:45 +0000 Subject: [CodeGen] Print constant pool index operands as %const.0 + 8 in both MIR and debug output Work towards the unification of MIR and debug output by printing `%const.0 + 8` instead of `` and `%const.0 - 8` instead of ``. Only debug syntax is affected. Differential Revision: https://reviews.llvm.org/D41116 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@320564 91177308-0d34-0410-b5e6-96231b3b80d8 --- docs/MIRLangRef.rst | 49 +++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 47 insertions(+), 2 deletions(-) (limited to 'docs') diff --git a/docs/MIRLangRef.rst b/docs/MIRLangRef.rst index 7615a28112d..82a61bcde86 100644 --- a/docs/MIRLangRef.rst +++ b/docs/MIRLangRef.rst @@ -549,6 +549,53 @@ lower bits from the 32-bit virtual register 0 to the 8-bit virtual register 1: The names of the subregister indices are target specific, and are typically defined in the target's ``*RegisterInfo.td`` file. +Constant Pool Indices +^^^^^^^^^^^^^^^^^^^^^ + +A constant pool index (CPI) operand is printed using its index in the +function's ``MachineConstantPool`` and an offset. + +For example, a CPI with the index 1 and offset 8: + +.. code-block:: text + + %1:gr64 = MOV64ri %const.1 + 8 + +For a CPI with the index 0 and offset -12: + +.. code-block:: text + + %1:gr64 = MOV64ri %const.0 - 12 + +A constant pool entry is bound to a LLVM IR ``Constant`` or a target-specific +``MachineConstantPoolValue``. When serializing all the function's constants the +following format is used: + +.. code-block:: text + + constants: + - id: + value: + alignment: + isTargetSpecific: + +where ```` is a 32-bit unsigned integer, ```` is a `LLVM IR Constant +`_, alignment is a 32-bit +unsigned integer, and ```` is either true or false. + +Example: + +.. code-block:: text + + constants: + - id: 0 + value: 'double 3.250000e+00' + alignment: 8 + - id: 1 + value: 'g-(LPC0+8)' + alignment: 4 + isTargetSpecific: true + Global Value Operands ^^^^^^^^^^^^^^^^^^^^^ @@ -578,8 +625,6 @@ the '@' prefix, like in the following examples: ``@0``, ``@989``. .. TODO: Describe the frame information YAML mapping. .. TODO: Describe the syntax of the stack object machine operands and their YAML definitions. -.. TODO: Describe the syntax of the constant pool machine operands and their - YAML definitions. .. TODO: Describe the syntax of the jump table machine operands and their YAML definitions. .. TODO: Describe the syntax of the block address machine operands. -- cgit v1.2.3