[PATCH] D154202: [MC/AsmLexer] Add '?' (Question) token

Sergei Barannikov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jun 30 13:44:21 PDT 2023


barannikov88 added a comment.

In D154202#4464906 <https://reviews.llvm.org/D154202#4464906>, @MaskRay wrote:

> In MSVC, mangled C++ names start with `?` and the symbols are quoted. If your target needs `?`, you can use quotes as well?

'?' is already allowed to be a part of an identifier, and it can also be the first character of an identifier if doesAllowQuestionAtStartOfIdentifier returns true.
I need this symbol in a different context -- it is used as ternary operator in some instructions, e.g. ".float vreg0 = not mask ? vreg1 : vreg2" (assembler syntax is "high level"-ish).
The spaces around '?' are optional.

Note that adding a dedicated token kind for '?' can't break anything, because it used to be a hard error to use it in non-identifier context. This also matches how other "special" identifier characters are handled: '$', '@' and '#'.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D154202/new/

https://reviews.llvm.org/D154202



More information about the llvm-commits mailing list