[llvm-commits] [llvm] r93536 - in /llvm/trunk: include/llvm/MC/MCAsmParser.h lib/Target/X86/AsmParser/X86AsmParser.cpp tools/llvm-mc/AsmParser.cpp tools/llvm-mc/AsmParser.h
Chris Lattner
sabre at nondot.org
Fri Jan 15 11:39:23 PST 2010
Author: lattner
Date: Fri Jan 15 13:39:23 2010
New Revision: 93536
URL: http://llvm.org/viewvc/llvm-project?rev=93536&view=rev
Log:
fix a bug in range information for $42, eliminate an
unneeded argument from ParseExpression.
Modified:
llvm/trunk/include/llvm/MC/MCAsmParser.h
llvm/trunk/lib/Target/X86/AsmParser/X86AsmParser.cpp
llvm/trunk/tools/llvm-mc/AsmParser.cpp
llvm/trunk/tools/llvm-mc/AsmParser.h
Modified: llvm/trunk/include/llvm/MC/MCAsmParser.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/MC/MCAsmParser.h?rev=93536&r1=93535&r2=93536&view=diff
==============================================================================
--- llvm/trunk/include/llvm/MC/MCAsmParser.h (original)
+++ llvm/trunk/include/llvm/MC/MCAsmParser.h Fri Jan 15 13:39:23 2010
@@ -55,8 +55,7 @@
/// @param Res - The value of the expression. The result is undefined
/// on error.
/// @result - False on success.
- virtual bool ParseExpression(const MCExpr *&Res,
- SMLoc &StartLoc, SMLoc &EndLoc) = 0;
+ virtual bool ParseExpression(const MCExpr *&Res, SMLoc &EndLoc) = 0;
bool ParseExpression(const MCExpr *&Res);
/// ParseParenExpression - Parse an arbitrary expression, assuming that an
Modified: llvm/trunk/lib/Target/X86/AsmParser/X86AsmParser.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/AsmParser/X86AsmParser.cpp?rev=93536&r1=93535&r2=93536&view=diff
==============================================================================
--- llvm/trunk/lib/Target/X86/AsmParser/X86AsmParser.cpp (original)
+++ llvm/trunk/lib/Target/X86/AsmParser/X86AsmParser.cpp Fri Jan 15 13:39:23 2010
@@ -279,10 +279,10 @@
}
case AsmToken::Dollar: {
// $42 -> immediate.
+ SMLoc Start = getLexer().getTok().getLoc(), End;
getLexer().Lex();
const MCExpr *Val;
- SMLoc Start, End;
- if (getParser().ParseExpression(Val, Start, End))
+ if (getParser().ParseExpression(Val, End))
return 0;
return X86Operand::CreateImm(Val, Start, End);
}
@@ -302,15 +302,15 @@
// it.
const MCExpr *Disp = MCConstantExpr::Create(0, getParser().getContext());
if (getLexer().isNot(AsmToken::LParen)) {
- SMLoc ExprStart, ExprEnd;
- if (getParser().ParseExpression(Disp, MemStart, ExprEnd)) return 0;
+ SMLoc ExprEnd;
+ if (getParser().ParseExpression(Disp, ExprEnd)) return 0;
// After parsing the base expression we could either have a parenthesized
// memory address or not. If not, return now. If so, eat the (.
if (getLexer().isNot(AsmToken::LParen)) {
// Unless we have a segment register, treat this as an immediate.
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);
}
Modified: llvm/trunk/tools/llvm-mc/AsmParser.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-mc/AsmParser.cpp?rev=93536&r1=93535&r2=93536&view=diff
==============================================================================
--- llvm/trunk/tools/llvm-mc/AsmParser.cpp (original)
+++ llvm/trunk/tools/llvm-mc/AsmParser.cpp Fri Jan 15 13:39:23 2010
@@ -271,8 +271,8 @@
}
bool AsmParser::ParseExpression(const MCExpr *&Res) {
- SMLoc L;
- return ParseExpression(Res, L, L);
+ SMLoc EndLoc;
+ return ParseExpression(Res, EndLoc);
}
/// ParseExpression - Parse an expression and return it.
@@ -282,9 +282,7 @@
/// expr ::= expr *,/,%,<<,>> expr -> highest.
/// expr ::= primaryexpr
///
-bool AsmParser::ParseExpression(const MCExpr *&Res,
- SMLoc &StartLoc, SMLoc &EndLoc) {
- StartLoc = Lexer.getLoc();
+bool AsmParser::ParseExpression(const MCExpr *&Res, SMLoc &EndLoc) {
Res = 0;
return ParsePrimaryExpr(Res, EndLoc) ||
ParseBinOpRHS(1, Res, EndLoc);
Modified: llvm/trunk/tools/llvm-mc/AsmParser.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-mc/AsmParser.h?rev=93536&r1=93535&r2=93536&view=diff
==============================================================================
--- llvm/trunk/tools/llvm-mc/AsmParser.h (original)
+++ llvm/trunk/tools/llvm-mc/AsmParser.h Fri Jan 15 13:39:23 2010
@@ -80,8 +80,7 @@
virtual bool Error(SMLoc L, const Twine &Msg);
bool ParseExpression(const MCExpr *&Res);
- virtual bool ParseExpression(const MCExpr *&Res,
- SMLoc &StartLoc, SMLoc &EndLoc);
+ virtual bool ParseExpression(const MCExpr *&Res, SMLoc &EndLoc);
virtual bool ParseParenExpression(const MCExpr *&Res, SMLoc &EndLoc);
virtual bool ParseAbsoluteExpression(int64_t &Res);
More information about the llvm-commits
mailing list