diff options
author | Yonghong Song <yhs@fb.com> | 2019-03-28 21:59:49 +0000 |
---|---|---|
committer | Yonghong Song <yhs@fb.com> | 2019-03-28 21:59:49 +0000 |
commit | 360a4e2ca6ead28b4d761b189c3995be5ac72a91 (patch) | |
tree | 23732508543f26ec86a25e44a5622f0fef04e5e0 /llvm/lib/Target/BPF/BTFDebug.h | |
parent | 3dd72ea810dbb0c45c5815d2f43cc2b393d274a1 (diff) | |
download | bcm5719-llvm-360a4e2ca6ead28b4d761b189c3995be5ac72a91.tar.gz bcm5719-llvm-360a4e2ca6ead28b4d761b189c3995be5ac72a91.zip |
[BPF] add proper multi-dimensional array support
For multi-dimensional array like below
int a[2][3];
the previous implementation generates BTF_KIND_ARRAY type
like below:
. element_type: int
. index_type: unsigned int
. number of elements: 6
This is not the best way to represent arrays, esp.,
when converting BTF back to headers and users will see
int a[6];
instead.
This patch generates proper support for multi-dimensional arrays.
For "int a[2][3]", the two BTF_KIND_ARRAY types will be
generated:
Type #n:
. element_type: int
. index_type: unsigned int
. number of elements: 3
Type #(n+1):
. element_type: #n
. index_type: unsigned int
. number of elements: 2
The linux kernel already supports such a multi-dimensional
array representation properly.
Signed-off-by: Yonghong Song <yhs@fb.com>
Differential Revision: https://reviews.llvm.org/D59943
llvm-svn: 357215
Diffstat (limited to 'llvm/lib/Target/BPF/BTFDebug.h')
-rw-r--r-- | llvm/lib/Target/BPF/BTFDebug.h | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/llvm/lib/Target/BPF/BTFDebug.h b/llvm/lib/Target/BPF/BTFDebug.h index 58fba7f5a9c..7d7a1d9b707 100644 --- a/llvm/lib/Target/BPF/BTFDebug.h +++ b/llvm/lib/Target/BPF/BTFDebug.h @@ -100,11 +100,10 @@ public: /// Handle array type. class BTFTypeArray : public BTFTypeBase { - const DICompositeType *ATy; struct BTF::BTFArray ArrayInfo; public: - BTFTypeArray(const DICompositeType *ATy); + BTFTypeArray(uint32_t ElemTypeId, uint32_t NumElems); uint32_t getSize() { return BTFTypeBase::getSize() + BTF::BTFArraySize; } void completeType(BTFDebug &BDebug); void emitType(MCStreamer &OS); |