2525using namespace llvm ;
2626
2727// / Collect the full set of implied features for a SubtargetFeature.
28- static void CollectImpliedFeatures (std::set<Record *> &SeenFeats, Record *Rec) {
28+ static void CollectImpliedFeatures (std::set<const Record *> &SeenFeats,
29+ const Record *Rec) {
2930 assert (Rec->isSubClassOf (" SubtargetFeature" ) &&
3031 " Rec is not a SubtargetFeature" );
3132
3233 SeenFeats.insert (Rec);
33- for (Record *Implied : Rec->getValueAsListOfDefs (" Implies" ))
34+ for (const Record *Implied : Rec->getValueAsListOfDefs (" Implies" ))
3435 CollectImpliedFeatures (SeenFeats, Implied);
3536}
3637
37- static void CheckFeatureTree (Record *Root) {
38- std::set<Record *> SeenFeats;
38+ static void CheckFeatureTree (const Record *Root) {
39+ std::set<const Record *> SeenFeats;
3940 CollectImpliedFeatures (SeenFeats, Root);
4041
4142 // Check that each of the mandatory (implied) features which is an
4243 // ExtensionWithMArch is also enabled by default.
4344 auto DefaultExtsVec = Root->getValueAsListOfDefs (" DefaultExts" );
44- std::set<Record *> DefaultExts{DefaultExtsVec.begin (), DefaultExtsVec.end ()};
45- for (auto *Feat : SeenFeats) {
45+ std::set<const Record *> DefaultExts{DefaultExtsVec.begin (),
46+ DefaultExtsVec.end ()};
47+ for (const Record *Feat : SeenFeats) {
4648 if (Feat->isSubClassOf (" ExtensionWithMArch" ) && !DefaultExts.count (Feat))
4749 PrintFatalError (Root->getLoc (),
4850 " ExtensionWithMArch " + Feat->getName () +
@@ -51,7 +53,7 @@ static void CheckFeatureTree(Record *Root) {
5153 }
5254}
5355
54- static void EmitARMTargetDef (RecordKeeper &RK, raw_ostream &OS) {
56+ static void EmitARMTargetDef (const RecordKeeper &RK, raw_ostream &OS) {
5557 OS << " // Autogenerated by ARMTargetDefEmitter.cpp\n\n " ;
5658
5759 // Look through all SubtargetFeature defs with the given FieldName, and
@@ -67,14 +69,14 @@ static void EmitARMTargetDef(RecordKeeper &RK, raw_ostream &OS) {
6769 };
6870
6971 // Sort the extensions alphabetically, so they don't appear in tablegen order.
70- std::vector<Record *> SortedExtensions =
72+ std::vector<const Record *> SortedExtensions =
7173 RK.getAllDerivedDefinitions (" Extension" );
72- auto Alphabetical = [](Record *A, Record *B) -> bool {
74+ auto Alphabetical = [](const Record *A, const Record *B) -> bool {
7375 const auto NameA = A->getValueAsString (" Name" );
7476 const auto NameB = B->getValueAsString (" Name" );
7577 return NameA.compare (NameB) < 0 ; // A lexographically less than B
7678 };
77- std:: sort (SortedExtensions. begin (), SortedExtensions. end () , Alphabetical);
79+ sort (SortedExtensions, Alphabetical);
7880
7981 // The ARMProcFamilyEnum values are initialised by SubtargetFeature defs
8082 // which set the ARMProcFamily field. We can generate the enum from these defs
@@ -287,15 +289,17 @@ static void EmitARMTargetDef(RecordKeeper &RK, raw_ostream &OS) {
287289 if (Name == " apple-latest" )
288290 continue ;
289291
290- Record *Arch;
292+ const Record *Arch;
291293 if (Name == " generic" ) {
292294 // "generic" is an exception. It does not have an architecture, and there
293295 // are tests that depend on e.g. -mattr=-v8.4a meaning HasV8_0aOps==false.
294296 // However, in TargetParser CPUInfo, it is written as 8.0-A.
295297 Arch = RK.getDef (" HasV8_0aOps" );
296298 } else {
297299 // Search for an Architecture64 in the list of features.
298- auto IsArch = [](Record *F) { return F->isSubClassOf (" Architecture64" ); };
300+ auto IsArch = [](const Record *F) {
301+ return F->isSubClassOf (" Architecture64" );
302+ };
299303 auto ArchIter = llvm::find_if (Features, IsArch);
300304 if (ArchIter == Features.end ())
301305 PrintFatalError (Rec, " Features must include an Architecture64." );
@@ -320,7 +324,7 @@ static void EmitARMTargetDef(RecordKeeper &RK, raw_ostream &OS) {
320324
321325 // Keep track of extensions we have seen
322326 StringSet<> SeenExts;
323- for (auto *E : Rec->getValueAsListOfDefs (" Features" ))
327+ for (const Record *E : Rec->getValueAsListOfDefs (" Features" ))
324328 // Only process subclasses of Extension
325329 if (E->isSubClassOf (" Extension" )) {
326330 const auto AEK = E->getValueAsString (" ArchExtKindSpelling" ).upper ();
0 commit comments