IR: Assembly and bitcode for GenericDebugNode
llvm-svn: 228041
diff --git a/llvm/lib/IR/AsmWriter.cpp b/llvm/lib/IR/AsmWriter.cpp
index d52ac87..ba1c526 100644
--- a/llvm/lib/IR/AsmWriter.cpp
+++ b/llvm/lib/IR/AsmWriter.cpp
@@ -1286,10 +1286,32 @@
}
} // end namespace
-static void writeGenericDebugNode(raw_ostream &, const GenericDebugNode *,
- TypePrinting *, SlotTracker *,
- const Module *) {
- llvm_unreachable("Unimplemented write");
+static void writeGenericDebugNode(raw_ostream &Out, const GenericDebugNode *N,
+ TypePrinting *TypePrinter,
+ SlotTracker *Machine, const Module *Context) {
+ Out << "!GenericDebugNode(";
+ FieldSeparator FS;
+ // Always output the line, since 0 is a relevant and important value for it.
+ Out << FS << "tag: " << N->getTag();
+ if (!N->getHeader().empty()) {
+ Out << FS << "header: \"";
+ PrintEscapedString(N->getHeader(), Out);
+ Out << "\"";
+ }
+ if (N->getNumDwarfOperands()) {
+ Out << FS << "operands: {";
+ FieldSeparator IFS;
+ for (auto &I : N->dwarf_operands()) {
+ Out << IFS;
+ if (!I) {
+ Out << "null";
+ continue;
+ }
+ WriteAsOperandInternal(Out, I, TypePrinter, Machine, Context);
+ }
+ Out << "}";
+ }
+ Out << ")";
}
static void writeMDLocation(raw_ostream &Out, const MDLocation *DL,