OSDN Git Service

e4e62dbc36fcd3e85b58501761f04a2c37cbacd4
[pf3gnuchains/gcc-fork.git] / gcc / opts-global.c
1 /* Command line option handling.  Code involving global state that
2    should not be shared with the driver.
3    Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010
4    Free Software Foundation, Inc.
5
6 This file is part of GCC.
7
8 GCC is free software; you can redistribute it and/or modify it under
9 the terms of the GNU General Public License as published by the Free
10 Software Foundation; either version 3, or (at your option) any later
11 version.
12
13 GCC is distributed in the hope that it will be useful, but WITHOUT ANY
14 WARRANTY; without even the implied warranty of MERCHANTABILITY or
15 FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
16 for more details.
17
18 You should have received a copy of the GNU General Public License
19 along with GCC; see the file COPYING3.  If not see
20 <http://www.gnu.org/licenses/>.  */
21
22 #include "config.h"
23 #include "system.h"
24 #include "coretypes.h"
25 #include "diagnostic-core.h"
26 #include "opts.h"
27 #include "flags.h"
28 #include "ggc.h"
29 #include "tm.h" /* Required by rtl.h.  */
30 #include "rtl.h"
31 #include "output.h"
32 #include "plugin.h"
33 #include "tree-pass.h"
34
35 void
36 handle_common_deferred_options (void)
37 {
38   unsigned int i;
39   cl_deferred_option *opt;
40   VEC(cl_deferred_option,heap) *vec
41     = (VEC(cl_deferred_option,heap) *) common_deferred_options;
42
43   FOR_EACH_VEC_ELT (cl_deferred_option, vec, i, opt)
44     {
45       switch (opt->opt_index)
46         {
47         case OPT_fcall_used_:
48           fix_register (opt->arg, 0, 1);
49           break;
50
51         case OPT_fcall_saved_:
52           fix_register (opt->arg, 0, 0);
53           break;
54
55         case OPT_fdump_:
56           if (!dump_switch_p (opt->arg))
57             error ("unrecognized command line option %<-fdump-%s%>", opt->arg);
58           break;
59
60         case OPT_ffixed_:
61           /* Deferred.  */
62           fix_register (opt->arg, 1, 1);
63           break;
64
65         case OPT_fplugin_:
66 #ifdef ENABLE_PLUGIN
67           add_new_plugin (opt->arg);
68 #else
69           error ("plugin support is disabled; configure with --enable-plugin");
70 #endif
71           break;
72
73         case OPT_fplugin_arg_:
74 #ifdef ENABLE_PLUGIN
75           parse_plugin_arg_opt (opt->arg);
76 #else
77           error ("plugin support is disabled; configure with --enable-plugin");
78 #endif
79           break;
80
81         case OPT_fstack_limit:
82           /* The real switch is -fno-stack-limit.  */
83           gcc_assert (!opt->value);
84           stack_limit_rtx = NULL_RTX;
85           break;
86
87         case OPT_fstack_limit_register_:
88           {
89             int reg = decode_reg_name (opt->arg);
90             if (reg < 0)
91               error ("unrecognized register name %qs", opt->arg);
92             else
93               stack_limit_rtx = gen_rtx_REG (Pmode, reg);
94           }
95           break;
96
97         case OPT_fstack_limit_symbol_:
98           stack_limit_rtx = gen_rtx_SYMBOL_REF (Pmode, ggc_strdup (opt->arg));
99           break;
100
101         default:
102           gcc_unreachable ();
103         }
104     }
105 }