[llvm-branch-commits] [mlir] [mlir] Decouple enum generation from attributes, adding EnumInfo and EnumCase (PR #132148)

Krzysztof Drewniak via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Sun Mar 23 18:35:54 PDT 2025


================
@@ -128,8 +143,95 @@ namespace llvm {
 inline ::llvm::raw_ostream &operator<<(::llvm::raw_ostream &p, {0} value) {{
   auto valueStr = stringifyEnum(value);
 )";
-  os << formatv(parsedAndPrinterStart, qualName, cppNamespace,
-                enumAttr.getSummary());
+
+  const char *parsedAndPrinterStartUnquotedBitEnum = R"(
+  namespace mlir {
+  template <typename T, typename>
+  struct FieldParser;
+
+  template<>
+  struct FieldParser<{0}, {0}> {{
----------------
krzysz00 wrote:

There's a FieldParser implementation above that's the old-style bit enum. It's handled by always quoting bit enum values that have more than one bit set.

Usually, these FieldParser values were very much unused, as there are separate parser implementatinos both in `EnumParameter` and in other bits of `mlir-tblgen` that mean this code was basically never called.

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


More information about the llvm-branch-commits mailing list