1 /* Common hooks for IA64.
2    Copyright (C) 1999-2019 Free Software Foundation, Inc.
3 
4 This file is part of GCC.
5 
6 GCC is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 3, or (at your option)
9 any later version.
10 
11 GCC is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14 GNU General Public License for more details.
15 
16 You should have received a copy of the GNU General Public License
17 along 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 "diagnostic-core.h"
24 #include "tm.h"
25 #include "memmodel.h"
26 #include "tm_p.h"
27 #include "common/common-target.h"
28 #include "common/common-target-def.h"
29 #include "opts.h"
30 #include "flags.h"
31 #include "params.h"
32 
33 /* Implement overriding of the optimization options.  */
34 static const struct default_options ia64_option_optimization_table[] =
35   {
36 #ifdef SUBTARGET_OPTIMIZATION_OPTIONS
37     SUBTARGET_OPTIMIZATION_OPTIONS,
38 #endif
39     { OPT_LEVELS_NONE, 0, NULL, 0 }
40   };
41 
42 /* Implement TARGET_HANDLE_OPTION.  */
43 
44 static bool
ia64_handle_option(struct gcc_options * opts ATTRIBUTE_UNUSED,struct gcc_options * opts_set ATTRIBUTE_UNUSED,const struct cl_decoded_option * decoded,location_t loc)45 ia64_handle_option (struct gcc_options *opts ATTRIBUTE_UNUSED,
46 		    struct gcc_options *opts_set ATTRIBUTE_UNUSED,
47 		    const struct cl_decoded_option *decoded,
48 		    location_t loc)
49 {
50   size_t code = decoded->opt_index;
51   const char *arg = decoded->arg;
52   int value = decoded->value;
53 
54   switch (code)
55     {
56     case OPT_mtls_size_:
57       if (value != 14 && value != 22 && value != 64)
58 	error_at (loc, "bad value %<%s%> for %<-mtls-size=%> switch", arg);
59       return true;
60 
61     default:
62       return true;
63     }
64 }
65 
66 /* Implement TARGET_EXCEPT_UNWIND_INFO.  */
67 
68 enum unwind_info_type
ia64_except_unwind_info(struct gcc_options * opts)69 ia64_except_unwind_info (struct gcc_options *opts)
70 {
71   /* Honor the --enable-sjlj-exceptions configure switch.  */
72 #ifdef CONFIG_SJLJ_EXCEPTIONS
73   if (CONFIG_SJLJ_EXCEPTIONS)
74     return UI_SJLJ;
75 #endif
76 
77   /* For simplicity elsewhere in this file, indicate that all unwind
78      info is disabled if we're not emitting unwind tables.  */
79   if (!opts->x_flag_exceptions && !opts->x_flag_unwind_tables)
80     return UI_NONE;
81 
82   return UI_TARGET;
83 }
84 
85 /* Implement TARGET_OPTION_DEFAULT_PARAMS.  */
86 
87 static void
ia64_option_default_params(void)88 ia64_option_default_params (void)
89 {
90   /* Let the scheduler form additional regions.  */
91   set_default_param_value (PARAM_MAX_SCHED_EXTEND_REGIONS_ITERS, 2);
92 
93   /* Set the default values for cache-related parameters.  */
94   set_default_param_value (PARAM_SIMULTANEOUS_PREFETCHES, 6);
95   set_default_param_value (PARAM_L1_CACHE_LINE_SIZE, 32);
96 
97   set_default_param_value (PARAM_SCHED_MEM_TRUE_DEP_COST, 4);
98 }
99 
100 #undef TARGET_OPTION_OPTIMIZATION_TABLE
101 #define TARGET_OPTION_OPTIMIZATION_TABLE ia64_option_optimization_table
102 #undef TARGET_OPTION_DEFAULT_PARAMS
103 #define TARGET_OPTION_DEFAULT_PARAMS ia64_option_default_params
104 
105 #undef TARGET_EXCEPT_UNWIND_INFO
106 #define TARGET_EXCEPT_UNWIND_INFO  ia64_except_unwind_info
107 
108 #undef TARGET_DEFAULT_TARGET_FLAGS
109 #define TARGET_DEFAULT_TARGET_FLAGS (TARGET_DEFAULT | TARGET_CPU_DEFAULT)
110 #undef TARGET_HANDLE_OPTION
111 #define TARGET_HANDLE_OPTION ia64_handle_option
112 
113 struct gcc_targetm_common targetm_common = TARGETM_COMMON_INITIALIZER;
114