public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r11-8880] arm: Don't reconfigure globals in arm_configure_build_target
@ 2021-08-18 15:23 Richard Earnshaw
  0 siblings, 0 replies; only message in thread
From: Richard Earnshaw @ 2021-08-18 15:23 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:302eb5361d703e279043560a3d4ffefe6b610ad6

commit r11-8880-g302eb5361d703e279043560a3d4ffefe6b610ad6
Author: Richard Earnshaw <rearnsha@arm.com>
Date:   Tue Jul 27 15:44:57 2021 +0100

    arm: Don't reconfigure globals in arm_configure_build_target
    
    arm_configure_build_target is usually used to reconfigure the
    arm_active_target structure, which is then used to reconfigure a
    number of other global variables describing the current target.
    Occasionally, however, we need to use arm_configure_build_target to
    construct a temporary target structure and in that case it is wrong to
    try to reconfigure the global variables (although probably harmless,
    since arm_option_reconfigure_globals() only looks at
    arm_active_target).  At the very least, however, this is wasted work,
    so it is best not to do it unless needed.  What's more, several
    callers of arm_configure_build target call
    arm_option_reconfigure_globals themselves within a few lines, making
    the call from within arm_configure_build_target completely redundant.
    
    So this patch moves the responsibility of calling of
    arm_configure_build_target to its callers (only two places needed
    updating).
    
    gcc:
            * config/arm/arm.c (arm_configure_build_target): Don't call
            arm_option_reconfigure_globals.
            (arm_option_restore): Call arm_option_reconfigure_globals after
            reconfiguring the target.
            * config/arm/arm-c.c (arm_pragma_target_parse): Likewise.
    (cherry picked from commit 6a37d0331c25f23628d4308e5a75624005c223b2)

Diff:
---
 gcc/config/arm/arm-c.c | 1 +
 gcc/config/arm/arm.c   | 2 +-
 2 files changed, 2 insertions(+), 1 deletion(-)

diff --git a/gcc/config/arm/arm-c.c b/gcc/config/arm/arm-c.c
index ae2139c4bfa..cc7901bca8d 100644
--- a/gcc/config/arm/arm-c.c
+++ b/gcc/config/arm/arm-c.c
@@ -409,6 +409,7 @@ arm_pragma_target_parse (tree args, tree pop_target)
       target_option_current_node = cur_tree;
       arm_configure_build_target (&arm_active_target,
 				  TREE_TARGET_OPTION (cur_tree), false);
+      arm_option_reconfigure_globals ();
     }
 
   /* Update macros if target_node changes. The global state will be restored
diff --git a/gcc/config/arm/arm.c b/gcc/config/arm/arm.c
index daafeb34683..a238118bd77 100644
--- a/gcc/config/arm/arm.c
+++ b/gcc/config/arm/arm.c
@@ -3056,6 +3056,7 @@ arm_option_restore (struct gcc_options */* opts */,
 		    struct cl_target_option *ptr)
 {
   arm_configure_build_target (&arm_active_target, ptr, false);
+  arm_option_reconfigure_globals ();
 }
 
 /* Reset options between modes that the user has specified.  */
@@ -3439,7 +3440,6 @@ arm_configure_build_target (struct arm_build_target *target,
   target->tune_flags = tune_data->tune_flags;
   target->tune = tune_data->tune;
   target->tune_core = tune_data->scheduler;
-  arm_option_reconfigure_globals ();
 }
 
 /* Fix up any incompatible options that the user has specified.  */


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2021-08-18 15:23 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-18 15:23 [gcc r11-8880] arm: Don't reconfigure globals in arm_configure_build_target Richard Earnshaw

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).