diff options
| author | Chris Lattner <sabre@nondot.org> | 2010-09-14 23:34:29 +0000 |
|---|---|---|
| committer | Chris Lattner <sabre@nondot.org> | 2010-09-14 23:34:29 +0000 |
| commit | 5f2311dc29c5182b3b5dc07fc5d01ac25eeec877 (patch) | |
| tree | de61e68b69e049e614481e647c44b18da8a39af6 /llvm | |
| parent | 72c9b0d582fa34cd1e6073153a5dc75b06e4b1b1 (diff) | |
| download | bcm5719-llvm-5f2311dc29c5182b3b5dc07fc5d01ac25eeec877.tar.gz bcm5719-llvm-5f2311dc29c5182b3b5dc07fc5d01ac25eeec877.zip | |
add a terrible hack to allow out with dx is parens, a gas bug.
This fixes PR8114
llvm-svn: 113894
Diffstat (limited to 'llvm')
| -rw-r--r-- | llvm/lib/Target/X86/AsmParser/X86AsmParser.cpp | 14 | ||||
| -rw-r--r-- | llvm/test/MC/AsmParser/X86/x86_instructions.s | 10 |
2 files changed, 24 insertions, 0 deletions
diff --git a/llvm/lib/Target/X86/AsmParser/X86AsmParser.cpp b/llvm/lib/Target/X86/AsmParser/X86AsmParser.cpp index 6a664ad4ce1..dae7d1298eb 100644 --- a/llvm/lib/Target/X86/AsmParser/X86AsmParser.cpp +++ b/llvm/lib/Target/X86/AsmParser/X86AsmParser.cpp @@ -857,6 +857,20 @@ ParseInstruction(StringRef Name, SMLoc NameLoc, std::swap(Operands[1], Operands[2]); } + // FIXME: Hack to handle "out[bwl]? %al, (%dx)" -> "outb %al, %dx". + if ((Name == "outb" || Name == "outw" || Name == "outl" || Name == "out") && + Operands.size() == 3) { + X86Operand &Op = *(X86Operand*)Operands.back(); + if (Op.isMem() && Op.Mem.SegReg == 0 && + isa<MCConstantExpr>(Op.Mem.Disp) && + cast<MCConstantExpr>(Op.Mem.Disp)->getValue() == 0 && + Op.Mem.BaseReg == MatchRegisterName("dx") && Op.Mem.IndexReg == 0) { + SMLoc Loc = Op.getEndLoc(); + Operands.back() = X86Operand::CreateReg(Op.Mem.BaseReg, Loc, Loc); + delete &Op; + } + } + // FIXME: Hack to handle "f{mul*,add*,sub*,div*} $op, st(0)" the same as // "f{mul*,add*,sub*,div*} $op" if ((Name.startswith("fmul") || Name.startswith("fadd") || diff --git a/llvm/test/MC/AsmParser/X86/x86_instructions.s b/llvm/test/MC/AsmParser/X86/x86_instructions.s index b895de35cce..d4444f89523 100644 --- a/llvm/test/MC/AsmParser/X86/x86_instructions.s +++ b/llvm/test/MC/AsmParser/X86/x86_instructions.s @@ -200,3 +200,13 @@ inw %dx outb $0x7f outw %dx inl %dx + + +// PR8114 +// CHECK: outb %al, %dx +// CHECK: outw %ax, %dx +// CHECK: outl %eax, %dx + +out %al, (%dx) +out %ax, (%dx) +outl %eax, (%dx) |

