diff --git a/gcc/config/s390/s390-c.c b/gcc/config/s390/s390-c.c index dc05c17..0c5fe57 100644 --- a/gcc/config/s390/s390-c.c +++ b/gcc/config/s390/s390-c.c @@ -389,7 +389,7 @@ s390_pragma_target_parse (tree args, tree pop_target) gcc_options options; tree def_tree; - memcpy (&options, &global_options, sizeof (options)); + options = global_options; def_tree = (pop_target ? pop_target : target_option_default_node); cl_target_option_restore (&options, TREE_TARGET_OPTION (def_tree)); if (! args) @@ -398,13 +398,14 @@ s390_pragma_target_parse (tree args, tree pop_target) { gcc_options options_set; - memcpy (&options_set, &global_options_set, sizeof (options_set)); + options_set = global_options_set; cur_tree = s390_valid_target_attribute_tree (args, &options, &options_set, true); if (!cur_tree || cur_tree == error_mark_node) return false; + global_options_set = options_set; } - memcpy (&global_options, &options, sizeof (options)); + global_options = options; } target_option_current_node = cur_tree; diff --git a/gcc/config/s390/s390.c b/gcc/config/s390/s390.c index 3c5a042..a94420b 100644 --- a/gcc/config/s390/s390.c +++ b/gcc/config/s390/s390.c @@ -13532,23 +13532,15 @@ s390_option_override_internal (struct gcc_options *opts, } /* Set the march default in case it hasn't been specified on cmdline. */ - if (opts->x_s390_arch == PROCESSOR_max) - { - opts->x_s390_arch = TARGET_ZARCH_P (opts->x_target_flags) - ? PROCESSOR_2064_Z900 : PROCESSOR_9672_G5; - opts->x_s390_arch_specified = 0; - } - else - opts->x_s390_arch_specified = 1; + if (!opts_set->x_s390_arch) + opts->x_s390_arch = TARGET_ZARCH_P (opts->x_target_flags) + ? PROCESSOR_2064_Z900 : PROCESSOR_9672_G5; + opts->x_s390_arch_flags = processor_flags_table[(int) opts->x_s390_arch]; /* Determine processor to tune for. */ - if (opts->x_s390_tune == PROCESSOR_max) - { - opts->x_s390_tune = opts->x_s390_arch; - opts->x_s390_tune_specified = 0; - } - else - opts->x_s390_tune_specified = 1; + if (!opts_set->x_s390_tune) + opts->x_s390_tune = opts->x_s390_arch; + opts->x_s390_tune_flags = processor_flags_table[opts->x_s390_tune]; /* Sanity checks. */ @@ -14033,8 +14025,6 @@ s390_valid_target_attribute_tree (tree args, struct gcc_options *opts_set, bool force_pragma) { - int orig_arch_specified = s390_arch_specified; - int orig_tune_specified = s390_tune_specified; tree t = NULL_TREE; struct gcc_options new_opts_set; @@ -14054,45 +14044,29 @@ s390_valid_target_attribute_tree (tree args, || new_opts_set.x_s390_stack_size || new_opts_set.x_s390_branch_cost || new_opts_set.x_s390_warn_framesize - || new_opts_set.x_s390_warn_dynamicstack_p - ) + || new_opts_set.x_s390_warn_dynamicstack_p) { - /* If we are using the default tune= or arch=, undo the value assigned, - and use the default. */ - if (!new_opts_set.x_s390_arch) - { - if (!orig_arch_specified) - opts->x_s390_arch = PROCESSOR_max; - } - if (!new_opts_set.x_s390_tune && new_opts_set.x_s390_arch) - { - if (opts->x_s390_arch != PROCESSOR_max) - opts->x_s390_tune = PROCESSOR_max; - else if (!orig_tune_specified) - opts->x_s390_tune = PROCESSOR_max; - } + struct gcc_options joined_opts_set; + unsigned char *src = (unsigned char *)&new_opts_set; + unsigned char *dest = (unsigned char *)&joined_opts_set; + unsigned int i; - { - struct gcc_options joined_opts_set; - unsigned char *src = (unsigned char *)&new_opts_set; - unsigned char *dest = (unsigned char *)&joined_opts_set; - unsigned int i; - - /* Make a joined copy of the original and the additional option flags. - */ - memcpy (&joined_opts_set, opts_set, sizeof (*opts_set)); - for (i = 0; i < sizeof(*opts_set); i++) - dest[i] |= src[i]; - - /* Do any overrides, such as arch=xxx, or tune=xxx support. */ - s390_option_override_internal (opts, &joined_opts_set); - } + /* A single -march overwrites a former -mtune. */ + if (new_opts_set.x_s390_arch && !new_opts_set.x_s390_tune) + opts_set->x_s390_tune = (enum processor_type)0; + /* Make a joined copy of the original and the additional option + flags. */ + joined_opts_set = *opts_set; + for (i = 0; i < sizeof(*opts_set); i++) + dest[i] |= src[i]; + + /* Do any overrides, such as arch=xxx, or tune=xxx support. */ + s390_option_override_internal (opts, &joined_opts_set); /* Save the current options unless we are validating options for #pragma. */ t = build_target_option_node (opts); } - return t; } diff --git a/gcc/config/s390/s390.opt b/gcc/config/s390/s390.opt index 4bddda5..409ec72 100644 --- a/gcc/config/s390/s390.opt +++ b/gcc/config/s390/s390.opt @@ -23,18 +23,10 @@ config/s390/s390-opts.h ;; Definitions to add to the cl_target_option and gcc_options structures -;; whether -march was specified -TargetVariable -unsigned char s390_arch_specified - ;; Flags derived from s390_arch TargetVariable int s390_arch_flags -;; whether -mtune was specified -TargetVariable -unsigned char s390_tune_specified - ;; Flags derived from s390_tune TargetVariable int s390_tune_flags @@ -158,7 +150,7 @@ Target RejectNegative Joined UInteger Var(s390_stack_size) Save Emit extra code in the function prologue in order to trap if the stack size exceeds the given limit. mtune= -Target RejectNegative Joined Enum(processor_type) Var(s390_tune) Init(PROCESSOR_max) Save. +Target RejectNegative Joined Enum(processor_type) Var(s390_tune) Init(PROCESSOR_max) Save Schedule code for given CPU mmvcle