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]

[PATCH/RFC, ARM] Improve static checking of tune_params


One of the things that worries me about all the static tuning tables we
have in the compiler is that it is easy to get the order of elements
wrong, especially when adding a lot of new fields to existing
descriptions.  This patch attempts to improve the static checking in
this area by making use of enums to replace all those true/false fields;
this means that an element that is out of order should now fail a
compile-time check (verified by deliberately switching two elements
around).  A fringe benefit of this approach is that the table is now
pretty-much self-commented.

I'd like to gather opinions on this; it's not quite as simple as I'd
hoped in that you have to use base::enum_val, rather than just enum_val
in the tables.  Either that or make the declarations global, which I
think is slightly worse from a purist point of view.


I'll wait a couple of days before committing this.


        * arm-protos.h (struct tune_params): Re-organise.  Convert bool
entries
        to enums.
        * arm.c (arm_slowmul_tune): Update accordingly.
        (arm_fastmul_tune): Likewise.
        (arm_strongarm_tune, arm_xscale_tune, arm_9e_tune): Likewise.
        (arm_v6t2_tune, arm_cortex_tune, arm_cortex_a8_tune): Likewise.
        (arm_cortex_a7_tune, arm_cortex_a15_tune): Likewise.
        (arm_cortex_a53_tune, arm_cortex_a57_tune): Likewise.
        (arm_cortex_a5_tune, arm_cortex_a9_tune): Likewise.
        (arm_cortex_a12_tune, arm_v7m_tune, arm_v6m_tune): Likewise.
        (arm_fa726te_tune): Likewise.
        (thumb2_reorg): Update accordingly.
        * arm.h (LOGICAL_OP_NON_SHORTCIRCUIT_P): Update accordingly.

Attachment: tune-init.patch
Description: Text document


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