[PATCH] D90315: [TableGen] Treat reg as isolated in reg$foo (but not in ${foo}reg)

Jay Foad via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Oct 28 09:31:31 PDT 2020


foad created this revision.
foad added reviewers: nhaehnle, ab, craig.topper.
Herald added subscribers: llvm-commits, pengfei, tpr.
Herald added a project: LLVM.
foad requested review of this revision.

D9844 <https://reviews.llvm.org/D9844> fixed a problem where the ss suffix in the AsmString "cmp${cc}ss"
was recognised as the X86 SS register, by only recognising a token as a
register name if it is "isolated", i.e. surrounded by separator
characters.

In the AMDGPU backend there are many operands like $clamp which expand
to an optional string " clamp" including the preceding space, so we want
to have AsmStrings including sequences like "vcc$clamp" where vcc is a
register name.

This patch relaxes the rules for an isolated token, to say that it's OK
if the token is immediately followed by a '$'.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D90315

Files:
  llvm/utils/TableGen/AsmMatcherEmitter.cpp


Index: llvm/utils/TableGen/AsmMatcherEmitter.cpp
===================================================================
--- llvm/utils/TableGen/AsmMatcherEmitter.cpp
+++ llvm/utils/TableGen/AsmMatcherEmitter.cpp
@@ -1018,7 +1018,7 @@
 
     case '$': {
       if (InTok) {
-        addAsmOperand(String.slice(Prev, i), false);
+        addAsmOperand(String.slice(Prev, i), IsIsolatedToken);
         InTok = false;
         IsIsolatedToken = false;
       }


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D90315.301314.patch
Type: text/x-patch
Size: 455 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20201028/96fd8fce/attachment.bin>


More information about the llvm-commits mailing list