Lines Matching refs:Field
41 int64_t getInt(Record *R, StringRef Field) { in getInt() argument
42 return getAsInt(R->getValueInit(Field)); in getInt()
86 for (const auto &Field : Fields) { in getFieldByName() local
87 if (Name == Field.Name) in getFieldByName()
88 return &Field; in getFieldByName()
116 std::string primaryRepresentation(SMLoc Loc, const GenericField &Field, in primaryRepresentation() argument
119 if (Field.IsCode || SI->hasCodeFormat()) in primaryRepresentation()
127 else if (Field.IsIntrinsic) in primaryRepresentation()
129 else if (Field.IsInstruction) in primaryRepresentation()
131 else if (Field.Enum) { in primaryRepresentation()
132 auto *Entry = Field.Enum->EntryMap[cast<DefInit>(I)->getDef()]; in primaryRepresentation()
135 Twine("Entry for field '") + Field.Name + "' is null"); in primaryRepresentation()
138 PrintFatalError(Loc, Twine("invalid field type for field '") + Field.Name + in primaryRepresentation()
160 const GenericField &Field, TypeContext Ctx) { in searchableFieldType() argument
161 if (isa<StringRecTy>(Field.RecType)) { in searchableFieldType()
167 } else if (BitsRecTy *BI = dyn_cast<BitsRecTy>(Field.RecType)) { in searchableFieldType()
179 "', key field '" + Field.Name + in searchableFieldType()
181 } else if (isa<BitRecTy>(Field.RecType)) { in searchableFieldType()
183 } else if (Field.Enum || Field.IsIntrinsic || Field.IsInstruction) in searchableFieldType()
187 Index.Name + "', key field '" + Field.Name + in searchableFieldType()
188 "' has invalid type: " + Field.RecType->getAsString()); in searchableFieldType()
199 bool parseFieldType(GenericField &Field, Init *II);
238 for (const auto &Field : Index.Fields) { in compareBy() local
239 Init *LHSI = LHS->getValueInit(Field.Name); in compareBy()
240 Init *RHSI = RHS->getValueInit(Field.Name); in compareBy()
242 if (isa<BitsRecTy>(Field.RecType) || isa<IntRecTy>(Field.RecType)) { in compareBy()
249 } else if (Field.IsIntrinsic) { in compareBy()
258 } else if (Field.IsInstruction) { in compareBy()
275 } else if (Field.Enum) { in compareBy()
278 int64_t LHSv = Field.Enum->EntryMap[LHSr]->second; in compareBy()
279 int64_t RHSv = Field.Enum->EntryMap[RHSr]->second; in compareBy()
285 std::string LHSs = primaryRepresentation(Index.Loc, Field, LHSI); in compareBy()
286 std::string RHSs = primaryRepresentation(Index.Loc, Field, RHSI); in compareBy()
288 if (isa<StringRecTy>(Field.RecType)) { in compareBy()
340 for (const auto &Field : Index.Fields) { in emitLookupFunction() local
342 << searchableFieldType(Table, Index, Field, TypeInStaticStruct) << " " in emitLookupFunction()
343 << Field.Name << ";\n"; in emitLookupFunction()
366 for (const auto &Field : Index.Fields) { in emitLookupFunction() local
368 Index.Loc, Field, Entry.first->getValueInit(Field.Name)); in emitLookupFunction()
369 if (isa<StringRecTy>(Field.RecType)) in emitLookupFunction()
399 const GenericField &Field = Index.Fields[0]; in emitLookupFunction() local
401 Index.Loc, Field, IndexRows[0]->getValueInit(Field.Name)); in emitLookupFunction()
403 Index.Loc, Field, IndexRows.back()->getValueInit(Field.Name)); in emitLookupFunction()
404 OS << " if ((" << Field.Name << " < " << FirstRepr << ") ||\n"; in emitLookupFunction()
405 OS << " (" << Field.Name << " > " << LastRepr << "))\n"; in emitLookupFunction()
421 const GenericField &Field = Index.Fields[0]; in emitLookupFunction() local
423 Index.Loc, Field, IndexRows[0]->getValueInit(Field.Name)); in emitLookupFunction()
425 Index.Loc, Field, IndexRows.back()->getValueInit(Field.Name)); in emitLookupFunction()
426 OS << " if ((" << Field.Name << " < " << FirstRepr << ") ||\n"; in emitLookupFunction()
427 OS << " (" << Field.Name << " > " << LastRepr << "))\n"; in emitLookupFunction()
432 for (const auto &Field : Index.Fields) { in emitLookupFunction() local
433 OS << " " << searchableFieldType(Table, Index, Field, TypeInTempStruct) in emitLookupFunction()
434 << " " << Field.Name << ";\n"; in emitLookupFunction()
439 for (const auto &Field : Index.Fields) { in emitLookupFunction() local
440 OS << LS << Field.Name; in emitLookupFunction()
441 if (isa<StringRecTy>(Field.RecType)) { in emitLookupFunction()
448 Field.Name + "'"); in emitLookupFunction()
458 for (const auto &Field : Index.Fields) { in emitLookupFunction() local
459 if (isa<StringRecTy>(Field.RecType)) { in emitLookupFunction()
460 OS << " int Cmp" << Field.Name << " = StringRef(LHS." << Field.Name in emitLookupFunction()
461 << ").compare(RHS." << Field.Name << ");\n"; in emitLookupFunction()
462 OS << " if (Cmp" << Field.Name << " < 0) return true;\n"; in emitLookupFunction()
463 OS << " if (Cmp" << Field.Name << " > 0) return false;\n"; in emitLookupFunction()
464 } else if (Field.Enum) { in emitLookupFunction()
467 OS << " if ((unsigned)LHS." << Field.Name << " < (unsigned)RHS." in emitLookupFunction()
468 << Field.Name << ")\n"; in emitLookupFunction()
470 OS << " if ((unsigned)LHS." << Field.Name << " > (unsigned)RHS." in emitLookupFunction()
471 << Field.Name << ")\n"; in emitLookupFunction()
474 OS << " if (LHS." << Field.Name << " < RHS." << Field.Name in emitLookupFunction()
477 OS << " if (LHS." << Field.Name << " > RHS." << Field.Name in emitLookupFunction()
503 for (const auto &Field : Index.Fields) in emitLookupFunction() local
504 OS << " ||\n Key." << Field.Name << " != Idx->" << Field.Name; in emitLookupFunction()
529 for (const auto &Field : Index.Fields) in emitLookupDeclaration() local
530 OS << LS << searchableFieldType(Table, Index, Field, TypeInArgument) << " " in emitLookupDeclaration()
531 << Field.Name; in emitLookupDeclaration()
560 for (const auto &Field : Table.Fields) in emitGenericTable() local
562 << primaryRepresentation(Table.Locs[0], Field, in emitGenericTable()
563 Entry->getValueInit(Field.Name)); in emitGenericTable()
579 bool SearchableTableEmitter::parseFieldType(GenericField &Field, Init *TypeOf) { in parseFieldType() argument
582 Field.IsCode = true; in parseFieldType()
587 Field.Enum = EnumMap[TypeRec]; in parseFieldType()
588 Field.RecType = RecordRecTy::get(Field.Enum->Class); in parseFieldType()
608 const GenericField *Field = Table.getFieldByName(FieldName); in parseSearchIndex() local
609 if (!Field) in parseSearchIndex()
616 Index->Fields.push_back(*Field); in parseSearchIndex()
665 for (auto &Field : Table.Fields) { in collectTableEntries() local
666 auto TI = dyn_cast<TypedInit>(EntryRec->getValueInit(Field.Name)); in collectTableEntries()
670 "' is missing field '" + Field.Name + in collectTableEntries()
673 if (!Field.RecType) { in collectTableEntries()
674 Field.RecType = TI->getType(); in collectTableEntries()
676 RecTy *Ty = resolveTypes(Field.RecType, TI->getType()); in collectTableEntries()
678 PrintFatalError(EntryRec->getValue(Field.Name), in collectTableEntries()
679 Twine("Field '") + Field.Name + "' of table '" + in collectTableEntries()
682 Field.RecType->getAsString()); in collectTableEntries()
683 Field.RecType = Ty; in collectTableEntries()
692 for (auto &Field : Table.Fields) { in collectTableEntries() local
693 if (!Field.RecType) in collectTableEntries()
694 PrintFatalError(Twine("Cannot determine type of field '") + Field.Name + in collectTableEntries()
697 if (auto RecordTy = dyn_cast<RecordRecTy>(Field.RecType)) { in collectTableEntries()
699 Field.IsIntrinsic = true; in collectTableEntries()
701 Field.IsInstruction = true; in collectTableEntries()
861 for (const RecordVal &Field : Class->getValues()) { in run() local
862 std::string FieldName = std::string(Field.getName()); in run()
876 for (const auto &Field : in run() local
879 (Twine("lookup") + Table->CppTypeName + "By" + Field).str(); in run()
881 parseSearchIndex(*Table, Class->getValue(Field), Name, {Field}, in run()