]>
Commit | Line | Data |
---|---|---|
526b7aee | 1 | /* Common hooks for Synopsys DesignWare ARC |
83ffe9cd | 2 | Copyright (C) 1994-2023 Free Software Foundation, Inc. |
526b7aee SV |
3 | Contributor: Joern Rennecke <joern.rennecke@embecosm.com> |
4 | on behalf of Synopsys Inc. | |
f9ccf899 | 5 | Claudiu Zissulescu <Claudiu.Zissulescu@synopsys.com> |
526b7aee SV |
6 | |
7 | This file is part of GCC. | |
8 | ||
9 | GCC is free software; you can redistribute it and/or modify | |
10 | it under the terms of the GNU General Public License as published by | |
11 | the Free Software Foundation; either version 3, or (at your option) | |
12 | any later version. | |
13 | ||
14 | GCC is distributed in the hope that it will be useful, | |
15 | but WITHOUT ANY WARRANTY; without even the implied warranty of | |
16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
17 | GNU General Public License for more details. | |
18 | ||
19 | You should have received a copy of the GNU General Public License | |
20 | along with GCC; see the file COPYING3. If not see | |
21 | <http://www.gnu.org/licenses/>. */ | |
22 | ||
23 | #include "config.h" | |
24 | #include "system.h" | |
25 | #include "coretypes.h" | |
26 | #include "diagnostic-core.h" | |
27 | #include "tm.h" | |
28 | #include "common/common-target.h" | |
29 | #include "opts.h" | |
30 | #include "flags.h" | |
31 | ||
32 | static void | |
2d7967a1 | 33 | arc_option_init_struct (struct gcc_options *opts ATTRIBUTE_UNUSED) |
526b7aee | 34 | { |
f50bb868 | 35 | /* Which cpu we're compiling for (ARC600, ARC601, ARC700, ARCv2). */ |
526b7aee SV |
36 | arc_cpu = PROCESSOR_NONE; |
37 | } | |
38 | ||
39 | /* Set default optimization options. */ | |
40 | /* The conditions are incomplete, so we rely on the evaluation order here, | |
41 | which goes from first to last, i.e. the last match prevails. */ | |
42 | /* ??? But this trick only works for reject_negative options. Approximate | |
43 | missing option combination. */ | |
44 | #define OPT_LEVELS_3_PLUS_SPEED_ONLY OPT_LEVELS_3_PLUS | |
45 | static const struct default_options arc_option_optimization_table[] = | |
46 | { | |
526b7aee | 47 | { OPT_LEVELS_ALL, OPT_msize_level_, NULL, 1 }, |
526b7aee SV |
48 | { OPT_LEVELS_ALL, OPT_mearly_cbranchsi, NULL, 1 }, |
49 | { OPT_LEVELS_ALL, OPT_mbbit_peephole, NULL, 1 }, | |
c44fa4a6 CZ |
50 | { OPT_LEVELS_SIZE, OPT_ftree_loop_optimize, NULL, 0}, |
51 | { OPT_LEVELS_SIZE, OPT_fmove_loop_invariants, NULL, 0}, | |
52 | { OPT_LEVELS_SIZE, OPT_fbranch_count_reg, NULL, 0}, | |
53 | { OPT_LEVELS_SIZE, OPT_fdelayed_branch, NULL, 0 }, | |
54 | { OPT_LEVELS_SIZE, OPT_fsection_anchors, NULL, 1 }, | |
526b7aee | 55 | { OPT_LEVELS_SIZE, OPT_mcase_vector_pcrel, NULL, 1 }, |
c44fa4a6 | 56 | { OPT_LEVELS_SIZE, OPT_msize_level_, NULL, 3 }, |
90b48013 | 57 | { OPT_LEVELS_SIZE, OPT_mmillicode, NULL, 1 }, |
ac5e8d2f | 58 | { OPT_LEVELS_SIZE, OPT_fif_conversion, NULL, 0 }, |
c44fa4a6 CZ |
59 | { OPT_LEVELS_1_PLUS, OPT_fomit_frame_pointer, NULL, 1 }, |
60 | { OPT_LEVELS_3_PLUS_SPEED_ONLY, OPT_msize_level_, NULL, 0 }, | |
526b7aee SV |
61 | { OPT_LEVELS_NONE, 0, NULL, 0 } |
62 | }; | |
63 | ||
64 | /* Process options. */ | |
65 | static bool | |
f9ccf899 CZ |
66 | arc_handle_option (struct gcc_options *opts, |
67 | struct gcc_options *opts_set ATTRIBUTE_UNUSED, | |
526b7aee SV |
68 | const struct cl_decoded_option *decoded, |
69 | location_t loc) | |
70 | { | |
71 | size_t code = decoded->opt_index; | |
72 | int value = decoded->value; | |
f9ccf899 | 73 | static int mcpu_seen = PROCESSOR_NONE; |
526b7aee SV |
74 | |
75 | switch (code) | |
76 | { | |
526b7aee SV |
77 | case OPT_mcpu_: |
78 | /* N.B., at this point arc_cpu has already been set to its new value by | |
79 | our caller, so comparing arc_cpu with PROCESSOR_NONE is pointless. */ | |
80 | ||
81 | if (mcpu_seen != PROCESSOR_NONE && mcpu_seen != value) | |
89c94716 | 82 | warning_at (loc, 0, "multiple %<-mcpu=%> options specified"); |
526b7aee | 83 | mcpu_seen = value; |
f50bb868 CZ |
84 | break; |
85 | ||
86 | case OPT_mmpy_option_: | |
f9ccf899 CZ |
87 | if (opts->x_arc_mpy_option == 1) |
88 | warning_at (loc, 0, "Unsupported value for mmpy-option"); | |
89 | break; | |
90 | ||
91 | default: | |
f50bb868 | 92 | break; |
526b7aee SV |
93 | } |
94 | ||
95 | return true; | |
96 | } | |
97 | ||
f9ccf899 | 98 | #undef TARGET_OPTION_INIT_STRUCT |
526b7aee | 99 | #define TARGET_OPTION_INIT_STRUCT arc_option_init_struct |
f9ccf899 CZ |
100 | |
101 | #undef TARGET_OPTION_OPTIMIZATION_TABLE | |
526b7aee | 102 | #define TARGET_OPTION_OPTIMIZATION_TABLE arc_option_optimization_table |
526b7aee SV |
103 | |
104 | #define DEFAULT_NO_SDATA (TARGET_SDATA_DEFAULT ? 0 : MASK_NO_SDATA_SET) | |
105 | ||
f9ccf899 CZ |
106 | #undef TARGET_DEFAULT_TARGET_FLAGS |
107 | #define TARGET_DEFAULT_TARGET_FLAGS (DEFAULT_NO_SDATA | MASK_VOLATILE_CACHE_SET) | |
526b7aee | 108 | |
f9ccf899 CZ |
109 | #undef TARGET_HANDLE_OPTION |
110 | #define TARGET_HANDLE_OPTION arc_handle_option | |
526b7aee SV |
111 | |
112 | #include "common/common-target-def.h" | |
113 | ||
114 | struct gcc_targetm_common targetm_common = TARGETM_COMMON_INITIALIZER; |