This is the mail archive of the binutils@sourceware.org mailing list for the binutils 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]

Re: [PATCH, gas/ARM] Clean up selection of feature bits


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



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