[PATCH, gas/ARM] Clean up selection of feature bits
Nick Clifton
nickc@redhat.com
Thu Mar 1 10:58:00 GMT 2018
Hi Thomas,
> I've always found the code in ARM backend of gas to control what
> CPU/architecture and FPU are selected by the user and to support
> autodetection of features complex and confusing. Chief among the
> issues I have with that code is the lack of comments to explain
> the meaning of the various variables. This patch addresses that
> and much more:
Wow - thank you for doing this.
My first thought actually was whether this improvement ought to be generalized
and used for other targets, and not just ARM. I think however that there is
probably too much target specific knowledge to be handled, but it might be worth
thinking about for the future.
> *** gas/ChangeLog ***
> 2018-02-21 Thomas Preud'homme <thomas.preudhomme@arm.com>
>
> Â Â Â Â * config/tc-arm.c (cpu_variant, arm_arch_used, thumb_arch_used,
> Â Â Â Â legacy_cpu, legacy_fpu, mcpu_cpu_opt, dyn_mcpu_ext_opt,
> Â Â Â Â mcpu_fpu_opt, march_cpu_opt, dyn_march_ext_opt, march_fpu_opt,
> Â Â Â Â mfpu_opt, object_arch, selected_cpu): Comment meaning of variables.
> Â Â Â Â (dyn_mcpu_ext_opt): Also rename into ...
> Â Â Â Â (mcpu_ext_opt): This.
> Â Â Â Â (dyn_march_ext_opt): Also rename into ...
> Â Â Â Â (march_ext_opt): This.
> Â Â Â Â (object_arch): Also rename into ...
> Â Â Â Â (selected_object_arch): This and make it a plain arm_feature_set
> Â Â Â Â structure.
> Â Â Â Â (selected_arch, selected_ext, selected_fpu): New static variables.
> Â Â Â Â (do_bx): Adapt to change in name and type of object_arch.
> Â Â Â Â (md_begin): Set selected_arch rather than mcpu_cpu_opt, selected_ext
> Â Â Â Â rather than dyn_mcpu_ext_opt and selected_fpu rather than mfpu_opt.
> Â Â Â Â Remove dead code to set default FPU if architecture version is greater
>     than 5. Set all CPU bits of cpu_variant directly in autodection
> Â Â Â Â leaving mcpu_cpu_opt, selected_arch and selected_cpu unset.
> Â Â Â Â (arm_parse_extension): Take extension feature set pointer
>     parameter by value rather than by pointer. Remove allocation
>     code. Adapt code accordingly.
> Â Â Â Â (arm_parse_cpu): Adapt to variable renaming and changes in
> Â Â Â Â arm_parse_extension () signature.
> Â Â Â Â (arm_parse_arch): Likewise.
> Â Â Â Â (aeabi_set_public_attributes): Also set selected_arch and selected_ext
>     in addition to selected_cpu. Set flags_arch and flags_ext from them
>     instead of selected_cpu. Adapt to variables renaming and type change.
> Â Â Â Â (arm_md_post_relax): Adapt to variable renaming.
> Â Â Â Â (s_arm_cpu): Set selcted_cpu_cpu and selected_ext instead of
>     mcpu_cpu_opt and dyn_mcpu_ext_opt. Set selected_cpu from them
> Â Â Â Â and cpu_variant from selected_cpu and selected_fpu.
> Â Â Â Â (s_arm_arch): Likewise.
> Â Â Â Â (s_arm_object_arch): Adapt to variable renaming.
> Â Â Â Â (s_arm_arch_extension): Use ARM_CPU_IS_ANY instead of checking
>     feature set against arm_any. Check selected_arch rather than
>     *mcpu_cpu_opt. Set selected_ext rather than *dyn_mcpu_ext_opt and
> Â Â Â Â remove allocation code.
>     (s_arm_fpu): Set selected_fpu instead of mfpu_opt. Set all CPU
> Â Â Â Â feature bits if in autodetection mode.
Approved - please apply.
Cheers
Nick
More information about the Binutils
mailing list