@@ -1082,18 +1082,6 @@ static std::string getDecoderString(const InstructionEncoding &Encoding) {
10821082 return Decoder;
10831083}
10841084
1085- static unsigned getDecoderIndex (const InstructionEncoding &Encoding,
1086- DecoderTableInfo &TableInfo) {
1087- // Using the full decoder string as the key value here is a bit
1088- // heavyweight, but is effective. If the string comparisons become a
1089- // performance concern, we can implement a mangling of the predicate
1090- // data easily enough with a map back to the actual string. That's
1091- // overkill for now, though.
1092- std::string Decoder = getDecoderString (Encoding);
1093- TableInfo.insertDecoder (Decoder);
1094- return TableInfo.getDecoderIndex (Decoder);
1095- }
1096-
10971085static std::string getPredicateString (const InstructionEncoding &Encoding,
10981086 StringRef TargetName) {
10991087 std::vector<const Record *> Predicates =
@@ -1110,29 +1098,22 @@ static std::string getPredicateString(const InstructionEncoding &Encoding,
11101098 return Predicate;
11111099}
11121100
1113- static unsigned getPredicateIndex (StringRef Predicate,
1114- DecoderTableInfo &TableInfo) {
1115- // Using the full predicate string as the key value here is a bit
1116- // heavyweight, but is effective. If the string comparisons become a
1117- // performance concern, we can implement a mangling of the predicate
1118- // data easily enough with a map back to the actual string. That's
1119- // overkill for now, though.
1120- TableInfo.insertPredicate (Predicate);
1121- return TableInfo.getPredicateIndex (Predicate);
1122- }
1123-
11241101void DecoderTableBuilder::emitPredicateTableEntry (unsigned EncodingID) const {
11251102 const InstructionEncoding &Encoding = Encodings[EncodingID];
11261103 std::string Predicate = getPredicateString (Encoding, Target.getName ());
11271104 if (Predicate.empty ())
11281105 return ;
11291106
1130- // Figure out the index into the predicate table for the predicate just
1131- // computed.
1132- unsigned PIdx = getPredicateIndex (Predicate, TableInfo);
1107+ // Using the full predicate string as the key value here is a bit
1108+ // heavyweight, but is effective. If the string comparisons become a
1109+ // performance concern, we can implement a mangling of the predicate
1110+ // data easily enough with a map back to the actual string. That's
1111+ // overkill for now, though.
1112+ TableInfo.insertPredicate (Predicate);
1113+ unsigned PredicateIndex = TableInfo.getPredicateIndex (Predicate);
11331114
11341115 TableInfo.Table .insertOpcode (OPC_CheckPredicate);
1135- TableInfo.Table .insertULEB128 (PIdx );
1116+ TableInfo.Table .insertULEB128 (PredicateIndex );
11361117}
11371118
11381119void DecoderTableBuilder::emitSoftFailTableEntry (unsigned EncodingID) const {
@@ -1175,7 +1156,14 @@ void DecoderTableBuilder::emitSingletonTableEntry(
11751156 // Check for soft failure of the match.
11761157 emitSoftFailTableEntry (EncodingID);
11771158
1178- unsigned DIdx = getDecoderIndex (Encoding, TableInfo);
1159+ // Using the full decoder string as the key value here is a bit
1160+ // heavyweight, but is effective. If the string comparisons become a
1161+ // performance concern, we can implement a mangling of the predicate
1162+ // data easily enough with a map back to the actual string. That's
1163+ // overkill for now, though.
1164+ std::string Decoder = getDecoderString (Encoding);
1165+ TableInfo.insertDecoder (Decoder);
1166+ unsigned DecoderIndex = TableInfo.getDecoderIndex (Decoder);
11791167
11801168 // Produce OPC_Decode or OPC_TryDecode opcode based on the information
11811169 // whether the instruction decoder is complete or not. If it is complete
@@ -1191,7 +1179,7 @@ void DecoderTableBuilder::emitSingletonTableEntry(
11911179 TableInfo.Table .insertOpcode (DecoderOp);
11921180 const Record *InstDef = Encodings[EncodingID].getInstruction ()->TheDef ;
11931181 TableInfo.Table .insertULEB128 (Target.getInstrIntValue (InstDef));
1194- TableInfo.Table .insertULEB128 (DIdx );
1182+ TableInfo.Table .insertULEB128 (DecoderIndex );
11951183}
11961184
11971185std::unique_ptr<Filter>
0 commit comments