Lines Matching refs:Index

156   bool compareBy(Record *LHS, Record *RHS, const SearchIndex &Index);
159 const SearchIndex &Index, in searchableFieldType() argument
177 PrintFatalError(Index.Loc, Twine("In table '") + Table.Name + in searchableFieldType()
178 "' lookup method '" + Index.Name + in searchableFieldType()
185 PrintFatalError(Index.Loc, in searchableFieldType()
187 Index.Name + "', key field '" + Field.Name + in searchableFieldType()
194 const SearchIndex &Index, raw_ostream &OS);
195 void emitLookupFunction(const GenericTable &Table, const SearchIndex &Index,
209 int64_t getNumericKey(const SearchIndex &Index, Record *Rec);
216 int64_t SearchableTableEmitter::getNumericKey(const SearchIndex &Index, in getNumericKey() argument
218 assert(Index.Fields.size() == 1); in getNumericKey()
222 if (Index.Fields[0].IsInstruction) { in getNumericKey()
223 Record *TheDef = Rec->getValueAsDef(Index.Fields[0].Name); in getNumericKey()
226 if (Index.Fields[0].Enum) { in getNumericKey()
227 Record *EnumEntry = Rec->getValueAsDef(Index.Fields[0].Name); in getNumericKey()
228 return Index.Fields[0].Enum->EntryMap[EnumEntry]->second; in getNumericKey()
231 return getInt(Rec, Index.Fields[0].Name); in getNumericKey()
237 const SearchIndex &Index) { in compareBy() argument
238 for (const auto &Field : Index.Fields) { in compareBy()
285 std::string LHSs = primaryRepresentation(Index.Loc, Field, LHSI); in compareBy()
286 std::string RHSs = primaryRepresentation(Index.Loc, Field, RHSI); in compareBy()
322 const SearchIndex &Index, in emitLookupFunction() argument
326 emitLookupDeclaration(Table, Index, OS); in emitLookupFunction()
340 for (const auto &Field : Index.Fields) { in emitLookupFunction()
342 << searchableFieldType(Table, Index, Field, TypeInStaticStruct) << " " in emitLookupFunction()
357 return compareBy(LHS.first, RHS.first, Index); in emitLookupFunction()
366 for (const auto &Field : Index.Fields) { in emitLookupFunction()
368 Index.Loc, Field, Entry.first->getValueInit(Field.Name)); in emitLookupFunction()
385 if (Index.Fields.size() == 1 && in emitLookupFunction()
386 (Index.Fields[0].Enum || isa<BitsRecTy>(Index.Fields[0].RecType) || in emitLookupFunction()
387 Index.Fields[0].IsInstruction)) { in emitLookupFunction()
388 int64_t FirstKeyVal = getNumericKey(Index, IndexRows[0]); in emitLookupFunction()
391 if (getNumericKey(Index, IndexRows[i]) != (FirstKeyVal + i)) { in emitLookupFunction()
399 const GenericField &Field = Index.Fields[0]; in emitLookupFunction()
401 Index.Loc, Field, IndexRows[0]->getValueInit(Field.Name)); in emitLookupFunction()
403 Index.Loc, Field, IndexRows.back()->getValueInit(Field.Name)); in emitLookupFunction()
408 OS << " size_t Idx = " << Index.Fields[0].Name << " - " << FirstRepr in emitLookupFunction()
420 if (Index.EarlyOut) { in emitLookupFunction()
421 const GenericField &Field = Index.Fields[0]; in emitLookupFunction()
423 Index.Loc, Field, IndexRows[0]->getValueInit(Field.Name)); in emitLookupFunction()
425 Index.Loc, Field, IndexRows.back()->getValueInit(Field.Name)); in emitLookupFunction()
432 for (const auto &Field : Index.Fields) { in emitLookupFunction()
433 OS << " " << searchableFieldType(Table, Index, Field, TypeInTempStruct) in emitLookupFunction()
439 for (const auto &Field : Index.Fields) { in emitLookupFunction()
444 PrintFatalError(Index.Loc, in emitLookupFunction()
458 for (const auto &Field : Index.Fields) { in emitLookupFunction()
486 bool ShouldReturnRange = Index.ReturnRange; in emitLookupFunction()
503 for (const auto &Field : Index.Fields) in emitLookupFunction()
521 const SearchIndex &Index, in emitLookupDeclaration() argument
523 if (Index.ReturnRange) in emitLookupDeclaration()
527 OS << Index.Name << "("; in emitLookupDeclaration()
529 for (const auto &Field : Index.Fields) in emitLookupDeclaration()
530 OS << LS << searchableFieldType(Table, Index, Field, TypeInArgument) << " " in emitLookupDeclaration()
544 for (const auto &Index : Table.Indices) { in emitGenericTable() local
545 emitLookupDeclaration(Table, *Index, OS); in emitGenericTable()
573 for (const auto &Index : Table.Indices) in emitGenericTable() local
574 emitLookupFunction(Table, *Index, /*IsPrimary=*/false, OS); in emitGenericTable()
601 auto Index = std::make_unique<SearchIndex>(); in parseSearchIndex() local
602 Index->Name = std::string(Name); in parseSearchIndex()
603 Index->Loc = KeyRecVal->getLoc(); in parseSearchIndex()
604 Index->EarlyOut = EarlyOut; in parseSearchIndex()
605 Index->ReturnRange = ReturnRange; in parseSearchIndex()
616 Index->Fields.push_back(*Field); in parseSearchIndex()
619 if (EarlyOut && isa<StringRecTy>(Index->Fields[0].RecType)) { in parseSearchIndex()
625 return Index; in parseSearchIndex()