[PATCH][GCC][ARM] Fix code generation from parsecpu.awk to remove duplicates.

Tamar Christina Tamar.Christina@arm.com
Tue Jul 25 13:00:00 GMT 2017


Hi All,

The new ARM options parser generates from the following entry

begin cpu cortex-a55
 ...
 architecture armv8.2-a+fp16+foo
 option crypto add FP_ARMv8 CRYPTO
 option dotprod add FP_ARMv8 FOO
 option nofp remove ALL_FP
 ...
end cpu cortex-a55

A list of all feature bits that using -mcpu=cortex-a55
enabled and stores these in an array. The size of this array
is statically set to be isa_num_bits which is the last entry
in the isa_feature_bits enum.

What this means is that there is an assumption that you can
never have more feature bits in this array than there are
features.  Which is a reasonable assumption only if the entries
in the array are unique.

The above example currently would add FP_ARMv8 three times.
FP_ARMv8 maps to the macro ISA_FP_ARMv8.  Which when expanded
trivially exceeds the size of the array.

This patch makes sure that when constructing the array we only
emit an a value once. The array is constructed between three
different sources which is where the duplications come in.

Because we can't however look into the macros. When expended
they may still introduce duplicate bits. So this doesn't
completely fix the problem. Just makes it a bit less likely.

Bootstrapped on arm-none-eabi and no issues.

Ok for trunk?

gcc/
2017-07-25  Tamar Christina  <tamar.christina@arm.com>

	* config/arm/parsecpu.awk (all_cores): Remove duplicates.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: parsecpu-remove-dups.patch
Type: text/x-patch
Size: 1749 bytes
Desc: parsecpu-remove-dups.patch
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20170725/c444e642/attachment.bin>


More information about the Gcc-patches mailing list