llvm.org GIT mirror llvm / 24f5fdd
[ms-inline asm] Properly emit the asm directives when the AsmPrinterVariant and InlineAsmVariant don't match. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@163550 91177308-0d34-0410-b5e6-96231b3b80d8 Chad Rosier 8 years ago
2 changed file(s) with 19 addition(s) and 3 deletion(s). Raw diff Collapse all Expand all
199199 // The variant of the current asmprinter.
200200 int AsmPrinterVariant = MAI->getAssemblerDialect();
201201 int InlineAsmVariant = MI->getInlineAsmDialect();
202
202
203 // Switch to the inline assembly variant.
204 if (AsmPrinterVariant != InlineAsmVariant) {
205 if (InlineAsmVariant == 0)
206 OS << ".att_syntax\n\t";
207 else
208 OS << ".intel_syntax\n\t";
209 }
210
203211 int CurVariant = -1; // The number of the {.|.|.} region we are in.
204212 const char *LastEmitted = AsmStr; // One past the last character emitted.
205213
364372 }
365373 }
366374 }
375 // Switch to the AsmPrinter variant.
376 if (AsmPrinterVariant != InlineAsmVariant) {
377 if (AsmPrinterVariant == 0)
378 OS << "\n\t.att_syntax";
379 else
380 OS << "\n\t.intel_syntax";
381 }
382
367383 OS << '\n' << (char)0; // null terminate string.
368384 EmitInlineAsm(OS.str(), LocMD, MI->getInlineAsmDialect());
369385
55 ret i32 %0
66 ; CHECK: t1
77 ; CHECK: ## InlineAsm Start
8 ; FIXME: .intel_syntax
8 ; CHECK: .intel_syntax
99 ; CHECK: mov eax, ecx
1010 ; CHECK: mov ecx, eax
11 ; FIXME: .att_syntax
11 ; CHECK: .att_syntax
1212 ; CHECK: ## InlineAsm End
1313 }