[PATCH] D96518: [MIRLangRef] Document MachineOperand comments

Sjoerd Meijer via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Feb 11 08:49:32 PST 2021


SjoerdMeijer created this revision.
SjoerdMeijer added reviewers: dmgreen, fhahn.
Herald added a subscriber: jdoerfert.
SjoerdMeijer requested review of this revision.
Herald added a project: LLVM.

Late follow-up of D74306 <https://reviews.llvm.org/D74306> to document MachineOperand comments in MIRLangRef.


https://reviews.llvm.org/D96518

Files:
  llvm/docs/MIRLangRef.rst


Index: llvm/docs/MIRLangRef.rst
===================================================================
--- llvm/docs/MIRLangRef.rst
+++ llvm/docs/MIRLangRef.rst
@@ -506,6 +506,24 @@
 
 .. TODO: Describe the FPIMM immediate operands.
 
+Comments
+^^^^^^^^
+
+Machine operands can have C/C++ style comments, which are annotations enclosed
+between ``/*`` and ``*/`` to improve readability of e.g. immediate operands.
+In the example below, ARM instructions EOR and BCC and immediate operands
+``14`` and ``0`` have been annotated with their condition codes (CC)
+definitions, i.e. the ``always`` and ``eq`` condition codes:
+
+.. code-block:: text
+
+  dead renamable $r2, $cpsr = tEOR killed renamable $r2, renamable $r1, 14 /* CC::always */, $noreg
+  t2Bcc %bb.4, 0 /* CC:eq */, killed $cpsr
+
+As these annotations are comments, they are ignored by the MI parser.
+Comments can be added or customized by overriding InstrInfo's hook
+``createMIROperandComment()``.
+
 .. _register-operands:
 
 Register Operands


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D96518.323038.patch
Type: text/x-patch
Size: 1010 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210211/f18f9473/attachment.bin>


More information about the llvm-commits mailing list