[llvm] [TableGen] Restore OpName::OPERAND_LAST emission in InstrInfoEmitter (PR #125265)

via llvm-commits llvm-commits at lists.llvm.org
Fri Jan 31 10:02:43 PST 2025


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-tablegen

Author: Rahul Joshi (jurahul)

<details>
<summary>Changes</summary>

- Looks like this sentinel value is used in some downstream backends, so restore emitting it.
- It now also has the correct value (earlier code may have emitted an incorrect value for OPERAND_LAST and hence it was removed in https://github.com/llvm/llvm-project/pull/124960)

---
Full diff: https://github.com/llvm/llvm-project/pull/125265.diff


1 Files Affected:

- (modified) llvm/utils/TableGen/InstrInfoEmitter.cpp (+1) 


``````````diff
diff --git a/llvm/utils/TableGen/InstrInfoEmitter.cpp b/llvm/utils/TableGen/InstrInfoEmitter.cpp
index 55e9d576b9b068..97c00ad4924197 100644
--- a/llvm/utils/TableGen/InstrInfoEmitter.cpp
+++ b/llvm/utils/TableGen/InstrInfoEmitter.cpp
@@ -286,6 +286,7 @@ void InstrInfoEmitter::emitOperandNameMappings(
   OS << "enum {\n";
   for (const auto &[I, Op] : enumerate(OperandNameToID))
     OS << "  " << Op.first << " = " << I << ",\n";
+  OS << "  OPERAND_LAST = " << NumOperandNames << ",\n";
   OS << "};\n";
   OS << "} // end namespace llvm::" << Namespace << "::OpName\n";
   OS << "#endif //GET_INSTRINFO_OPERAND_ENUM\n\n";

``````````

</details>


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


More information about the llvm-commits mailing list