[llvm] b3dac4e - [TableGen] Treat reg as isolated in reg$foo (but not in ${foo}reg)

Jay Foad via llvm-commits llvm-commits at lists.llvm.org
Wed Oct 28 14:48:51 PDT 2020


Author: Jay Foad
Date: 2020-10-28T21:39:39Z
New Revision: b3dac4ee240897194a5167aaae2aabbfba76da85

URL: https://github.com/llvm/llvm-project/commit/b3dac4ee240897194a5167aaae2aabbfba76da85
DIFF: https://github.com/llvm/llvm-project/commit/b3dac4ee240897194a5167aaae2aabbfba76da85.diff

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

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 '$'.

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

Added: 
    

Modified: 
    llvm/utils/TableGen/AsmMatcherEmitter.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/utils/TableGen/AsmMatcherEmitter.cpp b/llvm/utils/TableGen/AsmMatcherEmitter.cpp
index 3f05ab5b9955..ec7f59631687 100644
--- a/llvm/utils/TableGen/AsmMatcherEmitter.cpp
+++ b/llvm/utils/TableGen/AsmMatcherEmitter.cpp
@@ -1018,7 +1018,7 @@ void MatchableInfo::tokenizeAsmString(const AsmMatcherInfo &Info,
 
     case '$': {
       if (InTok) {
-        addAsmOperand(String.slice(Prev, i), false);
+        addAsmOperand(String.slice(Prev, i), IsIsolatedToken);
         InTok = false;
         IsIsolatedToken = false;
       }


        


More information about the llvm-commits mailing list