1//===-- enums.td - EnumsGen test definition file -----------*- tablegen -*-===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8
9include "mlir/IR/OpBase.td"
10
11def CaseA: StrEnumAttrCase<"CaseA">;
12def CaseB: StrEnumAttrCase<"CaseB", 10>;
13
14def StrEnum: StrEnumAttr<"StrEnum", "A test enum", [CaseA, CaseB]> {
15  let cppNamespace = "Outer::Inner";
16  let stringToSymbolFnName = "ConvertToEnum";
17  let symbolToStringFnName = "ConvertToString";
18  let genSpecializedAttr = 1;
19}
20
21def Case5: I32EnumAttrCase<"Case5", 5>;
22def Case10: I32EnumAttrCase<"Case10", 10>;
23
24def I32Enum: I32EnumAttr<"I32Enum", "A test enum", [Case5, Case10]>;
25
26def Bit0 : BitEnumAttrCase<"None", 0x0000>;
27def Bit1 : BitEnumAttrCase<"Bit1", 0x0001>;
28def Bit3 : BitEnumAttrCase<"Bit3", 0x0004>;
29
30def BitEnumWithNone : BitEnumAttr<"BitEnumWithNone", "A test enum",
31                                  [Bit0, Bit1, Bit3]>;
32
33def BitEnumWithoutNone : BitEnumAttr<"BitEnumWithoutNone", "A test enum",
34                                     [Bit1, Bit3]>;
35
36def PrettyIntEnumCase1: I32EnumAttrCase<"Case1", 1, "case_one">;
37def PrettyIntEnumCase2: I32EnumAttrCase<"Case2", 2, "case_two">;
38
39def PrettyIntEnum: I32EnumAttr<"PrettyIntEnum", "A test enum",
40                               [PrettyIntEnumCase1, PrettyIntEnumCase2]>;
41