[Mlir-commits] [mlir] [mlir-tblgen] Emit named operand indices (PR #146839)

Michael Kruse llvmlistbot at llvm.org
Fri Jul 4 07:06:49 PDT 2025


Meinersbur wrote:

> It is possible to emit a method computing this from TableGen (the opposite of getODSOperands() ?

Is this a question or a statement? Even if we had an oppsite of `getODSOperands()` (Input: `OpOperand`, output: an index of the arguments list in the `.td` file), it one would still need compare that return index to an hardcoded magic number, instead of by the name of that argument.

> but I'm not sure how this patch solves the problem right now?

It is done in #144785 which uses it for this pupose. In principle: Check whether a given operand index falls into the range of `getODSOperandIndexAndLength(argnum)`, where `argnum` is one of the named constants such as `odsIndex_input`. Equivalently, but less efficient, `llvm::contains(opoperand, getODSOperand(OpB::odsIndex_input))`.

https://github.com/llvm/llvm-project/pull/146839


More information about the Mlir-commits mailing list