[llvm-commits] [llvm] r117299 - in /llvm/trunk: lib/MC/MCParser/AsmParser.cpp test/MC/AsmParser/exprs.s
Daniel Dunbar
daniel at zuster.org
Mon Oct 25 13:18:57 PDT 2010
Author: ddunbar
Date: Mon Oct 25 15:18:56 2010
New Revision: 117299
URL: http://llvm.org/viewvc/llvm-project?rev=117299&view=rev
Log:
MC/AsmParser: Fix relative precedence of {+,-} and comparison ops.
Modified:
llvm/trunk/lib/MC/MCParser/AsmParser.cpp
llvm/trunk/test/MC/AsmParser/exprs.s
Modified: llvm/trunk/lib/MC/MCParser/AsmParser.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/MCParser/AsmParser.cpp?rev=117299&r1=117298&r2=117299&view=diff
==============================================================================
--- llvm/trunk/lib/MC/MCParser/AsmParser.cpp (original)
+++ llvm/trunk/lib/MC/MCParser/AsmParser.cpp Mon Oct 25 15:18:56 2010
@@ -717,13 +717,7 @@
Kind = MCBinaryExpr::And;
return 2;
- // Intermediate Precedence: +, -, ==, !=, <>, <, <=, >, >=
- case AsmToken::Plus:
- Kind = MCBinaryExpr::Add;
- return 3;
- case AsmToken::Minus:
- Kind = MCBinaryExpr::Sub;
- return 3;
+ // Low Intermediate Precedence: ==, !=, <>, <, <=, >, >=
case AsmToken::EqualEqual:
Kind = MCBinaryExpr::EQ;
return 3;
@@ -744,22 +738,30 @@
Kind = MCBinaryExpr::GTE;
return 3;
+ // High Intermediate Precedence: +, -
+ case AsmToken::Plus:
+ Kind = MCBinaryExpr::Add;
+ return 4;
+ case AsmToken::Minus:
+ Kind = MCBinaryExpr::Sub;
+ return 4;
+
// Highest Precedence: *, /, %, <<, >>
case AsmToken::Star:
Kind = MCBinaryExpr::Mul;
- return 4;
+ return 5;
case AsmToken::Slash:
Kind = MCBinaryExpr::Div;
- return 4;
+ return 5;
case AsmToken::Percent:
Kind = MCBinaryExpr::Mod;
- return 4;
+ return 5;
case AsmToken::LessLess:
Kind = MCBinaryExpr::Shl;
- return 4;
+ return 5;
case AsmToken::GreaterGreater:
Kind = MCBinaryExpr::Shr;
- return 4;
+ return 5;
}
}
Modified: llvm/trunk/test/MC/AsmParser/exprs.s
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/AsmParser/exprs.s?rev=117299&r1=117298&r2=117299&view=diff
==============================================================================
--- llvm/trunk/test/MC/AsmParser/exprs.s (original)
+++ llvm/trunk/test/MC/AsmParser/exprs.s Mon Oct 25 15:18:56 2010
@@ -43,7 +43,8 @@
check_expr 1 || 2, 1
check_expr 0 || 1, 1
check_expr 0 || 0, 0
-
+ check_expr 1 + 2 < 3 + 4, 1
+
.set c, 10
check_expr c + 1, 11
More information about the llvm-commits
mailing list