Import gcc-4.7.2 to new vendor branch
[dragonfly.git] / contrib / gcc-4.7 / gcc / common / common-targhooks.c
1 /* Default common target hook functions.
2    Copyright (C) 2003, 2004, 2005, 2007, 2008, 2009, 2010, 2011
3    Free Software Foundation, Inc.
4
5 This file is part of GCC.
6
7 GCC is free software; you can redistribute it and/or modify it under
8 the terms of the GNU General Public License as published by the Free
9 Software Foundation; either version 3, or (at your option) any later
10 version.
11
12 GCC is distributed in the hope that it will be useful, but WITHOUT ANY
13 WARRANTY; without even the implied warranty of MERCHANTABILITY or
14 FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
15 for more details.
16
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/>.  */
20
21 #include "config.h"
22 #include "system.h"
23 #include "coretypes.h"
24 #include "input.h"
25 #include "tm.h"
26 #include "common/common-target.h"
27 #include "common/common-targhooks.h"
28
29 /* Determine the exception handling mechanism for the target.  */
30
31 enum unwind_info_type
32 default_except_unwind_info (struct gcc_options *opts ATTRIBUTE_UNUSED)
33 {
34   /* Obey the configure switch to turn on sjlj exceptions.  */
35 #ifdef CONFIG_SJLJ_EXCEPTIONS
36   if (CONFIG_SJLJ_EXCEPTIONS)
37     return UI_SJLJ;
38 #endif
39
40   /* ??? Change all users to the hook, then poison this.  */
41 #ifdef DWARF2_UNWIND_INFO
42   if (DWARF2_UNWIND_INFO)
43     return UI_DWARF2;
44 #endif
45
46   return UI_SJLJ;
47 }
48
49 /* To be used by targets that force dwarf2 unwind enabled.  */
50
51 enum unwind_info_type
52 dwarf2_except_unwind_info (struct gcc_options *opts ATTRIBUTE_UNUSED)
53 {
54   /* Obey the configure switch to turn on sjlj exceptions.  */
55 #ifdef CONFIG_SJLJ_EXCEPTIONS
56   if (CONFIG_SJLJ_EXCEPTIONS)
57     return UI_SJLJ;
58 #endif
59
60   return UI_DWARF2;
61 }
62
63 /* To be used by targets that force sjlj unwind enabled.  */
64
65 enum unwind_info_type
66 sjlj_except_unwind_info (struct gcc_options *opts ATTRIBUTE_UNUSED)
67 {
68   return UI_SJLJ;
69 }
70
71 /* Default version of TARGET_HANDLE_OPTION.  */
72
73 bool
74 default_target_handle_option (struct gcc_options *opts ATTRIBUTE_UNUSED,
75                               struct gcc_options *opts_set ATTRIBUTE_UNUSED,
76                               const struct cl_decoded_option *decoded ATTRIBUTE_UNUSED,
77                               location_t loc ATTRIBUTE_UNUSED)
78 {
79   return true;
80 }
81
82 const struct default_options empty_optimization_table[] =
83   {
84     { OPT_LEVELS_NONE, 0, NULL, 0 }
85   };