[llvm-commits] [llvm] r83160 - /llvm/trunk/lib/VMCore/AsmWriter.cpp
Devang Patel
dpatel at apple.com
Wed Sep 30 13:16:55 PDT 2009
Author: dpatel
Date: Wed Sep 30 15:16:54 2009
New Revision: 83160
URL: http://llvm.org/viewvc/llvm-project?rev=83160&view=rev
Log:
Print tag name for MDNodes that are used to encode debug info.
Modified:
llvm/trunk/lib/VMCore/AsmWriter.cpp
Modified: llvm/trunk/lib/VMCore/AsmWriter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/AsmWriter.cpp?rev=83160&r1=83159&r2=83160&view=diff
==============================================================================
--- llvm/trunk/lib/VMCore/AsmWriter.cpp (original)
+++ llvm/trunk/lib/VMCore/AsmWriter.cpp Wed Sep 30 15:16:54 2009
@@ -32,6 +32,7 @@
#include "llvm/ADT/StringExtras.h"
#include "llvm/ADT/STLExtras.h"
#include "llvm/Support/CFG.h"
+#include "llvm/Support/Dwarf.h"
#include "llvm/Support/ErrorHandling.h"
#include "llvm/Support/MathExtras.h"
#include "llvm/Support/FormattedStream.h"
@@ -869,6 +870,30 @@
return pred;
}
+static void WriteMDNodeComment(const MDNode *Node,
+ formatted_raw_ostream &Out) {
+ if (Node->getNumElements() < 1)
+ return;
+ ConstantInt *CI = dyn_cast<ConstantInt>(Node->getElement(0));
+ if (!CI) return;
+ unsigned Val = CI->getZExtValue();
+ unsigned Tag = Val & ~LLVMDebugVersionMask;
+ if (Val >= LLVMDebugVersion) {
+ if (Tag == dwarf::DW_TAG_auto_variable)
+ Out << "; [ DW_TAG_auto_variable ]";
+ else if (Tag == dwarf::DW_TAG_arg_variable)
+ Out << "; [ DW_TAG_arg_variable ]";
+ else if (Tag == dwarf::DW_TAG_return_variable)
+ Out << "; [ DW_TAG_return_variable ]";
+ else if (Tag == dwarf::DW_TAG_vector_type)
+ Out << "; [ DW_TAG_vector_type ]";
+ else if (Tag == dwarf::DW_TAG_user_base)
+ Out << "; [ DW_TAG_user_base ]";
+ else
+ Out << "; [" << dwarf::TagString(Tag) << " ]";
+ }
+}
+
static void WriteMDNodes(formatted_raw_ostream &Out, TypePrinting &TypePrinter,
SlotTracker &Machine) {
SmallVector<const MDNode *, 16> Nodes;
@@ -898,7 +923,10 @@
if (++NI != NE)
Out << ", ";
}
- Out << "}\n";
+
+ Out << "}";
+ WriteMDNodeComment(Node, Out);
+ Out << "\n";
}
}
More information about the llvm-commits
mailing list