[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:33:48 PDT 2021


aqjune created this revision.
aqjune added reviewers: jeroen.dobbelaere, jdoerfert.
Herald added a subscriber: kosarev.
aqjune requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

As discussed in D100717 <https://reviews.llvm.org/D100717>, this patch states that if TBAA metadata node's type name is
`any pointer` or `vtable pointer` it can be used as a hint to drive further optimizations/passes.


Repository:
  rG LLVM Github Monorepo

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,24 @@
 
 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.
+
+LLVM does not assign meaning to the name of the type that is the value of the
+first operand of scalar type descriptors or struct type descriptors. But,
+``"any pointer"`` and ``"vtable pointer"`` are exceptions and they might be
+used to drive optimization passes/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.340106.patch
Type: text/x-patch
Size: 2442 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210423/e3582b02/attachment.bin>


More information about the llvm-commits mailing list