diff options
author | Bill Wendling <isanbard@gmail.com> | 2010-09-14 23:38:48 +0000 |
---|---|---|
committer | Bill Wendling <isanbard@gmail.com> | 2010-09-14 23:38:48 +0000 |
commit | 1c8b0a1846a6a4548bd4b1acc5b8d4ef2f2f3424 (patch) | |
tree | c51a48f389f00c81f43b6cca0adebc6305ac717d | |
parent | 7c9f0684e31b66775113fe8e246250eed5248823 (diff) | |
download | llvm-1c8b0a1846a6a4548bd4b1acc5b8d4ef2f2f3424.zip llvm-1c8b0a1846a6a4548bd4b1acc5b8d4ef2f2f3424.tar.gz llvm-1c8b0a1846a6a4548bd4b1acc5b8d4ef2f2f3424.tar.bz2 |
Approved by Chris
$ svn merge -c 113894 https://llvm.org/svn/llvm-project/llvm/trunk
--- Merging r113894 into '.':
U test/MC/AsmParser/X86/x86_instructions.s
U lib/Target/X86/AsmParser/X86AsmParser.cpp
Log:
add a terrible hack to allow out with dx is parens, a gas bug.
This fixes PR8114
llvm-svn: 113896
-rw-r--r-- | llvm/lib/Target/X86/AsmParser/X86AsmParser.cpp | 14 | ||||
-rw-r--r-- | llvm/test/MC/AsmParser/X86/x86_instructions.s | 9 |
2 files changed, 23 insertions, 0 deletions
diff --git a/llvm/lib/Target/X86/AsmParser/X86AsmParser.cpp b/llvm/lib/Target/X86/AsmParser/X86AsmParser.cpp index b4542a0..f8588d8 100644 --- a/llvm/lib/Target/X86/AsmParser/X86AsmParser.cpp +++ b/llvm/lib/Target/X86/AsmParser/X86AsmParser.cpp @@ -815,6 +815,20 @@ ParseInstruction(StringRef Name, SMLoc NameLoc, Operands.erase(Operands.begin() + 1); } + // 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 5d7fff9..a82d2a1 100644 --- a/llvm/test/MC/AsmParser/X86/x86_instructions.s +++ b/llvm/test/MC/AsmParser/X86/x86_instructions.s @@ -164,3 +164,12 @@ imul $12, %eax // CHECK: imull %ecx, %eax imull %ecx, %eax + +// PR8114 +// CHECK: outb %al, %dx +// CHECK: outw %ax, %dx +// CHECK: outl %eax, %dx + +out %al, (%dx) +out %ax, (%dx) +outl %eax, (%dx) |