[PATCH] D22361: [X86][MC] Fix bracket expression parsing in intel-style assembly.
Nirav Dave via llvm-commits
llvm-commits at lists.llvm.org
Thu Jul 14 08:32:18 PDT 2016
niravd created this revision.
niravd added a reviewer: rnk.
niravd added a subscriber: llvm-commits.
Only perform struct field check on Identifier tokens.
Fixes PR28547.
https://reviews.llvm.org/D22361
Files:
lib/Target/X86/AsmParser/X86AsmParser.cpp
test/MC/X86/pr28547.s
Index: test/MC/X86/pr28547.s
===================================================================
--- /dev/null
+++ test/MC/X86/pr28547.s
@@ -0,0 +1,5 @@
+// RUN: llvm-mc -triple x86_64-unknown-unknown %s
+ .intel_syntax
+ones:
+ .float +1.0, +1.0, +1.0, +1.0
+ vmovaps xmm15, xmmword ptr [rip+ones] # +1.0, +1.0, +1.0, +1.0
Index: lib/Target/X86/AsmParser/X86AsmParser.cpp
===================================================================
--- lib/Target/X86/AsmParser/X86AsmParser.cpp
+++ lib/Target/X86/AsmParser/X86AsmParser.cpp
@@ -1394,7 +1394,7 @@
return ErrorOperand(BracLoc, "Expected '[' token!");
Parser.Lex(); // Eat '['
- SMLoc StartInBrac = Tok.getLoc();
+ SMLoc StartInBrac = Parser.getTok().getLoc();
// Parse [ Symbol + ImmDisp ] and [ BaseReg + Scale*IndexReg + ImmDisp ]. We
// may have already parsed an immediate displacement before the bracketed
// expression.
@@ -1423,7 +1423,8 @@
// Parse struct field access. Intel requires a dot, but MSVC doesn't. MSVC
// will in fact do global lookup the field name inside all global typedefs,
// but we don't emulate that.
- if (Tok.getString().find('.') != StringRef::npos) {
+ if (Parser.getTok().getKind() == AsmToken::Identifier &&
+ Parser.getTok().getString().find('.') != StringRef::npos) {
const MCExpr *NewDisp;
if (ParseIntelDotOperator(Disp, NewDisp))
return nullptr;
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D22361.63982.patch
Type: text/x-patch
Size: 1399 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160714/ea0cbd77/attachment.bin>
More information about the llvm-commits
mailing list