From 65600cb2a7e940babf6c493503b9d3fd19f8cb06 Mon Sep 17 00:00:00 2001 From: gbtozers Date: Wed, 30 Sep 2020 16:29:53 +0100 Subject: [DebugInfo] Add DIArgList MD to store multple values in DbgVariableIntrinsics This patch adds a new metadata node, DIArgList, which contains a list of SSA values. This node is in many ways similar in function to the existing ValueAsMetadata node, with the difference being that it tracks a list instead of a single value. Internally, it uses ValueAsMetadata to track the individual values, but there is also a reasonable amount of DIArgList-specific value-tracking logic on top of that. Similar to ValueAsMetadata, it is a special case in parsing and printing due to the fact that it requires a function state (as it may reference function-local values). This patch should not result in any immediate functional change; it allows for DIArgLists to be parsed and printed, but debug variable intrinsics do not yet recognize them as a valid argument (outside of parsing). Differential Revision: https://reviews.llvm.org/D88175 --- llvm/lib/Bitcode/Writer/BitcodeWriter.cpp | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'llvm/lib/Bitcode/Writer/BitcodeWriter.cpp') diff --git a/llvm/lib/Bitcode/Writer/BitcodeWriter.cpp b/llvm/lib/Bitcode/Writer/BitcodeWriter.cpp index dd47e220d9e7..fd4b0a6a6a38 100644 --- a/llvm/lib/Bitcode/Writer/BitcodeWriter.cpp +++ b/llvm/lib/Bitcode/Writer/BitcodeWriter.cpp @@ -335,6 +335,8 @@ private: unsigned Abbrev); void writeDIMacroFile(const DIMacroFile *N, SmallVectorImpl &Record, unsigned Abbrev); + void writeDIArgList(const DIArgList *N, SmallVectorImpl &Record, + unsigned Abbrev); void writeDIModule(const DIModule *N, SmallVectorImpl &Record, unsigned Abbrev); void writeDITemplateTypeParameter(const DITemplateTypeParameter *N, @@ -1867,6 +1869,17 @@ void ModuleBitcodeWriter::writeDIMacroFile(const DIMacroFile *N, Record.clear(); } +void ModuleBitcodeWriter::writeDIArgList(const DIArgList *N, + SmallVectorImpl &Record, + unsigned Abbrev) { + Record.reserve(N->getArgs().size()); + for (ValueAsMetadata *MD : N->getArgs()) + Record.push_back(VE.getMetadataOrNullID(MD)); + + Stream.EmitRecord(bitc::METADATA_ARG_LIST, Record, Abbrev); + Record.clear(); +} + void ModuleBitcodeWriter::writeDIModule(const DIModule *N, SmallVectorImpl &Record, unsigned Abbrev) { -- cgit v1.2.3