diff options
author | Chris Lattner <sabre@nondot.org> | 2010-10-30 19:23:13 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2010-10-30 19:23:13 +0000 |
commit | 2cb092dc55807b630864d1adbeda52068828feb1 (patch) | |
tree | 3540d54f220db32f170c632ebdc6ca0a0e16533e /llvm/lib/Target/X86/AsmParser/X86AsmParser.cpp | |
parent | cda8eb7a21c490818d02f3587379cc7c0115eb1f (diff) | |
download | bcm5719-llvm-2cb092dc55807b630864d1adbeda52068828feb1.tar.gz bcm5719-llvm-2cb092dc55807b630864d1adbeda52068828feb1.zip |
Implement (and document!) support for MnemonicAlias's to have Requires
directives, allowing things like this:
def : MnemonicAlias<"pop", "popl">, Requires<[In32BitMode]>;
def : MnemonicAlias<"pop", "popq">, Requires<[In64BitMode]>;
Move the rest of the X86 MnemonicAliases over to the .td file.
llvm-svn: 117830
Diffstat (limited to 'llvm/lib/Target/X86/AsmParser/X86AsmParser.cpp')
-rw-r--r-- | llvm/lib/Target/X86/AsmParser/X86AsmParser.cpp | 20 |
1 files changed, 7 insertions, 13 deletions
diff --git a/llvm/lib/Target/X86/AsmParser/X86AsmParser.cpp b/llvm/lib/Target/X86/AsmParser/X86AsmParser.cpp index 8b410015136..28e30769abc 100644 --- a/llvm/lib/Target/X86/AsmParser/X86AsmParser.cpp +++ b/llvm/lib/Target/X86/AsmParser/X86AsmParser.cpp @@ -620,16 +620,10 @@ X86Operand *X86ATTAsmParser::ParseMemOperand(unsigned SegReg, SMLoc MemStart) { bool X86ATTAsmParser:: ParseInstruction(StringRef Name, SMLoc NameLoc, SmallVectorImpl<MCParsedAsmOperand*> &Operands) { - // FIXME: Hack to recognize some aliases. - StringRef PatchedName = StringSwitch<StringRef>(Name) - .Case("push", Is64Bit ? "pushq" : "pushl") - .Case("pop", Is64Bit ? "popq" : "popl") - .Case("pushf", Is64Bit ? "pushfq" : "pushfl") - .Case("popf", Is64Bit ? "popfq" : "popfl") - .Case("retl", Is64Bit ? "retl" : "ret") - .Case("retq", Is64Bit ? "ret" : "retq") - .Case("movzx", "movzb") // FIXME: Not correct. - .Default(Name); + // FIXME: This is not correct at all. + if (Name == "movzx") Name = "movzb"; + + StringRef PatchedName = Name; // FIXME: Hack to recognize cmp<comparison code>{ss,sd,ps,pd}. const MCExpr *ExtraImmOp = 0; @@ -714,9 +708,9 @@ ParseInstruction(StringRef Name, SMLoc NameLoc, // Determine whether this is an instruction prefix. bool isPrefix = - PatchedName == "lock" || PatchedName == "rep" || - PatchedName == "repe" || PatchedName == "repz" || - PatchedName == "repne" || PatchedName == "repnz"; + Name == "lock" || Name == "rep" || + Name == "repe" || Name == "repz" || + Name == "repne" || Name == "repnz"; // This does the actual operand parsing. Don't parse any more if we have a |