summaryrefslogtreecommitdiff
path: root/gcc/opts-global.c
diff options
context:
space:
mode:
authorJoseph Myers <joseph@codesourcery.com>2010-11-19 13:25:39 +0000
committerJoseph Myers <jsm28@gcc.gnu.org>2010-11-19 13:25:39 +0000
commit21bf1558203226d4191d93a0b110b46611782f72 (patch)
treef12b65b217fce54841d0387e6cafc7b704994c38 /gcc/opts-global.c
parent3be0ac864a1e360076605c24c39387f0b97bdf0c (diff)
downloadgcc-21bf1558203226d4191d93a0b110b46611782f72.tar.gz
options.texi (Var): Document effects of Defer.
* doc/options.texi (Var): Document effects of Defer. (Defer): Document. * opt-functions.awk (var_type, var_set): Handle deferred options. * opts-common.c (set_option): Handle CLVC_DEFER. * common.opt (fcall-saved-, fcall-used-, fdump-, ffixed-, fplugin=, fplugin-arg-, fstack-limit, fstack-limit-register=, fstack-limit-symbol=): Mark as deferred. * opts.c: Don't include rtl.h, ggc.h, output.h, tree-pass.h or plugin.h. (print_filtered_help): Don't report state of CLVC_DEFER options. (common_handle_option): Move code for OPT_fcall_used_, OPT_fcall_saved_, OPT_fdump_, OPT_ffixed_, OPT_fplugin_, OPT_fplugin_arg_, OPT_fstack_limit, OPT_fstack_limit_register_ and OPT_fstack_limit_symbol_ to opts-global.c. (option_enabled, get_option_state): Handle CLVC_DEFER. * opts.h: Include vec.h. (enum cl_var_type): Add CLVC_DEFER. (cl_deferred_option): Define type and vectors. (handle_common_deferred_options): Declare. * opts-global.c: New. * toplev.c (toplev_main): Call handle_common_deferred_options * Makefile.in (OPTS_H): Include $(VEC_H). (OBJS-common): Include opts-global.o. (opts.o): Update dependencies. (opts-global.o): Add dependencies. From-SVN: r166942
Diffstat (limited to 'gcc/opts-global.c')
-rw-r--r--gcc/opts-global.c105
1 files changed, 105 insertions, 0 deletions
diff --git a/gcc/opts-global.c b/gcc/opts-global.c
new file mode 100644
index 00000000000..e4e62dbc36f
--- /dev/null
+++ b/gcc/opts-global.c
@@ -0,0 +1,105 @@
+/* Command line option handling. Code involving global state that
+ should not be shared with the driver.
+ Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010
+ Free Software Foundation, Inc.
+
+This file is part of GCC.
+
+GCC is free software; you can redistribute it and/or modify it under
+the terms of the GNU General Public License as published by the Free
+Software Foundation; either version 3, or (at your option) any later
+version.
+
+GCC is distributed in the hope that it will be useful, but WITHOUT ANY
+WARRANTY; without even the implied warranty of MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+for more details.
+
+You should have received a copy of the GNU General Public License
+along with GCC; see the file COPYING3. If not see
+<http://www.gnu.org/licenses/>. */
+
+#include "config.h"
+#include "system.h"
+#include "coretypes.h"
+#include "diagnostic-core.h"
+#include "opts.h"
+#include "flags.h"
+#include "ggc.h"
+#include "tm.h" /* Required by rtl.h. */
+#include "rtl.h"
+#include "output.h"
+#include "plugin.h"
+#include "tree-pass.h"
+
+void
+handle_common_deferred_options (void)
+{
+ unsigned int i;
+ cl_deferred_option *opt;
+ VEC(cl_deferred_option,heap) *vec
+ = (VEC(cl_deferred_option,heap) *) common_deferred_options;
+
+ FOR_EACH_VEC_ELT (cl_deferred_option, vec, i, opt)
+ {
+ switch (opt->opt_index)
+ {
+ case OPT_fcall_used_:
+ fix_register (opt->arg, 0, 1);
+ break;
+
+ case OPT_fcall_saved_:
+ fix_register (opt->arg, 0, 0);
+ break;
+
+ case OPT_fdump_:
+ if (!dump_switch_p (opt->arg))
+ error ("unrecognized command line option %<-fdump-%s%>", opt->arg);
+ break;
+
+ case OPT_ffixed_:
+ /* Deferred. */
+ fix_register (opt->arg, 1, 1);
+ break;
+
+ case OPT_fplugin_:
+#ifdef ENABLE_PLUGIN
+ add_new_plugin (opt->arg);
+#else
+ error ("plugin support is disabled; configure with --enable-plugin");
+#endif
+ break;
+
+ case OPT_fplugin_arg_:
+#ifdef ENABLE_PLUGIN
+ parse_plugin_arg_opt (opt->arg);
+#else
+ error ("plugin support is disabled; configure with --enable-plugin");
+#endif
+ break;
+
+ case OPT_fstack_limit:
+ /* The real switch is -fno-stack-limit. */
+ gcc_assert (!opt->value);
+ stack_limit_rtx = NULL_RTX;
+ break;
+
+ case OPT_fstack_limit_register_:
+ {
+ int reg = decode_reg_name (opt->arg);
+ if (reg < 0)
+ error ("unrecognized register name %qs", opt->arg);
+ else
+ stack_limit_rtx = gen_rtx_REG (Pmode, reg);
+ }
+ break;
+
+ case OPT_fstack_limit_symbol_:
+ stack_limit_rtx = gen_rtx_SYMBOL_REF (Pmode, ggc_strdup (opt->arg));
+ break;
+
+ default:
+ gcc_unreachable ();
+ }
+ }
+}