annotate gcc/common/config/arc/arc-common.c @ 145:1830386684a0

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