Beaver.MLIR.Context (beaver v0.4.0)

This module defines functions creating or destroying MLIR context.

Summary

Functions

Create a MLIR context. By default it registers and loads all dialects.

Run the given function with a diagnostic handler attached to the MLIR context.

Run a function with a registry appended to the context.

Types

context_option()

@type context_option() ::
  {:allow_unregistered, boolean()} | {:all_dialects, boolean()}

handler_acc()

@type handler_acc() :: any()

result()

@type result() :: any()

t()

@type t() :: %Beaver.MLIR.Context{ref: term()}

Functions

create(opts \\ [])

@spec create([context_option()]) :: t()

Create a MLIR context. By default it registers and loads all dialects.

destroy(ctx)

See Beaver.MLIR.CAPI.mlirContextDestroy/1.

make(value)

register_translations(ctx)

See Beaver.MLIR.CAPI.mlirRegisterAllLLVMTranslations/1.

with_diagnostics(ctx, fun, handler)

@spec with_diagnostics(
  t(),
  (-> result()),
  (Beaver.MLIR.Diagnostic.t(), handler_acc() -> handler_acc())
  | {(-> handler_acc()),
     (Beaver.MLIR.Diagnostic.t(), handler_acc() -> handler_acc())}
) :: {result(), handler_acc()}

Run the given function with a diagnostic handler attached to the MLIR context.

with_registry(ctx, fun)

Run a function with a registry appended to the context.