(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.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@166942
138bc75d-0d04-0410-961f-
82ee72b054a4
+2010-11-19 Joseph Myers <joseph@codesourcery.com>
+
+ * 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.
+
2010-11-19 Nicola Pero <nicola.pero@meta-innovation.com>
* c-parser.c (c_parser_objc_protocol_definition): Pass attributes
CPPLIB_H = $(srcdir)/../libcpp/include/line-map.h \
$(srcdir)/../libcpp/include/cpplib.h
INPUT_H = $(srcdir)/../libcpp/include/line-map.h input.h
-OPTS_H = $(INPUT_H) opts.h
+OPTS_H = $(INPUT_H) $(VEC_H) opts.h
DECNUM_H = $(DECNUM)/decContext.h $(DECNUM)/decDPD.h $(DECNUM)/decNumber.h \
$(DECNUMFMT)/decimal32.h $(DECNUMFMT)/decimal64.h \
$(DECNUMFMT)/decimal128.h $(DECNUMFMT)/decimal128Local.h
optabs.o \
options.o \
opts-common.o \
+ opts-global.o \
opts.o \
params.o \
passes.o \
diagnostic.o : diagnostic.c $(CONFIG_H) $(SYSTEM_H) coretypes.h \
version.h $(INPUT_H) intl.h $(DIAGNOSTIC_H) diagnostic.def
opts.o : opts.c $(OPTS_H) $(OPTIONS_H) $(TOPLEV_H) $(DIAGNOSTIC_CORE_H) $(CONFIG_H) $(SYSTEM_H) \
- coretypes.h $(TREE_H) $(TM_H) langhooks.h $(GGC_H) $(EXPR_H) $(RTL_H) \
- output.h $(DIAGNOSTIC_H) $(TM_P_H) $(INSN_ATTR_H) intl.h $(TARGET_H) \
- $(FLAGS_H) $(PARAMS_H) $(TREE_PASS_H) $(DBGCNT_H) debug.h \
- $(PLUGIN_H) $(EXCEPT_H) $(LTO_STREAMER_H) opts-diagnostic.h
+ coretypes.h $(TREE_H) $(TM_H) langhooks.h $(EXPR_H) \
+ $(DIAGNOSTIC_H) $(TM_P_H) $(INSN_ATTR_H) intl.h $(TARGET_H) \
+ $(FLAGS_H) $(PARAMS_H) $(DBGCNT_H) debug.h \
+ $(EXCEPT_H) $(LTO_STREAMER_H) opts-diagnostic.h
+opts-global.o : opts-global.c $(CONFIG_H) $(SYSTEM_H) coretypes.h \
+ $(DIAGNOSTIC_CORE_H) $(OPTS_H) $(FLAGS_H) $(GGC_H) $(TM_H) $(RTL_H) \
+ output.h $(PLUGIN_H) $(TREE_PASS_H)
opts-common.o : opts-common.c $(OPTS_H) $(FLAGS_H) $(CONFIG_H) $(SYSTEM_H) \
coretypes.h intl.h $(DIAGNOSTIC_H) $(TM_H)
targhooks.o : targhooks.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TREE_H) \
Restrict target load migration not to re-use registers in any basic block
fcall-saved-
-Common Joined RejectNegative
+Common Joined RejectNegative Var(common_deferred_options) Defer
-fcall-saved-<register> Mark <register> as being preserved across functions
fcall-used-
-Common Joined RejectNegative
+Common Joined RejectNegative Var(common_deferred_options) Defer
-fcall-used-<register> Mark <register> as being corrupted by function calls
; Nonzero for -fcaller-saves: allocate values in regs that need to
Amend appropriate diagnostic messages with the command line option that controls them
fdump-
-Common Joined RejectNegative
+Common Joined RejectNegative Var(common_deferred_options) Defer
-fdump-<type> Dump various compiler internals to a file
fdump-final-insns
Assume no NaNs or infinities are generated
ffixed-
-Common Joined RejectNegative
+Common Joined RejectNegative Var(common_deferred_options) Defer
-ffixed-<register> Mark <register> as being unavailable to the compiler
ffloat-store
Generate position-independent code for executables if possible (small mode)
fplugin=
-Common Joined RejectNegative
+Common Joined RejectNegative Var(common_deferred_options) Defer
Specify a plugin to load
fplugin-arg-
-Common Joined RejectNegative
+Common Joined RejectNegative Var(common_deferred_options) Defer
-fplugin-arg-<name>-<key>[=<value>] Specify argument <key>=<value> for plugin <name>
fpredictive-commoning
Insert stack checking code into the program. Same as -fstack-check=specific
fstack-limit
-Common
+Common Var(common_deferred_options) Defer
fstack-limit-register=
-Common RejectNegative Joined
+Common RejectNegative Joined Var(common_deferred_options) Defer
-fstack-limit-register=<register> Trap if the stack goes past <register>
fstack-limit-symbol=
-Common RejectNegative Joined
+Common RejectNegative Joined Var(common_deferred_options) Defer
-fstack-limit-symbol=<name> Trap if the stack goes past symbol <name>
fstack-protector
@var{var} is an integer variable that stores the value of the argument.
@item
+If the option has the @code{Defer} property, @var{var} is a pointer to
+a @code{VEC(cl_deferred_option,heap)} that stores the option for later
+processing. (@var{var} is declared with type @code{void *} and needs
+to be cast to @code{VEC(cl_deferred_option,heap)} before use.)
+
+@item
Otherwise, if the option takes an argument, @var{var} is a pointer to
the argument string. The pointer will be null if the argument is optional
and wasn't given.
The first option should use @samp{Mask(@var{name})} and the others
should use @samp{Mask(@var{name}) MaskExists}.
+@item Defer
+The option should be stored in a vector, specified with @code{Var},
+for later processing.
+
@item Alias(@var{opt})
@itemx Alias(@var{opt}, @var{arg})
@itemx Alias(@var{opt}, @var{posarg}, @var{negarg})
# Return the type of variable that should be associated with the given flags.
function var_type(flags)
{
- if (!flag_set_p("Joined.*", flags) && !flag_set_p("Separate", flags))
+ if (flag_set_p("Defer", flags))
+ return "void *"
+ else if (!flag_set_p("Joined.*", flags) && !flag_set_p("Separate", flags))
return "int "
else if (flag_set_p("UInteger", flags))
return "int "
# "var_cond" and "var_value" fields of its cl_options[] entry.
function var_set(flags)
{
+ if (flag_set_p("Defer", flags))
+ return "CLVC_DEFER, 0"
s = nth_arg(1, opt_args("Var", flags))
if (s != "")
return "CLVC_EQUAL, " s
if (set_flag_var)
*(const char **) set_flag_var = "";
break;
+
+ case CLVC_DEFER:
+ {
+ VEC(cl_deferred_option,heap) *vec
+ = (VEC(cl_deferred_option,heap) *) *(void **) flag_var;
+ cl_deferred_option *p;
+
+ p = VEC_safe_push (cl_deferred_option, heap, vec, NULL);
+ p->opt_index = opt_index;
+ p->arg = arg;
+ p->value = value;
+ *(void **) flag_var = vec;
+ if (set_flag_var)
+ *(void **) set_flag_var = vec;
+ }
+ break;
}
if ((diagnostic_t) kind != DK_UNSPECIFIED
--- /dev/null
+/* 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 ();
+ }
+ }
+}
#include "coretypes.h"
#include "tm.h"
#include "tree.h"
-#include "rtl.h"
#include "expr.h"
-#include "ggc.h"
-#include "output.h"
#include "langhooks.h"
#include "opts.h"
#include "options.h"
#include "opts-diagnostic.h"
#include "insn-attr.h" /* For INSN_SCHEDULING. */
#include "target.h"
-#include "tree-pass.h"
#include "dbgcnt.h"
#include "debug.h"
-#include "plugin.h"
#include "except.h"
#include "lto-streamer.h"
else
strcpy (new_help, "\t");
- if (flag_var != NULL)
+ if (flag_var != NULL
+ && option->var_type != CLVC_DEFER)
{
if (option->flags & CL_JOINED)
{
break;
case OPT_fcall_used_:
- fix_register (arg, 0, 1);
- break;
-
case OPT_fcall_saved_:
- fix_register (arg, 0, 0);
+ /* Deferred. */
break;
case OPT_fcompare_debug_second:
break;
case OPT_fdump_:
- if (!dump_switch_p (arg))
- return false;
+ /* Deferred. */
break;
case OPT_ffp_contract_:
break;
case OPT_ffixed_:
- fix_register (arg, 1, 1);
+ /* Deferred. */
break;
case OPT_finline_limit_:
break;
case OPT_fplugin_:
-#ifdef ENABLE_PLUGIN
- add_new_plugin (arg);
-#else
- error ("plugin support is disabled; configure with --enable-plugin");
-#endif
- break;
-
case OPT_fplugin_arg_:
-#ifdef ENABLE_PLUGIN
- parse_plugin_arg_opt (arg);
-#else
- error ("plugin support is disabled; configure with --enable-plugin");
-#endif
+ /* Deferred. */
break;
case OPT_fprofile_dir_:
/* The real switch is -fno-stack-limit. */
if (value)
return false;
- stack_limit_rtx = NULL_RTX;
+ /* Deferred. */
break;
case OPT_fstack_limit_register_:
- {
- int reg = decode_reg_name (arg);
- if (reg < 0)
- error ("unrecognized register name \"%s\"", 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 (arg));
+ /* Deferred. */
break;
case OPT_ftree_vectorizer_verbose_:
return (*(int *) flag_var & option->var_value) != 0;
case CLVC_STRING:
+ case CLVC_DEFER:
break;
}
return -1;
state->data = "";
state->size = strlen ((const char *) state->data) + 1;
break;
+
+ case CLVC_DEFER:
+ return false;
}
return true;
}
#define GCC_OPTS_H
#include "input.h"
+#include "vec.h"
/* Specifies how a switch's VAR_VALUE relates to its FLAG_VAR. */
enum cl_var_type {
/* The switch takes a string argument and FLAG_VAR points to that
argument. */
- CLVC_STRING
+ CLVC_STRING,
+
+ /* The switch should be stored in the VEC pointed to by FLAG_VAR for
+ later processing. */
+ CLVC_DEFER
};
struct cl_option
int errors;
};
+/* Structure describing an option deferred for handling after the main
+ option handlers. */
+
+typedef struct
+{
+ /* Elements from struct cl_decoded_option used for deferred
+ options. */
+ size_t opt_index;
+ const char *arg;
+ int value;
+} cl_deferred_option;
+DEF_VEC_O(cl_deferred_option);
+DEF_VEC_ALLOC_O(cl_deferred_option,heap);
+
/* Structure describing a single option-handling callback. */
struct cl_option_handler_func
struct gcc_options *opts_set,
diagnostic_context *dc);
extern void print_ignored_options (void);
+extern void handle_common_deferred_options (void);
#endif
save_decoded_options, save_decoded_options_count,
UNKNOWN_LOCATION, global_dc);
+ handle_common_deferred_options ();
+
init_local_tick ();
initialize_plugins ();