[PATCH] D35621: X86 Asm can't work properly with symbolic Scale

coby via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Aug 9 10:46:23 PDT 2017


coby added inline comments.


================
Comment at: lib/Target/X86/AsmParser/X86AsmParser.cpp:1461
       } else if (!isParsingInlineAsm()) {
         if (getParser().parsePrimaryExpr(Val, End))
           return Error(Tok.getLoc(), "Unexpected identifier!");
----------------
Suggested simplification (instead of the other changes as well):

```
      } else if (!isParsingInlineAsm()) {
        if (getParser().parsePrimaryExpr(Val, End))
          return Error(Tok.getLoc(), "Unexpected identifier!");
        if (Val->getKind() == MCExpr::Constant) {
          int64_t TmpInt;
          Val->evaluateAsAbsolute(TmpInt);
          StringRef ErrMsg;
          if (SM.onInteger(TmpInt, ErrMsg))
            return Error(Tok.getLoc(), ErrMsg);
        } else
          SM.onIdentifierExpr(Val, Identifier);

```

Will allow the use of an assembly constant as an immediate, as integral part of whatever compound expression (scale / other).


https://reviews.llvm.org/D35621





More information about the llvm-commits mailing list