Skip to content

Commit 025fdcc

Browse files
committed
[NFC][TableGen] Delete getLogicalOperandType from InstrInfoEmitter
- Delete `getLogicalOperandType` function from InstrInfoEmitter as no backend seems to use it.
1 parent 4e14b8a commit 025fdcc

File tree

1 file changed

+0
-93
lines changed

1 file changed

+0
-93
lines changed

llvm/utils/TableGen/InstrInfoEmitter.cpp

Lines changed: 0 additions & 93 deletions
Original file line numberDiff line numberDiff line change
@@ -94,9 +94,6 @@ class InstrInfoEmitter {
9494
void emitLogicalOperandSizeMappings(
9595
raw_ostream &OS, StringRef Namespace,
9696
ArrayRef<const CodeGenInstruction *> NumberedInstructions);
97-
void emitLogicalOperandTypeMappings(
98-
raw_ostream &OS, StringRef Namespace,
99-
ArrayRef<const CodeGenInstruction *> NumberedInstructions);
10097

10198
// Operand information.
10299
unsigned CollectOperandInfo(OperandInfoListTy &OperandInfoList,
@@ -556,93 +553,6 @@ void InstrInfoEmitter::emitLogicalOperandSizeMappings(
556553
OS << "#endif // GET_INSTRINFO_LOGICAL_OPERAND_SIZE_MAP\n\n";
557554
}
558555

559-
void InstrInfoEmitter::emitLogicalOperandTypeMappings(
560-
raw_ostream &OS, StringRef Namespace,
561-
ArrayRef<const CodeGenInstruction *> NumberedInstructions) {
562-
std::map<std::vector<std::string>, unsigned> LogicalOpTypeMap;
563-
564-
std::map<unsigned, std::vector<std::string>> InstMap;
565-
566-
size_t OpTypeListSize = 0U;
567-
std::vector<std::string> LogicalOpTypeList;
568-
for (const auto *Inst : NumberedInstructions) {
569-
if (!Inst->TheDef->getValueAsBit("UseLogicalOperandMappings"))
570-
continue;
571-
572-
LogicalOpTypeList.clear();
573-
for (const auto &Op : Inst->Operands) {
574-
auto *OpR = Op.Rec;
575-
if ((OpR->isSubClassOf("Operand") ||
576-
OpR->isSubClassOf("RegisterOperand") ||
577-
OpR->isSubClassOf("RegisterClass")) &&
578-
!OpR->isAnonymous()) {
579-
LogicalOpTypeList.push_back(
580-
(Namespace + "::OpTypes::" + Op.Rec->getName()).str());
581-
} else {
582-
LogicalOpTypeList.push_back("-1");
583-
}
584-
}
585-
OpTypeListSize = std::max(LogicalOpTypeList.size(), OpTypeListSize);
586-
587-
auto I =
588-
LogicalOpTypeMap.insert({LogicalOpTypeList, LogicalOpTypeMap.size()})
589-
.first;
590-
InstMap[I->second].push_back(
591-
(Namespace + "::" + Inst->TheDef->getName()).str());
592-
}
593-
594-
OS << "#ifdef GET_INSTRINFO_LOGICAL_OPERAND_TYPE_MAP\n";
595-
OS << "#undef GET_INSTRINFO_LOGICAL_OPERAND_TYPE_MAP\n";
596-
OS << "namespace llvm::" << Namespace << " {\n";
597-
OS << "LLVM_READONLY static int\n";
598-
OS << "getLogicalOperandType(uint16_t Opcode, uint16_t LogicalOpIdx) {\n";
599-
if (!InstMap.empty()) {
600-
std::vector<const std::vector<std::string> *> LogicalOpTypeList(
601-
LogicalOpTypeMap.size());
602-
for (auto &P : LogicalOpTypeMap) {
603-
LogicalOpTypeList[P.second] = &P.first;
604-
}
605-
OS << " static const int TypeMap[][" << OpTypeListSize << "] = {\n";
606-
for (int r = 0, rs = LogicalOpTypeList.size(); r < rs; ++r) {
607-
const auto &Row = *LogicalOpTypeList[r];
608-
OS << " {";
609-
int i, s = Row.size();
610-
for (i = 0; i < s; ++i) {
611-
if (i > 0)
612-
OS << ", ";
613-
OS << Row[i];
614-
}
615-
for (; i < static_cast<int>(OpTypeListSize); ++i) {
616-
if (i > 0)
617-
OS << ", ";
618-
OS << "-1";
619-
}
620-
OS << "}";
621-
if (r != rs - 1)
622-
OS << ",";
623-
OS << "\n";
624-
}
625-
OS << " };\n";
626-
627-
OS << " switch (Opcode) {\n";
628-
OS << " default: return -1;\n";
629-
for (auto &P : InstMap) {
630-
auto OpMapIdx = P.first;
631-
const auto &Insts = P.second;
632-
for (const auto &Inst : Insts) {
633-
OS << " case " << Inst << ":\n";
634-
}
635-
OS << " return TypeMap[" << OpMapIdx << "][LogicalOpIdx];\n";
636-
}
637-
OS << " }\n";
638-
} else {
639-
OS << " return -1;\n";
640-
}
641-
OS << "}\n";
642-
OS << "} // end namespace llvm::" << Namespace << "\n";
643-
OS << "#endif // GET_INSTRINFO_LOGICAL_OPERAND_TYPE_MAP\n\n";
644-
}
645-
646556
void InstrInfoEmitter::emitMCIIHelperMethods(raw_ostream &OS,
647557
StringRef TargetName) {
648558
ArrayRef<const Record *> TIIPredicates =
@@ -1130,9 +1040,6 @@ void InstrInfoEmitter::run(raw_ostream &OS) {
11301040
Timer.startTimer("Emit logical operand size mappings");
11311041
emitLogicalOperandSizeMappings(OS, TargetName, NumberedInstructions);
11321042

1133-
Timer.startTimer("Emit logical operand type mappings");
1134-
emitLogicalOperandTypeMappings(OS, TargetName, NumberedInstructions);
1135-
11361043
Timer.startTimer("Emit helper methods");
11371044
emitMCIIHelperMethods(OS, TargetName);
11381045

0 commit comments

Comments
 (0)