@@ -94,9 +94,6 @@ class InstrInfoEmitter {
94
94
void emitLogicalOperandSizeMappings (
95
95
raw_ostream &OS, StringRef Namespace,
96
96
ArrayRef<const CodeGenInstruction *> NumberedInstructions);
97
- void emitLogicalOperandTypeMappings (
98
- raw_ostream &OS, StringRef Namespace,
99
- ArrayRef<const CodeGenInstruction *> NumberedInstructions);
100
97
101
98
// Operand information.
102
99
unsigned CollectOperandInfo (OperandInfoListTy &OperandInfoList,
@@ -563,93 +560,6 @@ void InstrInfoEmitter::emitLogicalOperandSizeMappings(
563
560
OS << " #endif // GET_INSTRINFO_LOGICAL_OPERAND_SIZE_MAP\n\n " ;
564
561
}
565
562
566
- void InstrInfoEmitter::emitLogicalOperandTypeMappings (
567
- raw_ostream &OS, StringRef Namespace,
568
- ArrayRef<const CodeGenInstruction *> NumberedInstructions) {
569
- std::map<std::vector<std::string>, unsigned > LogicalOpTypeMap;
570
-
571
- std::map<unsigned , std::vector<std::string>> InstMap;
572
-
573
- size_t OpTypeListSize = 0U ;
574
- std::vector<std::string> LogicalOpTypeList;
575
- for (const auto *Inst : NumberedInstructions) {
576
- if (!Inst->TheDef ->getValueAsBit (" UseLogicalOperandMappings" ))
577
- continue ;
578
-
579
- LogicalOpTypeList.clear ();
580
- for (const auto &Op : Inst->Operands ) {
581
- auto *OpR = Op.Rec ;
582
- if ((OpR->isSubClassOf (" Operand" ) ||
583
- OpR->isSubClassOf (" RegisterOperand" ) ||
584
- OpR->isSubClassOf (" RegisterClass" )) &&
585
- !OpR->isAnonymous ()) {
586
- LogicalOpTypeList.push_back (
587
- (Namespace + " ::OpTypes::" + Op.Rec ->getName ()).str ());
588
- } else {
589
- LogicalOpTypeList.push_back (" -1" );
590
- }
591
- }
592
- OpTypeListSize = std::max (LogicalOpTypeList.size (), OpTypeListSize);
593
-
594
- auto I =
595
- LogicalOpTypeMap.insert ({LogicalOpTypeList, LogicalOpTypeMap.size ()})
596
- .first ;
597
- InstMap[I->second ].push_back (
598
- (Namespace + " ::" + Inst->TheDef ->getName ()).str ());
599
- }
600
-
601
- OS << " #ifdef GET_INSTRINFO_LOGICAL_OPERAND_TYPE_MAP\n " ;
602
- OS << " #undef GET_INSTRINFO_LOGICAL_OPERAND_TYPE_MAP\n " ;
603
- OS << " namespace llvm::" << Namespace << " {\n " ;
604
- OS << " LLVM_READONLY static int\n " ;
605
- OS << " getLogicalOperandType(uint16_t Opcode, uint16_t LogicalOpIdx) {\n " ;
606
- if (!InstMap.empty ()) {
607
- std::vector<const std::vector<std::string> *> LogicalOpTypeList (
608
- LogicalOpTypeMap.size ());
609
- for (auto &P : LogicalOpTypeMap) {
610
- LogicalOpTypeList[P.second ] = &P.first ;
611
- }
612
- OS << " static const int TypeMap[][" << OpTypeListSize << " ] = {\n " ;
613
- for (int r = 0 , rs = LogicalOpTypeList.size (); r < rs; ++r) {
614
- const auto &Row = *LogicalOpTypeList[r];
615
- OS << " {" ;
616
- int i, s = Row.size ();
617
- for (i = 0 ; i < s; ++i) {
618
- if (i > 0 )
619
- OS << " , " ;
620
- OS << Row[i];
621
- }
622
- for (; i < static_cast <int >(OpTypeListSize); ++i) {
623
- if (i > 0 )
624
- OS << " , " ;
625
- OS << " -1" ;
626
- }
627
- OS << " }" ;
628
- if (r != rs - 1 )
629
- OS << " ," ;
630
- OS << " \n " ;
631
- }
632
- OS << " };\n " ;
633
-
634
- OS << " switch (Opcode) {\n " ;
635
- OS << " default: return -1;\n " ;
636
- for (auto &P : InstMap) {
637
- auto OpMapIdx = P.first ;
638
- const auto &Insts = P.second ;
639
- for (const auto &Inst : Insts) {
640
- OS << " case " << Inst << " :\n " ;
641
- }
642
- OS << " return TypeMap[" << OpMapIdx << " ][LogicalOpIdx];\n " ;
643
- }
644
- OS << " }\n " ;
645
- } else {
646
- OS << " return -1;\n " ;
647
- }
648
- OS << " }\n " ;
649
- OS << " } // end namespace llvm::" << Namespace << " \n " ;
650
- OS << " #endif // GET_INSTRINFO_LOGICAL_OPERAND_TYPE_MAP\n\n " ;
651
- }
652
-
653
563
void InstrInfoEmitter::emitMCIIHelperMethods (raw_ostream &OS,
654
564
StringRef TargetName) {
655
565
ArrayRef<const Record *> TIIPredicates =
@@ -1155,9 +1065,6 @@ void InstrInfoEmitter::run(raw_ostream &OS) {
1155
1065
emitLogicalOperandSizeMappings (OS, TargetName, NumberedInstructions);
1156
1066
}
1157
1067
1158
- Timer.startTimer (" Emit logical operand type mappings" );
1159
- emitLogicalOperandTypeMappings (OS, TargetName, NumberedInstructions);
1160
-
1161
1068
Timer.startTimer (" Emit helper methods" );
1162
1069
emitMCIIHelperMethods (OS, TargetName);
1163
1070
0 commit comments