Beaver.MLIR.DominanceInfo (beaver v0.4.8)

Copy Markdown

High-level access to MLIR dominance analysis.

A dominance info owns native analysis state. It must not outlive the IR or context from which it was created, and must be destroyed with destroy/1. Prefer with_info/2 when the analysis does not need to escape a scope.

Mutating the analyzed IR may make cached answers stale. Call invalidate/1 after a mutation before issuing another query.

Summary

Functions

Creates an owned dominance analysis for an operation or module.

Destroys an owned dominance analysis.

Returns whether a dominates b.

Invalidates all cached dominance information and returns info.

Returns the nearest common dominator, or nil when none exists.

Returns whether a properly dominates b (excluding equality).

Returns whether a block is reachable from the entry block of its region.

Returns whether a value dominates an operation.

Returns whether a value properly dominates an operation.

Runs fun with a new dominance analysis and always destroys it.

Types

analyzed_ir()

@type analyzed_ir() :: Beaver.MLIR.Module.t() | Beaver.MLIR.Operation.t()

t()

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

Functions

create(ir)

@spec create(analyzed_ir()) :: t()

Creates an owned dominance analysis for an operation or module.

destroy(info)

@spec destroy(t()) :: :ok

Destroys an owned dominance analysis.

dominates?(info, a, b)

@spec dominates?(t(), Beaver.MLIR.Operation.t(), Beaver.MLIR.Operation.t()) ::
  boolean()
@spec dominates?(t(), Beaver.MLIR.Block.t(), Beaver.MLIR.Block.t()) :: boolean()

Returns whether a dominates b.

invalidate(info)

@spec invalidate(t()) :: t()

Invalidates all cached dominance information and returns info.

make(value)

nearest_common_dominator(info, a, b)

@spec nearest_common_dominator(t(), Beaver.MLIR.Block.t(), Beaver.MLIR.Block.t()) ::
  Beaver.MLIR.Block.t() | nil

Returns the nearest common dominator, or nil when none exists.

properly_dominates?(info, a, b)

@spec properly_dominates?(t(), Beaver.MLIR.Operation.t(), Beaver.MLIR.Operation.t()) ::
  boolean()
@spec properly_dominates?(t(), Beaver.MLIR.Block.t(), Beaver.MLIR.Block.t()) ::
  boolean()

Returns whether a properly dominates b (excluding equality).

reachable_from_entry?(info, block)

@spec reachable_from_entry?(t(), Beaver.MLIR.Block.t()) :: boolean()

Returns whether a block is reachable from the entry block of its region.

value_dominates?(info, value, op)

@spec value_dominates?(t(), Beaver.MLIR.Value.t(), Beaver.MLIR.Operation.t()) ::
  boolean()

Returns whether a value dominates an operation.

value_properly_dominates?(info, value, op)

@spec value_properly_dominates?(t(), Beaver.MLIR.Value.t(), Beaver.MLIR.Operation.t()) ::
  boolean()

Returns whether a value properly dominates an operation.

with_info(ir, fun)

@spec with_info(analyzed_ir(), (t() -> result)) :: result when result: var

Runs fun with a new dominance analysis and always destroys it.