[llvm] [RemoveDIs][DebugInfo][IR] Add parsing for non-intrinsic debug values (PR #79818)
Stephen Tozer via llvm-commits
llvm-commits at lists.llvm.org
Thu Feb 22 07:24:18 PST 2024
================
@@ -6406,11 +6455,106 @@ bool LLParser::parseBasicBlock(PerFunctionState &PFS) {
// Set the name on the instruction.
if (PFS.setInstName(NameID, NameStr, NameLoc, Inst))
return true;
+
+ // Attach any preceding debug values to this instruction.
+ for (std::unique_ptr<DPValue> &DPV : TrailingDPValues)
+ BB->insertDPValueBefore(DPV.release(), Inst->getIterator());
+ TrailingDPValues.clear();
} while (!Inst->isTerminator());
+ assert(TrailingDPValues.empty() &&
+ "All debug values should have been attached to an instruction.");
+
+ return false;
+}
+
+/// parseDebugProgramValue
+/// ::= #dbg_Type '{' (ValueAsMetadata|DIArgList|MDNode) ',' MetadataID ','
----------------
SLTozer wrote:
I think it's not entirely described in terms of actual token types - we refer to "Instructions" in other descriptions, for example, which aren't tokens but parseable objects, i.e. anything that we can call `parseFoo` for - but we can follow that description more closely than I've done here, since we do for example call `parseMetadata` for the "value" arguments.
https://github.com/llvm/llvm-project/pull/79818
More information about the llvm-commits
mailing list