summaryrefslogtreecommitdiffstats
path: root/llvm/docs
diff options
context:
space:
mode:
authorYonghong Song <yhs@fb.com>2019-08-02 21:28:28 +0000
committerYonghong Song <yhs@fb.com>2019-08-02 21:28:28 +0000
commitd0ea05d5eff475a27a5d3bbe4d9fd389935f9cb2 (patch)
treeea42a342055799012a910575e5cfe53f6b8cc842 /llvm/docs
parent73752abeab1a1ce5d44ed3c4c6ac78a4a00be6ed (diff)
downloadbcm5719-llvm-d0ea05d5eff475a27a5d3bbe4d9fd389935f9cb2.tar.gz
bcm5719-llvm-d0ea05d5eff475a27a5d3bbe4d9fd389935f9cb2.zip
[BPF] annotate DIType metadata for builtin preseve_array_access_index()
Previously, debuginfo types are annotated to IR builtin preserve_struct_access_index() and preserve_union_access_index(), but not preserve_array_access_index(). The debug info is useful to identify the root type name which later will be used for type comparison. For user access without explicit type conversions, the previous scheme works as we can ignore intermediate compiler generated type conversions (e.g., from union types to union members) and still generate correct access index string. The issue comes with user explicit type conversions, e.g., converting an array to a structure like below: struct t { int a; char b[40]; }; struct p { int c; int d; }; struct t *var = ...; ... __builtin_preserve_access_index(&(((struct p *)&(var->b[0]))->d)) ... Although BPF backend can derive the type of &(var->b[0]), explicit type annotation make checking more consistent and less error prone. Another benefit is for multiple dimension array handling. For example, struct p { int c; int d; } g[8][9][10]; ... __builtin_preserve_access_index(&g[2][3][4].d) ... It would be possible to calculate the number of "struct p"'s before accessing its member "d" if array debug info is available as it contains each dimension range. This patch enables to annotate IR builtin preserve_array_access_index() with proper debuginfo type. The unit test case and language reference is updated as well. Signed-off-by: Yonghong Song <yhs@fb.com> Differential Revision: https://reviews.llvm.org/D65664 llvm-svn: 367724
Diffstat (limited to 'llvm/docs')
-rw-r--r--llvm/docs/LangRef.rst4
1 files changed, 4 insertions, 0 deletions
diff --git a/llvm/docs/LangRef.rst b/llvm/docs/LangRef.rst
index 5fa698e7510..a6acdeaf85e 100644
--- a/llvm/docs/LangRef.rst
+++ b/llvm/docs/LangRef.rst
@@ -17395,6 +17395,10 @@ based on array base ``base``, array dimension ``dim`` and the last access index
into the array. The return type ``ret_type`` is a pointer type to the array element.
The array ``dim`` and ``index`` are preserved which is more robust than
getelementptr instruction which may be subject to compiler transformation.
+The ``llvm.preserve.access.index`` type of metadata is attached to this call instruction
+to provide array or pointer debuginfo type.
+The metadata is a ``DICompositeType`` or ``DIDerivedType`` representing the
+debuginfo version of ``type``.
Arguments:
""""""""""
OpenPOWER on IntegriCloud