[PATCH] D122832: [TableGen] Add a backend to help with target enums

Fraser Cormack via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Apr 7 08:05:48 PDT 2022


frasercrmck added a comment.

In D122832#3422031 <https://reviews.llvm.org/D122832#3422031>, @Paul-C-Anagnostopoulos wrote:

> Sorry, I'm just quickly passing through for now. How does this new feature relate to the existing GenericEnum class?
>
> https://llvm.org/docs/TableGen/BackEnds.html#generic-enumerated-types

Good question! If I'm honest, I originally wrote this patch back in 2017 before that class was added and didn't fully grok `GenericEnum` when rebasing the patch. I thought it was purely internal to the searchable-table backend for some reason.

The way I see it, these two enum classes overlap more than is ideal. Personally I feel that `GenericEnum`'s implicit use of alphabetical enumerator order isn't as flexible for use in C++ as using an ordered `list` is. When explicitly instantiating values that's less of a problem, though. Having to/from string support is quite useful, too.

Now whether or not those features can/should go into `GenericEnum` is a question I don't really have the answer to. If there's no appetite to really use TableGen enums in backends then it's probably not worth the hassle.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D122832



More information about the llvm-commits mailing list