fix a bug in range information for $42, eliminate an
authorChris Lattner <sabre@nondot.org>
Fri, 15 Jan 2010 19:39:23 +0000 (19:39 +0000)
committerChris Lattner <sabre@nondot.org>
Fri, 15 Jan 2010 19:39:23 +0000 (19:39 +0000)
unneeded argument from ParseExpression.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@93536 91177308-0d34-0410-b5e6-96231b3b80d8

include/llvm/MC/MCAsmParser.h
lib/Target/X86/AsmParser/X86AsmParser.cpp
tools/llvm-mc/AsmParser.cpp
tools/llvm-mc/AsmParser.h

index a3c10f9c2fe182395c6e6e970c1fb02a19f99ef3..f1ce323c15530c5ec19a65f5fe63bd55dfd66313 100644 (file)
@@ -55,8 +55,7 @@ public:
   /// @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
index b350c9fd6b4c0f3a2acadacef6dd30698b60c4ad..c2459c9e65439512cc8e1edcae5b04d0005cf544 100644 (file)
@@ -279,10 +279,10 @@ X86Operand *X86ATTAsmParser::ParseOperand() {
   }
   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 @@ X86Operand *X86ATTAsmParser::ParseMemOperand() {
   // 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);
     }
     
index 4e03646fec65d45464ee4d4db52080649d1f680c..d4af4bd0df6e119046984f6f6b7c1e4ade5548a7 100644 (file)
@@ -271,8 +271,8 @@ bool AsmParser::ParsePrimaryExpr(const MCExpr *&Res, SMLoc &EndLoc) {
 }
 
 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 @@ bool AsmParser::ParseExpression(const MCExpr *&Res) {
 ///  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);
index 63bac59f7a854742057609e90c42a0a080adfa2e..5aefb5b622d0f1e7527fab60c14f6aeb8ac27cda 100644 (file)
@@ -80,8 +80,7 @@ public:
   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);