[PATCH] D101185: [LangRef] tbaa: 'any pointer' and 'vtable pointer' type names can be used

Juneyoung Lee via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Apr 23 10:51:37 PDT 2021


aqjune updated this revision to Diff 340110.
aqjune added a comment.

Address jdoerfert's comment


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D101185/new/

https://reviews.llvm.org/D101185

Files:
  llvm/docs/LangRef.rst


Index: llvm/docs/LangRef.rst
===================================================================
--- llvm/docs/LangRef.rst
+++ llvm/docs/LangRef.rst
@@ -5790,22 +5790,25 @@
 
 Scalar type descriptors are represented as an ``MDNode`` s with two
 operands.  The first operand is an ``MDString`` denoting the name of the
-struct type.  LLVM does not assign meaning to the value of this operand, it
-only cares about it being an ``MDString``.  The second operand is an
-``MDNode`` which points to the parent for said scalar type descriptor,
-which is either another scalar type descriptor or the TBAA root.  Scalar
-type descriptors can have an optional third argument, but that must be the
-constant integer zero.
+scalar type.  The second operand is an ``MDNode`` which points to the parent
+for said scalar type descriptor, which is either another scalar type
+descriptor or the TBAA root.  Scalar type descriptors can have an optional
+third argument, but that must be the constant integer zero.
 
 Struct type descriptors are represented as ``MDNode`` s with an odd number
 of operands greater than 1.  The first operand is an ``MDString`` denoting
-the name of the struct type.  Like in scalar type descriptors the actual
-value of this name operand is irrelevant to LLVM.  After the name operand,
-the struct type descriptors have a sequence of alternating ``MDNode`` and
-``ConstantInt`` operands.  With N starting from 1, the 2N - 1 th operand,
-an ``MDNode``, denotes a contained field, and the 2N th operand, a
-``ConstantInt``, is the offset of the said contained field.  The offsets
-must be in non-decreasing order.
+the name of the struct type.  After the name operand, the struct type
+descriptors have a sequence of alternating ``MDNode`` and ``ConstantInt``
+operands.  With N starting from 1, the 2N - 1 th operand, an ``MDNode``,
+denotes a contained field, and the 2N th operand, a ``ConstantInt``, is the
+offset of the said contained field.  The offsets must be in non-decreasing
+order.
+
+The names in the first operand of a scalar or struct type description can be
+chosen freely by the frontend. However, optimizations might use them as a
+heuristics for better performance without affecting correctness. As an
+example, ``"any pointer"`` and ``"vtable pointer"`` might be recognized and
+used to select a different, but equivalent, code generation.
 
 Access tags are represented as ``MDNode`` s with either 3 or 4 operands.
 The first operand is an ``MDNode`` pointing to the node representing the


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D101185.340110.patch
Type: text/x-patch
Size: 2523 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210423/fbcadca1/attachment.bin>


More information about the llvm-commits mailing list