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.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@117830 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Chris Lattner
2010-10-30 19:23:13 +00:00
parent 8cc0a6b788
commit 693173feef
5 changed files with 108 additions and 31 deletions

View File

@@ -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