]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
arm: Don't reconfigure globals in arm_configure_build_target
authorRichard Earnshaw <rearnsha@arm.com>
Tue, 27 Jul 2021 14:44:57 +0000 (15:44 +0100)
committerRichard Earnshaw <rearnsha@arm.com>
Thu, 5 Aug 2021 11:51:14 +0000 (12:51 +0100)
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.

gcc/config/arm/arm-c.c
gcc/config/arm/arm.c

index ae2139c4bfa795f97b14682b61ed4d4a714bd2ad..cc7901bca8dc9c5c27ed6afc5bc26afd42689e6d 100644 (file)
@@ -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
index b2dd58d875178a17154bd6228be809fd6cdbbd63..273202ac2fdf7b6ce00223361257012a9fa561c1 100644 (file)
@@ -3058,6 +3058,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.  */
@@ -3441,7 +3442,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.  */