mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-07-16 11:24:39 +00:00
[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
This commit is contained in:
@@ -200,7 +200,15 @@ void AsmPrinter::EmitInlineAsm(const MachineInstr *MI) const {
|
|||||||
// The variant of the current asmprinter.
|
// The variant of the current asmprinter.
|
||||||
int AsmPrinterVariant = MAI->getAssemblerDialect();
|
int AsmPrinterVariant = MAI->getAssemblerDialect();
|
||||||
int InlineAsmVariant = MI->getInlineAsmDialect();
|
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.
|
int CurVariant = -1; // The number of the {.|.|.} region we are in.
|
||||||
const char *LastEmitted = AsmStr; // One past the last character emitted.
|
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.
|
OS << '\n' << (char)0; // null terminate string.
|
||||||
EmitInlineAsm(OS.str(), LocMD, MI->getInlineAsmDialect());
|
EmitInlineAsm(OS.str(), LocMD, MI->getInlineAsmDialect());
|
||||||
|
|
||||||
|
@@ -6,9 +6,9 @@ entry:
|
|||||||
ret i32 %0
|
ret i32 %0
|
||||||
; CHECK: t1
|
; CHECK: t1
|
||||||
; CHECK: ## InlineAsm Start
|
; CHECK: ## InlineAsm Start
|
||||||
; FIXME: .intel_syntax
|
; CHECK: .intel_syntax
|
||||||
; CHECK: mov eax, ecx
|
; CHECK: mov eax, ecx
|
||||||
; CHECK: mov ecx, eax
|
; CHECK: mov ecx, eax
|
||||||
; FIXME: .att_syntax
|
; CHECK: .att_syntax
|
||||||
; CHECK: ## InlineAsm End
|
; CHECK: ## InlineAsm End
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user