X86 asm parser: Avoid duplicating the list of aliased instructions

No functional change.

llvm-svn: 214364
This commit is contained in:
Reid Kleckner 2014-07-31 00:07:33 +00:00
parent 9e281bf0fe
commit b1f2d2f4ef
1 changed files with 11 additions and 16 deletions

View File

@ -2302,16 +2302,6 @@ bool X86AsmParser::MatchAndEmitInstruction(SMLoc IDLoc, unsigned &Opcode,
// FIXME: This should be replaced with a real .td file alias mechanism.
// Also, MatchInstructionImpl should actually *do* the EmitInstruction
// call.
if (Op.getToken() == "fstsw" || Op.getToken() == "fstcw" ||
Op.getToken() == "fstsww" || Op.getToken() == "fstcww" ||
Op.getToken() == "finit" || Op.getToken() == "fsave" ||
Op.getToken() == "fstenv" || Op.getToken() == "fclex") {
MCInst Inst;
Inst.setOpcode(X86::WAIT);
Inst.setLoc(IDLoc);
if (!MatchingInlineAsm)
EmitInstruction(Inst, Operands, Out);
const char *Repl = StringSwitch<const char *>(Op.getToken())
.Case("finit", "fninit")
.Case("fsave", "fnsave")
@ -2322,7 +2312,12 @@ bool X86AsmParser::MatchAndEmitInstruction(SMLoc IDLoc, unsigned &Opcode,
.Case("fstsww", "fnstsw")
.Case("fclex", "fnclex")
.Default(nullptr);
assert(Repl && "Unknown wait-prefixed instruction");
if (Repl) {
MCInst Inst;
Inst.setOpcode(X86::WAIT);
Inst.setLoc(IDLoc);
if (!MatchingInlineAsm)
EmitInstruction(Inst, Operands, Out);
Operands[0] = X86Operand::CreateToken(Repl, IDLoc);
}