[all-commits] [llvm/llvm-project] 4c25a5: [mlir] Start rewrite tool (#77668)

Jacques Pienaar via All-commits all-commits at lists.llvm.org
Sat Oct 12 15:10:56 PDT 2024


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 4c25a538d3677866f6e3757ad3beecc50c56e589
      https://github.com/llvm/llvm-project/commit/4c25a538d3677866f6e3757ad3beecc50c56e589
  Author: Jacques Pienaar <jpienaar at google.com>
  Date:   2024-10-12 (Sat, 12 Oct 2024)

  Changed paths:
    A mlir/docs/Tools/mlir-rewrite.md
    M mlir/test/CMakeLists.txt
    A mlir/test/mlir-rewrite/simple.mlir
    M mlir/tools/CMakeLists.txt
    A mlir/tools/mlir-rewrite/CMakeLists.txt
    A mlir/tools/mlir-rewrite/mlir-rewrite.cpp
    M utils/bazel/llvm-project-overlay/mlir/BUILD.bazel

  Log Message:
  -----------
  [mlir] Start rewrite tool (#77668)

Initial commit of a tool to help in textual rewrites of .mlir files.
This tool builds of of AsmParserState and is rather simple. Took some
inspiration from when I used clang's AST rewrites where I'd often treat
it as a "localizing" regex applicator in fallback cases, and started
with that as functionality. There though, one does have access to the
lower level info than here, but still a step up over sed over entire
file.

This aims to be helpful (e.g., rewrite syntax including best effort
inside comments) rather than bulletproof tool. It may even be better
suited under utils than tools. And most of the rewrites would be rather
short lived and might never make it upstream (while the helpers of those
rewrites may for future rewrites).

The layering at the moment is not ideal as it is reusing the
RewriteBuffer class from clang's rewrite engine. So only optionally
enabling where clang is also enable. There doesn't seem to be anything
clang specific there (the dep does pull in more dependencies than ideal,
but leaving both refactorings).

Additionally started it as a single file to prototype more easily,
planning to refactor later to include and libs for out of file usage.



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list