]> git.ipfire.org Git - thirdparty/gcc.git/blame - gcc/common/config/sh/sh-common.c
Update copyright years.
[thirdparty/gcc.git] / gcc / common / config / sh / sh-common.c
CommitLineData
677f3fa8 1/* Common hooks for Renesas / SuperH SH.
85ec4feb 2 Copyright (C) 1993-2018 Free Software Foundation, Inc.
677f3fa8
JM
3
4This file is part of GCC.
5
6GCC is free software; you can redistribute it and/or modify
7it under the terms of the GNU General Public License as published by
8the Free Software Foundation; either version 3, or (at your option)
9any later version.
10
11GCC is distributed in the hope that it will be useful,
12but WITHOUT ANY WARRANTY; without even the implied warranty of
13MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14GNU General Public License for more details.
15
16You should have received a copy of the GNU General Public License
17along 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 "tm.h"
24#include "common/common-target.h"
25#include "common/common-target-def.h"
26#include "opts.h"
27#include "flags.h"
4c77620d 28#include "params.h"
677f3fa8
JM
29
30/* Set default optimization options. */
31static const struct default_options sh_option_optimization_table[] =
32 {
677f3fa8
JM
33 { OPT_LEVELS_SIZE, OPT_mdiv_, SH_DIV_STR_FOR_SIZE, 1 },
34 { OPT_LEVELS_0_ONLY, OPT_mdiv_, "", 1 },
677f3fa8
JM
35 { OPT_LEVELS_NONE, 0, NULL, 0 }
36 };
37
38/* Implement TARGET_HANDLE_OPTION. */
39
40static bool
41sh_handle_option (struct gcc_options *opts,
42 struct gcc_options *opts_set ATTRIBUTE_UNUSED,
43 const struct cl_decoded_option *decoded,
44 location_t loc ATTRIBUTE_UNUSED)
45{
46 size_t code = decoded->opt_index;
47
48 switch (code)
49 {
50 case OPT_m1:
51 opts->x_target_flags = (opts->x_target_flags & ~MASK_ARCH) | SELECT_SH1;
52 return true;
53
54 case OPT_m2:
55 opts->x_target_flags = (opts->x_target_flags & ~MASK_ARCH) | SELECT_SH2;
56 return true;
57
58 case OPT_m2a:
59 opts->x_target_flags = (opts->x_target_flags & ~MASK_ARCH) | SELECT_SH2A;
60 return true;
61
62 case OPT_m2a_nofpu:
63 opts->x_target_flags
64 = (opts->x_target_flags & ~MASK_ARCH) | SELECT_SH2A_NOFPU;
65 return true;
66
67 case OPT_m2a_single:
68 opts->x_target_flags
69 = (opts->x_target_flags & ~MASK_ARCH) | SELECT_SH2A_SINGLE;
70 return true;
71
72 case OPT_m2a_single_only:
73 opts->x_target_flags
74 = (opts->x_target_flags & ~MASK_ARCH) | SELECT_SH2A_SINGLE_ONLY;
75 return true;
76
77 case OPT_m2e:
78 opts->x_target_flags = (opts->x_target_flags & ~MASK_ARCH) | SELECT_SH2E;
79 return true;
80
81 case OPT_m3:
82 opts->x_target_flags = (opts->x_target_flags & ~MASK_ARCH) | SELECT_SH3;
83 return true;
84
85 case OPT_m3e:
86 opts->x_target_flags = (opts->x_target_flags & ~MASK_ARCH) | SELECT_SH3E;
87 return true;
88
89 case OPT_m4:
90 case OPT_m4_100:
91 case OPT_m4_200:
92 case OPT_m4_300:
93 opts->x_target_flags = (opts->x_target_flags & ~MASK_ARCH) | SELECT_SH4;
94 return true;
95
96 case OPT_m4_nofpu:
97 case OPT_m4_100_nofpu:
98 case OPT_m4_200_nofpu:
99 case OPT_m4_300_nofpu:
100 case OPT_m4_340:
101 case OPT_m4_400:
102 case OPT_m4_500:
103 opts->x_target_flags
104 = (opts->x_target_flags & ~MASK_ARCH) | SELECT_SH4_NOFPU;
105 return true;
106
107 case OPT_m4_single:
108 case OPT_m4_100_single:
109 case OPT_m4_200_single:
110 case OPT_m4_300_single:
111 opts->x_target_flags
112 = (opts->x_target_flags & ~MASK_ARCH) | SELECT_SH4_SINGLE;
113 return true;
114
115 case OPT_m4_single_only:
116 case OPT_m4_100_single_only:
117 case OPT_m4_200_single_only:
118 case OPT_m4_300_single_only:
119 opts->x_target_flags
120 = (opts->x_target_flags & ~MASK_ARCH) | SELECT_SH4_SINGLE_ONLY;
121 return true;
122
123 case OPT_m4a:
124 opts->x_target_flags = (opts->x_target_flags & ~MASK_ARCH) | SELECT_SH4A;
125 return true;
126
127 case OPT_m4a_nofpu:
128 case OPT_m4al:
129 opts->x_target_flags
130 = (opts->x_target_flags & ~MASK_ARCH) | SELECT_SH4A_NOFPU;
131 return true;
132
133 case OPT_m4a_single:
134 opts->x_target_flags
135 = (opts->x_target_flags & ~MASK_ARCH) | SELECT_SH4A_SINGLE;
136 return true;
137
138 case OPT_m4a_single_only:
139 opts->x_target_flags
140 = (opts->x_target_flags & ~MASK_ARCH) | SELECT_SH4A_SINGLE_ONLY;
141 return true;
142
677f3fa8
JM
143 default:
144 return true;
145 }
146}
147
4c77620d
JM
148/* Implement TARGET_OPTION_DEFAULT_PARAMS. */
149static void
150sh_option_default_params (void)
151{
152 set_default_param_value (PARAM_SIMULTANEOUS_PREFETCHES, 2);
153}
154
677f3fa8
JM
155#undef TARGET_OPTION_OPTIMIZATION_TABLE
156#define TARGET_OPTION_OPTIMIZATION_TABLE sh_option_optimization_table
4c77620d
JM
157#undef TARGET_OPTION_DEFAULT_PARAMS
158#define TARGET_OPTION_DEFAULT_PARAMS sh_option_default_params
677f3fa8
JM
159#undef TARGET_DEFAULT_TARGET_FLAGS
160#define TARGET_DEFAULT_TARGET_FLAGS TARGET_DEFAULT
161#undef TARGET_HANDLE_OPTION
162#define TARGET_HANDLE_OPTION sh_handle_option
163
164struct gcc_targetm_common targetm_common = TARGETM_COMMON_INITIALIZER;