946c93a499bbaa2da4558ec16b9dde3e8c17930b
[platform/upstream/gcc48.git] / gcc / common / config / rx / rx-common.c
1 /* Common hooks for Renesas RX.
2    Copyright (C) 2008-2013 Free Software Foundation, Inc.
3
4    This file is part of GCC.
5
6    GCC is free software; you can redistribute it and/or modify
7    it under the terms of the GNU General Public License as published by
8    the Free Software Foundation; either version 3, or (at your option)
9    any later version.
10
11    GCC is distributed in the hope that it will be useful,
12    but WITHOUT ANY WARRANTY; without even the implied warranty of
13    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14    GNU General Public License for more details.
15
16    You should have received a copy of the GNU General Public License
17    along with GCC; see the file COPYING3.  If not see
18    <http://www.gnu.org/licenses/>.  */
19
20 #include "config.h"
21 #include "system.h"
22 #include "coretypes.h"
23 #include "diagnostic-core.h"
24 #include "tm.h"
25 #include "common/common-target.h"
26 #include "common/common-target-def.h"
27 #include "opts.h"
28 #include "flags.h"
29
30 /* Extra processing for target specific command line options.  */
31
32 static bool
33 rx_handle_option (struct gcc_options *opts,
34                   struct gcc_options *opts_set ATTRIBUTE_UNUSED,
35                   const struct cl_decoded_option *decoded,
36                   location_t loc)
37 {
38   size_t code = decoded->opt_index;
39   int value = decoded->value;
40
41   switch (code)
42     {
43     case OPT_mint_register_:
44       /* Make sure that the -mint-register option is in range.  Other
45          handling in rx_option_override.  */
46       return value >= 0 && value <= 4;
47       break;
48
49     case OPT_mmax_constant_size_:
50       /* Make sure that the -mmax-constant_size option is in range.  */
51       return value >= 0 && value <= 4;
52
53     case OPT_mcpu_:
54       if ((enum rx_cpu_types) value == RX200)
55         opts->x_target_flags |= MASK_NO_USE_FPU;
56       break;
57       
58     case OPT_fpu:
59       if (opts->x_rx_cpu_type == RX200)
60         error_at (loc, "the RX200 cpu does not have FPU hardware");
61       break;
62
63     default:
64       break;
65     }
66
67   return true;
68 }
69
70 /* Implement TARGET_OPTION_OPTIMIZATION_TABLE.  */
71 static const struct default_options rx_option_optimization_table[] =
72   {
73     { OPT_LEVELS_1_PLUS, OPT_fomit_frame_pointer, NULL, 1 },
74     { OPT_LEVELS_NONE, 0, NULL, 0 }
75   };
76
77 #undef  TARGET_HANDLE_OPTION
78 #define TARGET_HANDLE_OPTION                    rx_handle_option
79
80 #undef  TARGET_OPTION_OPTIMIZATION_TABLE
81 #define TARGET_OPTION_OPTIMIZATION_TABLE        rx_option_optimization_table
82
83 #undef  TARGET_EXCEPT_UNWIND_INFO
84 #define TARGET_EXCEPT_UNWIND_INFO               sjlj_except_unwind_info
85
86 struct gcc_targetm_common targetm_common = TARGETM_COMMON_INITIALIZER;