Add support for global constants, and for initializers for constants
llvm-svn: 598
diff --git a/llvm/lib/VMCore/AsmWriter.cpp b/llvm/lib/VMCore/AsmWriter.cpp
index 926e611..f61c547 100644
--- a/llvm/lib/VMCore/AsmWriter.cpp
+++ b/llvm/lib/VMCore/AsmWriter.cpp
@@ -123,9 +123,17 @@
}
void AssemblyWriter::processGlobal(const GlobalVariable *GV) {
- Out << "global ";
if (GV->hasName()) Out << "%" << GV->getName() << " = ";
- Out << GV->getType()->getDescription() << endl;
+
+ if (!GV->hasInitializer()) Out << "uninitialized ";
+
+ Out << (GV->isConstant() ? "constant " : "global ")
+ << GV->getType()->getValueType()->getDescription();
+
+ if (GV->hasInitializer())
+ writeOperand(GV->getInitializer(), false, false);
+
+ Out << endl;
}