This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

RFA: Add --target-help hook to gcc_target structure


Hi Guys,

  I would like to add a new hook to the gcc_target structure.  This
  would be a void function which is run whenever the user invokes
  --target-help on the gcc command line.  The purpose of this hook is
  to allow the back-ends a chance to display any extra information that
  they think is pertinent to --target-help.

  The attached patch implements this idea and also includes a use of
  the hook for the ARM backend.  For the ARM, a list of the CPUs and
  architectures supported by the compiler are displayed, extracted
  from arrays built into the backend:

    % arm-eabi-gcc --target-help
    The following options are target specific:
    -mabi=                      Specify an ABI
    ...
    Known ARM CPUs (for use with the -mcpu= and -mtune= options):
      cortex-m3, cortex-r4, cortex-a8, arm1156t2-s, mpcore, mpcorenovfp, arm1176jzf-s, arm1176jz-s, arm1136jf-s, arm1136j-s, arm1026ej-s, arm926ej-s, iwmmxt, xscale, arm1022e, arm1020e, arm10e, arm968e-s, arm966e-s, arm946e-s, arm9e, arm1020t, arm10tdmi, ep9312, arm940t, arm922t, arm920t, arm920, arm9tdmi, arm9, arm740t, arm720t, arm710t, arm7tdmi-s, arm7tdmi, strongarm1110, strongarm1100, strongarm110, strongarm, arm810, arm8, arm7dmi, arm7dm, arm7m, arm7500fe, arm7500, arm7100, arm710c, arm720, arm710, arm700i, arm700, arm70, arm7di, arm7d, arm7, arm620, arm610, arm600, arm60, arm6, arm3, arm250, arm2

    Known ARM architectures (for use with the -march= option):
      iwmmxt, ep9312, armv7-m, armv7-r, armv7-a, armv7, armv6t2, armv6zk, armv6z, armv6k, armv6j, armv6, armv5te, armv5e, armv5t, armv5, armv4t, armv4, armv3m, armv3, armv2a, armv2

  I thought about invoking the hook when --help=target is passed on
  the command line, but I decided against it.  One of the intentions
  of the --help= option is to allow for script based parsing of the
  output, and cluttering it up with whatever arbitrary text a backend
  may decide to display would not be a good idea.

  Tested by (re)building an arm-eabi toolchain and running the gcc
  and g++ testsuites without any regressions.
  
  So - may I apply this patch please ?

Cheers
  Nick

gcc/ChangeLog
2007-06-27  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 list of cores and architectures
	supported.

Attachment: target-help.patch.bz2
Description: BZip2 compressed data


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]