diff options
author | Devang Patel <dpatel@apple.com> | 2009-09-30 20:16:54 +0000 |
---|---|---|
committer | Devang Patel <dpatel@apple.com> | 2009-09-30 20:16:54 +0000 |
commit | 60a7ae26df4ce7d2dac4636e924c29eed0f97df4 (patch) | |
tree | 5722a148e7fedd77e540928f2dfe8f71773bc5cf /lib/VMCore | |
parent | e9b95fd1ebb1f046d17afd0123d7c3afcd4ddef0 (diff) | |
download | external_llvm-60a7ae26df4ce7d2dac4636e924c29eed0f97df4.zip external_llvm-60a7ae26df4ce7d2dac4636e924c29eed0f97df4.tar.gz external_llvm-60a7ae26df4ce7d2dac4636e924c29eed0f97df4.tar.bz2 |
Print tag name for MDNodes that are used to encode debug info.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@83160 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/VMCore')
-rw-r--r-- | lib/VMCore/AsmWriter.cpp | 30 |
1 files changed, 29 insertions, 1 deletions
diff --git a/lib/VMCore/AsmWriter.cpp b/lib/VMCore/AsmWriter.cpp index 60c5b3e..fbd62dd 100644 --- a/lib/VMCore/AsmWriter.cpp +++ b/lib/VMCore/AsmWriter.cpp @@ -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 @@ static const char *getPredicateText(unsigned predicate) { 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 @@ static void WriteMDNodes(formatted_raw_ostream &Out, TypePrinting &TypePrinter, if (++NI != NE) Out << ", "; } - Out << "}\n"; + + Out << "}"; + WriteMDNodeComment(Node, Out); + Out << "\n"; } } |