1 /* Common hooks for Synopsys DesignWare ARC
2 Copyright (C) 1994-2017 Free Software Foundation, Inc.
3 Contributor: Joern Rennecke <joern.rennecke@embecosm.com>
4 on behalf of Synopsys Inc.
5 Claudiu Zissulescu <Claudiu.Zissulescu@synopsys.com>
7 This file is part of GCC.
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)
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.
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/>. */
25 #include "coretypes.h"
26 #include "diagnostic-core.h"
28 #include "common/common-target.h"
33 arc_option_init_struct (struct gcc_options
*opts
)
35 opts
->x_flag_no_common
= 255; /* Mark as not user-initialized. */
37 /* Which cpu we're compiling for (ARC600, ARC601, ARC700, ARCv2). */
38 arc_cpu
= PROCESSOR_NONE
;
41 /* Set default optimization options. */
42 /* The conditions are incomplete, so we rely on the evaluation order here,
43 which goes from first to last, i.e. the last match prevails. */
44 /* ??? But this trick only works for reject_negative options. Approximate
45 missing option combination. */
46 #define OPT_LEVELS_3_PLUS_SPEED_ONLY OPT_LEVELS_3_PLUS
47 static const struct default_options arc_option_optimization_table
[] =
49 { OPT_LEVELS_SIZE
, OPT_fsection_anchors
, NULL
, 1 },
50 { OPT_LEVELS_ALL
, OPT_mRcq
, NULL
, 1 },
51 { OPT_LEVELS_ALL
, OPT_mRcw
, NULL
, 1 },
52 { OPT_LEVELS_ALL
, OPT_msize_level_
, NULL
, 1 },
53 { OPT_LEVELS_3_PLUS_SPEED_ONLY
, OPT_msize_level_
, NULL
, 0 },
54 { OPT_LEVELS_SIZE
, OPT_msize_level_
, NULL
, 3 },
55 { OPT_LEVELS_3_PLUS_SPEED_ONLY
, OPT_malign_call
, NULL
, 1 },
56 { OPT_LEVELS_ALL
, OPT_mearly_cbranchsi
, NULL
, 1 },
57 { OPT_LEVELS_ALL
, OPT_mbbit_peephole
, NULL
, 1 },
58 { OPT_LEVELS_SIZE
, OPT_mq_class
, NULL
, 1 },
59 { OPT_LEVELS_SIZE
, OPT_mcase_vector_pcrel
, NULL
, 1 },
60 { OPT_LEVELS_NONE
, 0, NULL
, 0 }
63 /* Process options. */
65 arc_handle_option (struct gcc_options
*opts
,
66 struct gcc_options
*opts_set ATTRIBUTE_UNUSED
,
67 const struct cl_decoded_option
*decoded
,
70 size_t code
= decoded
->opt_index
;
71 int value
= decoded
->value
;
72 static int mcpu_seen
= PROCESSOR_NONE
;
77 /* N.B., at this point arc_cpu has already been set to its new value by
78 our caller, so comparing arc_cpu with PROCESSOR_NONE is pointless. */
80 if (mcpu_seen
!= PROCESSOR_NONE
&& mcpu_seen
!= value
)
81 warning_at (loc
, 0, "multiple -mcpu= options specified.");
85 case OPT_mmpy_option_
:
86 if (opts
->x_arc_mpy_option
== 1)
87 warning_at (loc
, 0, "Unsupported value for mmpy-option");
97 #undef TARGET_OPTION_INIT_STRUCT
98 #define TARGET_OPTION_INIT_STRUCT arc_option_init_struct
100 #undef TARGET_OPTION_OPTIMIZATION_TABLE
101 #define TARGET_OPTION_OPTIMIZATION_TABLE arc_option_optimization_table
103 #define DEFAULT_NO_SDATA (TARGET_SDATA_DEFAULT ? 0 : MASK_NO_SDATA_SET)
105 #undef TARGET_DEFAULT_TARGET_FLAGS
106 #define TARGET_DEFAULT_TARGET_FLAGS (DEFAULT_NO_SDATA | MASK_VOLATILE_CACHE_SET)
108 #undef TARGET_HANDLE_OPTION
109 #define TARGET_HANDLE_OPTION arc_handle_option
111 #include "common/common-target-def.h"
113 struct gcc_targetm_common targetm_common
= TARGETM_COMMON_INITIALIZER
;