[llvm] [TableGen] Implement getOperandIdxName (PR #154944)
Matt Arsenault via llvm-commits
llvm-commits at lists.llvm.org
Fri Aug 22 19:03:49 PDT 2025
================
@@ -223,17 +223,104 @@ void InstrInfoEmitter::EmitOperandInfo(raw_ostream &OS,
}
}
+static void emitGetInstructionIndexForOpLookup(
+ raw_ostream &OS, const MapVector<SmallVector<int>, unsigned> &OperandMap,
+ ArrayRef<unsigned> InstructionIndex) {
+ StringRef Type = OperandMap.size() <= UINT8_MAX + 1 ? "uint8_t" : "uint16_t";
+ OS << "LLVM_READONLY\n";
+ OS << "static " << Type
+ << " getInstructionIndexForOpLookup(uint16_t Opcode) {\n";
+ OS << " static constexpr " << Type << " InstructionIndex[] = {";
----------------
arsenm wrote:
```suggestion
<< " getInstructionIndexForOpLookup(uint16_t Opcode) {\n"
" static constexpr " << Type << " InstructionIndex[] = {";
```
https://github.com/llvm/llvm-project/pull/154944
More information about the llvm-commits
mailing list