[llvm-commits] [llvm] r117952 - in /llvm/trunk/lib/Target/X86: AsmParser/X86AsmParser.cpp X86InstrInfo.td
Chris Lattner
sabre at nondot.org
Mon Nov 1 14:06:34 PDT 2010
Author: lattner
Date: Mon Nov 1 16:06:34 2010
New Revision: 117952
URL: http://llvm.org/viewvc/llvm-project?rev=117952&view=rev
Log:
use our fancy new MnemonicAlias mechanism to remove a bunch of hacks
from X86AsmParser.cpp
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=117952&r1=117951&r2=117952&view=diff
==============================================================================
--- llvm/trunk/lib/Target/X86/AsmParser/X86AsmParser.cpp (original)
+++ llvm/trunk/lib/Target/X86/AsmParser/X86AsmParser.cpp Mon Nov 1 16:06:34 2010
@@ -969,14 +969,6 @@
NameLoc);
}
- // call foo is not ambiguous with callw.
- if (Name == "call" && Operands.size() == 2) {
- const char *NewName = Is64Bit ? "callq" : "calll";
- delete Operands[0];
- Operands[0] = X86Operand::CreateToken(NewName, NameLoc);
- Name = NewName;
- }
-
// movsd -> movsl (when no operands are specified).
if (Name == "movsd" && Operands.size() == 1) {
delete Operands[0];
@@ -1009,46 +1001,6 @@
Operands.push_back(X86Operand::CreateImm(A, NameLoc, NameLoc));
}
- // "lgdtl" is not ambiguous 32-bit mode and is the same as "lgdt".
- // "lgdtq" is not ambiguous 64-bit mode and is the same as "lgdt".
- if ((Name == "lgdtl" && Is64Bit == false) ||
- (Name == "lgdtq" && Is64Bit == true)) {
- const char *NewName = "lgdt";
- delete Operands[0];
- Operands[0] = X86Operand::CreateToken(NewName, NameLoc);
- Name = NewName;
- }
-
- // "lidtl" is not ambiguous 32-bit mode and is the same as "lidt".
- // "lidtq" is not ambiguous 64-bit mode and is the same as "lidt".
- if ((Name == "lidtl" && Is64Bit == false) ||
- (Name == "lidtq" && Is64Bit == true)) {
- const char *NewName = "lidt";
- delete Operands[0];
- Operands[0] = X86Operand::CreateToken(NewName, NameLoc);
- Name = NewName;
- }
-
- // "sgdtl" is not ambiguous 32-bit mode and is the same as "sgdt".
- // "sgdtq" is not ambiguous 64-bit mode and is the same as "sgdt".
- if ((Name == "sgdtl" && Is64Bit == false) ||
- (Name == "sgdtq" && Is64Bit == true)) {
- const char *NewName = "sgdt";
- delete Operands[0];
- Operands[0] = X86Operand::CreateToken(NewName, NameLoc);
- Name = NewName;
- }
-
- // "sidtl" is not ambiguous 32-bit mode and is the same as "sidt".
- // "sidtq" is not ambiguous 64-bit mode and is the same as "sidt".
- if ((Name == "sidtl" && Is64Bit == false) ||
- (Name == "sidtq" && Is64Bit == true)) {
- const char *NewName = "sidt";
- delete Operands[0];
- Operands[0] = X86Operand::CreateToken(NewName, NameLoc);
- Name = NewName;
- }
-
return false;
}
Modified: llvm/trunk/lib/Target/X86/X86InstrInfo.td
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86InstrInfo.td?rev=117952&r1=117951&r2=117952&view=diff
==============================================================================
--- llvm/trunk/lib/Target/X86/X86InstrInfo.td (original)
+++ llvm/trunk/lib/Target/X86/X86InstrInfo.td Mon Nov 1 16:06:34 2010
@@ -1306,10 +1306,10 @@
(MOVZX64rr16_Q GR64:$dst, GR16:$src)>;
// Note: No GR32->GR64 movzx form.
-// TODO: lidtl/lidtq can be opcode aliases, perhaps others.
-def : MnemonicAlias<"iret", "iretl">;
-def : MnemonicAlias<"sysret", "sysretl">;
+def : MnemonicAlias<"call", "calll">, Requires<[In32BitMode]>;
+def : MnemonicAlias<"call", "callq">, Requires<[In64BitMode]>;
+
def : MnemonicAlias<"cbw", "cbtw">;
def : MnemonicAlias<"cwd", "cwtd">;
def : MnemonicAlias<"cdq", "cltd">;
@@ -1351,6 +1351,19 @@
def : MnemonicAlias<"ud2a", "ud2">;
def : MnemonicAlias<"verrw", "verr">;
+// System instruction aliases.
+def : MnemonicAlias<"iret", "iretl">;
+def : MnemonicAlias<"sysret", "sysretl">;
+
+def : MnemonicAlias<"lgdtl", "lgdt">, Requires<[In32BitMode]>;
+def : MnemonicAlias<"lgdtq", "lgdt">, Requires<[In64BitMode]>;
+def : MnemonicAlias<"lidtl", "lidt">, Requires<[In32BitMode]>;
+def : MnemonicAlias<"lidtq", "lidt">, Requires<[In64BitMode]>;
+def : MnemonicAlias<"sgdtl", "sgdt">, Requires<[In32BitMode]>;
+def : MnemonicAlias<"sgdtq", "sgdt">, Requires<[In64BitMode]>;
+def : MnemonicAlias<"sidtl", "sidt">, Requires<[In32BitMode]>;
+def : MnemonicAlias<"sidtq", "sidt">, Requires<[In64BitMode]>;
+
// Floating point stack aliases.
def : MnemonicAlias<"fcmovz", "fcmove">;
More information about the llvm-commits
mailing list