Derive MDNode from MetadataBase instead of Constant. Emit MDNodes into METADATA_BLOCK in bitcode file.

llvm-svn: 76834
diff --git a/llvm/lib/VMCore/AsmWriter.cpp b/llvm/lib/VMCore/AsmWriter.cpp
index d9d8cc8..ae55d5b 100644
--- a/llvm/lib/VMCore/AsmWriter.cpp
+++ b/llvm/lib/VMCore/AsmWriter.cpp
@@ -1132,6 +1132,11 @@
     return;
   }
 
+  if (const MDNode *N = dyn_cast<MDNode>(V)) {
+    Out << '!' << Machine->getMetadataSlot(N);
+    return;
+  }
+
   if (const MDString *MDS = dyn_cast<MDString>(V)) {
     Out << "!\"";
     PrintEscapedString(MDS->begin(), MDS->size(), Out);