From 117fdbfa24eaad74ae3b80bce79f0152fe2e776a Mon Sep 17 00:00:00 2001 From: Joseph Myers Date: Tue, 22 Mar 2011 22:46:13 +0000 Subject: [PATCH] sh.c (sh_handle_option): Access target_flags via opts pointer. * config/sh/sh.c (sh_handle_option): Access target_flags via opts pointer. Don't assert that global structures are in use. From-SVN: r171326 --- gcc/ChangeLog | 5 ++++ gcc/config/sh/sh.c | 67 +++++++++++++++++++++++++++------------------- 2 files changed, 45 insertions(+), 27 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 17745df185b..88c6de61399 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +2011-03-22 Joseph Myers + + * config/sh/sh.c (sh_handle_option): Access target_flags via opts + pointer. Don't assert that global structures are in use. + 2011-03-22 Joseph Myers * config/pdp11/pdp11.c (pdp11_handle_option): Access target_flags diff --git a/gcc/config/sh/sh.c b/gcc/config/sh/sh.c index bbeb7a258dd..926c2f59ddc 100644 --- a/gcc/config/sh/sh.c +++ b/gcc/config/sh/sh.c @@ -606,58 +606,59 @@ struct gcc_target targetm = TARGET_INITIALIZER; /* Implement TARGET_HANDLE_OPTION. */ static bool -sh_handle_option (struct gcc_options *opts, struct gcc_options *opts_set, +sh_handle_option (struct gcc_options *opts, + struct gcc_options *opts_set ATTRIBUTE_UNUSED, const struct cl_decoded_option *decoded, location_t loc ATTRIBUTE_UNUSED) { size_t code = decoded->opt_index; - gcc_assert (opts == &global_options); - gcc_assert (opts_set == &global_options_set); - switch (code) { case OPT_m1: - target_flags = (target_flags & ~MASK_ARCH) | SELECT_SH1; + opts->x_target_flags = (opts->x_target_flags & ~MASK_ARCH) | SELECT_SH1; return true; case OPT_m2: - target_flags = (target_flags & ~MASK_ARCH) | SELECT_SH2; + opts->x_target_flags = (opts->x_target_flags & ~MASK_ARCH) | SELECT_SH2; return true; case OPT_m2a: - target_flags = (target_flags & ~MASK_ARCH) | SELECT_SH2A; + opts->x_target_flags = (opts->x_target_flags & ~MASK_ARCH) | SELECT_SH2A; return true; case OPT_m2a_nofpu: - target_flags = (target_flags & ~MASK_ARCH) | SELECT_SH2A_NOFPU; + opts->x_target_flags + = (opts->x_target_flags & ~MASK_ARCH) | SELECT_SH2A_NOFPU; return true; case OPT_m2a_single: - target_flags = (target_flags & ~MASK_ARCH) | SELECT_SH2A_SINGLE; + opts->x_target_flags + = (opts->x_target_flags & ~MASK_ARCH) | SELECT_SH2A_SINGLE; return true; case OPT_m2a_single_only: - target_flags = (target_flags & ~MASK_ARCH) | SELECT_SH2A_SINGLE_ONLY; + opts->x_target_flags + = (opts->x_target_flags & ~MASK_ARCH) | SELECT_SH2A_SINGLE_ONLY; return true; case OPT_m2e: - target_flags = (target_flags & ~MASK_ARCH) | SELECT_SH2E; + opts->x_target_flags = (opts->x_target_flags & ~MASK_ARCH) | SELECT_SH2E; return true; case OPT_m3: - target_flags = (target_flags & ~MASK_ARCH) | SELECT_SH3; + opts->x_target_flags = (opts->x_target_flags & ~MASK_ARCH) | SELECT_SH3; return true; case OPT_m3e: - target_flags = (target_flags & ~MASK_ARCH) | SELECT_SH3E; + opts->x_target_flags = (opts->x_target_flags & ~MASK_ARCH) | SELECT_SH3E; return true; case OPT_m4: case OPT_m4_100: case OPT_m4_200: case OPT_m4_300: - target_flags = (target_flags & ~MASK_ARCH) | SELECT_SH4; + opts->x_target_flags = (opts->x_target_flags & ~MASK_ARCH) | SELECT_SH4; return true; case OPT_m4_nofpu: @@ -667,62 +668,74 @@ sh_handle_option (struct gcc_options *opts, struct gcc_options *opts_set, case OPT_m4_340: case OPT_m4_400: case OPT_m4_500: - target_flags = (target_flags & ~MASK_ARCH) | SELECT_SH4_NOFPU; + opts->x_target_flags + = (opts->x_target_flags & ~MASK_ARCH) | SELECT_SH4_NOFPU; return true; case OPT_m4_single: case OPT_m4_100_single: case OPT_m4_200_single: case OPT_m4_300_single: - target_flags = (target_flags & ~MASK_ARCH) | SELECT_SH4_SINGLE; + opts->x_target_flags + = (opts->x_target_flags & ~MASK_ARCH) | SELECT_SH4_SINGLE; return true; case OPT_m4_single_only: case OPT_m4_100_single_only: case OPT_m4_200_single_only: case OPT_m4_300_single_only: - target_flags = (target_flags & ~MASK_ARCH) | SELECT_SH4_SINGLE_ONLY; + opts->x_target_flags + = (opts->x_target_flags & ~MASK_ARCH) | SELECT_SH4_SINGLE_ONLY; return true; case OPT_m4a: - target_flags = (target_flags & ~MASK_ARCH) | SELECT_SH4A; + opts->x_target_flags = (opts->x_target_flags & ~MASK_ARCH) | SELECT_SH4A; return true; case OPT_m4a_nofpu: case OPT_m4al: - target_flags = (target_flags & ~MASK_ARCH) | SELECT_SH4A_NOFPU; + opts->x_target_flags + = (opts->x_target_flags & ~MASK_ARCH) | SELECT_SH4A_NOFPU; return true; case OPT_m4a_single: - target_flags = (target_flags & ~MASK_ARCH) | SELECT_SH4A_SINGLE; + opts->x_target_flags + = (opts->x_target_flags & ~MASK_ARCH) | SELECT_SH4A_SINGLE; return true; case OPT_m4a_single_only: - target_flags = (target_flags & ~MASK_ARCH) | SELECT_SH4A_SINGLE_ONLY; + opts->x_target_flags + = (opts->x_target_flags & ~MASK_ARCH) | SELECT_SH4A_SINGLE_ONLY; return true; case OPT_m5_32media: - target_flags = (target_flags & ~MASK_ARCH) | SELECT_SH5_32MEDIA; + opts->x_target_flags + = (opts->x_target_flags & ~MASK_ARCH) | SELECT_SH5_32MEDIA; return true; case OPT_m5_32media_nofpu: - target_flags = (target_flags & ~MASK_ARCH) | SELECT_SH5_32MEDIA_NOFPU; + opts->x_target_flags + = (opts->x_target_flags & ~MASK_ARCH) | SELECT_SH5_32MEDIA_NOFPU; return true; case OPT_m5_64media: - target_flags = (target_flags & ~MASK_ARCH) | SELECT_SH5_64MEDIA; + opts->x_target_flags + = (opts->x_target_flags & ~MASK_ARCH) | SELECT_SH5_64MEDIA; return true; case OPT_m5_64media_nofpu: - target_flags = (target_flags & ~MASK_ARCH) | SELECT_SH5_64MEDIA_NOFPU; + opts->x_target_flags + = (opts->x_target_flags & ~MASK_ARCH) | SELECT_SH5_64MEDIA_NOFPU; return true; case OPT_m5_compact: - target_flags = (target_flags & ~MASK_ARCH) | SELECT_SH5_COMPACT; + opts->x_target_flags + = (opts->x_target_flags & ~MASK_ARCH) | SELECT_SH5_COMPACT; return true; case OPT_m5_compact_nofpu: - target_flags = (target_flags & ~MASK_ARCH) | SELECT_SH5_COMPACT_NOFPU; + opts->x_target_flags + = (opts->x_target_flags & ~MASK_ARCH) | SELECT_SH5_COMPACT_NOFPU; return true; default: -- 2.30.2