[arm] Use cl_target_options for configuring the active target
authorRichard Earnshaw <rearnsha@arm.com>
Thu, 15 Dec 2016 16:00:30 +0000 (16:00 +0000)
committerRichard Earnshaw <rearnsha@gcc.gnu.org>
Thu, 15 Dec 2016 16:00:30 +0000 (16:00 +0000)
It now becomes apparent that it would be better to use the the
cl_target_options as the basis for calling arm_configure_build_target;
it already contains exactly the same fields that we need.  I chose not
to rewrite the earlier patches as that would make the progression of
changes seem less logical than it currently is, with several early
changes having no immediate justification.

* arm-protos.h (arm_configure_build_target): Change second argument
to cl_target_options.
* arm.c (arm_configure_build_target): Likewise.
(arm_option_restore): Update accordingly.
(arm_option_override): Create the target_option_default_node before
calling arm_configure_build_target.  Use it in call of latter.
Resynchronize after all other overrides have been calculated.
(arm_valid_target_attribute_tree): Use the target options for
reconfiguration.  Resynchronize after performing override checks.
* arm-c.c (arm_pragma_target_parse): Use target optiosn from cur_tree
to reconfigure the build target.

From-SVN: r243713

gcc/ChangeLog
gcc/config/arm/arm-c.c
gcc/config/arm/arm-protos.h
gcc/config/arm/arm.c

index cd6be7d..da2edc7 100644 (file)
@@ -1,5 +1,19 @@
 2016-12-15  Richard Earnshaw  <rearnsha@arm.com>
 
+       * arm-protos.h (arm_configure_build_target): Change second argument
+       to cl_target_options.
+       * arm.c (arm_configure_build_target): Likewise.
+       (arm_option_restore): Update accordingly.
+       (arm_option_override): Create the target_option_default_node before
+       calling arm_configure_build_target.  Use it in call of latter.
+       Resynchronize after all other overrides have been calculated.
+       (arm_valid_target_attribute_tree): Use the target options for
+       reconfiguration.  Resynchronize after performing override checks.
+       * arm-c.c (arm_pragma_target_parse): Use target optiosn from cur_tree
+       to reconfigure the build target.
+
+2016-12-15  Richard Earnshaw  <rearnsha@arm.com>
+
        * arm.h (TARGET_VFPD32): Use arm_active_target.
        (TARGET_VFP3): Likewise.
        (TARGET_VFP5): Likewise.
index 9dd9a8d..b57af69 100644 (file)
@@ -243,7 +243,8 @@ arm_pragma_target_parse (tree args, tree pop_target)
       /* handle_pragma_pop_options and handle_pragma_reset_options will set
        target_option_current_node, but not handle_pragma_target.  */
       target_option_current_node = cur_tree;
-      arm_configure_build_target (&arm_active_target, &global_options,
+      arm_configure_build_target (&arm_active_target,
+                                 TREE_TARGET_OPTION (cur_tree),
                                  &global_options_set, false);
     }
 
index da3484f..d418ca9 100644 (file)
@@ -225,7 +225,7 @@ extern bool arm_change_mode_p (tree);
 extern tree arm_valid_target_attribute_tree (tree, struct gcc_options *,
                                             struct gcc_options *);
 extern void arm_configure_build_target (struct arm_build_target *,
-                                       struct gcc_options *,
+                                       struct cl_target_option *,
                                        struct gcc_options *, bool);
 extern void arm_pr_long_calls (struct cpp_reader *);
 extern void arm_pr_no_long_calls (struct cpp_reader *);
index 676c78b..df520e5 100644 (file)
@@ -2936,16 +2936,17 @@ arm_override_options_after_change_1 (struct gcc_options *opts)
 static void
 arm_override_options_after_change (void)
 {
-  arm_configure_build_target (&arm_active_target, &global_options,
+  arm_configure_build_target (&arm_active_target,
+                             TREE_TARGET_OPTION (target_option_default_node),
                              &global_options_set, false);
 
   arm_override_options_after_change_1 (&global_options);
 }
 
 static void
-arm_option_restore (struct gcc_options *opts, struct cl_target_option *ptr)
+arm_option_restore (struct gcc_options *, struct cl_target_option *ptr)
 {
-  arm_configure_build_target (&arm_active_target, opts, &global_options_set,
+  arm_configure_build_target (&arm_active_target, ptr, &global_options_set,
                              false);
 }
 
@@ -3070,7 +3071,7 @@ static sbitmap isa_quirkbits;
    architecture have been specified, but the two are not identical.  */
 void
 arm_configure_build_target (struct arm_build_target *target,
-                           struct gcc_options *opts,
+                           struct cl_target_option *opts,
                            struct gcc_options *opts_set,
                            bool warn_compatible)
 {
@@ -3306,7 +3307,13 @@ arm_option_override (void)
       gcc_assert (ok);
     }
 
-  arm_configure_build_target (&arm_active_target, &global_options,
+  /* Create the default target_options structure.  We need this early
+     to configure the overall build target.  */
+  target_option_default_node = target_option_current_node
+    = build_target_option_node (&global_options);
+
+  arm_configure_build_target (&arm_active_target,
+                             TREE_TARGET_OPTION (target_option_default_node),
                              &global_options_set, true);
 
 #ifdef SUBTARGET_OVERRIDE_OPTIONS
@@ -3657,14 +3664,12 @@ arm_option_override (void)
   arm_option_check_internal (&global_options);
   arm_option_params_internal ();
 
+  /* Resynchronize the saved target options.  */
+  cl_target_option_save (TREE_TARGET_OPTION (target_option_default_node),
+                        &global_options);
   /* Register global variables with the garbage collector.  */
   arm_add_gc_roots ();
 
-  /* Save the initial options in case the user does function specific
-     options or #pragma target.  */
-  target_option_default_node = target_option_current_node
-    = build_target_option_node (&global_options);
-
   /* Init initial mode for testing.  */
   thumb_flipper = TARGET_THUMB;
 }
@@ -30326,15 +30331,22 @@ tree
 arm_valid_target_attribute_tree (tree args, struct gcc_options *opts,
                                 struct gcc_options *opts_set)
 {
+  tree t;
+
   if (!arm_valid_target_attribute_rec (args, opts))
     return NULL_TREE;
 
-  arm_configure_build_target (&arm_active_target, opts, opts_set, false);
+  t = build_target_option_node (opts);
+  arm_configure_build_target (&arm_active_target, TREE_TARGET_OPTION (t),
+                             opts_set, false);
   arm_option_check_internal (opts);
   /* Do any overrides, such as global options arch=xxx.  */
   arm_option_override_internal (opts, opts_set);
 
-  return build_target_option_node (opts);
+  /* Resynchronize the saved target options.  */
+  cl_target_option_save (TREE_TARGET_OPTION (t), opts);
+
+  return t;
 }
 
 static void