diff options
| author | Chad Rosier <mcrosier@apple.com> | 2012-09-10 21:36:05 +0000 |
|---|---|---|
| committer | Chad Rosier <mcrosier@apple.com> | 2012-09-10 21:36:05 +0000 |
| commit | 7641f587849d00edfbafa3b4c036293e4e009a52 (patch) | |
| tree | 5f968106ecacc8532b0d4008b92e79a5e7e9176a /llvm/lib/CodeGen/AsmPrinter | |
| parent | 1c1319b9e7bb6482f360a9dba6cff8b9cb0e5013 (diff) | |
| download | bcm5719-llvm-7641f587849d00edfbafa3b4c036293e4e009a52.tar.gz bcm5719-llvm-7641f587849d00edfbafa3b4c036293e4e009a52.zip | |
[ms-inline asm] Properly emit the asm directives when the AsmPrinterVariant
and InlineAsmVariant don't match.
llvm-svn: 163550
Diffstat (limited to 'llvm/lib/CodeGen/AsmPrinter')
| -rw-r--r-- | llvm/lib/CodeGen/AsmPrinter/AsmPrinterInlineAsm.cpp | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/llvm/lib/CodeGen/AsmPrinter/AsmPrinterInlineAsm.cpp b/llvm/lib/CodeGen/AsmPrinter/AsmPrinterInlineAsm.cpp index 2dfb73e300e..260871d33b0 100644 --- a/llvm/lib/CodeGen/AsmPrinter/AsmPrinterInlineAsm.cpp +++ b/llvm/lib/CodeGen/AsmPrinter/AsmPrinterInlineAsm.cpp @@ -200,7 +200,15 @@ void AsmPrinter::EmitInlineAsm(const MachineInstr *MI) const { // The variant of the current asmprinter. int AsmPrinterVariant = MAI->getAssemblerDialect(); int InlineAsmVariant = MI->getInlineAsmDialect(); - + + // Switch to the inline assembly variant. + if (AsmPrinterVariant != InlineAsmVariant) { + if (InlineAsmVariant == 0) + OS << ".att_syntax\n\t"; + else + OS << ".intel_syntax\n\t"; + } + int CurVariant = -1; // The number of the {.|.|.} region we are in. const char *LastEmitted = AsmStr; // One past the last character emitted. @@ -365,6 +373,14 @@ void AsmPrinter::EmitInlineAsm(const MachineInstr *MI) const { } } } + // Switch to the AsmPrinter variant. + if (AsmPrinterVariant != InlineAsmVariant) { + if (AsmPrinterVariant == 0) + OS << "\n\t.att_syntax"; + else + OS << "\n\t.intel_syntax"; + } + OS << '\n' << (char)0; // null terminate string. EmitInlineAsm(OS.str(), LocMD, MI->getInlineAsmDialect()); |

