1 /* Common hooks for IA64.
2    Copyright (C) 1999-2021 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 
32 /* Implement overriding of the optimization options.  */
33 static const struct default_options ia64_option_optimization_table[] =
34   {
35 #ifdef SUBTARGET_OPTIMIZATION_OPTIONS
36     SUBTARGET_OPTIMIZATION_OPTIONS,
37 #endif
38 
39     /* Let the scheduler form additional regions.  */
40     { OPT_LEVELS_ALL, OPT__param_max_sched_extend_regions_iters_, NULL, 2 },
41       /* Set the default values for cache-related parameters.  */
42     { OPT_LEVELS_ALL, OPT__param_simultaneous_prefetches_, NULL, 6 },
43     { OPT_LEVELS_ALL, OPT__param_l1_cache_line_size_ , NULL, 32},
44     { OPT_LEVELS_ALL, OPT__param_sched_mem_true_dep_cost_, NULL, 4 },
45 
46     { OPT_LEVELS_NONE, 0, NULL, 0 }
47   };
48 
49 /* Implement TARGET_HANDLE_OPTION.  */
50 
51 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)52 ia64_handle_option (struct gcc_options *opts ATTRIBUTE_UNUSED,
53 		    struct gcc_options *opts_set ATTRIBUTE_UNUSED,
54 		    const struct cl_decoded_option *decoded,
55 		    location_t loc)
56 {
57   size_t code = decoded->opt_index;
58   const char *arg = decoded->arg;
59   int value = decoded->value;
60 
61   switch (code)
62     {
63     case OPT_mtls_size_:
64       if (value != 14 && value != 22 && value != 64)
65 	error_at (loc, "bad value %<%s%> for %<-mtls-size=%> switch", arg);
66       return true;
67 
68     default:
69       return true;
70     }
71 }
72 
73 /* Implement TARGET_EXCEPT_UNWIND_INFO.  */
74 
75 enum unwind_info_type
ia64_except_unwind_info(struct gcc_options * opts)76 ia64_except_unwind_info (struct gcc_options *opts)
77 {
78   /* Honor the --enable-sjlj-exceptions configure switch.  */
79 #ifdef CONFIG_SJLJ_EXCEPTIONS
80   if (CONFIG_SJLJ_EXCEPTIONS)
81     return UI_SJLJ;
82 #endif
83 
84   /* For simplicity elsewhere in this file, indicate that all unwind
85      info is disabled if we're not emitting unwind tables.  */
86   if (!opts->x_flag_exceptions && !opts->x_flag_unwind_tables)
87     return UI_NONE;
88 
89   return UI_TARGET;
90 }
91 
92 #undef TARGET_OPTION_OPTIMIZATION_TABLE
93 #define TARGET_OPTION_OPTIMIZATION_TABLE ia64_option_optimization_table
94 
95 #undef TARGET_EXCEPT_UNWIND_INFO
96 #define TARGET_EXCEPT_UNWIND_INFO  ia64_except_unwind_info
97 
98 #undef TARGET_DEFAULT_TARGET_FLAGS
99 #define TARGET_DEFAULT_TARGET_FLAGS (TARGET_DEFAULT | TARGET_CPU_DEFAULT)
100 #undef TARGET_HANDLE_OPTION
101 #define TARGET_HANDLE_OPTION ia64_handle_option
102 
103 struct gcc_targetm_common targetm_common = TARGETM_COMMON_INITIALIZER;
104