Fix ARM memory operand parsing of post indexing with just a base register, that

is just "[Rn]" and no tailing comma with an offset, etc.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@84205 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Kevin Enderby
2009-10-15 21:42:45 +00:00
parent b923953733
commit e2a98dd2a4

View File

@@ -383,26 +383,29 @@ bool ARMAsmParser::ParseMemory(ARMOperand &Op) {
Writeback = true;
getLexer().Lex(); // Eat right bracket token.
const AsmToken &CommaTok = getLexer().getTok();
if (CommaTok.isNot(AsmToken::Comma))
return Error(CommaTok.getLoc(), "',' expected");
getLexer().Lex(); // Eat comma token.
int OffsetRegNum = 0;
bool OffsetRegShifted = false;
enum ShiftType ShiftType;
const MCExpr *ShiftAmount;
const MCExpr *Offset;
const AsmToken &NextTok = getLexer().getTok();
if (NextTok.is(AsmToken::Plus))
if (NextTok.isNot(AsmToken::EndOfStatement)) {
if (NextTok.isNot(AsmToken::Comma))
return Error(NextTok.getLoc(), "',' expected");
getLexer().Lex(); // Eat comma token.
const AsmToken &PlusMinusTok = getLexer().getTok();
if (PlusMinusTok.is(AsmToken::Plus))
getLexer().Lex(); // Eat plus token.
else if (NextTok.is(AsmToken::Minus)) {
else if (PlusMinusTok.is(AsmToken::Minus)) {
Negative = true;
getLexer().Lex(); // Eat minus token
}
// See if there is a register following the "[Rn]," we have so far.
const AsmToken &OffsetRegTok = getLexer().getTok();
int OffsetRegNum = MatchRegisterName(OffsetRegTok.getString());
bool OffsetRegShifted = false;
enum ShiftType ShiftType;
const MCExpr *ShiftAmount;
const MCExpr *Offset;
OffsetRegNum = MatchRegisterName(OffsetRegTok.getString());
if (OffsetRegNum != -1) {
OffsetIsReg = true;
getLexer().Lex(); // Eat identifier token for the offset register.
@@ -427,6 +430,8 @@ bool ARMAsmParser::ParseMemory(ARMOperand &Op) {
if (getParser().ParseExpression(Offset))
return true;
}
}
Op = ARMOperand::CreateMem(BaseRegNum, OffsetIsReg, Offset, OffsetRegNum,
OffsetRegShifted, ShiftType, ShiftAmount,
Preindexed, Postindexed, Negative, Writeback);