[llvm-commits] [llvm] r95158 - in /llvm/trunk: lib/Target/X86/AsmParser/X86AsmParser.cpp test/MC/AsmParser/X86/x86_instructions.s

Daniel Dunbar daniel at zuster.org
Tue Feb 2 15:46:47 PST 2010


Author: ddunbar
Date: Tue Feb  2 17:46:47 2010
New Revision: 95158

URL: http://llvm.org/viewvc/llvm-project?rev=95158&view=rev
Log:
AsmParser/X86: Add temporary hack to allow parsing "sal". Eventually we need
some mechanism for specifying alternative syntaxes, but I'm not sure what form
that should take yet.

Modified:
    llvm/trunk/lib/Target/X86/AsmParser/X86AsmParser.cpp
    llvm/trunk/test/MC/AsmParser/X86/x86_instructions.s

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=95158&r1=95157&r2=95158&view=diff

==============================================================================
--- llvm/trunk/lib/Target/X86/AsmParser/X86AsmParser.cpp (original)
+++ llvm/trunk/lib/Target/X86/AsmParser/X86AsmParser.cpp Tue Feb  2 17:46:47 2010
@@ -456,8 +456,14 @@
 bool X86ATTAsmParser::
 ParseInstruction(const StringRef &Name, SMLoc NameLoc,
                  SmallVectorImpl<MCParsedAsmOperand*> &Operands) {
-
-  Operands.push_back(X86Operand::CreateToken(Name, NameLoc));
+  // FIXME: Hack to recognize "sal..." for now. We need a way to represent
+  // alternative syntaxes in the .td file, without requiring instruction
+  // duplication.
+  if (Name.startswith("sal")) {
+    std::string Tmp = "shl" + Name.substr(3).str();
+    Operands.push_back(X86Operand::CreateToken(Tmp, NameLoc));
+  } else
+    Operands.push_back(X86Operand::CreateToken(Name, NameLoc));
 
   if (getLexer().isNot(AsmToken::EndOfStatement)) {
 

Modified: llvm/trunk/test/MC/AsmParser/X86/x86_instructions.s
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/AsmParser/X86/x86_instructions.s?rev=95158&r1=95157&r2=95158&view=diff

==============================================================================
--- llvm/trunk/test/MC/AsmParser/X86/x86_instructions.s (original)
+++ llvm/trunk/test/MC/AsmParser/X86/x86_instructions.s Tue Feb  2 17:46:47 2010
@@ -64,3 +64,9 @@
 // FIXME: Check that this matches the correct instruction.
 // CHECK: shldl %cl, %eax, %ebx
         shldl %cl, %eax, %ebx
+
+// CHECK: shll $2, %eax
+        shll $2, %eax
+
+// CHECK: shll $2, %eax
+        sall $2, %eax





More information about the llvm-commits mailing list