[llvm] [RemoveDIs][DebugInfo][IR] Add parsing for non-intrinsic debug values (PR #79818)

Jeremy Morse via llvm-commits llvm-commits at lists.llvm.org
Thu Feb 22 06:22:17 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 ','
----------------
jmorse wrote:

We're now using parens rather than brackets.

For consistency, we should avoid using DIArgList etc here as that delves into the class hierarchy. The parsing is described in terms of BNF types, so I think we just say it's a Metadata?

https://github.com/llvm/llvm-project/pull/79818


More information about the llvm-commits mailing list