move rep aliases to td file
authorChris Lattner <sabre@nondot.org>
Sat, 30 Oct 2010 18:17:33 +0000 (18:17 +0000)
committerChris Lattner <sabre@nondot.org>
Sat, 30 Oct 2010 18:17:33 +0000 (18:17 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@117822 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Target/X86/AsmParser/X86AsmParser.cpp
lib/Target/X86/X86InstrInfo.td

index 9e31833fca9b78031c499c06d63cd591ab7d47f1..111afbf47a6f72100cb68dc2b541542cd661d7df 100644 (file)
@@ -620,13 +620,10 @@ X86Operand *X86ATTAsmParser::ParseMemOperand(unsigned SegReg, SMLoc MemStart) {
 bool X86ATTAsmParser::
 ParseInstruction(StringRef Name, SMLoc NameLoc,
                  SmallVectorImpl<MCParsedAsmOperand*> &Operands) {
-  // FIXME: Hack to recognize "sal..." and "rep..." for now. We need a way to
-  // represent alternative syntaxes in the .td file, without requiring
-  // instruction duplication.
+  // FIXME: Hack to recognize some aliases.
   StringRef PatchedName = StringSwitch<StringRef>(Name)
     .Case("repe", "rep")
     .Case("repz", "rep")
-    .Case("repnz", "repne")
     .Case("push", Is64Bit ? "pushq" : "pushl")
     .Case("pop", Is64Bit ? "popq" : "popl")
     .Case("pushf", Is64Bit ? "pushfq" : "pushfl")
@@ -721,7 +718,8 @@ ParseInstruction(StringRef Name, SMLoc NameLoc,
   // Determine whether this is an instruction prefix.
   bool isPrefix =
     PatchedName == "lock" || PatchedName == "rep" ||
-    PatchedName == "repne";
+    PatchedName == "repe" || PatchedName == "repz" ||
+    PatchedName == "repne" || PatchedName == "repnz";
 
 
   // This does the actual operand parsing.  Don't parse any more if we have a
index 71e90c0ae6d05bee95353d6d454dbcb1e3ccd655..9df652938906f0ff99e7bf8458b1f4c2f4342f25 100644 (file)
@@ -1269,6 +1269,10 @@ def : MnemonicAlias<"cdqe", "cltq">;
 def : MnemonicAlias<"pushfd", "pushfl">;
 def : MnemonicAlias<"popfd",  "popfl">;
 
+def : MnemonicAlias<"repe", "rep">;
+def : MnemonicAlias<"repz", "rep">;
+def : MnemonicAlias<"repnz", "repne">;
+
 def : MnemonicAlias<"salb", "shlb">;
 def : MnemonicAlias<"salw", "shlw">;
 def : MnemonicAlias<"sall", "shll">;