@@ -986,6 +986,7 @@ PLUGIN_H = plugin.h $(GCC_PLUGIN_H)
PLUGIN_VERSION_H = plugin-version.h configargs.h
LIBFUNCS_H = libfuncs.h $(HASHTAB_H)
GRAPHITE_HTAB_H = graphite-htab.h graphite-clast-to-gimple.h $(HASH_TABLE_H)
+CONTEXT_H = context.h
#
# Now figure out from those variables how to compile and link.
@@ -1200,6 +1201,7 @@ OBJS = \
combine.o \
combine-stack-adj.o \
compare-elim.o \
+ context.o \
convert.o \
coverage.o \
cppbuiltin.o \
@@ -2729,7 +2731,7 @@ toplev.o : toplev.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(TREE_H) \
$(OPTS_H) params.def tree-mudflap.h $(TREE_PASS_H) $(GIMPLE_H) \
tree-ssa-alias.h $(PLUGIN_H) realmpfr.h tree-diagnostic.h \
$(TREE_PRETTY_PRINT_H) opts-diagnostic.h $(COMMON_TARGET_H) \
- tsan.h diagnostic-color.h
+ tsan.h diagnostic-color.h $(CONTEXT_H)
hwint.o : hwint.c $(CONFIG_H) $(SYSTEM_H) $(DIAGNOSTIC_CORE_H)
@@ -3487,6 +3489,8 @@ $(out_object_file): $(out_file) $(CONFIG_H) coretypes.h $(TM_H) $(TREE_H) \
regrename.h
$(COMPILER) -c $(ALL_COMPILERFLAGS) $(ALL_CPPFLAGS) \
$(out_file) $(OUTPUT_OPTION)
+context.o: context.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(GGC_H) \
+ $(CONTEXT_H)
$(common_out_object_file): $(common_out_file) $(CONFIG_H) $(SYSTEM_H) \
coretypes.h $(COMMON_TARGET_H) $(COMMON_TARGET_DEF_H) $(PARAMS_H) \
new file mode 100644
@@ -0,0 +1,27 @@
+/* context.c - Holder for global state
+ Copyright (C) 2013 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 "ggc.h"
+#include "context.h"
+
+/* The singleton holder of global state: */
+gcc::context *g;
new file mode 100644
@@ -0,0 +1,42 @@
+/* context.h - Holder for global state
+ Copyright (C) 2013 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/>. */
+
+#ifndef GCC_CONTEXT_H
+#define GCC_CONTEXT_H
+
+namespace gcc {
+
+/* GCC's internal state can be divided into zero or more
+ "parallel universe" of state; an instance of this class is one such
+ context of state. */
+class context
+{
+public:
+
+ /* Currently empty. */
+
+}; // class context
+
+} // namespace gcc
+
+/* The global singleton context aka "g".
+ (the name is chosen to be easy to type in a debugger). */
+extern gcc::context *g;
+
+#endif /* ! GCC_CONTEXT_H */
@@ -75,6 +75,7 @@ along with GCC; see the file COPYING3. If not see
#include "tree-ssa-alias.h"
#include "plugin.h"
#include "diagnostic-color.h"
+#include "context.h"
#if defined(DBX_DEBUGGING_INFO) || defined(XCOFF_DEBUGGING_INFO)
#include "dbxout.h"
@@ -1156,6 +1157,10 @@ general_init (const char *argv0)
/* This must be done after global_init_params but before argument
processing. */
init_ggc_heuristics();
+
+ /* Create the singleton holder for global state. */
+ g = new gcc::context();
+
init_optimization_passes ();
statistics_early_init ();
finish_params ();