Beaver.SSA (beaver v0.4.8)

Copy Markdown

Storing MLIR IR structure with a Elixir struct. Macros like Beaver.mlir/1 will generate SSA structs defined by this module.

Semantically a SSA has no concept of "current block" or "current context". These are only needed when creating an operation. Therefore SSA syntax in Beaver can be used in both IR-generating and PDL-generating. To be more specific, the macro system in Beaver will use an SSA and its surrounding environment to construct a operation changeset, and then create an operation from it by calling MLIR CAPI.

Summary

Types

argument_entry()

@type argument_entry() :: Beaver.Changeset.argument()

evaluator()

@type evaluator() :: (t() -> term())

filler_fun()

@type filler_fun() :: (-> term())

insertion_point()

op_result_entry()

@type op_result_entry() ::
  {:op, Beaver.Changeset.result() | [Beaver.Changeset.result()]}

result_entry()

@type result_entry() :: Beaver.Changeset.result() | :infer | op_result_entry()

t()

@type t() :: %Beaver.SSA{
  arguments: [argument_entry()],
  ctx: Beaver.MLIR.Context.t() | nil,
  evaluator: evaluator() | nil,
  filler: filler_fun() | nil,
  ip: insertion_point(),
  loc: Beaver.MLIR.Location.t() | nil,
  op: String.t() | nil,
  results: :infer | [result_entry()]
}

Functions

eval(ssa)

postwalk(ast, evaluator)

prewalk(ast, evaluator)

put_arguments(ssa, additional_arguments)

put_ctx(ssa, ctx)

put_filler(ssa, filler)

put_ip(ssa, ip)

put_location(ssa, loc)

put_results(ssa, f)