llvm.org GIT mirror llvm / 3b132fa
[ms-inline asm] Pass the correct AsmVariant to the PrintAsmOperand() function and update the printOperand() function accordingly. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@163544 91177308-0d34-0410-b5e6-96231b3b80d8 Chad Rosier 8 years ago
4 changed file(s) with 24 addition(s) and 7 deletion(s). Raw diff Collapse all Expand all
198198
199199 // The variant of the current asmprinter.
200200 int AsmPrinterVariant = MAI->getAssemblerDialect();
201
201 int InlineAsmVariant = MI->getInlineAsmDialect();
202
202203 int CurVariant = -1; // The number of the {.|.|.} region we are in.
203204 const char *LastEmitted = AsmStr; // One past the last character emitted.
204205
343344 else {
344345 AsmPrinter *AP = const_cast(this);
345346 if (InlineAsm::isMemKind(OpFlags)) {
346 Error = AP->PrintAsmMemoryOperand(MI, OpNo, AsmPrinterVariant,
347 Error = AP->PrintAsmMemoryOperand(MI, OpNo, InlineAsmVariant,
347348 Modifier[0] ? Modifier : 0,
348349 OS);
349350 } else {
350 Error = AP->PrintAsmOperand(MI, OpNo, AsmPrinterVariant,
351 Error = AP->PrintAsmOperand(MI, OpNo, InlineAsmVariant,
351352 Modifier[0] ? Modifier : 0, OS);
352353 }
353354 }
232232
233233
234234 void X86AsmPrinter::printOperand(const MachineInstr *MI, unsigned OpNo,
235 raw_ostream &O, const char *Modifier) {
235 raw_ostream &O, const char *Modifier,
236 unsigned AsmVariant) {
236237 const MachineOperand &MO = MI->getOperand(OpNo);
237238 switch (MO.getType()) {
238239 default: llvm_unreachable("unknown operand type!");
239240 case MachineOperand::MO_Register: {
240 O << '%';
241 // FIXME: Enumerating AsmVariant, so we can remove magic number.
242 if (AsmVariant == 0) O << '%';
241243 unsigned Reg = MO.getReg();
242244 if (Modifier && strncmp(Modifier, "subreg", strlen("subreg")) == 0) {
243245 EVT VT = (strcmp(Modifier+6,"64") == 0) ?
470472 }
471473 }
472474
473 printOperand(MI, OpNo, O);
475 printOperand(MI, OpNo, O, /*Modifier*/ 0, AsmVariant);
474476 return false;
475477 }
476478
4949
5050 // These methods are used by the tablegen'erated instruction printer.
5151 void printOperand(const MachineInstr *MI, unsigned OpNo, raw_ostream &O,
52 const char *Modifier = 0);
52 const char *Modifier = 0, unsigned AsmVariant = 0);
5353 void print_pcrel_imm(const MachineInstr *MI, unsigned OpNo, raw_ostream &O);
5454
5555 bool printAsmMRegister(const MachineOperand &MO, char Mode, raw_ostream &O);
0 ; RUN: llc < %s -march=x86 | FileCheck %s
1
2 define i32 @t1() nounwind {
3 entry:
4 %0 = tail call i32 asm sideeffect inteldialect "mov eax, $1\0Amov $0, eax", "=r,r,~{eax},~{dirflag},~{fpsr},~{flags}"(i32 1) nounwind
5 ret i32 %0
6 ; CHECK: _t1
7 ; CHECK: ## InlineAsm Start
8 ; FIXME: .intel_syntax
9 ; CHECK: mov eax, ecx
10 ; CHECK: mov ecx, eax
11 ; FIXME: .att_syntax
12 ; CHECK: ## InlineAsm End
13 }