comparison mlir/unittests/TableGen/enums.td @ 150:1d019706d866

LLVM10
author anatofuz
date Thu, 13 Feb 2020 15:10:13 +0900
parents
children 2e18cbf3894f
comparison
equal deleted inserted replaced
147:c2174574ed3a 150:1d019706d866
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
9 include "mlir/IR/OpBase.td"
10
11 def CaseA: StrEnumAttrCase<"CaseA">;
12 def CaseB: StrEnumAttrCase<"CaseB", 10>;
13
14 def StrEnum: StrEnumAttr<"StrEnum", "A test enum", [CaseA, CaseB]> {
15 let cppNamespace = "Outer::Inner";
16 let stringToSymbolFnName = "ConvertToEnum";
17 let symbolToStringFnName = "ConvertToString";
18 }
19
20 def Case5: I32EnumAttrCase<"Case5", 5>;
21 def Case10: I32EnumAttrCase<"Case10", 10>;
22
23 def I32Enum: I32EnumAttr<"I32Enum", "A test enum", [Case5, Case10]>;
24
25 def Bit0 : BitEnumAttrCase<"None", 0x0000>;
26 def Bit1 : BitEnumAttrCase<"Bit1", 0x0001>;
27 def Bit3 : BitEnumAttrCase<"Bit3", 0x0004>;
28
29 def BitEnumWithNone : BitEnumAttr<"BitEnumWithNone", "A test enum",
30 [Bit0, Bit1, Bit3]>;
31
32 def BitEnumWithoutNone : BitEnumAttr<"BitEnumWithoutNone", "A test enum",
33 [Bit1, Bit3]>;
34
35 def PrettyIntEnumCase1: I32EnumAttrCase<"Case1", 1, "case_one">;
36 def PrettyIntEnumCase2: I32EnumAttrCase<"Case2", 2, "case_two">;
37
38 def PrettyIntEnum: I32EnumAttr<"PrettyIntEnum", "A test enum",
39 [PrettyIntEnumCase1, PrettyIntEnumCase2]>;