+2016-10-14 Kyrylo Tkachov <kyrylo.tkachov@arm.com>
+
+ * config/aarch64/aarch64.c (aarch64_print_hint_for_core_or_arch):
+ New function.
+ (aarch64_print_hint_for_core): Likewise.
+ (aarch64_print_hint_for_arch): Likewise.
+ (aarch64_validate_march): Use it. Fix indentation in type signature.
+ (aarch64_validate_mcpu): Use aarch64_print_hint_for_core_or_arch.
+ (aarch64_validate_mtune): Likewise.
+ (aarch64_handle_attr_arch): Likewise.
+ (aarch64_handle_attr_cpu): Likewise.
+ (aarch64_handle_attr_tune): Likewise.
+
2016-10-14 Prathamesh Kulkarni <prathamesh.kulkarni@linaro.org>
* optabs.def: Remove optab function gen_int_libfunc for sdivmod_optab
aarch64_override_options_after_change_1 (opts);
}
+/* Print a hint with a suggestion for a core or architecture name that
+ most closely resembles what the user passed in STR. ARCH is true if
+ the user is asking for an architecture name. ARCH is false if the user
+ is asking for a core name. */
+
+static void
+aarch64_print_hint_for_core_or_arch (const char *str, bool arch)
+{
+ auto_vec<const char *> candidates;
+ const struct processor *entry = arch ? all_architectures : all_cores;
+ for (; entry->name != NULL; entry++)
+ candidates.safe_push (entry->name);
+ char *s;
+ const char *hint = candidates_list_and_hint (str, s, candidates);
+ if (hint)
+ inform (input_location, "valid arguments are: %s;"
+ " did you mean %qs?", s, hint);
+ XDELETEVEC (s);
+}
+
+/* Print a hint with a suggestion for a core name that most closely resembles
+ what the user passed in STR. */
+
+inline static void
+aarch64_print_hint_for_core (const char *str)
+{
+ aarch64_print_hint_for_core_or_arch (str, false);
+}
+
+/* Print a hint with a suggestion for an architecture name that most closely
+ resembles what the user passed in STR. */
+
+inline static void
+aarch64_print_hint_for_arch (const char *str)
+{
+ aarch64_print_hint_for_core_or_arch (str, true);
+}
+
/* Validate a command-line -mcpu option. Parse the cpu and extensions (if any)
specified in STR and throw errors if appropriate. Put the results if
they are valid in RES and ISA_FLAGS. Return whether the option is
break;
case AARCH64_PARSE_INVALID_ARG:
error ("unknown value %qs for -mcpu", str);
+ aarch64_print_hint_for_core (str);
break;
case AARCH64_PARSE_INVALID_FEATURE:
error ("invalid feature modifier in -mcpu=%qs", str);
static bool
aarch64_validate_march (const char *str, const struct processor **res,
- unsigned long *isa_flags)
+ unsigned long *isa_flags)
{
enum aarch64_parse_opt_result parse_res
= aarch64_parse_arch (str, res, isa_flags);
break;
case AARCH64_PARSE_INVALID_ARG:
error ("unknown value %qs for -march", str);
+ aarch64_print_hint_for_arch (str);
break;
case AARCH64_PARSE_INVALID_FEATURE:
error ("invalid feature modifier in -march=%qs", str);
break;
case AARCH64_PARSE_INVALID_ARG:
error ("unknown value %qs for -mtune", str);
+ aarch64_print_hint_for_core (str);
break;
default:
gcc_unreachable ();
break;
case AARCH64_PARSE_INVALID_ARG:
error ("unknown value %qs for 'arch' target %s", str, pragma_or_attr);
+ aarch64_print_hint_for_arch (str);
break;
case AARCH64_PARSE_INVALID_FEATURE:
error ("invalid feature modifier %qs for 'arch' target %s",
break;
case AARCH64_PARSE_INVALID_ARG:
error ("unknown value %qs for 'cpu' target %s", str, pragma_or_attr);
+ aarch64_print_hint_for_core (str);
break;
case AARCH64_PARSE_INVALID_FEATURE:
error ("invalid feature modifier %qs for 'cpu' target %s",
{
case AARCH64_PARSE_INVALID_ARG:
error ("unknown value %qs for 'tune' target %s", str, pragma_or_attr);
+ aarch64_print_hint_for_core (str);
break;
default:
gcc_unreachable ();