diff options
| author | Jeroen van Rijn <Kelimion@users.noreply.github.com> | 2023-11-10 19:37:08 +0100 |
|---|---|---|
| committer | Jeroen van Rijn <Kelimion@users.noreply.github.com> | 2023-11-10 19:37:08 +0100 |
| commit | e19460cbd7c847bd5452b2c7bf96b38d06b2a182 (patch) | |
| tree | 33163490d2d1468aa452b71134af22eb12d2a3e0 /src/main.cpp | |
| parent | 70c1f9d0e19a4b97c03308de8f2b9c0c28ba4cf1 (diff) | |
Add -microarch:?
Diffstat (limited to 'src/main.cpp')
| -rw-r--r-- | src/main.cpp | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/src/main.cpp b/src/main.cpp index 79c2b3561..8a917090b 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -2518,6 +2518,45 @@ int main(int arg_count, char const **arg_ptr) { // return 1; // } + // Check chosen microarchitecture. If not found or ?, print list. + bool print_microarch_list = true; + if (build_context.microarch.len == 0) { + // Autodetect, no need to print list. + print_microarch_list = false; + } else { + String march_list = target_microarch_list[build_context.metrics.arch]; + String_Iterator it = {march_list, 0}; + for (;;) { + String str = string_split_iterator(&it, ','); + if (str == "") break; + // If it's the entry in the list marked (default), we strip off the suffix before the match. + if (string_ends_with(str, str_lit(" (default)"))) { + str = substring(str, 0, str.len - 10); + } + if (str == build_context.microarch) { + // Found matching microarch + print_microarch_list = false; + } + } + } + + if (print_microarch_list) { + if (build_context.microarch != "?") { + gb_printf("Unknown microarchitecture '%.*s'.\n", LIT(build_context.microarch)); + } + gb_printf("Possible -microarch values for target %.*s are:\n", LIT(target_arch_names[build_context.metrics.arch])); + gb_printf("\n"); + + String march_list = target_microarch_list[build_context.metrics.arch]; + String_Iterator it = {march_list, 0}; + for (;;) { + String str = string_split_iterator(&it, ','); + if (str == "") break; + gb_printf("\t%.*s\n", LIT(str)); + } + return 0; + } + // Set and check build paths... if (!init_build_paths(init_filename)) { return 1; |