@@ -1082,18 +1082,6 @@ static std::string getDecoderString(const InstructionEncoding &Encoding) {
1082
1082
return Decoder;
1083
1083
}
1084
1084
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
-
1097
1085
static std::string getPredicateString (const InstructionEncoding &Encoding,
1098
1086
StringRef TargetName) {
1099
1087
std::vector<const Record *> Predicates =
@@ -1110,29 +1098,22 @@ static std::string getPredicateString(const InstructionEncoding &Encoding,
1110
1098
return Predicate;
1111
1099
}
1112
1100
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
-
1124
1101
void DecoderTableBuilder::emitPredicateTableEntry (unsigned EncodingID) const {
1125
1102
const InstructionEncoding &Encoding = Encodings[EncodingID];
1126
1103
std::string Predicate = getPredicateString (Encoding, Target.getName ());
1127
1104
if (Predicate.empty ())
1128
1105
return ;
1129
1106
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);
1133
1114
1134
1115
TableInfo.Table .insertOpcode (OPC_CheckPredicate);
1135
- TableInfo.Table .insertULEB128 (PIdx );
1116
+ TableInfo.Table .insertULEB128 (PredicateIndex );
1136
1117
}
1137
1118
1138
1119
void DecoderTableBuilder::emitSoftFailTableEntry (unsigned EncodingID) const {
@@ -1175,7 +1156,14 @@ void DecoderTableBuilder::emitSingletonTableEntry(
1175
1156
// Check for soft failure of the match.
1176
1157
emitSoftFailTableEntry (EncodingID);
1177
1158
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);
1179
1167
1180
1168
// Produce OPC_Decode or OPC_TryDecode opcode based on the information
1181
1169
// whether the instruction decoder is complete or not. If it is complete
@@ -1191,7 +1179,7 @@ void DecoderTableBuilder::emitSingletonTableEntry(
1191
1179
TableInfo.Table .insertOpcode (DecoderOp);
1192
1180
const Record *InstDef = Encodings[EncodingID].getInstruction ()->TheDef ;
1193
1181
TableInfo.Table .insertULEB128 (Target.getInstrIntValue (InstDef));
1194
- TableInfo.Table .insertULEB128 (DIdx );
1182
+ TableInfo.Table .insertULEB128 (DecoderIndex );
1195
1183
}
1196
1184
1197
1185
std::unique_ptr<Filter>
0 commit comments