[llvm-dev] MCAsmParser and custom tokens

David Greene via llvm-dev llvm-dev at lists.llvm.org
Mon Jan 3 17:16:43 PST 2022


Hello!

Our assembly syntax has some custom tokens that are not defined under
AsmToken in MCAsmMacro.h.  Currently those tokens are parsed as part of
an identifier, which screws up things like register parsing.

Is there any ability to customize tokens a target parser recognizes, or
do we have to bite the bullet and change MCAsmMacro.h and related things
to recognize a new token?  I could examine the parsed identifier string,
split it and create target-specific token operands manually but I don't
know how to feed the remainder of the string for further parsing (like
to tryParseRegister).  Is there maybe a way to "unparse" part of a token
string?  AFAICT one can only "unlex" an entire token.

Thanks for any help!

                          -David


More information about the llvm-dev mailing list