mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-25 12:12:47 +01:00
[ms-inline asm] Pass the correct AsmVariant to the PrintAsmOperand() function
and update the printOperand() function accordingly. llvm-svn: 163544
This commit is contained in:
parent
e1355ead98
commit
054e489dd3
@ -199,7 +199,8 @@ void AsmPrinter::EmitInlineAsm(const MachineInstr *MI) const {
|
||||
|
||||
// The variant of the current asmprinter.
|
||||
int AsmPrinterVariant = MAI->getAssemblerDialect();
|
||||
|
||||
int InlineAsmVariant = MI->getInlineAsmDialect();
|
||||
|
||||
int CurVariant = -1; // The number of the {.|.|.} region we are in.
|
||||
const char *LastEmitted = AsmStr; // One past the last character emitted.
|
||||
|
||||
@ -344,11 +345,11 @@ void AsmPrinter::EmitInlineAsm(const MachineInstr *MI) const {
|
||||
else {
|
||||
AsmPrinter *AP = const_cast<AsmPrinter*>(this);
|
||||
if (InlineAsm::isMemKind(OpFlags)) {
|
||||
Error = AP->PrintAsmMemoryOperand(MI, OpNo, AsmPrinterVariant,
|
||||
Error = AP->PrintAsmMemoryOperand(MI, OpNo, InlineAsmVariant,
|
||||
Modifier[0] ? Modifier : 0,
|
||||
OS);
|
||||
} else {
|
||||
Error = AP->PrintAsmOperand(MI, OpNo, AsmPrinterVariant,
|
||||
Error = AP->PrintAsmOperand(MI, OpNo, InlineAsmVariant,
|
||||
Modifier[0] ? Modifier : 0, OS);
|
||||
}
|
||||
}
|
||||
|
@ -233,12 +233,14 @@ void X86AsmPrinter::print_pcrel_imm(const MachineInstr *MI, unsigned OpNo,
|
||||
|
||||
|
||||
void X86AsmPrinter::printOperand(const MachineInstr *MI, unsigned OpNo,
|
||||
raw_ostream &O, const char *Modifier) {
|
||||
raw_ostream &O, const char *Modifier,
|
||||
unsigned AsmVariant) {
|
||||
const MachineOperand &MO = MI->getOperand(OpNo);
|
||||
switch (MO.getType()) {
|
||||
default: llvm_unreachable("unknown operand type!");
|
||||
case MachineOperand::MO_Register: {
|
||||
O << '%';
|
||||
// FIXME: Enumerating AsmVariant, so we can remove magic number.
|
||||
if (AsmVariant == 0) O << '%';
|
||||
unsigned Reg = MO.getReg();
|
||||
if (Modifier && strncmp(Modifier, "subreg", strlen("subreg")) == 0) {
|
||||
EVT VT = (strcmp(Modifier+6,"64") == 0) ?
|
||||
@ -471,7 +473,7 @@ bool X86AsmPrinter::PrintAsmOperand(const MachineInstr *MI, unsigned OpNo,
|
||||
}
|
||||
}
|
||||
|
||||
printOperand(MI, OpNo, O);
|
||||
printOperand(MI, OpNo, O, /*Modifier*/ 0, AsmVariant);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -50,7 +50,7 @@ class LLVM_LIBRARY_VISIBILITY X86AsmPrinter : public AsmPrinter {
|
||||
|
||||
// These methods are used by the tablegen'erated instruction printer.
|
||||
void printOperand(const MachineInstr *MI, unsigned OpNo, raw_ostream &O,
|
||||
const char *Modifier = 0);
|
||||
const char *Modifier = 0, unsigned AsmVariant = 0);
|
||||
void print_pcrel_imm(const MachineInstr *MI, unsigned OpNo, raw_ostream &O);
|
||||
|
||||
bool printAsmMRegister(const MachineOperand &MO, char Mode, raw_ostream &O);
|
||||
|
14
test/CodeGen/X86/ms-inline-asm.ll
Normal file
14
test/CodeGen/X86/ms-inline-asm.ll
Normal file
@ -0,0 +1,14 @@
|
||||
; RUN: llc < %s -march=x86 | FileCheck %s
|
||||
|
||||
define i32 @t1() nounwind {
|
||||
entry:
|
||||
%0 = tail call i32 asm sideeffect inteldialect "mov eax, $1\0Amov $0, eax", "=r,r,~{eax},~{dirflag},~{fpsr},~{flags}"(i32 1) nounwind
|
||||
ret i32 %0
|
||||
; CHECK: _t1
|
||||
; CHECK: ## InlineAsm Start
|
||||
; FIXME: .intel_syntax
|
||||
; CHECK: mov eax, ecx
|
||||
; CHECK: mov ecx, eax
|
||||
; FIXME: .att_syntax
|
||||
; CHECK: ## InlineAsm End
|
||||
}
|
Loading…
Reference in New Issue
Block a user