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
@type argument_entry() :: Beaver.Changeset.argument()
@type filler_fun() :: (-> term())
@type insertion_point() :: Beaver.MLIR.Block.t() | Beaver.MLIR.PatternRewriter.t() | Beaver.MLIR.RewriterBase.t() | nil
@type op_result_entry() ::
{:op, Beaver.Changeset.result() | [Beaver.Changeset.result()]}
@type result_entry() :: Beaver.Changeset.result() | :infer | op_result_entry()
@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()] }