[llvm] [TableGen] List the indices of sub-operands (PR #163723)
Matt Arsenault via llvm-commits
llvm-commits at lists.llvm.org
Fri Oct 17 18:44:45 PDT 2025
================
@@ -1135,6 +1135,20 @@ void InstrInfoEmitter::run(raw_ostream &OS) {
OS << "\n};\n} // end namespace llvm\n";
+ OS << "namespace llvm::" << Target.getInstNamespace() << " {\n";
+ for (const Record *R : Records.getAllDerivedDefinitions("Operand")) {
+ if (R->isAnonymous())
+ continue;
+ if (const DagInit *D = R->getValueAsDag("MIOperandInfo")) {
+ for (unsigned i = 0, e = D->getNumArgs(); i < e; ++i) {
+ if (const StringInit *Name = D->getArgName(i))
+ OS << " constexpr unsigned SUBOP_" << R->getName() << "_"
+ << Name->getValue() << " = " << i << ";\n";
+ }
+ }
+ }
+ OS << "} // end namespace llvm::" << Target.getInstNamespace() << "\n";
----------------
arsenm wrote:
Use NamespaceEmitter for this?
https://github.com/llvm/llvm-project/pull/163723
More information about the llvm-commits
mailing list