[PATCH] D92269: [TableGen] Eliminate the 'code' type
Jessica Clarke via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Sat Nov 28 16:51:50 PST 2020
jrtc27 added a comment.
In D92269#2421399 <https://reviews.llvm.org/D92269#2421399>, @Paul-C-Anagnostopoulos wrote:
> Yes, we could create !codeconcat instead, along with !codeinterleave, !codeeq, etc. We could also just extend the existing bang operators to work on the code type. I thought it was cleaner just to get rid of the distinction.
You wouldn't need a new !eq, you can just add another overloading. Really there should probably be an overloaded !concat that works on string, bits, list and code; !strconcat is the unusual case where it's qualified with the type in the name.
> I agree that !subst is a mess, even without this change. My plan is eventually to implement a saner !replace. But I'm not sure why doing string replacement in code is sad. There is even a utility to do it: GlobalISel\CodeExpander.
I was confused and thought !subst was substring not substitute, which is normally a meaningless operation to perform on code. Substitution is less weird, thought normally the useful/meaningful representation for code is something like a list of tokens which would make !subst a bit more useful as currently you just get raw string replacement which risks all manner of false positives for matches.
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
More information about the llvm-commits