[llvm] [TableGen] Rework `EmitIntrinsicToBuiltinMap` (PR #104681)

Rahul Joshi via llvm-commits llvm-commits at lists.llvm.org
Tue Aug 20 11:06:29 PDT 2024


jurahul wrote:

> > ```c++
> > static constexpr char BuiltinNames[] = {
> >   'd', 'm', 'b', '\000', 'd', 's', 'b', '\000', 'i', 's', 'b', '\000', 'M', 'o', 'v',
> >   'e', 'F', 'r', 'o', 'm', 'C', 'o', 'p', 'r', 'o', 'c', 'e', 's', 's', 'o',
> >   'r', '\000', 'M', 'o', 'v', 'e', 'F', 'r', 'o', 'm', 'C', 'o', 'p', 'r', 'o',
> >   'c', 'e', 's', 's', 'o', 'r', '2', '\000', '_', 'd', 'm', 'b', '\000', '_', 'd',
> >   's', 'b', '\000', '_', 'i', 's', 'b', '\000',
> >   };
> > ```
> 
> Just curious. Would it make sense to generate string literals instead. Makes it more useful for grepping for the string values.
> 
> > ```c++
> > static constexpr char BuiltinNames[] = 
> >   "dmb\000" 
> >   "dsb\000"
> >   "isb\000"
> >   "MoveFromCoprocessor\000"
> >   "MoveFromCoprocessor2\000"
> >   "_dmb\000"
> >   "_dsb\000"
> >   "_isb\000"
> >   };
> > ```

I did look at it. There are 2 classes in TableGen that support string emission: `StringToOffsetTable` and `SequenceToOffsetTable`. The latter supports emitting strings like what you mentioned. I can adopt that as a follow on change if that's ok.

https://github.com/llvm/llvm-project/pull/104681


More information about the llvm-commits mailing list