[llvm-branch-commits] [llvm] [MIR2Vec] Handle Operands (PR #163281)

Mircea Trofin via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Tue Oct 14 17:49:55 PDT 2025


================
@@ -122,22 +155,74 @@ unsigned MIRVocabulary::getCanonicalOpcodeIndex(unsigned Opcode) const {
   return getCanonicalIndexForBaseName(BaseOpcode);
 }
 
+unsigned
+MIRVocabulary::getCanonicalIndexForOperandName(StringRef OperandName) const {
+  auto It = std::find(std::begin(CommonOperandNames),
+                      std::end(CommonOperandNames), OperandName);
+  assert(It != std::end(CommonOperandNames) &&
+         "Operand name not found in common operands");
+  return Layout.CommonOperandBase +
+         std::distance(std::begin(CommonOperandNames), It);
+}
+
+unsigned
+MIRVocabulary::getCanonicalIndexForRegisterName(StringRef RegName,
----------------
mtrofin wrote:

RegisterClass?

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


More information about the llvm-branch-commits mailing list