From 025fdcc0f202b5a04d0242dd3f2520567a18467d Mon Sep 17 00:00:00 2001 From: Rahul Joshi Date: Wed, 5 Feb 2025 14:37:32 -0800 Subject: [PATCH] [NFC][TableGen] Delete `getLogicalOperandType` from InstrInfoEmitter - Delete `getLogicalOperandType` function from InstrInfoEmitter as no backend seems to use it. --- llvm/utils/TableGen/InstrInfoEmitter.cpp | 93 ------------------------ 1 file changed, 93 deletions(-) diff --git a/llvm/utils/TableGen/InstrInfoEmitter.cpp b/llvm/utils/TableGen/InstrInfoEmitter.cpp index 97c00ad492419..b042a1c0c5cda 100644 --- a/llvm/utils/TableGen/InstrInfoEmitter.cpp +++ b/llvm/utils/TableGen/InstrInfoEmitter.cpp @@ -94,9 +94,6 @@ class InstrInfoEmitter { void emitLogicalOperandSizeMappings( raw_ostream &OS, StringRef Namespace, ArrayRef NumberedInstructions); - void emitLogicalOperandTypeMappings( - raw_ostream &OS, StringRef Namespace, - ArrayRef NumberedInstructions); // Operand information. unsigned CollectOperandInfo(OperandInfoListTy &OperandInfoList, @@ -556,93 +553,6 @@ void InstrInfoEmitter::emitLogicalOperandSizeMappings( OS << "#endif // GET_INSTRINFO_LOGICAL_OPERAND_SIZE_MAP\n\n"; } -void InstrInfoEmitter::emitLogicalOperandTypeMappings( - raw_ostream &OS, StringRef Namespace, - ArrayRef NumberedInstructions) { - std::map, unsigned> LogicalOpTypeMap; - - std::map> InstMap; - - size_t OpTypeListSize = 0U; - std::vector LogicalOpTypeList; - for (const auto *Inst : NumberedInstructions) { - if (!Inst->TheDef->getValueAsBit("UseLogicalOperandMappings")) - continue; - - LogicalOpTypeList.clear(); - for (const auto &Op : Inst->Operands) { - auto *OpR = Op.Rec; - if ((OpR->isSubClassOf("Operand") || - OpR->isSubClassOf("RegisterOperand") || - OpR->isSubClassOf("RegisterClass")) && - !OpR->isAnonymous()) { - LogicalOpTypeList.push_back( - (Namespace + "::OpTypes::" + Op.Rec->getName()).str()); - } else { - LogicalOpTypeList.push_back("-1"); - } - } - OpTypeListSize = std::max(LogicalOpTypeList.size(), OpTypeListSize); - - auto I = - LogicalOpTypeMap.insert({LogicalOpTypeList, LogicalOpTypeMap.size()}) - .first; - InstMap[I->second].push_back( - (Namespace + "::" + Inst->TheDef->getName()).str()); - } - - OS << "#ifdef GET_INSTRINFO_LOGICAL_OPERAND_TYPE_MAP\n"; - OS << "#undef GET_INSTRINFO_LOGICAL_OPERAND_TYPE_MAP\n"; - OS << "namespace llvm::" << Namespace << " {\n"; - OS << "LLVM_READONLY static int\n"; - OS << "getLogicalOperandType(uint16_t Opcode, uint16_t LogicalOpIdx) {\n"; - if (!InstMap.empty()) { - std::vector *> LogicalOpTypeList( - LogicalOpTypeMap.size()); - for (auto &P : LogicalOpTypeMap) { - LogicalOpTypeList[P.second] = &P.first; - } - OS << " static const int TypeMap[][" << OpTypeListSize << "] = {\n"; - for (int r = 0, rs = LogicalOpTypeList.size(); r < rs; ++r) { - const auto &Row = *LogicalOpTypeList[r]; - OS << " {"; - int i, s = Row.size(); - for (i = 0; i < s; ++i) { - if (i > 0) - OS << ", "; - OS << Row[i]; - } - for (; i < static_cast(OpTypeListSize); ++i) { - if (i > 0) - OS << ", "; - OS << "-1"; - } - OS << "}"; - if (r != rs - 1) - OS << ","; - OS << "\n"; - } - OS << " };\n"; - - OS << " switch (Opcode) {\n"; - OS << " default: return -1;\n"; - for (auto &P : InstMap) { - auto OpMapIdx = P.first; - const auto &Insts = P.second; - for (const auto &Inst : Insts) { - OS << " case " << Inst << ":\n"; - } - OS << " return TypeMap[" << OpMapIdx << "][LogicalOpIdx];\n"; - } - OS << " }\n"; - } else { - OS << " return -1;\n"; - } - OS << "}\n"; - OS << "} // end namespace llvm::" << Namespace << "\n"; - OS << "#endif // GET_INSTRINFO_LOGICAL_OPERAND_TYPE_MAP\n\n"; -} - void InstrInfoEmitter::emitMCIIHelperMethods(raw_ostream &OS, StringRef TargetName) { ArrayRef TIIPredicates = @@ -1130,9 +1040,6 @@ void InstrInfoEmitter::run(raw_ostream &OS) { Timer.startTimer("Emit logical operand size mappings"); emitLogicalOperandSizeMappings(OS, TargetName, NumberedInstructions); - Timer.startTimer("Emit logical operand type mappings"); - emitLogicalOperandTypeMappings(OS, TargetName, NumberedInstructions); - Timer.startTimer("Emit helper methods"); emitMCIIHelperMethods(OS, TargetName);