Skip to content

Bind missing LLVM 22 MLIR C API rewriter functions (Rewrite.h) - #895

Open
BabarZKhan wants to merge 12 commits into
mlir-rs:mainfrom
BabarZKhan:rewriter-gap
Open

Bind missing LLVM 22 MLIR C API rewriter functions (Rewrite.h)#895
BabarZKhan wants to merge 12 commits into
mlir-rs:mainfrom
BabarZKhan:rewriter-gap

Conversation

@BabarZKhan

Copy link
Copy Markdown
Contributor

added wrappers for 11 mlir-c Rewrite.h here functions (LLVM llvmorg-22.1.0) not previously implemented in melior mainline.

So, three files have been changed:

  • ir_rewriter.rs
  • greedy_rewrite_driver.rs
  • lib.rs

What exactly are the changes? Following:

RewriterBase (ir_rewriter.rs):

  • replace_all_op_uses_with_values / replace_all_op_uses_with_operation
  • replace_all_uses_except
  • replace_all_value_range_uses_with
  • replace_op_uses_within_block
  • inline_block_before / merge_blocks / create_block_before
  • set_insertion_point_after_value / operation_after_insertion

Greedy driver (greedy_rewrite_driver.rs):

  • apply_patterns_and_fold_greedily_with_op (op-scoped variant of the existing module-scoped function)

Plus lib.rs re-export and tests. Design notes: create_block_before takes &[(Type, Location)] mirroring Block::new; operation_after_insertion returns Option since the C API returns null at block end.

Part of #893

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants