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} 19 20def Case5: I32EnumAttrCase<"Case5", 5>; 21def Case10: I32EnumAttrCase<"Case10", 10>; 22 23def I32Enum: I32EnumAttr<"I32Enum", "A test enum", [Case5, Case10]>; 24 25def Bit0 : BitEnumAttrCase<"None", 0x0000>; 26def Bit1 : BitEnumAttrCase<"Bit1", 0x0001>; 27def Bit3 : BitEnumAttrCase<"Bit3", 0x0004>; 28 29def BitEnumWithNone : BitEnumAttr<"BitEnumWithNone", "A test enum", 30 [Bit0, Bit1, Bit3]>; 31 32def BitEnumWithoutNone : BitEnumAttr<"BitEnumWithoutNone", "A test enum", 33 [Bit1, Bit3]>; 34 35def PrettyIntEnumCase1: I32EnumAttrCase<"Case1", 1, "case_one">; 36def PrettyIntEnumCase2: I32EnumAttrCase<"Case2", 2, "case_two">; 37 38def PrettyIntEnum: I32EnumAttr<"PrettyIntEnum", "A test enum", 39 [PrettyIntEnumCase1, PrettyIntEnumCase2]>; 40