aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorNick Clifton <nickc@redhat.com>2007-07-04 15:05:26 +0000
committerNick Clifton <nickc@gcc.gnu.org>2007-07-04 15:05:26 +0000
commit67e6ba46a4215ab85c2fa8ae0922740f71fa47b5 (patch)
tree130ff355eaa28d20f9252f17820bbf64de1c44c6 /gcc
parentfda41d93b807f02db14dd054e6daa4d639233445 (diff)
downloadgcc-67e6ba46a4215ab85c2fa8ae0922740f71fa47b5.zip
gcc-67e6ba46a4215ab85c2fa8ae0922740f71fa47b5.tar.gz
gcc-67e6ba46a4215ab85c2fa8ae0922740f71fa47b5.tar.bz2
target.h (struct gcc_target): Add target_help field.
* 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
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog16
-rw-r--r--gcc/config/arm/arm.c89
-rw-r--r--gcc/doc/invoke.texi3
-rw-r--r--gcc/doc/tm.texi7
-rw-r--r--gcc/opts.c4
-rw-r--r--gcc/target-def.h2
-rw-r--r--gcc/target.h4
7 files changed, 124 insertions, 1 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 39da288..cb8bc95 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,19 @@
+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
diff --git a/gcc/config/arm/arm.c b/gcc/config/arm/arm.c
index 6c9a695..2169256 100644
--- a/gcc/config/arm/arm.c
+++ b/gcc/config/arm/arm.c
@@ -193,6 +193,7 @@ static bool arm_cxx_class_data_always_comdat (void);
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);
@@ -243,6 +244,8 @@ static void arm_output_dwarf_dtprel (FILE *, int, rtx) ATTRIBUTE_UNUSED;
#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
@@ -930,6 +933,92 @@ arm_handle_option (size_t code, const char *arg, int value ATTRIBUTE_UNUSED)
}
}
+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
diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi
index 57dbb02..b1bbcf0 100644
--- a/gcc/doc/invoke.texi
+++ b/gcc/doc/invoke.texi
@@ -1106,7 +1106,8 @@ have no documentation associated with them will also be displayed.
@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
diff --git a/gcc/doc/tm.texi b/gcc/doc/tm.texi
index 145c81a..ceeec11 100644
--- a/gcc/doc/tm.texi
+++ b/gcc/doc/tm.texi
@@ -842,6 +842,13 @@ this macro!} The debugging options are not supposed to alter the
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
diff --git a/gcc/opts.c b/gcc/opts.c
index 974c19b..97bcb9f 100644
--- a/gcc/opts.c
+++ b/gcc/opts.c
@@ -1229,6 +1229,10 @@ common_handle_option (size_t scode, const char *arg, int value,
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_:
diff --git a/gcc/target-def.h b/gcc/target-def.h
index c106577..48e1c1a 100644
--- a/gcc/target-def.h
+++ b/gcc/target-def.h
@@ -369,6 +369,7 @@ Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#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
@@ -666,6 +667,7 @@ Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
TARGET_VECTORIZE, \
TARGET_DEFAULT_TARGET_FLAGS, \
TARGET_HANDLE_OPTION, \
+ TARGET_HELP, \
TARGET_EH_RETURN_FILTER_MODE, \
TARGET_MERGE_DECL_ATTRIBUTES, \
TARGET_MERGE_TYPE_ATTRIBUTES, \
diff --git a/gcc/target.h b/gcc/target.h
index effd933..4e84e5a 100644
--- a/gcc/target.h
+++ b/gcc/target.h
@@ -425,6 +425,10 @@ struct gcc_target
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);