aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Bitcode/Writer/BitcodeWriter.cpp
diff options
context:
space:
mode:
authorYonghong Song <yhs@fb.com>2021-07-19 09:33:55 -0700
committerYonghong Song <yhs@fb.com>2021-08-26 10:03:44 -0700
commit30c288489ae51a3e0819241f367eeae6df2b09e7 (patch)
treeac633c6960ad10e6463c338b71ce78924c498d19 /llvm/lib/Bitcode/Writer/BitcodeWriter.cpp
parentbe19aee4b26ea1e8672c61b1cfd520a5f8d9ba0e (diff)
downloadllvm-30c288489ae51a3e0819241f367eeae6df2b09e7.zip
llvm-30c288489ae51a3e0819241f367eeae6df2b09e7.tar.gz
llvm-30c288489ae51a3e0819241f367eeae6df2b09e7.tar.bz2
[DebugInfo] generate btf_tag annotations for DIGlobalVariable
Generate btf_tag annotations for DIGlobalVariable. A field "annotations" is introduced to DIGlobalVariable, and annotations are represented as an DINodeArray, similar to DIComposite elements. The following example illustrates how annotations are encoded in IR: distinct !DIGlobalVariable(..., annotations: !10) !10 = !{!11, !12} !11 = !{!"btf_tag", !"a"} !12 = !{!"btf_tag", !"b"} Differential Revision: https://reviews.llvm.org/D106619
Diffstat (limited to 'llvm/lib/Bitcode/Writer/BitcodeWriter.cpp')
-rw-r--r--llvm/lib/Bitcode/Writer/BitcodeWriter.cpp1
1 files changed, 1 insertions, 0 deletions
diff --git a/llvm/lib/Bitcode/Writer/BitcodeWriter.cpp b/llvm/lib/Bitcode/Writer/BitcodeWriter.cpp
index 19f518d..d012733 100644
--- a/llvm/lib/Bitcode/Writer/BitcodeWriter.cpp
+++ b/llvm/lib/Bitcode/Writer/BitcodeWriter.cpp
@@ -1962,6 +1962,7 @@ void ModuleBitcodeWriter::writeDIGlobalVariable(
Record.push_back(VE.getMetadataOrNullID(N->getStaticDataMemberDeclaration()));
Record.push_back(VE.getMetadataOrNullID(N->getTemplateParams()));
Record.push_back(N->getAlignInBits());
+ Record.push_back(VE.getMetadataOrNullID(N->getAnnotations().get()));
Stream.EmitRecord(bitc::METADATA_GLOBAL_VAR, Record, Abbrev);
Record.clear();