# `Beaver.Slang`

Defines extensible MLIR dialects in Elixir and compiles their schemas to
[IRDL](https://mlir.llvm.org/docs/Dialects/IRDL/).

Slang supports named type and attribute parameters, named operation operands,
results, attributes and regions, reusable constraints, `any_of`, `all_of` and
`base` constraints, and optional or variadic operands and results. Built-in
dynamic operation traits can be attached when the dialect is loaded.

Schema construction and runtime interface attachment are separate:
`__slang_dialect__/1` builds the inspectable IRDL module, while `load/2`
verifies and registers that module before attaching traits. See the
[Slang guide](slang.html) for a complete dialect and the supported syntax.

# `__using__`
*macro* 

This macro is invoked when the module is used. It sets up the module by registering attributes and importing macros from `Beaver.Slang`.

# `all_of`
*macro* 

Generates an `irdl.all_of` constraint.

# `any`
*macro* 

This macro generates the AST for the `irdl.any` op.

# `any_of`
*macro* 

This macro generates the AST for the any_of attribute in the dialect.

# `base`
*macro* 

Generates an `irdl.base` constraint from a base name or a Slang type/attribute.

Base names use upstream IRDL spelling such as `"!builtin.integer"` or
`"#builtin.string"`.

# `defalias`
*macro* 

Defines a reusable named constraint.

`defalias` is retained as a concise spelling of `defconstraint`.

# `defattr`
*macro* 

This macro defines a attribute in the dialect.

# `defconstraint`
*macro* 

Defines a reusable named constraint.

Reference it from another declaration with `^name`.

# `defop`
*macro* 

This macro defines an operation in the dialect. It generates the AST for the creator function for the operation.

# `deftype`
*macro* 

This macro defines a type in the dialect.

# `is`
*macro* 

This macro generates the AST for `irdl.is` op, usually used to create a constraint on type

# `load`

This function loads the MLIR dialect into the MLIR context. It invokes the internal function of the provided module to create the dialect's IRDL module and performs additional MLIR transformations and verification.

# `optional`
*macro* 

Marks an operand or result constraint as optional.

# `single`
*macro* 

Marks an operand or result constraint as a required singleton.

# `variadic`
*macro* 

Marks an operand or result constraint as variadic.
