Beaver.MLIR.RewriterBase (beaver v0.4.8)

Copy Markdown

This module defines functions working with MLIR RewriterBase.

Summary

Functions

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

insertion_position()

@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()}

t()

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

Functions

block(arg1)

See Beaver.MLIR.CAPI.mlirRewriterBaseGetBlock/1.

cancel_op_modification(arg1, arg2)

See Beaver.MLIR.CAPI.mlirRewriterBaseCancelOpModification/2.

clear_insertion_point(arg1)

See Beaver.MLIR.CAPI.mlirRewriterBaseClearInsertionPoint/1.

clone(arg1, arg2)

See Beaver.MLIR.CAPI.mlirRewriterBaseClone/2.

clone_region_before(arg1, arg2, arg3)

See Beaver.MLIR.CAPI.mlirRewriterBaseCloneRegionBefore/3.

clone_with_mapping(arg1, arg2, arg3)

See Beaver.MLIR.CAPI.mlirRewriterBaseCloneWithMapping/3.

clone_without_regions(arg1, arg2)

See Beaver.MLIR.CAPI.mlirRewriterBaseCloneWithoutRegions/2.

context(arg1)

See Beaver.MLIR.CAPI.mlirRewriterBaseGetContext/1.

create_block_before(arg1, arg2, arg3, arg4, arg5)

See Beaver.MLIR.CAPI.mlirRewriterBaseCreateBlockBefore/5.

erase_block(arg1, arg2)

See Beaver.MLIR.CAPI.mlirRewriterBaseEraseBlock/2.

erase_op(arg1, arg2)

See Beaver.MLIR.CAPI.mlirRewriterBaseEraseOp/2.

finalize_op_modification(arg1, arg2)

See Beaver.MLIR.CAPI.mlirRewriterBaseFinalizeOpModification/2.

inline_block_before(arg1, arg2, arg3, arg4, arg5)

See Beaver.MLIR.CAPI.mlirRewriterBaseInlineBlockBefore/5.

inline_region_before(arg1, arg2, arg3)

See Beaver.MLIR.CAPI.mlirRewriterBaseInlineRegionBefore/3.

insert(arg1, arg2)

See Beaver.MLIR.CAPI.mlirRewriterBaseInsert/2.

insertion_block(arg1)

See Beaver.MLIR.CAPI.mlirRewriterBaseGetInsertionBlock/1.

make(value)

merge_blocks(arg1, arg2, arg3, arg4, arg5)

See Beaver.MLIR.CAPI.mlirRewriterBaseMergeBlocks/5.

move_block_before(arg1, arg2, arg3)

See Beaver.MLIR.CAPI.mlirRewriterBaseMoveBlockBefore/3.

move_op_after(arg1, arg2, arg3)

See Beaver.MLIR.CAPI.mlirRewriterBaseMoveOpAfter/3.

move_op_before(arg1, arg2, arg3)

See Beaver.MLIR.CAPI.mlirRewriterBaseMoveOpBefore/3.

operation_after_insertion(arg1)

See Beaver.MLIR.CAPI.mlirRewriterBaseGetOperationAfterInsertion/1.

replace(rewriter, from, to)

Syntactic sugar for replace_all_uses_with/3 and replace_all_op_uses_with_operation/3.

replace_all_op_uses_with_operation(arg1, arg2, arg3)

See Beaver.MLIR.CAPI.mlirRewriterBaseReplaceAllOpUsesWithOperation/3.

replace_all_op_uses_with_value_range(arg1, arg2, arg3, arg4)

See Beaver.MLIR.CAPI.mlirRewriterBaseReplaceAllOpUsesWithValueRange/4.

replace_all_uses_except(arg1, arg2, arg3, arg4)

See Beaver.MLIR.CAPI.mlirRewriterBaseReplaceAllUsesExcept/4.

replace_all_uses_with(arg1, arg2, arg3)

See Beaver.MLIR.CAPI.mlirRewriterBaseReplaceAllUsesWith/3.

replace_all_value_range_uses_with(arg1, arg2, arg3, arg4)

See Beaver.MLIR.CAPI.mlirRewriterBaseReplaceAllValueRangeUsesWith/4.

replace_op(rewriter, from, to)

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.

replace_op_uses_within_block(arg1, arg2, arg3, arg4, arg5)

See Beaver.MLIR.CAPI.mlirRewriterBaseReplaceOpUsesWithinBlock/5.

replace_op_with_operation(arg1, arg2, arg3)

See Beaver.MLIR.CAPI.mlirRewriterBaseReplaceOpWithOperation/3.

replace_op_with_values(arg1, arg2, arg3, arg4)

See Beaver.MLIR.CAPI.mlirRewriterBaseReplaceOpWithValues/4.

restore_insertion_point(arg1, arg2)

See Beaver.MLIR.CAPI.mlirRewriterBaseRestoreInsertionPoint/2.

save_insertion_point(arg1)

See Beaver.MLIR.CAPI.mlirRewriterBaseSaveInsertionPoint/1.

set_insertion_point_after(arg1, arg2)

See Beaver.MLIR.CAPI.mlirRewriterBaseSetInsertionPointAfter/2.

set_insertion_point_after_value(arg1, arg2)

See Beaver.MLIR.CAPI.mlirRewriterBaseSetInsertionPointAfterValue/2.

set_insertion_point_before(arg1, arg2)

See Beaver.MLIR.CAPI.mlirRewriterBaseSetInsertionPointBefore/2.

set_insertion_point_to_end(arg1, arg2)

See Beaver.MLIR.CAPI.mlirRewriterBaseSetInsertionPointToEnd/2.

set_insertion_point_to_start(arg1, arg2)

See Beaver.MLIR.CAPI.mlirRewriterBaseSetInsertionPointToStart/2.

start_op_modification(arg1, arg2)

See Beaver.MLIR.CAPI.mlirRewriterBaseStartOpModification/2.

with_insertion_point(rewriter, fun)

@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.

with_insertion_point(rewriter, position, fun)

@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.