1 /* Common hooks for NEC V850 series.
2 Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
3 2006, 2007, 2008, 2009, 2010, 2011 Free Software Foundation, Inc.
5 This file is part of GCC.
7 GCC is free software; you can redistribute it and/or modify it
8 under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 3, or (at your option)
12 GCC is distributed in the hope that it will be useful, but WITHOUT
13 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
14 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
17 You should have received a copy of the GNU General Public License
18 along with GCC; see the file COPYING3. If not see
19 <http://www.gnu.org/licenses/>. */
23 #include "coretypes.h"
24 #include "diagnostic-core.h"
26 #include "common/common-target.h"
27 #include "common/common-target-def.h"
31 /* Information about the various small memory areas. */
32 static const int small_memory_physical_max
[(int) SMALL_MEMORY_max
] =
39 /* Set the maximum size of small memory area TYPE to the value given
40 by SIZE in structure OPTS (option text OPT passed at location LOC). */
43 v850_handle_memory_option (enum small_memory_type type
,
44 struct gcc_options
*opts
, const char *opt
,
45 int size
, location_t loc
)
47 if (size
> small_memory_physical_max
[type
])
48 error_at (loc
, "value passed in %qs is too large", opt
);
50 opts
->x_small_memory_max
[type
] = size
;
53 /* Implement TARGET_HANDLE_OPTION. */
56 v850_handle_option (struct gcc_options
*opts
,
57 struct gcc_options
*opts_set ATTRIBUTE_UNUSED
,
58 const struct cl_decoded_option
*decoded
,
61 size_t code
= decoded
->opt_index
;
62 int value
= decoded
->value
;
67 opts
->x_target_flags
|= MASK_EP
| MASK_PROLOG_FUNCTION
;
71 opts
->x_target_flags
&= ~(MASK_CPU
^ MASK_V850
);
77 opts
->x_target_flags
&= ~(MASK_CPU
^ MASK_V850E
);
81 opts
->x_target_flags
&= ~(MASK_CPU
^ MASK_V850E2
);
85 opts
->x_target_flags
&= ~(MASK_CPU
^ MASK_V850E2V3
);
89 v850_handle_memory_option (SMALL_MEMORY_TDA
, opts
,
90 decoded
->orig_option_with_args_text
,
95 v850_handle_memory_option (SMALL_MEMORY_SDA
, opts
,
96 decoded
->orig_option_with_args_text
,
101 v850_handle_memory_option (SMALL_MEMORY_ZDA
, opts
,
102 decoded
->orig_option_with_args_text
,
111 /* Implement TARGET_OPTION_OPTIMIZATION_TABLE. */
113 static const struct default_options v850_option_optimization_table
[] =
115 { OPT_LEVELS_1_PLUS
, OPT_fomit_frame_pointer
, NULL
, 1 },
116 /* Note - we no longer enable MASK_EP when optimizing. This is
117 because of a hardware bug which stops the SLD and SST instructions
118 from correctly detecting some hazards. If the user is sure that
119 their hardware is fixed or that their program will not encounter
120 the conditions that trigger the bug then they can enable -mep by
122 { OPT_LEVELS_1_PLUS
, OPT_mprolog_function
, NULL
, 1 },
123 { OPT_LEVELS_NONE
, 0, NULL
, 0 }
126 #undef TARGET_DEFAULT_TARGET_FLAGS
127 #define TARGET_DEFAULT_TARGET_FLAGS (MASK_DEFAULT | MASK_APP_REGS)
128 #undef TARGET_HANDLE_OPTION
129 #define TARGET_HANDLE_OPTION v850_handle_option
130 #undef TARGET_OPTION_OPTIMIZATION_TABLE
131 #define TARGET_OPTION_OPTIMIZATION_TABLE v850_option_optimization_table
133 struct gcc_targetm_common targetm_common
= TARGETM_COMMON_INITIALIZER
;