Beaver. MLIR. RewriterBase
(beaver v0.4.8)
Copy Markdown
This module defines functions working with MLIR RewriterBase.
Summary
Functions
Syntactic sugar for replace_all_uses_with/3 and replace_all_op_uses_with_operation/3.
Replaces an operation and erases it through MLIR's rewriter infrastructure.
Runs fun and restores the current insertion point afterward.
Temporarily moves the insertion point while running fun.
Types
@type insertion_position() :: :current | :clear | {:before, Beaver.MLIR.Operation.t()} | {:after, Beaver.MLIR.Operation.t()} | {:after_value, Beaver.MLIR.Value.t()} | {:start, Beaver.MLIR.Block.t()} | {:end, Beaver.MLIR.Block.t()}
@type t() :: %Beaver.MLIR.RewriterBase{ref: term()}
Functions
See Beaver.MLIR.CAPI.mlirRewriterBaseCancelOpModification/2.
See Beaver.MLIR.CAPI.mlirRewriterBaseFinalizeOpModification/2.
See Beaver.MLIR.CAPI.mlirRewriterBaseGetOperationAfterInsertion/1.
Syntactic sugar for replace_all_uses_with/3 and replace_all_op_uses_with_operation/3.
See Beaver.MLIR.CAPI.mlirRewriterBaseReplaceAllOpUsesWithOperation/3.
See Beaver.MLIR.CAPI.mlirRewriterBaseReplaceAllOpUsesWithValueRange/4.
See Beaver.MLIR.CAPI.mlirRewriterBaseReplaceAllUsesExcept/4.
See Beaver.MLIR.CAPI.mlirRewriterBaseReplaceAllValueRangeUsesWith/4.
@spec replace_op( t(), Beaver.MLIR.Operation.t(), Beaver.MLIR.Operation.t() | Beaver.MLIR.Value.t() | [Beaver.MLIR.Value.t()] ) :: :ok
Replaces an operation and erases it through MLIR's rewriter infrastructure.
A replacement can be another operation, one value, or a list of values. The result counts and types must match before MLIR is called.
See Beaver.MLIR.CAPI.mlirRewriterBaseReplaceOpUsesWithinBlock/5.
See Beaver.MLIR.CAPI.mlirRewriterBaseReplaceOpWithOperation/3.
See Beaver.MLIR.CAPI.mlirRewriterBaseRestoreInsertionPoint/2.
See Beaver.MLIR.CAPI.mlirRewriterBaseSetInsertionPointAfter/2.
See Beaver.MLIR.CAPI.mlirRewriterBaseSetInsertionPointAfterValue/2.
See Beaver.MLIR.CAPI.mlirRewriterBaseSetInsertionPointBefore/2.
See Beaver.MLIR.CAPI.mlirRewriterBaseSetInsertionPointToEnd/2.
See Beaver.MLIR.CAPI.mlirRewriterBaseSetInsertionPointToStart/2.
@spec with_insertion_point(t(), (-> result)) :: result when result: var
Runs fun and restores the current insertion point afterward.
Restoration happens on normal return, throw, exit, and exception.
@spec with_insertion_point(t(), insertion_position(), (-> result)) :: result when result: var
Temporarily moves the insertion point while running fun.
Supported positions are :clear, {:before, operation},
{:after, operation}, {:after_value, value}, {:start, block}, and
{:end, block}. The previous insertion point is always restored.