llvm-project/llvm/lib/MC/MCParser
Reid Kleckner 953bdce68d [MC] Separate masm integer literal lexer support from inline asm
Summary:
This 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 llvm-mc command line. We may need to
arrange things so that users can get this behavior from clang, but
that's future work.

I also put additional hex literal lexing functionality under this flag
to fix PR32973. It appears that this hex literal parsing wasn't intended
to be enabled in non-masm-style blocks.

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 for inline asm blobs that use
intel syntax. If the .intel_syntax directive is used inside a gnu-style
inline asm statement, masm literals will not be lexed, which is
compatible with gas and llvm-mc standalone .s assembly.

This fixes PR36144 and PR32973.

Reviewers: Gerolf, avt77

Subscribers: eraman, hiraditya, llvm-commits

Differential Revision: https://reviews.llvm.org/D53535

llvm-svn: 345189
2018-10-24 20:23:57 +00:00
..
AsmLexer.cpp [MC] Separate masm integer literal lexer support from inline asm 2018-10-24 20:23:57 +00:00
AsmParser.cpp [MC] Separate masm integer literal lexer support from inline asm 2018-10-24 20:23:57 +00:00
CMakeLists.txt
COFFAsmParser.cpp [MC] Add support for the .rva assembler directive for COFF targets 2018-07-26 20:11:26 +00:00
DarwinAsmParser.cpp [MC] Error on a .zerofill directive in a non-virtual section 2018-07-02 17:29:43 +00:00
ELFAsmParser.cpp Revert "Add a warning if someone attempts to add extra section flags to sections" 2018-08-05 14:23:37 +00:00
LLVMBuild.txt
MCAsmLexer.cpp [MCAsmParser] Move AltMacroMode tracking out of MCAsmLexer 2018-09-25 20:55:55 +00:00
MCAsmParser.cpp [MC] Shrink MCAsmParser by grouping bools, add const, NFC 2018-10-22 22:29:09 +00:00
MCAsmParserExtension.cpp [MC] Fix some Clang-tidy modernize and Include What You Use warnings; other minor fixes (NFC). 2017-02-10 01:33:54 +00:00
MCTargetAsmParser.cpp [Asm] Add debug tracing in table-generated assembly matcher 2017-10-11 09:17:43 +00:00