Charms.Intrinsic behaviour (charms v0.1.1)

Behaviour to define intrinsic functions.

Summary

Callbacks

Callback to implement an intrinsic.

Types

Link to this type

intrinsic_return()

@type intrinsic_return() :: ir_return() | (any() -> ir_return())
@type ir_return() :: MLIR.Value.t() | MLIR.Operation.t()
@type opt() ::
  {:ctx, MLIR.Context.t()}
  | {:block, MLIR.Block.t() | {:loc, MLIR.Location.t()}}
@type opts() :: [opt() | {atom(), term()}]

Callbacks

Link to this callback

handle_intrinsic(atom, list, opts)

@callback handle_intrinsic(atom(), [term()], opts()) :: intrinsic_return()

Callback to implement an intrinsic.

Having different return types, there are two kinds of intrinsic functions:

  • Regular: returns a MLIR value or operation.
  • Higher-order: returns a function that returns a MLIR value or operation.

More on higher-order intrinsic

Higher-order intrinsic function can be variadic, which means it a list will be passed as arguments.

Functions

Link to this macro

defintrinsic(intrinsic_list)

(macro)