Cleanup ARM mcpu/march handling

Paul Brook paul@codesourcery.com
Thu Jun 3 07:32:00 GMT 2010


The attached patch cleans up the ARM backend mcpu/march/mtune handling.
I find the old code extremely obtuse.  The loop may have made sense 
originally, but the gcc option handling has been rewritten since and it makes 
it very hard to figure out where values have come from.  The new code replaces 
the if-inside-loop mess with more straightforward conditionals. I've also 
taken the opportunity to move the parsing into arm_handle_option.

The important semantics are as follows:
 * Both -march=A and -mcpu=B specified: If these are consistent then
  equivalent to -mcpu=B. if mismatched then warn and treat as
  -march=A -mtune=B (but do not override explicit -mtune)
 * If -mtune is not specified then it defaults to -mcpu. If -mcpu is not
  specified then pick a representative cpu for the architecture.

I've also added FL_TUNE.  This masks out irrelevant flags when determining 
whether -march and -mcpu are consistent. This avoids bogus warnings on things 
like -march=armv4t -mcpu=arm9 because of FL_LDSCHED.

Tested on arm-none-eabi.
Applied to SVN trunk.

Paul

2010-06-03  Paul Brook  <paul@codesourcery.com>

	gcc/
	* config/arm/arm.c (FL_TUNE): Define.
	(arm_default_cpu, arm_cpu_select): Remove.
	(all_cores): Populate core field.
	(arm_selected_arch, arm_selected_cpu, arm_selected_tune): New.
	(arm_find_cpu): New function.
	(arm_handle_option): Lookup cpu/architecture names.
	(arm_override_options): Cleanup mcpu/march/mtune handling.
	(arm_file_start): Ditto.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: patch
Type: text/x-patch
Size: 9485 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20100603/c0928637/attachment.bin>


More information about the Gcc-patches mailing list