[all-commits] [llvm/llvm-project] 2eb733: [mlir][tblgen] add concrete create methods (#147168)

Maksim Levental via All-commits all-commits at lists.llvm.org
Mon Jul 14 07:42:13 PDT 2025


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 2eb733b5a6ab17a3ae812bb55c1c7c64569cadcd
      https://github.com/llvm/llvm-project/commit/2eb733b5a6ab17a3ae812bb55c1c7c64569cadcd
  Author: Maksim Levental <maksim.levental at gmail.com>
  Date:   2025-07-14 (Mon, 14 Jul 2025)

  Changed paths:
    M mlir/include/mlir/IR/Builders.h
    M mlir/include/mlir/IR/ImplicitLocOpBuilder.h
    M mlir/include/mlir/IR/OpDefinition.h
    M mlir/include/mlir/TableGen/Class.h
    M mlir/test/mlir-tblgen/op-decl-and-defs.td
    M mlir/tools/mlir-tblgen/OpDefinitionsGen.cpp

  Log Message:
  -----------
  [mlir][tblgen] add concrete create methods (#147168)

Currently `builder.create<...>` does not in any meaningful way hint/show
the various builders an op supports (arg names/types) because [`create`
forwards the args to
`build`](https://github.com/llvm/llvm-project/blob/887222e3526fbe08e748a33f740296ac22bf1ab1/mlir/include/mlir/IR/Builders.h#L503).

To improve QoL, this PR adds static create methods to the ops themselves
like

```c++
static arith::ConstantIntOp create(OpBuilder& builder, Location location, int64_t value, unsigned width);
```

Now if one types `arith::ConstantIntO::create(builder,...` instead of
`builder.create<arith::ConstantIntO>(...` auto-complete/hints will pop
up.

See
https://discourse.llvm.org/t/rfc-building-mlir-operation-observed-caveats-and-proposed-solution/87204/13
for more info.



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