From 47ab90bfa8544bc96a02443a7c430200a880bd2b Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Mon, 6 Sep 2010 18:32:06 +0000 Subject: [PATCH] random cleanups git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@113157 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Target/X86/AsmParser/X86AsmParser.cpp | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/lib/Target/X86/AsmParser/X86AsmParser.cpp b/lib/Target/X86/AsmParser/X86AsmParser.cpp index b4542a03aa9..6dcb7f554be 100644 --- a/lib/Target/X86/AsmParser/X86AsmParser.cpp +++ b/lib/Target/X86/AsmParser/X86AsmParser.cpp @@ -623,14 +623,14 @@ ParseInstruction(StringRef Name, SMLoc NameLoc, if (Is64Bit) { if (Name == "popfl") return Error(NameLoc, "popfl cannot be encoded in 64-bit mode"); - else if (Name == "pushfl") + if (Name == "pushfl") return Error(NameLoc, "pushfl cannot be encoded in 64-bit mode"); - else if (Name == "pusha") + if (Name == "pusha") return Error(NameLoc, "pusha cannot be encoded in 64-bit mode"); } else { if (Name == "popfq") return Error(NameLoc, "popfq cannot be encoded in 32-bit mode"); - else if (Name == "pushfq") + if (Name == "pushfq") return Error(NameLoc, "pushfq cannot be encoded in 32-bit mode"); } @@ -778,6 +778,8 @@ ParseInstruction(StringRef Name, SMLoc NameLoc, if (ExtraImmOp) Operands.push_back(X86Operand::CreateImm(ExtraImmOp, NameLoc, NameLoc)); + + // This does the actual operand parsing. if (getLexer().isNot(AsmToken::EndOfStatement)) { // Parse '*' modifier. @@ -807,12 +809,13 @@ ParseInstruction(StringRef Name, SMLoc NameLoc, // FIXME: Hack to handle recognizing s{hr,ar,hl}? $1. if ((Name.startswith("shr") || Name.startswith("sar") || Name.startswith("shl")) && - Operands.size() == 3 && - static_cast(Operands[1])->isImm() && - isa(static_cast(Operands[1])->getImm()) && - cast(static_cast(Operands[1])->getImm())->getValue() == 1) { - delete Operands[1]; - Operands.erase(Operands.begin() + 1); + Operands.size() == 3) { + X86Operand *Op1 = static_cast(Operands[1]); + if (Op1->isImm() && isa(Op1->getImm()) && + cast(Op1->getImm())->getValue() == 1) { + delete Operands[1]; + Operands.erase(Operands.begin() + 1); + } } // FIXME: Hack to handle "f{mul*,add*,sub*,div*} $op, st(0)" the same as