Make Intel syntax mode friendlier to Microsoft ML assembler (still needs more work).
llvm-svn: 28044
diff --git a/llvm/lib/CodeGen/AsmPrinter.cpp b/llvm/lib/CodeGen/AsmPrinter.cpp
index b28c386..9e94f7a 100644
--- a/llvm/lib/CodeGen/AsmPrinter.cpp
+++ b/llvm/lib/CodeGen/AsmPrinter.cpp
@@ -372,6 +372,21 @@
O << "\"";
}
+/// EmitString - Emit a zero-byte-terminated string constant.
+///
+void AsmPrinter::EmitString(const ConstantArray *CVA) const {
+ unsigned NumElts = CVA->getNumOperands();
+ if (AscizDirective && NumElts &&
+ cast<ConstantInt>(CVA->getOperand(NumElts-1))->getRawValue() == 0) {
+ O << AscizDirective;
+ printAsCString(O, CVA, NumElts-1);
+ } else {
+ O << AsciiDirective;
+ printAsCString(O, CVA, NumElts);
+ }
+ O << "\n";
+}
+
/// EmitGlobalConstant - Print a general LLVM constant to the .s file.
///
void AsmPrinter::EmitGlobalConstant(const Constant *CV) {
@@ -382,16 +397,7 @@
return;
} else if (const ConstantArray *CVA = dyn_cast<ConstantArray>(CV)) {
if (CVA->isString()) {
- unsigned NumElts = CVA->getNumOperands();
- if (AscizDirective && NumElts &&
- cast<ConstantInt>(CVA->getOperand(NumElts-1))->getRawValue() == 0) {
- O << AscizDirective;
- printAsCString(O, CVA, NumElts-1);
- } else {
- O << AsciiDirective;
- printAsCString(O, CVA, NumElts);
- }
- O << "\n";
+ EmitString(CVA);
} else { // Not a string. Print the values in successive locations
for (unsigned i = 0, e = CVA->getNumOperands(); i != e; ++i)
EmitGlobalConstant(CVA->getOperand(i));