From dd51e35ac7251a9cac90c686790906945ce327d0 Mon Sep 17 00:00:00 2001 From: Joseph Myers Date: Tue, 22 Mar 2011 22:49:06 +0000 Subject: [PATCH] mep.c (option_mtiny_specified): Remove. * config/mep/mep.c (option_mtiny_specified): Remove. (mep_option_override): Move register handling for -mivc2 from mep_handle_option. Use global_options_set.x_mep_tiny_cutoff instead of option_mtiny_specified. (mep_handle_option): Access target_flags via opts pointer. Don't assert that global structures are in use. Defer part of -mivc2 handling and move it to mep_option_override. * config/mep/mep.opt (IVC2): New Mask entry. (mivc2): Use Var and Defer instead of Mask. From-SVN: r171328 --- gcc/ChangeLog | 12 ++++ gcc/config/mep/mep.c | 124 ++++++++++++++++++++++------------------- gcc/config/mep/mep.opt | 6 +- 3 files changed, 83 insertions(+), 59 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 965bd3b8811..522d016cbe4 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,15 @@ +2011-03-22 Joseph Myers + + * config/mep/mep.c (option_mtiny_specified): Remove. + (mep_option_override): Move register handling for -mivc2 from + mep_handle_option. Use global_options_set.x_mep_tiny_cutoff + instead of option_mtiny_specified. + (mep_handle_option): Access target_flags via opts pointer. Don't + assert that global structures are in use. Defer part of -mivc2 + handling and move it to mep_option_override. + * config/mep/mep.opt (IVC2): New Mask entry. + (mivc2): Use Var and Defer instead of Mask. + 2011-03-22 Joseph Myers * config/v850/v850-opts.h: New. diff --git a/gcc/config/mep/mep.c b/gcc/config/mep/mep.c index 1d75777eb18..02c825ad763 100644 --- a/gcc/config/mep/mep.c +++ b/gcc/config/mep/mep.c @@ -268,8 +268,6 @@ static const int mep_cmov_insns[] = { mep_cor3 }; -static int option_mtiny_specified = 0; - static void mep_set_leaf_registers (int enable) @@ -316,6 +314,58 @@ static const struct default_options mep_option_optimization_table[] = static void mep_option_override (void) { + unsigned int i; + int j; + cl_deferred_option *opt; + VEC(cl_deferred_option,heap) *vec + = (VEC(cl_deferred_option,heap) *) mep_deferred_options; + + FOR_EACH_VEC_ELT (cl_deferred_option, vec, i, opt) + { + switch (opt->opt_index) + { + case OPT_mivc2: + for (j = 0; j < 32; j++) + fixed_regs[j + 48] = 0; + for (j = 0; j < 32; j++) + call_used_regs[j + 48] = 1; + for (j = 6; j < 8; j++) + call_used_regs[j + 48] = 0; + +#define RN(n,s) reg_names[FIRST_CCR_REGNO + n] = s + RN (0, "$csar0"); + RN (1, "$cc"); + RN (4, "$cofr0"); + RN (5, "$cofr1"); + RN (6, "$cofa0"); + RN (7, "$cofa1"); + RN (15, "$csar1"); + + RN (16, "$acc0_0"); + RN (17, "$acc0_1"); + RN (18, "$acc0_2"); + RN (19, "$acc0_3"); + RN (20, "$acc0_4"); + RN (21, "$acc0_5"); + RN (22, "$acc0_6"); + RN (23, "$acc0_7"); + + RN (24, "$acc1_0"); + RN (25, "$acc1_1"); + RN (26, "$acc1_2"); + RN (27, "$acc1_3"); + RN (28, "$acc1_4"); + RN (29, "$acc1_5"); + RN (30, "$acc1_6"); + RN (31, "$acc1_7"); +#undef RN + break; + + default: + gcc_unreachable (); + } + } + if (flag_pic == 1) warning (OPT_fpic, "-fpic is not supported"); if (flag_pic == 2) @@ -326,9 +376,9 @@ mep_option_override (void) error ("only one of -ms and -ml may be given"); if (TARGET_M && TARGET_L) error ("only one of -mm and -ml may be given"); - if (TARGET_S && option_mtiny_specified) + if (TARGET_S && global_options_set.x_mep_tiny_cutoff) error ("only one of -ms and -mtiny= may be given"); - if (TARGET_M && option_mtiny_specified) + if (TARGET_M && global_options_set.x_mep_tiny_cutoff) error ("only one of -mm and -mtiny= may be given"); if (TARGET_OPT_CLIP && ! TARGET_OPT_MINMAX) warning (0, "-mclip currently has no effect without -mminmax"); @@ -345,7 +395,7 @@ mep_option_override (void) mep_tiny_cutoff = 65536; if (TARGET_M) mep_tiny_cutoff = 0; - if (TARGET_L && ! option_mtiny_specified) + if (TARGET_L && ! global_options_set.x_mep_tiny_cutoff) mep_tiny_cutoff = 0; if (TARGET_64BIT_CR_REGS) @@ -7260,76 +7310,36 @@ mep_address_cost (rtx addr ATTRIBUTE_UNUSED, bool ATTRIBUTE_UNUSED speed_p) } static bool -mep_handle_option (struct gcc_options *opts, struct gcc_options *opts_set, +mep_handle_option (struct gcc_options *opts, + struct gcc_options *opts_set ATTRIBUTE_UNUSED, const struct cl_decoded_option *decoded, location_t loc ATTRIBUTE_UNUSED) { - int i; size_t code = decoded->opt_index; - gcc_assert (opts == &global_options); - gcc_assert (opts_set == &global_options_set); - switch (code) { case OPT_mall_opts: - target_flags |= MEP_ALL_OPTS; + opts->x_target_flags |= MEP_ALL_OPTS; break; case OPT_mno_opts: - target_flags &= ~ MEP_ALL_OPTS; + opts->x_target_flags &= ~ MEP_ALL_OPTS; break; case OPT_mcop64: - target_flags |= MASK_COP; - target_flags |= MASK_64BIT_CR_REGS; + opts->x_target_flags |= MASK_COP; + opts->x_target_flags |= MASK_64BIT_CR_REGS; break; - case OPT_mtiny_: - option_mtiny_specified = 1; - case OPT_mivc2: - target_flags |= MASK_COP; - target_flags |= MASK_64BIT_CR_REGS; - target_flags |= MASK_VLIW; - target_flags |= MASK_OPT_VL64; - target_flags |= MASK_IVC2; - - for (i=0; i<32; i++) - fixed_regs[i+48] = 0; - for (i=0; i<32; i++) - call_used_regs[i+48] = 1; - for (i=6; i<8; i++) - call_used_regs[i+48] = 0; - -#define RN(n,s) reg_names[FIRST_CCR_REGNO + n] = s - RN (0, "$csar0"); - RN (1, "$cc"); - RN (4, "$cofr0"); - RN (5, "$cofr1"); - RN (6, "$cofa0"); - RN (7, "$cofa1"); - RN (15, "$csar1"); - - RN (16, "$acc0_0"); - RN (17, "$acc0_1"); - RN (18, "$acc0_2"); - RN (19, "$acc0_3"); - RN (20, "$acc0_4"); - RN (21, "$acc0_5"); - RN (22, "$acc0_6"); - RN (23, "$acc0_7"); - - RN (24, "$acc1_0"); - RN (25, "$acc1_1"); - RN (26, "$acc1_2"); - RN (27, "$acc1_3"); - RN (28, "$acc1_4"); - RN (29, "$acc1_5"); - RN (30, "$acc1_6"); - RN (31, "$acc1_7"); -#undef RN + opts->x_target_flags |= MASK_COP; + opts->x_target_flags |= MASK_64BIT_CR_REGS; + opts->x_target_flags |= MASK_VLIW; + opts->x_target_flags |= MASK_OPT_VL64; + opts->x_target_flags |= MASK_IVC2; + /* Remaining handling of this option deferred. */ break; default: diff --git a/gcc/config/mep/mep.opt b/gcc/config/mep/mep.opt index 9670d3b4f68..38b8f80527b 100644 --- a/gcc/config/mep/mep.opt +++ b/gcc/config/mep/mep.opt @@ -1,5 +1,5 @@ ; Target specific command line options for the MEP port of the compiler. -; Copyright (C) 2005, 2007, 2009, 2010 Free Software Foundation, Inc. +; Copyright (C) 2005, 2007, 2009, 2010, 2011 Free Software Foundation, Inc. ; Contributed by Red Hat Inc. ; ; GCC is free software; you can redistribute it and/or modify it under @@ -16,6 +16,8 @@ ; along with GCC; see the file COPYING3. If not see ; . */ +Mask(IVC2) + mabsdiff Target Mask(OPT_ABSDIFF) Enable absolute difference instructions @@ -61,7 +63,7 @@ Target Mask(64BIT_CR_REGS) RejectNegative Enable MeP Coprocessor with 64-bit registers mivc2 -Target Mask(IVC2) RejectNegative +Target RejectNegative Var(mep_deferred_options) Defer Enable IVC2 scheduling mdc -- 2.30.2