[PATCH] D53535: [MC] Separate masm integer literal lexer support from inline asm

Reid Kleckner via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Oct 22 15:58:09 PDT 2018


rnk created this revision.
rnk added reviewers: Gerolf, avt77.
Herald added subscribers: hiraditya, eraman.

This effectively renames the IsParsingMSInlineAsm member variable of
AsmLexer to LexMasmIntegers and moves it up to MCAsmLexer. This is the
only behavior controlled by that variable. I added a public setter, so
that it can be set from outside or from the command line.

Now, masm integers (0b1101 and 0ABCh) work in __asm blocks from clang,
but 0b label references work when using .intel_syntax in standalone .s
files.

However, 0b label references will *not* work from __asm blocks in clang.
They will work from GCC inline asm blocks, which it sounds like is
important for Crypto++ as mentioned in PR36144.

Essentially, we only lex masm literals when the asm blob itself is
marked as using intel syntax. If the user emits .intel_syntax directly
in the asm string, masm literals will not be lexed, as is the case if we
did a standalone .s compilation.

Hopefully this addresses PR36144.


https://reviews.llvm.org/D53535

Files:
  llvm/include/llvm/MC/MCParser/AsmLexer.h
  llvm/include/llvm/MC/MCParser/MCAsmLexer.h
  llvm/lib/CodeGen/AsmPrinter/AsmPrinterInlineAsm.cpp
  llvm/lib/MC/MCParser/AsmLexer.cpp
  llvm/lib/MC/MCParser/AsmParser.cpp
  llvm/lib/Target/X86/AsmParser/X86AsmParser.cpp
  llvm/test/MC/X86/pr27884.s
  llvm/tools/llvm-mc/llvm-mc.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D53535.170519.patch
Type: text/x-patch
Size: 6107 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20181022/84e02976/attachment.bin>


More information about the llvm-commits mailing list