[PATCH] D101733: [M68k][AsmParser] Fix invalid register name parsing logics

Ricky Taylor via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun May 2 15:12:04 PDT 2021


ricky26 added inline comments.


================
Comment at: llvm/lib/Target/M68k/AsmParser/M68kAsmParser.cpp:483
   // Parse simple general-purpose registers.
-  if (RegisterNameLower.size() == 2) {
+  if (RegisterNameLower.size() >= 2) {
     static unsigned RegistersByIndex[] = {
----------------
It might be simpler to pull out CCR for now. Otherwise this will cause some invalid register names to be parsed as valid `%a0q` for example would be parsed as A0 (the third character would be ignored).

A better solution might be to remove this check and in the switch cases check the name length.

I recognise this is due to my error!


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D101733



More information about the llvm-commits mailing list