[all-commits] [llvm/llvm-project] 3dff20: [mlir] Reformat whitespace in dependent dialects c...

mlevesquedion via All-commits all-commits at lists.llvm.org
Mon Jan 15 02:12:05 PST 2024


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 3dff20cfa27e0988840d5d13a169482269aa4fa5
      https://github.com/llvm/llvm-project/commit/3dff20cfa27e0988840d5d13a169482269aa4fa5
  Author: mlevesquedion <mlevesquedion at google.com>
  Date:   2024-01-15 (Mon, 15 Jan 2024)

  Changed paths:
    M mlir/tools/mlir-tblgen/DialectGen.cpp
    M mlir/tools/mlir-tblgen/PassGen.cpp

  Log Message:
  -----------
  [mlir] Reformat whitespace in dependent dialects codegen (#78090)

The generated code for dependent dialects is awkwardly formatted, making
the code harder to read. This change reformats the whitespace to align
code in its context and avoid unnecessary empty lines.

Also included are some typo fixes.

Below are examples of the codegen for a dialect before and after the
change.

Before:

```
GPUDialect::GPUDialect(::mlir::MLIRContext *context)
    : ::mlir::Dialect(getDialectNamespace(), context, ::mlir::TypeID::get<GPUDialect>()) {

    getContext()->loadDialect<arith::ArithDialect>();

  initialize();
}
```

After:

```
GPUDialect::GPUDialect(::mlir::MLIRContext *context)
    : ::mlir::Dialect(getDialectNamespace(), context, ::mlir::TypeID::get<GPUDialect>()) {
  getContext()->loadDialect<arith::ArithDialect>();
  initialize();
}
```

Below are examples of the codegen for a pass before and after the
change.

Before:

```
  /// Return the dialect that must be loaded in the context before this pass.
  void getDependentDialects(::mlir::DialectRegistry &registry) const override {

  registry.insert<func::FuncDialect>();

  registry.insert<tensor::TensorDialect>();

  registry.insert<tosa::TosaDialect>();

  }
```

After:

```
  /// Register the dialects that must be loaded in the context before this pass.
  void getDependentDialects(::mlir::DialectRegistry &registry) const override {
    registry.insert<func::FuncDialect>();
    registry.insert<tensor::TensorDialect>();
    registry.insert<tosa::TosaDialect>();
  }
```




More information about the All-commits mailing list