@@ -227,26 +227,12 @@ MatchTableRecord MatchTable::NamedValue(unsigned NumBytes,
227227 MatchTableRecord::MTRF_CommaFollows);
228228}
229229
230- MatchTableRecord MatchTable::NamedValue (unsigned NumBytes, StringRef NamedValue,
231- int64_t RawValue) {
232- return MatchTableRecord (std::nullopt , NamedValue, NumBytes,
233- MatchTableRecord::MTRF_CommaFollows, RawValue);
234- }
235-
236230MatchTableRecord MatchTable::NamedValue (unsigned NumBytes, StringRef Namespace,
237231 StringRef NamedValue) {
238232 return MatchTableRecord (std::nullopt , (Namespace + " ::" + NamedValue).str (),
239233 NumBytes, MatchTableRecord::MTRF_CommaFollows);
240234}
241235
242- MatchTableRecord MatchTable::NamedValue (unsigned NumBytes, StringRef Namespace,
243- StringRef NamedValue,
244- int64_t RawValue) {
245- return MatchTableRecord (std::nullopt , (Namespace + " ::" + NamedValue).str (),
246- NumBytes, MatchTableRecord::MTRF_CommaFollows,
247- RawValue);
248- }
249-
250236MatchTableRecord MatchTable::IntValue (unsigned NumBytes, int64_t IntValue) {
251237 assert (isUIntN (NumBytes * 8 , IntValue) || isIntN (NumBytes * 8 , IntValue));
252238 auto Str = llvm::to_string (IntValue);
@@ -651,8 +637,8 @@ void SwitchMatcher::emit(MatchTable &Table) {
651637 [&Table]() { return Table.allocateLabelID (); });
652638 const unsigned Default = Table.allocateLabelID ();
653639
654- const int64_t LowerBound = Values.begin ()->getRawValue () ;
655- const int64_t UpperBound = Values.rbegin ()->getRawValue () + 1 ;
640+ const int64_t LowerBound = Values.begin ()->RawValue ;
641+ const int64_t UpperBound = Values.rbegin ()->RawValue + 1 ;
656642
657643 emitPredicateSpecificOpcodes (*Condition, Table);
658644
@@ -664,10 +650,11 @@ void SwitchMatcher::emit(MatchTable &Table) {
664650 auto VI = Values.begin ();
665651 for (unsigned I = 0 , E = Values.size (); I < E; ++I) {
666652 auto V = *VI++;
667- while (J++ < V.getRawValue () )
653+ while (J++ < V.RawValue )
668654 Table << MatchTable::IntValue (4 , 0 );
669- V.turnIntoComment ();
670- Table << MatchTable::LineBreak << V << MatchTable::JumpTarget (LabelIDs[I]);
655+ V.Record .turnIntoComment ();
656+ Table << MatchTable::LineBreak << V.Record
657+ << MatchTable::JumpTarget (LabelIDs[I]);
671658 }
672659 Table << MatchTable::LineBreak;
673660
@@ -1145,11 +1132,11 @@ void SameOperandMatcher::emitPredicateOpcodes(MatchTable &Table,
11451132
11461133std::map<LLTCodeGen, unsigned > LLTOperandMatcher::TypeIDValues;
11471134
1148- MatchTableRecord LLTOperandMatcher::getValue () const {
1135+ RecordAndValue LLTOperandMatcher::getValue () const {
11491136 const auto VI = TypeIDValues.find (Ty);
11501137 if (VI == TypeIDValues.end ())
11511138 return MatchTable::NamedValue (1 , getTy ().getCxxEnumValue ());
1152- return MatchTable::NamedValue (1 , getTy ().getCxxEnumValue (), VI->second ) ;
1139+ return { MatchTable::NamedValue (1 , getTy ().getCxxEnumValue ()) , VI->second } ;
11531140}
11541141
11551142bool LLTOperandMatcher::hasValue () const {
@@ -1167,7 +1154,8 @@ void LLTOperandMatcher::emitPredicateOpcodes(MatchTable &Table,
11671154 << MatchTable::ULEB128Value (InsnVarID);
11681155 }
11691156 Table << MatchTable::Comment (" Op" ) << MatchTable::ULEB128Value (OpIdx)
1170- << MatchTable::Comment (" Type" ) << getValue () << MatchTable::LineBreak;
1157+ << MatchTable::Comment (" Type" ) << getValue ().Record
1158+ << MatchTable::LineBreak;
11711159}
11721160
11731161// ===- PointerToAnyOperandMatcher -----------------------------------------===//
@@ -1411,12 +1399,12 @@ Error OperandMatcher::addTypeCheckPredicate(const TypeSetByHwMode &VTy,
14111399DenseMap<const CodeGenInstruction *, unsigned >
14121400 InstructionOpcodeMatcher::OpcodeValues;
14131401
1414- MatchTableRecord
1402+ RecordAndValue
14151403InstructionOpcodeMatcher::getInstValue (const CodeGenInstruction *I) const {
14161404 const auto VI = OpcodeValues.find (I);
14171405 if (VI != OpcodeValues.end ())
1418- return MatchTable::NamedValue (2 , I->Namespace , I->TheDef ->getName (),
1419- VI->second ) ;
1406+ return { MatchTable::NamedValue (2 , I->Namespace , I->TheDef ->getName () ),
1407+ VI->second } ;
14201408 return MatchTable::NamedValue (2 , I->Namespace , I->TheDef ->getName ());
14211409}
14221410
@@ -1428,14 +1416,14 @@ void InstructionOpcodeMatcher::initOpcodeValuesMap(
14281416 OpcodeValues[I] = Target.getInstrIntValue (I->TheDef );
14291417}
14301418
1431- MatchTableRecord InstructionOpcodeMatcher::getValue () const {
1419+ RecordAndValue InstructionOpcodeMatcher::getValue () const {
14321420 assert (Insts.size () == 1 );
14331421
14341422 const CodeGenInstruction *I = Insts[0 ];
14351423 const auto VI = OpcodeValues.find (I);
14361424 if (VI != OpcodeValues.end ())
1437- return MatchTable::NamedValue (2 , I->Namespace , I->TheDef ->getName (),
1438- VI->second ) ;
1425+ return { MatchTable::NamedValue (2 , I->Namespace , I->TheDef ->getName () ),
1426+ VI->second } ;
14391427 return MatchTable::NamedValue (2 , I->Namespace , I->TheDef ->getName ());
14401428}
14411429
@@ -1447,7 +1435,7 @@ void InstructionOpcodeMatcher::emitPredicateOpcodes(MatchTable &Table,
14471435 << MatchTable::ULEB128Value (InsnVarID);
14481436
14491437 for (const CodeGenInstruction *I : Insts)
1450- Table << getInstValue (I);
1438+ Table << getInstValue (I). Record ;
14511439 Table << MatchTable::LineBreak;
14521440}
14531441
0 commit comments