
# Autogenerated by mlir-tblgen; don't manually edit.

from enum import IntEnum, auto, IntFlag
from ._ods_common import _cext as _ods_cext
from ..ir import register_attribute_builder
_ods_ir = _ods_cext.ir

class Variadicity(IntEnum):
    """variadicity kind"""

    single = 0
    optional = 1
    variadic = 2

    def __str__(self):
        if self is Variadicity.single:
            return "single"
        if self is Variadicity.optional:
            return "optional"
        if self is Variadicity.variadic:
            return "variadic"
        raise ValueError("Unknown Variadicity enum entry.")



@register_attribute_builder("Variadicity", allow_existing=True)
def _variadicity(x, context):
    return _ods_ir.IntegerAttr.get(_ods_ir.IntegerType.get_signless(32, context=context), int(x))

@register_attribute_builder("irdl.VariadicityAttr")
def _variadicityattr(x, context):
    return _ods_ir.Attribute.parse(f'#irdl<variadicity {str(x)}>', context=context)

