[X86][ms-inline asm] Add support for memory operands that include structs
authorMarina Yatsina <marina.yatsina@intel.com>
Thu, 24 Dec 2015 12:09:51 +0000 (12:09 +0000)
committerMarina Yatsina <marina.yatsina@intel.com>
Thu, 24 Dec 2015 12:09:51 +0000 (12:09 +0000)
Add ability to reference struct symbols in memory operands.
Test case will be added on the clang side (review http://reviews.llvm.org/D15749)

Differential Revision: http://reviews.llvm.org/D15748

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

lib/Target/X86/AsmParser/X86AsmParser.cpp

index 4d36f1fd69cef0eba49049b4d8b6d500526457e8..5681966a2796aaa9050ac21b83a952ce03ff2dac 100644 (file)
@@ -1172,6 +1172,7 @@ bool X86AsmParser::ParseIntelExpression(IntelExprStateMachine &SM, SMLoc &End) {
   MCAsmParser &Parser = getParser();
   const AsmToken &Tok = Parser.getTok();
 
+  AsmToken::TokenKind PrevTK = AsmToken::Error;
   bool Done = false;
   while (!Done) {
     bool UpdateLocLex = true;
@@ -1215,7 +1216,8 @@ bool X86AsmParser::ParseIntelExpression(IntelExprStateMachine &SM, SMLoc &End) {
             return Error(Tok.getLoc(), "Unexpected identifier!");
         } else {
           // This is a dot operator, not an adjacent identifier.
-          if (Identifier.find('.') != StringRef::npos) {
+          if (Identifier.find('.') != StringRef::npos &&
+              PrevTK == AsmToken::RBrac) {
             return false;
           } else {
             InlineAsmIdentifierInfo &Info = SM.getIdentifierInfo();
@@ -1284,6 +1286,8 @@ bool X86AsmParser::ParseIntelExpression(IntelExprStateMachine &SM, SMLoc &End) {
 
     if (!Done && UpdateLocLex)
       End = consumeToken();
+
+    PrevTK = TK;
   }
   return false;
 }