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

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


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

- 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)

>From 384bc57a2e175a50da206fa1600824f387f4ecb1 Mon Sep 17 00:00:00 2001
From: Rahul Joshi <rjoshi at nvidia.com>
Date: Fri, 31 Jan 2025 09:58:05 -0800
Subject: [PATCH] [TableGen] Restore OpName::OPERAND_LAST emission in
 InstrInfoEmitter

- 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 hve emitted an
  incorrect value for OPERAND_LAST and hence it was removed in
  https://github.com/llvm/llvm-project/pull/124960)
---
 llvm/utils/TableGen/InstrInfoEmitter.cpp | 1 +
 1 file changed, 1 insertion(+)

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";



More information about the llvm-commits mailing list