diff --git a/mlir/include/mlir/IR/EnumAttr.td b/mlir/include/mlir/IR/EnumAttr.td --- a/mlir/include/mlir/IR/EnumAttr.td +++ b/mlir/include/mlir/IR/EnumAttr.td @@ -51,23 +51,22 @@ EnumAttrCaseInfo, SignlessIntegerAttrBase; -// A bit enum case stored with a 32-bit IntegerAttr. `val` here is *not* the -// ordinal number of a bit that is set. It is a 32-bit integer value with bits -// set to match the case. +class I8BitEnumAttrCase + : BitEnumAttrCaseBase; +class I16BitEnumAttrCase + : BitEnumAttrCaseBase; class I32BitEnumAttrCase : BitEnumAttrCaseBase; - -// A bit enum case stored with a 64-bit IntegerAttr. `val` here is *not* the -// ordinal number of a bit that is set. It is a 64-bit integer value with bits -// bits set to match the case. class I64BitEnumAttrCase : BitEnumAttrCaseBase; -// The special bit enum case for I32 with no bits set (i.e. value = 0). +// The special bit enum case with no bits set (i.e. value = 0). +class I8BitEnumAttrCaseNone + : I8BitEnumAttrCase; +class I16BitEnumAttrCaseNone + : I16BitEnumAttrCase; class I32BitEnumAttrCaseNone : I32BitEnumAttrCase; - -// The special bit enum case for I64 with no bits set (i.e. value = 0). class I64BitEnumAttrCaseNone : I64BitEnumAttrCase; @@ -80,17 +79,15 @@ "bit position larger than underlying storage"; } -// A bit enum case for a single bit in a 32-bit enum, specified by the -// bit position. +class I8BitEnumAttrCaseBit + : BitEnumAttrCaseBit; +class I16BitEnumAttrCaseBit + : BitEnumAttrCaseBit; class I32BitEnumAttrCaseBit : BitEnumAttrCaseBit; - -// A bit enum case for a single bit in a 64-bit enum, specified by the -// bit position. class I64BitEnumAttrCaseBit : BitEnumAttrCaseBit; - // A bit enum case for a group/list of previously declared cases, providing // a convenient alias for that group. class BitEnumAttrCaseGroup; -// A 32-bit enum case for a group/list of previously declared cases, providing -// a convenient alias for that group. +class I8BitEnumAttrCaseGroup cases, + string str = sym> + : BitEnumAttrCaseGroup; +class I16BitEnumAttrCaseGroup cases, + string str = sym> + : BitEnumAttrCaseGroup; class I32BitEnumAttrCaseGroup cases, string str = sym> : BitEnumAttrCaseGroup; - -// A 64-bit enum case for a group/list of previously declared cases, providing -// a convenient alias for that group. class I64BitEnumAttrCaseGroup cases, string str = sym> : BitEnumAttrCaseGroup; @@ -317,6 +315,18 @@ bit printBitEnumPrimaryGroups = 0; } +class I8BitEnumAttr cases> + : BitEnumAttr { + let underlyingType = "uint8_t"; +} + +class I16BitEnumAttr cases> + : BitEnumAttr { + let underlyingType = "uint16_t"; +} + class I32BitEnumAttr cases> : BitEnumAttr {