- ARM64_AM::ShiftType ShOp = StringSwitch<ARM64_AM::ShiftType>(LowerID)
- .Case("lsl", ARM64_AM::LSL)
- .Case("lsr", ARM64_AM::LSR)
- .Case("asr", ARM64_AM::ASR)
- .Case("ror", ARM64_AM::ROR)
- .Case("msl", ARM64_AM::MSL)
- .Default(ARM64_AM::InvalidShift);
- if (ShOp == ARM64_AM::InvalidShift)
- return MatchOperand_NoMatch;
-
- SMLoc S = Tok.getLoc();
- Parser.Lex();
-
- // We expect a number here.
- bool Hash = getLexer().is(AsmToken::Hash);
- if (!Hash && getLexer().isNot(AsmToken::Integer)) {
- TokError("expected #imm after shift specifier");
- return MatchOperand_ParseFail;
- }
-
- if (Hash)
- Parser.Lex(); // Eat the '#'.
-
- // Make sure we do actually have a number
- if (!Parser.getTok().is(AsmToken::Integer)) {
- Error(Parser.getTok().getLoc(),
- "expected integer shift amount");
- return MatchOperand_ParseFail;
- }
-
- const MCExpr *ImmVal;
- if (getParser().parseExpression(ImmVal))
- return MatchOperand_ParseFail;
-
- const MCConstantExpr *MCE = dyn_cast<MCConstantExpr>(ImmVal);
- if (!MCE) {
- TokError("expected #imm after shift specifier");
- return MatchOperand_ParseFail;
- }
-
- SMLoc E = SMLoc::getFromPointer(getLoc().getPointer() - 1);
-
- // If we have an shift that is too large to encode then crudely pass it
- // through as an invalid shift that is encodable so that we get consistant
- // diagnostics rather than ones different from out of range 32-bit shifts.
- if ((MCE->getValue() & 0x3f) != MCE->getValue()) {
- Operands.push_back(ARM64Operand::CreateShifter(ARM64_AM::InvalidShift, 0, S,
- E, getContext()));
- } else {
- Operands.push_back(ARM64Operand::CreateShifter(ShOp, MCE->getValue(), S,
- E, getContext()));
- }
-
- return MatchOperand_Success;
-}
-
-/// tryParseOptionalExtend - Some operands take an optional extend argument. Parse
-/// them if present.
-ARM64AsmParser::OperandMatchResultTy
-ARM64AsmParser::tryParseOptionalExtend(OperandVector &Operands) {
- const AsmToken &Tok = Parser.getTok();
- std::string LowerID = Tok.getString().lower();
- ARM64_AM::ExtendType ExtOp =
- StringSwitch<ARM64_AM::ExtendType>(LowerID)
+ ARM64_AM::ShiftExtendType ShOp =
+ StringSwitch<ARM64_AM::ShiftExtendType>(LowerID)
+ .Case("lsl", ARM64_AM::LSL)
+ .Case("lsr", ARM64_AM::LSR)
+ .Case("asr", ARM64_AM::ASR)
+ .Case("ror", ARM64_AM::ROR)
+ .Case("msl", ARM64_AM::MSL)