[all-commits] [llvm/llvm-project] a4f31c: [mlir-tblgen] Emit named operand indices (#146839)

Michael Kruse via All-commits all-commits at lists.llvm.org
Fri Jul 4 08:15:32 PDT 2025


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: a4f31ccfa0efd610589d5e474daaeca1e0159807
      https://github.com/llvm/llvm-project/commit/a4f31ccfa0efd610589d5e474daaeca1e0159807
  Author: Michael Kruse <llvm-project at meinersbur.de>
  Date:   2025-07-04 (Fri, 04 Jul 2025)

  Changed paths:
    M mlir/test/mlir-tblgen/op-operand.td
    M mlir/tools/mlir-tblgen/OpDefinitionsGen.cpp

  Log Message:
  -----------
  [mlir-tblgen] Emit named operand indices (#146839)

An operation's operands are defined by the `arguments` field in the
tablegen definition. mlir-tblgen generates accessors for them:
`getXYZ()` and `setXYZ(...)` to set an operation's operands without
knowing the operand's index, but it does not expose the operand index
itself. Yet some use cases requires knowing the operand index that is
now covered by just getters and setters. For instance:
* Given an `mlir::OpOperand`, find out whether it is a specific argument
(from the `arguments` field in the `.td` file)
* For operation with variable number of operands (variadic,
`AttrSizedOperandSegments`), get the value to pass to `getODSOperands`
or `getODSOperandIndexAndLength`.



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