aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Dunbar <daniel@zuster.org>2010-02-02 23:46:47 +0000
committerDaniel Dunbar <daniel@zuster.org>2010-02-02 23:46:47 +0000
commite7070e90066acc3460af1d6cac4036a80b0250b8 (patch)
treec21e7442a8320a4d833c13448797aec9c4bb1089
parente1f6de3fbd892ea3f918a26912660cf316866fc1 (diff)
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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95158 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--lib/Target/X86/AsmParser/X86AsmParser.cpp10
-rw-r--r--test/MC/AsmParser/X86/x86_instructions.s6
2 files changed, 14 insertions, 2 deletions
diff --git a/lib/Target/X86/AsmParser/X86AsmParser.cpp b/lib/Target/X86/AsmParser/X86AsmParser.cpp
index 73e377086b..3a8f5d5565 100644
--- a/lib/Target/X86/AsmParser/X86AsmParser.cpp
+++ b/lib/Target/X86/AsmParser/X86AsmParser.cpp
@@ -456,8 +456,14 @@ X86Operand *X86ATTAsmParser::ParseMemOperand() {
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)) {
diff --git a/test/MC/AsmParser/X86/x86_instructions.s b/test/MC/AsmParser/X86/x86_instructions.s
index 314fc1add1..a1b881b315 100644
--- a/test/MC/AsmParser/X86/x86_instructions.s
+++ b/test/MC/AsmParser/X86/x86_instructions.s
@@ -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