mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-05-15 16:38:41 +00:00
fix a bug in range information for $42, eliminate an
unneeded argument from ParseExpression. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@93536 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
0a3c5a54a1
commit
54482b472a
@ -55,8 +55,7 @@ public:
|
|||||||
/// @param Res - The value of the expression. The result is undefined
|
/// @param Res - The value of the expression. The result is undefined
|
||||||
/// on error.
|
/// on error.
|
||||||
/// @result - False on success.
|
/// @result - False on success.
|
||||||
virtual bool ParseExpression(const MCExpr *&Res,
|
virtual bool ParseExpression(const MCExpr *&Res, SMLoc &EndLoc) = 0;
|
||||||
SMLoc &StartLoc, SMLoc &EndLoc) = 0;
|
|
||||||
bool ParseExpression(const MCExpr *&Res);
|
bool ParseExpression(const MCExpr *&Res);
|
||||||
|
|
||||||
/// ParseParenExpression - Parse an arbitrary expression, assuming that an
|
/// ParseParenExpression - Parse an arbitrary expression, assuming that an
|
||||||
|
@ -279,10 +279,10 @@ X86Operand *X86ATTAsmParser::ParseOperand() {
|
|||||||
}
|
}
|
||||||
case AsmToken::Dollar: {
|
case AsmToken::Dollar: {
|
||||||
// $42 -> immediate.
|
// $42 -> immediate.
|
||||||
|
SMLoc Start = getLexer().getTok().getLoc(), End;
|
||||||
getLexer().Lex();
|
getLexer().Lex();
|
||||||
const MCExpr *Val;
|
const MCExpr *Val;
|
||||||
SMLoc Start, End;
|
if (getParser().ParseExpression(Val, End))
|
||||||
if (getParser().ParseExpression(Val, Start, End))
|
|
||||||
return 0;
|
return 0;
|
||||||
return X86Operand::CreateImm(Val, Start, End);
|
return X86Operand::CreateImm(Val, Start, End);
|
||||||
}
|
}
|
||||||
@ -302,15 +302,15 @@ X86Operand *X86ATTAsmParser::ParseMemOperand() {
|
|||||||
// it.
|
// it.
|
||||||
const MCExpr *Disp = MCConstantExpr::Create(0, getParser().getContext());
|
const MCExpr *Disp = MCConstantExpr::Create(0, getParser().getContext());
|
||||||
if (getLexer().isNot(AsmToken::LParen)) {
|
if (getLexer().isNot(AsmToken::LParen)) {
|
||||||
SMLoc ExprStart, ExprEnd;
|
SMLoc ExprEnd;
|
||||||
if (getParser().ParseExpression(Disp, MemStart, ExprEnd)) return 0;
|
if (getParser().ParseExpression(Disp, ExprEnd)) return 0;
|
||||||
|
|
||||||
// After parsing the base expression we could either have a parenthesized
|
// After parsing the base expression we could either have a parenthesized
|
||||||
// memory address or not. If not, return now. If so, eat the (.
|
// memory address or not. If not, return now. If so, eat the (.
|
||||||
if (getLexer().isNot(AsmToken::LParen)) {
|
if (getLexer().isNot(AsmToken::LParen)) {
|
||||||
// Unless we have a segment register, treat this as an immediate.
|
// Unless we have a segment register, treat this as an immediate.
|
||||||
if (SegReg == 0)
|
if (SegReg == 0)
|
||||||
return X86Operand::CreateImm(Disp, ExprStart, ExprEnd);
|
return X86Operand::CreateImm(Disp, MemStart, ExprEnd);
|
||||||
return X86Operand::CreateMem(SegReg, Disp, 0, 0, 1, MemStart, ExprEnd);
|
return X86Operand::CreateMem(SegReg, Disp, 0, 0, 1, MemStart, ExprEnd);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -271,8 +271,8 @@ bool AsmParser::ParsePrimaryExpr(const MCExpr *&Res, SMLoc &EndLoc) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool AsmParser::ParseExpression(const MCExpr *&Res) {
|
bool AsmParser::ParseExpression(const MCExpr *&Res) {
|
||||||
SMLoc L;
|
SMLoc EndLoc;
|
||||||
return ParseExpression(Res, L, L);
|
return ParseExpression(Res, EndLoc);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// ParseExpression - Parse an expression and return it.
|
/// ParseExpression - Parse an expression and return it.
|
||||||
@ -282,9 +282,7 @@ bool AsmParser::ParseExpression(const MCExpr *&Res) {
|
|||||||
/// expr ::= expr *,/,%,<<,>> expr -> highest.
|
/// expr ::= expr *,/,%,<<,>> expr -> highest.
|
||||||
/// expr ::= primaryexpr
|
/// expr ::= primaryexpr
|
||||||
///
|
///
|
||||||
bool AsmParser::ParseExpression(const MCExpr *&Res,
|
bool AsmParser::ParseExpression(const MCExpr *&Res, SMLoc &EndLoc) {
|
||||||
SMLoc &StartLoc, SMLoc &EndLoc) {
|
|
||||||
StartLoc = Lexer.getLoc();
|
|
||||||
Res = 0;
|
Res = 0;
|
||||||
return ParsePrimaryExpr(Res, EndLoc) ||
|
return ParsePrimaryExpr(Res, EndLoc) ||
|
||||||
ParseBinOpRHS(1, Res, EndLoc);
|
ParseBinOpRHS(1, Res, EndLoc);
|
||||||
|
@ -80,8 +80,7 @@ public:
|
|||||||
virtual bool Error(SMLoc L, const Twine &Msg);
|
virtual bool Error(SMLoc L, const Twine &Msg);
|
||||||
|
|
||||||
bool ParseExpression(const MCExpr *&Res);
|
bool ParseExpression(const MCExpr *&Res);
|
||||||
virtual bool ParseExpression(const MCExpr *&Res,
|
virtual bool ParseExpression(const MCExpr *&Res, SMLoc &EndLoc);
|
||||||
SMLoc &StartLoc, SMLoc &EndLoc);
|
|
||||||
virtual bool ParseParenExpression(const MCExpr *&Res, SMLoc &EndLoc);
|
virtual bool ParseParenExpression(const MCExpr *&Res, SMLoc &EndLoc);
|
||||||
virtual bool ParseAbsoluteExpression(int64_t &Res);
|
virtual bool ParseAbsoluteExpression(int64_t &Res);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user