summaryrefslogtreecommitdiff
path: root/lib/MC
diff options
context:
space:
mode:
authorChad Rosier <mcrosier@apple.com>2013-04-09 19:34:59 +0000
committerChad Rosier <mcrosier@apple.com>2013-04-09 19:34:59 +0000
commitd4727e3798981af3d1308418464a10a398290851 (patch)
treec44579a1404a7719cc6ca855cd283dcd5914bdaf /lib/MC
parente0828ec6027e43724a7c5c76a3409344198dac71 (diff)
downloadllvm-d4727e3798981af3d1308418464a10a398290851.tar.gz
llvm-d4727e3798981af3d1308418464a10a398290851.tar.bz2
llvm-d4727e3798981af3d1308418464a10a398290851.tar.xz
[ms-inline asm] Use parsePrimaryExpr in lieu of parseExpression if we need to
parse an identifier. Otherwise, parseExpression may parse multiple tokens, which makes it impossible to properly compute an immediate displacement. An example of such a case is the source operand (i.e., [Symbol + ImmDisp]) in the below example: __asm mov eax, [Symbol + ImmDisp] The existing test cases exercise this patch. rdar://13611297 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@179115 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/MC')
-rw-r--r--lib/MC/MCParser/AsmParser.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/lib/MC/MCParser/AsmParser.cpp b/lib/MC/MCParser/AsmParser.cpp
index 14577f79be..c50177cb0a 100644
--- a/lib/MC/MCParser/AsmParser.cpp
+++ b/lib/MC/MCParser/AsmParser.cpp
@@ -221,6 +221,7 @@ public:
bool parseExpression(const MCExpr *&Res);
virtual bool parseExpression(const MCExpr *&Res, SMLoc &EndLoc);
+ virtual bool parsePrimaryExpr(const MCExpr *&Res, SMLoc &EndLoc);
virtual bool parseParenExpression(const MCExpr *&Res, SMLoc &EndLoc);
virtual bool parseAbsoluteExpression(int64_t &Res);
@@ -869,6 +870,10 @@ bool AsmParser::parseExpression(const MCExpr *&Res) {
return parseExpression(Res, EndLoc);
}
+bool AsmParser::parsePrimaryExpr(const MCExpr *&Res, SMLoc &EndLoc) {
+ return ParsePrimaryExpr(Res, EndLoc);
+}
+
const MCExpr *
AsmParser::ApplyModifierToExpr(const MCExpr *E,
MCSymbolRefExpr::VariantKind Variant) {