xref: /netbsd-src/external/gpl3/gcc.old/dist/gcc/common/common-targhooks.c (revision 8feb0f0b7eaff0608f8350bbfa3098827b4bb91b)
136ac495dSmrg /* Default common target hook functions.
2*8feb0f0bSmrg    Copyright (C) 2003-2020 Free Software Foundation, Inc.
336ac495dSmrg 
436ac495dSmrg This file is part of GCC.
536ac495dSmrg 
636ac495dSmrg GCC is free software; you can redistribute it and/or modify it under
736ac495dSmrg the terms of the GNU General Public License as published by the Free
836ac495dSmrg Software Foundation; either version 3, or (at your option) any later
936ac495dSmrg version.
1036ac495dSmrg 
1136ac495dSmrg GCC is distributed in the hope that it will be useful, but WITHOUT ANY
1236ac495dSmrg WARRANTY; without even the implied warranty of MERCHANTABILITY or
1336ac495dSmrg FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
1436ac495dSmrg for more details.
1536ac495dSmrg 
1636ac495dSmrg You should have received a copy of the GNU General Public License
1736ac495dSmrg along with GCC; see the file COPYING3.  If not see
1836ac495dSmrg <http://www.gnu.org/licenses/>.  */
1936ac495dSmrg 
2036ac495dSmrg #include "config.h"
2136ac495dSmrg #include "system.h"
2236ac495dSmrg #include "coretypes.h"
2336ac495dSmrg #include "tm.h"
2436ac495dSmrg #include "common/common-target.h"
2536ac495dSmrg #include "common/common-targhooks.h"
26c0a68be4Smrg #include "opts.h"
2736ac495dSmrg 
2836ac495dSmrg /* Determine the exception handling mechanism for the target.  */
2936ac495dSmrg 
3036ac495dSmrg enum unwind_info_type
default_except_unwind_info(struct gcc_options * opts ATTRIBUTE_UNUSED)3136ac495dSmrg default_except_unwind_info (struct gcc_options *opts ATTRIBUTE_UNUSED)
3236ac495dSmrg {
3336ac495dSmrg   /* Obey the configure switch to turn on sjlj exceptions.  */
3436ac495dSmrg #ifdef CONFIG_SJLJ_EXCEPTIONS
3536ac495dSmrg   if (CONFIG_SJLJ_EXCEPTIONS)
3636ac495dSmrg     return UI_SJLJ;
3736ac495dSmrg #endif
3836ac495dSmrg 
3936ac495dSmrg   /* ??? Change all users to the hook, then poison this.  */
4036ac495dSmrg #ifdef DWARF2_UNWIND_INFO
4136ac495dSmrg   if (DWARF2_UNWIND_INFO)
4236ac495dSmrg     return UI_DWARF2;
4336ac495dSmrg #endif
4436ac495dSmrg 
4536ac495dSmrg   return UI_SJLJ;
4636ac495dSmrg }
4736ac495dSmrg 
4836ac495dSmrg /* To be used by targets that force dwarf2 unwind enabled.  */
4936ac495dSmrg 
5036ac495dSmrg enum unwind_info_type
dwarf2_except_unwind_info(struct gcc_options * opts ATTRIBUTE_UNUSED)5136ac495dSmrg dwarf2_except_unwind_info (struct gcc_options *opts ATTRIBUTE_UNUSED)
5236ac495dSmrg {
5336ac495dSmrg   /* Obey the configure switch to turn on sjlj exceptions.  */
5436ac495dSmrg #ifdef CONFIG_SJLJ_EXCEPTIONS
5536ac495dSmrg   if (CONFIG_SJLJ_EXCEPTIONS)
5636ac495dSmrg     return UI_SJLJ;
5736ac495dSmrg #endif
5836ac495dSmrg 
5936ac495dSmrg   return UI_DWARF2;
6036ac495dSmrg }
6136ac495dSmrg 
6236ac495dSmrg /* To be used by targets that force sjlj unwind enabled.  */
6336ac495dSmrg 
6436ac495dSmrg enum unwind_info_type
sjlj_except_unwind_info(struct gcc_options * opts ATTRIBUTE_UNUSED)6536ac495dSmrg sjlj_except_unwind_info (struct gcc_options *opts ATTRIBUTE_UNUSED)
6636ac495dSmrg {
6736ac495dSmrg   return UI_SJLJ;
6836ac495dSmrg }
6936ac495dSmrg 
7036ac495dSmrg /* Default version of TARGET_HANDLE_OPTION.  */
7136ac495dSmrg 
7236ac495dSmrg bool
default_target_handle_option(struct gcc_options * opts ATTRIBUTE_UNUSED,struct gcc_options * opts_set ATTRIBUTE_UNUSED,const struct cl_decoded_option * decoded ATTRIBUTE_UNUSED,location_t loc ATTRIBUTE_UNUSED)7336ac495dSmrg default_target_handle_option (struct gcc_options *opts ATTRIBUTE_UNUSED,
7436ac495dSmrg 			      struct gcc_options *opts_set ATTRIBUTE_UNUSED,
7536ac495dSmrg 			      const struct cl_decoded_option *decoded ATTRIBUTE_UNUSED,
7636ac495dSmrg 			      location_t loc ATTRIBUTE_UNUSED)
7736ac495dSmrg {
7836ac495dSmrg   return true;
7936ac495dSmrg }
8036ac495dSmrg 
81c0a68be4Smrg /* Default version of TARGET_GET_VALID_OPTION_VALUES.  */
82c0a68be4Smrg 
83c0a68be4Smrg vec<const char *>
default_get_valid_option_values(int,const char *)84c0a68be4Smrg default_get_valid_option_values (int, const char *)
85c0a68be4Smrg {
86c0a68be4Smrg   return vec<const char *> ();
87c0a68be4Smrg }
88c0a68be4Smrg 
8936ac495dSmrg const struct default_options empty_optimization_table[] =
9036ac495dSmrg   {
9136ac495dSmrg     { OPT_LEVELS_NONE, 0, NULL, 0 }
9236ac495dSmrg   };
93