[llvm] [TableGen] Improvements to Named operands in InstrInfoEmitter (PR #124960)

Rahul Joshi via llvm-commits llvm-commits at lists.llvm.org
Fri Jan 31 10:33:22 PST 2025


jurahul wrote:

> > Hi @jurahul ,
> > My downstream backend uses sentinel `OPERAND_LAST` (perhaps others do as well). It seems best to restore that line. It is pretty common for TableGen to emit sentinels in enums like this, and they can be useful.
> 
> Can you say more about what you use it for? If I understand correctly the value wasn't guaranteed to be a value that wasn't used elsewhere in the enum.

Really as a sentinel value, for example. to indicate that the enum value is not present. For example, a function that returns OpName can return OPERAND_LAST to indicate that it did not find the operand it was looking for. We could also instead use std::optional<OpName>but as @nvjle said its best to restore it as other downstream backends may be using this as well.

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


More information about the llvm-commits mailing list