summaryrefslogtreecommitdiffstats
path: root/llvm/lib/VMCore/AsmWriter.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2009-12-31 01:41:14 +0000
committerChris Lattner <sabre@nondot.org>2009-12-31 01:41:14 +0000
commit31fcc28a8479eb8bfadef1d22171c7de7a58abe6 (patch)
tree9e5730c22ba6630a80a45720f5139be655cdd9ba /llvm/lib/VMCore/AsmWriter.cpp
parentbe2de79b77c2404ad293023d9421f13e4bccbf31 (diff)
downloadbcm5719-llvm-31fcc28a8479eb8bfadef1d22171c7de7a58abe6.tar.gz
bcm5719-llvm-31fcc28a8479eb8bfadef1d22171c7de7a58abe6.zip
simplify printing of mdstring and Argument.
llvm-svn: 92325
Diffstat (limited to 'llvm/lib/VMCore/AsmWriter.cpp')
-rw-r--r--llvm/lib/VMCore/AsmWriter.cpp17
1 files changed, 5 insertions, 12 deletions
diff --git a/llvm/lib/VMCore/AsmWriter.cpp b/llvm/lib/VMCore/AsmWriter.cpp
index d00244c583e..f9ca2cb01ee 100644
--- a/llvm/lib/VMCore/AsmWriter.cpp
+++ b/llvm/lib/VMCore/AsmWriter.cpp
@@ -57,9 +57,11 @@ static const Module *getModuleFromVal(const Value *V) {
const Function *M = I->getParent() ? I->getParent()->getParent() : 0;
return M ? M->getParent() : 0;
}
-
+
if (const GlobalValue *GV = dyn_cast<GlobalValue>(V))
return GV->getParent();
+ if (const NamedMDNode *NMD = dyn_cast<NamedMDNode>(V))
+ return NMD->getParent();
return 0;
}
@@ -2091,13 +2093,6 @@ void Value::print(raw_ostream &ROS, AssemblyAnnotationWriter *AAW) const {
SlotTracker SlotTable(GV->getParent());
AssemblyWriter W(OS, SlotTable, GV->getParent(), AAW);
W.write(GV);
- } else if (const MDString *MDS = dyn_cast<MDString>(this)) {
- TypePrinting TypePrinter;
- TypePrinter.print(MDS->getType(), OS);
- OS << ' ';
- OS << "!\"";
- PrintEscapedString(MDS->getString(), OS);
- OS << '"';
} else if (const MDNode *N = dyn_cast<MDNode>(this)) {
SlotTracker SlotTable(N);
TypePrinting TypePrinter;
@@ -2123,10 +2118,8 @@ void Value::print(raw_ostream &ROS, AssemblyAnnotationWriter *AAW) const {
TypePrinter.print(C->getType(), OS);
OS << ' ';
WriteConstantInt(OS, C, TypePrinter, 0);
- } else if (const Argument *A = dyn_cast<Argument>(this)) {
- WriteAsOperand(OS, this, true,
- A->getParent() ? A->getParent()->getParent() : 0);
- } else if (isa<InlineAsm>(this)) {
+ } else if (isa<InlineAsm>(this) || isa<MDString>(this) ||
+ isa<Argument>(this)) {
WriteAsOperand(OS, this, true, 0);
} else {
// Otherwise we don't know what it is. Call the virtual function to
OpenPOWER on IntegriCloud