reference, declaration → definition definition → references, declarations, derived classes, virtual overrides reference to multiple definitions → definitions unreferenced |
2840 OS << "namespace {\n"; 2841 OS << " struct OperandMatchEntry {\n"; 2842 OS << " " << getMinimalTypeForRange(MaxMnemonicIndex) 2844 OS << " " << getMinimalTypeForRange(MaxMask) 2846 OS << " " << getMinimalTypeForRange(std::distance( 2848 OS << " " << getMinimalTypeForRange(MaxFeaturesIndex) 2850 OS << " StringRef getMnemonic() const {\n"; 2851 OS << " return StringRef(MnemonicTable + Mnemonic + 1,\n"; 2852 OS << " MnemonicTable[Mnemonic]);\n"; 2853 OS << " }\n"; 2854 OS << " };\n\n"; 2856 OS << " // Predicate for searching for an opcode.\n"; 2857 OS << " struct LessOpcodeOperand {\n"; 2858 OS << " bool operator()(const OperandMatchEntry &LHS, StringRef RHS) {\n"; 2859 OS << " return LHS.getMnemonic() < RHS;\n"; 2860 OS << " }\n"; 2861 OS << " bool operator()(StringRef LHS, const OperandMatchEntry &RHS) {\n"; 2862 OS << " return LHS < RHS.getMnemonic();\n"; 2863 OS << " }\n"; 2864 OS << " bool operator()(const OperandMatchEntry &LHS,"; 2865 OS << " const OperandMatchEntry &RHS) {\n"; 2866 OS << " return LHS.getMnemonic() < RHS.getMnemonic();\n"; 2867 OS << " }\n"; 2868 OS << " };\n"; 2870 OS << "} // end anonymous namespace\n\n"; 2872 OS << "static const OperandMatchEntry OperandMatchTable[" 2875 OS << " /* Operand List Mnemonic, Mask, Operand Class, Features */\n"; 2879 OS << " { "; 2883 OS << StringTable.GetOrAddStringOffset(LenMnemonic, false) 2886 OS << OMI.OperandMask; 2887 OS << " /* "; 2892 OS << ", "; 2893 OS << i; 2896 OS << " */, "; 2898 OS << OMI.CI->Name; 2901 OS << ", AMFBS"; 2903 OS << "_None"; 2906 OS << '_' << II.RequiredFeatures[i]->TheDef->getName(); 2908 OS << " },\n"; 2910 OS << "};\n\n"; 2914 OS << "OperandMatchResultTy " << Target.getName() << ClassName << "::\n" 2922 OS << " case " << CI.Name << ":\n" 2926 OS << " default:\n"; 2927 OS << " return MatchOperand_NoMatch;\n"; 2928 OS << " }\n"; 2929 OS << " return MatchOperand_NoMatch;\n"; 2930 OS << "}\n\n"; 2935 OS << "OperandMatchResultTy " << Target.getName() << ClassName << "::\n" 2941 OS << " // Get the current feature set.\n"; 2942 OS << " const FeatureBitset &AvailableFeatures = getAvailableFeatures();\n\n"; 2944 OS << " // Get the next operand index.\n"; 2945 OS << " unsigned NextOpNum = Operands.size()" 2949 OS << " // Search the table.\n"; 2951 OS << " auto MnemonicRange =\n"; 2952 OS << " std::equal_range(std::begin(OperandMatchTable), " 2954 OS << " Mnemonic, LessOpcodeOperand());\n\n"; 2956 OS << " auto MnemonicRange = std::make_pair(std::begin(OperandMatchTable)," 2958 OS << " if (!Mnemonic.empty())\n"; 2959 OS << " MnemonicRange =\n"; 2960 OS << " std::equal_range(std::begin(OperandMatchTable), " 2962 OS << " Mnemonic, LessOpcodeOperand());\n\n"; 2965 OS << " if (MnemonicRange.first == MnemonicRange.second)\n"; 2966 OS << " return MatchOperand_NoMatch;\n\n"; 2968 OS << " for (const OperandMatchEntry *it = MnemonicRange.first,\n" 2971 OS << " // equal_range guarantees that instruction mnemonic matches.\n"; 2972 OS << " assert(Mnemonic == it->getMnemonic());\n\n"; 2975 OS << " // check if the available features match\n"; 2976 OS << " const FeatureBitset &RequiredFeatures = " 2978 OS << " if (!ParseForAllFeatures && (AvailableFeatures & " 2980 OS << " continue;\n\n"; 2983 OS << " // check if the operand in question has a custom parser.\n"; 2984 OS << " if (!(it->OperandMask & (1 << NextOpNum)))\n"; 2985 OS << " continue;\n\n"; 2988 OS << " // call custom parse method to handle the operand\n"; 2989 OS << " OperandMatchResultTy Result = "; 2990 OS << "tryCustomParseOperand(Operands, it->Class);\n"; 2991 OS << " if (Result != MatchOperand_NoMatch)\n"; 2992 OS << " return Result;\n"; 2993 OS << " }\n\n"; 2995 OS << " // Okay, we had no match.\n"; 2996 OS << " return MatchOperand_NoMatch;\n"; 2997 OS << "}\n\n";