[llvm-commits] [llvm] r118349 - in /llvm/trunk/lib/Target/X86: AsmParser/X86AsmParser.cpp X86InstrInfo.td
Chris Lattner
sabre at nondot.org
Sat Nov 6 11:58:32 PDT 2010
Author: lattner
Date: Sat Nov 6 13:58:32 2010
New Revision: 118349
URL: http://llvm.org/viewvc/llvm-project?rev=118349&view=rev
Log:
move fnstsw aliases to .td file, fix typo
Modified:
llvm/trunk/lib/Target/X86/AsmParser/X86AsmParser.cpp
llvm/trunk/lib/Target/X86/X86InstrInfo.td
Modified: llvm/trunk/lib/Target/X86/AsmParser/X86AsmParser.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/AsmParser/X86AsmParser.cpp?rev=118349&r1=118348&r2=118349&view=diff
==============================================================================
--- llvm/trunk/lib/Target/X86/AsmParser/X86AsmParser.cpp (original)
+++ llvm/trunk/lib/Target/X86/AsmParser/X86AsmParser.cpp Sat Nov 6 13:58:32 2010
@@ -781,22 +781,6 @@
X86Operand::CreateImm(One, NameLoc, NameLoc));
}
-
- // FIXME: Hack to handle recognize "in[bwl] <op>". Canonicalize it to
- // "inb <op>, %al".
- if ((Name == "inb" || Name == "inw" || Name == "inl") &&
- Operands.size() == 2) {
- unsigned Reg;
- if (Name[2] == 'b')
- Reg = MatchRegisterName("al");
- else if (Name[2] == 'w')
- Reg = MatchRegisterName("ax");
- else
- Reg = MatchRegisterName("eax");
- SMLoc Loc = Operands.back()->getEndLoc();
- Operands.push_back(X86Operand::CreateReg(Reg, Loc, Loc));
- }
-
// FIXME: Hack to handle "out[bwl]? %al, (%dx)" -> "outb %al, %dx".
if ((Name == "outb" || Name == "outw" || Name == "outl" || Name == "out") &&
Operands.size() == 3) {
@@ -855,25 +839,6 @@
NameLoc, NameLoc));
}
- // The assembler accepts various amounts of brokenness for fnstsw.
- if (Name == "fnstsw" || Name == "fnstsww") {
- if (Operands.size() == 2 &&
- static_cast<X86Operand*>(Operands[1])->isReg()) {
- // "fnstsw al" and "fnstsw eax" -> "fnstw"
- unsigned Reg = static_cast<X86Operand*>(Operands[1])->Reg.RegNo;
- if (Reg == MatchRegisterName("eax") ||
- Reg == MatchRegisterName("al")) {
- delete Operands[1];
- Operands.pop_back();
- }
- }
-
- // "fnstw" -> "fnstw %ax"
- if (Operands.size() == 1)
- Operands.push_back(X86Operand::CreateReg(MatchRegisterName("ax"),
- NameLoc, NameLoc));
- }
-
// FIXME: Hack to handle recognize "aa[dm]" -> "aa[dm] $0xA".
if ((Name.startswith("aad") || Name.startswith("aam")) &&
Operands.size() == 1) {
Modified: llvm/trunk/lib/Target/X86/X86InstrInfo.td
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86InstrInfo.td?rev=118349&r1=118348&r2=118349&view=diff
==============================================================================
--- llvm/trunk/lib/Target/X86/X86InstrInfo.td (original)
+++ llvm/trunk/lib/Target/X86/X86InstrInfo.td Sat Nov 6 13:58:32 2010
@@ -1373,6 +1373,11 @@
def : InstAlias<"clrl $reg", (XOR32rr GR32:$reg, GR32:$reg)>;
def : InstAlias<"clrq $reg", (XOR64rr GR64:$reg, GR64:$reg)>;
+// We accepts "fnstsw %eax" even though it only writes %ax.
+def : InstAlias<"fnstsw %eax", (FNSTSW8r)>;
+def : InstAlias<"fnstsw %al" , (FNSTSW8r)>;
+def : InstAlias<"fnstsw" , (FNSTSW8r)>;
+
// lcall and ljmp aliases. This seems to be an odd mapping in 64-bit mode, but
// this is compatible with what GAS does.
def : InstAlias<"lcall $seg, $off", (FARCALL32i i32imm:$off, i16imm:$seg)>;
@@ -1393,7 +1398,7 @@
def : InstAlias<"inw %dx", (IN16rr)>;
def : InstAlias<"inl %dx", (IN32rr)>;
def : InstAlias<"inb $port", (IN8ri i8imm:$port)>;
-def : InstAlias<"inw $port", (IN16rir i8imm:$port)>;
+def : InstAlias<"inw $port", (IN16ri i8imm:$port)>;
def : InstAlias<"inl $port", (IN32ri i8imm:$port)>;
More information about the llvm-commits
mailing list