File tree Expand file tree Collapse file tree 5 files changed +158
-343
lines changed
Expand file tree Collapse file tree 5 files changed +158
-343
lines changed Original file line number Diff line number Diff line change @@ -64,6 +64,18 @@ std::vector<const Microarchitecture*> compatible_microarchitectures(const Detect
6464std::vector<const Microarchitecture*> compatible_microarchitectures (const DetectedCpuInfo& info,
6565 const std::string& arch);
6666
67+ /* *
68+ * Compare microarchitectures for sorting: prefers more ancestors and more features
69+ * Returns true if a < b (a is less specific than b)
70+ */
71+ inline bool compare_microarch_specificity (const Microarchitecture* a, const Microarchitecture* b) {
72+ size_t a_depth = a->ancestors ().size ();
73+ size_t b_depth = b->ancestors ().size ();
74+ if (a_depth != b_depth)
75+ return a_depth < b_depth;
76+ return a->features ().size () < b->features ().size ();
77+ }
78+
6779// Platform-specific detection functions
6880
6981#if defined(__linux__) || defined(__FreeBSD__)
Original file line number Diff line number Diff line change @@ -162,15 +162,17 @@ class MicroarchitectureDatabase {
162162 MicroarchitectureDatabase& operator =(const MicroarchitectureDatabase&) = delete ;
163163
164164 void load_embedded_data ();
165- void fill_target (const std::string& name, const void * json_data);
166- bool load_from_json_internal (const void * json_ptr);
167165
168166 std::map<std::string, Microarchitecture> targets_;
169167 std::map<std::string, std::set<std::string>> feature_aliases_;
170168 std::map<std::string, std::set<std::string>> family_features_;
171169 std::map<std::string, std::string> darwin_flags_;
172170 std::map<std::string, std::string> arm_vendors_;
173171 bool loaded_ = false ;
172+
173+ // Allow JSON parsing helper access to private members
174+ friend bool load_json_into_database (MicroarchitectureDatabase& db,
175+ const std::string& json_data);
174176};
175177
176178// Convenience function to get a microarchitecture by name
You can’t perform that action at this time.
0 commit comments