* target.h (struct gcc_target): Add target_help field.
* target-def.h (TARGET_HELP): New.
(TARGET_INITIALIZER): Use TARGET_HELP.
* opts.c (command_handle_option): Invoke target_help function, if defined, when the
user has specified --target-help on the command line.
* doc/invoke.texi: Mention that --target-help might print additional information.
* doc/tm.texi: Document TARGET_HELP hook.
* arm.c (TARGET_HELP): Override default definition.
(arm_target_help): New - display a wrapped list of cores and architectures supported.
From-SVN: r126323
+2007-07-04 Nick Clifton <nickc@redhat.com>
+
+ * target.h (struct gcc_target): Add target_help field.
+ * target-def.h (TARGET_HELP): New.
+ (TARGET_INITIALIZER): Use TARGET_HELP.
+ * opts.c (command_handle_option): Invoke target_help function, if
+ defined, when the user has specified --target-help on the command
+ line.
+ * doc/invoke.texi: Mention that --target-help might print
+ additional information.
+ * doc/tm.texi: Document TARGET_HELP hook.
+
+ * arm.c (TARGET_HELP): Override default definition.
+ (arm_target_help): New - display a wrapped list of cores and
+ architectures supported.
+
2007-07-04 Rask Ingemann Lambertsen <rask@sygehus.dk>
* config/gcc/v850/v850.c (expand_prologue): Make sure
static bool arm_cxx_use_aeabi_atexit (void);
static void arm_init_libfuncs (void);
static bool arm_handle_option (size_t, const char *, int);
+static void arm_target_help (void);
static unsigned HOST_WIDE_INT arm_shift_truncation_mask (enum machine_mode);
static bool arm_cannot_copy_insn_p (rtx);
static bool arm_tls_symbol_p (rtx x);
#define TARGET_DEFAULT_TARGET_FLAGS (TARGET_DEFAULT | MASK_SCHED_PROLOG)
#undef TARGET_HANDLE_OPTION
#define TARGET_HANDLE_OPTION arm_handle_option
+#undef TARGET_HELP
+#define TARGET_HELP arm_target_help
#undef TARGET_COMP_TYPE_ATTRIBUTES
#define TARGET_COMP_TYPE_ATTRIBUTES arm_comp_type_attributes
}
}
+static void
+arm_target_help (void)
+{
+ int i;
+ static int columns = 0;
+ int remaining;
+
+ /* If we have not done so already, obtain the desired maximum width of
+ the output. Note - this is a duplication of the code at the start of
+ gcc/opts.c:print_specific_help() - the two copies should probably be
+ replaced by a single function. */
+ if (columns == 0)
+ {
+ const char *p;
+
+ GET_ENVIRONMENT (p, "COLUMNS");
+ if (p != NULL)
+ {
+ int value = atoi (p);
+
+ if (value > 0)
+ columns = value;
+ }
+
+ if (columns == 0)
+ /* Use a reasonable default. */
+ columns = 80;
+ }
+
+ printf (" Known ARM CPUs (for use with the -mcpu= and -mtune= options):\n");
+
+ /* The - 2 is because we know that the last entry in the array is NULL. */
+ i = ARRAY_SIZE (all_cores) - 2;
+ gcc_assert (i > 0);
+ printf (" %s", all_cores[i].name);
+ remaining = columns - (strlen (all_cores[i].name) + 4);
+ gcc_assert (remaining >= 0);
+
+ while (i--)
+ {
+ int len = strlen (all_cores[i].name);
+
+ if (remaining > len + 2)
+ {
+ printf (", %s", all_cores[i].name);
+ remaining -= len + 2;
+ }
+ else
+ {
+ if (remaining > 0)
+ printf (",");
+ printf ("\n %s", all_cores[i].name);
+ remaining = columns - (len + 4);
+ }
+ }
+
+ printf ("\n\n Known ARM architectures (for use with the -march= option):\n");
+
+ i = ARRAY_SIZE (all_architectures) - 2;
+ gcc_assert (i > 0);
+
+ printf (" %s", all_architectures[i].name);
+ remaining = columns - (strlen (all_architectures[i].name) + 4);
+ gcc_assert (remaining >= 0);
+
+ while (i--)
+ {
+ int len = strlen (all_architectures[i].name);
+
+ if (remaining > len + 2)
+ {
+ printf (", %s", all_architectures[i].name);
+ remaining -= len + 2;
+ }
+ else
+ {
+ if (remaining > 0)
+ printf (",");
+ printf ("\n %s", all_architectures[i].name);
+ remaining = columns - (len + 4);
+ }
+ }
+ printf ("\n");
+
+}
+
/* Fix up any incompatible options that the user has specified.
This has now turned into a maze. */
void
@item --target-help
@opindex target-help
Print (on the standard output) a description of target-specific command
-line options for each tool.
+line options for each tool. For some targets extra target-specific
+information may also be printed.
@item --help=@var{class}@r{[},@var{qualifier}@r{]}
Print (on the standard output) a description of the command line
generated code.
@end defmac
+@deftypefn {Target Hook} bool TARGET_HELP (void)
+This hook is called in response to the user invoking
+@option{--target-help} on the command line. It gives the target a
+chance to display extra information on the target specific command
+line options found in its @file{.opt} file.
+@end deftypefn
+
@defmac CAN_DEBUG_WITHOUT_FP
Define this macro if debugging can be performed even without a frame
pointer. If this macro is defined, GCC will turn on the
case OPT__target_help:
print_specific_help (CL_TARGET, CL_UNDOCUMENTED, 0);
exit_after_options = true;
+
+ /* Allow the target a chance to give the user some additional information. */
+ if (targetm.target_help)
+ targetm.target_help ();
break;
case OPT_fhelp_:
#define TARGET_DEFAULT_TARGET_FLAGS 0
#define TARGET_HANDLE_OPTION hook_bool_size_t_constcharptr_int_true
+#define TARGET_HELP NULL
/* In except.c */
#define TARGET_EH_RETURN_FILTER_MODE default_eh_return_filter_mode
TARGET_VECTORIZE, \
TARGET_DEFAULT_TARGET_FLAGS, \
TARGET_HANDLE_OPTION, \
+ TARGET_HELP, \
TARGET_EH_RETURN_FILTER_MODE, \
TARGET_MERGE_DECL_ATTRIBUTES, \
TARGET_MERGE_TYPE_ATTRIBUTES, \
form was. Return true if the switch was valid. */
bool (* handle_option) (size_t code, const char *arg, int value);
+ /* Display extra, target specific information in response to a
+ --target-help switch. */
+ void (* target_help) (void);
+
/* Return machine mode for filter value. */
enum machine_mode (* eh_return_filter_mode) (void);