1 #ifndef ARCHITECTURE_H_
2 #define ARCHITECTURE_H_
5 #include <msp/datafile/loader.h>
12 Stores information about an architecture. This includes CPU type, model and
13 bitness and operating system.
18 class Loader: public Msp::DataFile::ObjectLoader<Architecture>
21 Loader(Architecture &);
24 void cross_prefix(const std::string &);
34 std::string toolchain;
37 std::string cross_prefix;
38 std::map<std::string, std::vector<Pattern>> filename_patterns;
41 Architecture(Builder &b, const std::string &spec);
43 void refine(const std::string &);
48 const std::string &get_type() const { return type; }
49 const std::string &get_name() const { return name; }
50 const std::string &get_system() const { return system; }
51 unsigned get_bits() const { return bits; }
52 const std::string &get_cpu() const { return cpu; }
53 const std::string &get_fpu() const { return fpu; }
54 const std::string &get_toolchain() const { return toolchain; }
55 bool match_name(const std::string &, unsigned * = 0) const;
56 std::string best_match(const std::vector<std::string> &) const;
57 bool is_native() const { return native; }
58 bool is_cross() const { return !cross_prefix.empty(); }
60 const std::string &get_cross_prefix() const { return cross_prefix; }
63 const std::vector<Pattern> &get_patterns() const;
66 std::string create_filename(const std::string &) const;
70 void add_pattern(const std::string &);
73 static void resolve_aliases(std::vector<std::string> &);
74 void parse_specification(const std::string &);
78 inline const std::vector<Pattern> &Architecture::get_patterns() const
80 auto i = filename_patterns.find(typeid(T).name());
81 if(i!=filename_patterns.end())
84 static std::vector<Pattern> empty;
89 inline std::string Architecture::create_filename(const std::string &base) const
91 const std::vector<Pattern> &patterns = get_patterns<T>();
92 return patterns.empty() ? base : patterns.front().apply(base);