This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[patch] Flatten cgraph.h.


No so much preamble for this one since cgraph.h is already representative of only things in cgraph.c. So this is mostly shuffling of include files.

One short 'interesting' patch, and a couple of longer boring mechanical ones.

symbol_table::initialize() was moved to cgraph.c. The use of TDI_cgraph to initialize the dump file was the only reason dumpfile.h was a pre-requirement for cgraph,h, thus the dependency was removed.

ipa-inline.h, ipa-prop.h, ipa-reference.h, and ipa-utils.h all included cgraph.h and one or 2 other files, so I simply flattened them and copied their include list to all places that included them. lto-streamer.h included cgraph.h and a bunch of stuff, so I simply removed cgraph.h from it and pushed it through to all the other places that included lto-streamer and into the eventual source file . I then removed all duplicate includes in all those affected files.

At this point, no .h file includes cgraph.h any more.

gcc-plugin.h has a few of cgraph.h's includes added to help avoid some plugin breakage, but depending on their uses, there are some ordering issues that could be beyond my control.

Bootstraps with no new regressions on x86_64-unknown-linux-gnu, and is currently running through a full set of targets from config-list.mk. Assuming no issues, OK for mainline?

Andrew

	* cgraph.h: Flatten.  Remove all include files.
	(symbol_table::initialize): Move to cgraph.c.
	* cgraph.c: Adjust include files.
	(symbol_table::initialize): Relocate from cgraph.h.
	* gengtype.c (open_base_files): Adjust include files.
	* gccplugin.h: Add hash-map.h, is-a.h, plugin-api.h, and ipa-ref.h to
	included files.
	* ipa-inline.h: Remove all include files.
	* ipa-prop.h: Ditto.
	* ipa-reference.h: Ditto.
	* ipa-utils.h: Ditto:
	* lto-streamer.h: Remove cgraph.h from include list.

Index: cgraph.h
===================================================================
--- cgraph.h	(revision 216736)
+++ cgraph.h	(working copy)
@@ -21,19 +21,6 @@
 #ifndef GCC_CGRAPH_H
 #define GCC_CGRAPH_H
 
-#include "hash-map.h"
-#include "is-a.h"
-#include "plugin-api.h"
-#include "vec.h"
-#include "hashtab.h"
-#include "hash-set.h"
-#include "machmode.h"
-#include "tm.h"
-#include "hard-reg-set.h"
-#include "input.h"
-#include "function.h"
-#include "ipa-ref.h"
-#include "dumpfile.h"
 
 /* Symbol table consists of functions and variables.
    TODO: add labels and CONST_DECLs.  */
@@ -1785,12 +1772,7 @@
   friend class cgraph_edge;
 
   /* Initialize callgraph dump file.  */
-  inline void
-  initialize (void)
-  {
-    if (!dump_file)
-      dump_file = dump_begin (TDI_cgraph, NULL);
-  }
+  void initialize (void);
 
   /* Register a top-level asm statement ASM_STR.  */
   inline asm_node *finalize_toplevel_asm (tree asm_str);
Index: cgraph.c
===================================================================
--- cgraph.c	(revision 216736)
+++ cgraph.c	(working copy)
@@ -43,6 +43,15 @@
 #include "dominance.h"
 #include "cfg.h"
 #include "basic-block.h"
+#include "hash-map.h"
+#include "is-a.h"
+#include "plugin-api.h"
+#include "vec.h"
+#include "machmode.h"
+#include "hard-reg-set.h"
+#include "input.h"
+#include "function.h"
+#include "ipa-ref.h"
 #include "cgraph.h"
 #include "intl.h"
 #include "tree-ssa-alias.h"
@@ -54,7 +63,6 @@
 #include "timevar.h"
 #include "dumpfile.h"
 #include "gimple-ssa.h"
-#include "cgraph.h"
 #include "tree-cfg.h"
 #include "tree-ssa.h"
 #include "value-prof.h"
@@ -63,6 +71,8 @@
 #include "rtl.h"
 #include "ipa-utils.h"
 #include "lto-streamer.h"
+#include "alloc-pool.h"
+#include "ipa-prop.h"
 #include "ipa-inline.h"
 #include "cfgloop.h"
 #include "gimple-pretty-print.h"
@@ -243,6 +253,15 @@
   after->prev = before;
 }
 
+/* Initialize callgraph dump file.  */
+
+void
+symbol_table::initialize (void)
+{
+  if (!dump_file)
+    dump_file = dump_begin (TDI_cgraph, NULL);
+}
+
 /* Allocate new callgraph node and insert it into basic data structures.  */
 
 cgraph_node *
Index: gengtype.c
===================================================================
--- gengtype.c	(revision 216736)
+++ gengtype.c	(working copy)
@@ -1830,9 +1830,9 @@
       "hashtab.h", "splay-tree.h", "obstack.h", "bitmap.h", "input.h",
       "tree.h", "rtl.h", "wide-int.h", "hashtab.h", "hash-set.h", "vec.h",
       "machmode.h", "tm.h", "hard-reg-set.h", "input.h", "predict.h",
-      "function.h", "insn-config.h", "expr.h",
+      "function.h", "insn-config.h", "expr.h", "alloc-pool.h",
       "hard-reg-set.h", "basic-block.h", "cselib.h", "insn-addr.h",
-      "optabs.h", "libfuncs.h", "debug.h", "ggc.h", "cgraph.h",
+      "optabs.h", "libfuncs.h", "debug.h", "ggc.h", 
       "hash-table.h", "vec.h", "ggc.h", "dominance.h", "cfg.h", "basic-block.h",
       "tree-ssa-alias.h", "internal-fn.h", "gimple-fold.h", "tree-eh.h",
       "gimple-expr.h", "is-a.h",
@@ -1841,8 +1841,8 @@
       "tree-ssa-loop.h", "tree-ssa-loop-ivopts.h", "tree-ssa-loop-manip.h",
       "tree-ssa-loop-niter.h", "tree-into-ssa.h", "tree-dfa.h", 
       "tree-ssa.h", "reload.h", "cpp-id-data.h", "tree-chrec.h",
-      "except.h", "output.h",  "cfgloop.h",
-      "target.h", "ipa-prop.h", "lto-streamer.h", "target-globals.h",
+      "except.h", "output.h",  "cfgloop.h", "target.h", "lto-streamer.h",
+      "target-globals.h", "ipa-ref.h", "cgraph.h", "ipa-prop.h", 
       "ipa-inline.h", "dwarf2out.h", NULL
     };
     const char *const *ifp;
Index: gcc-plugin.h
===================================================================
--- gcc-plugin.h	(revision 216736)
+++ gcc-plugin.h	(working copy)
@@ -44,6 +44,10 @@
 #include "lcm.h"
 #include "cfgbuild.h"
 #include "cfgcleanup.h"
+#include "hash-map.h"
+#include "is-a.h"
+#include "plugin-api.h"
+#include "ipa-ref.h"
 
 /* Event names.  */
 enum plugin_event
Index: ipa-inline.h
===================================================================
--- ipa-inline.h	(revision 216736)
+++ ipa-inline.h	(working copy)
@@ -21,7 +21,6 @@
 #ifndef GCC_IPA_INLINE_H
 #define GCC_IPA_INLINE_H
 
-#include "ipa-prop.h"
 
 /* Representation of inline parameters that do depend on context function is
    inlined into (i.e. known constant values of function parameters.
Index: ipa-prop.h
===================================================================
--- ipa-prop.h	(revision 216736)
+++ ipa-prop.h	(working copy)
@@ -20,9 +20,6 @@
 #ifndef IPA_PROP_H
 #define IPA_PROP_H
 
-#include "vec.h"
-#include "cgraph.h"
-#include "alloc-pool.h"
 
 /* The following definitions and interfaces are used by
    interprocedural analyses or parameters.  */
Index: ipa-reference.h
===================================================================
--- ipa-reference.h	(revision 216736)
+++ ipa-reference.h	(working copy)
@@ -20,8 +20,6 @@
 
 #ifndef GCC_IPA_REFERENCE_H
 #define GCC_IPA_REFERENCE_H
-#include "bitmap.h"
-#include "cgraph.h"
 
 /* In ipa-reference.c  */
 bitmap ipa_reference_get_not_read_global (struct cgraph_node *fn);
Index: ipa-utils.h
===================================================================
--- ipa-utils.h	(revision 216736)
+++ ipa-utils.h	(working copy)
@@ -20,7 +20,6 @@
 
 #ifndef GCC_IPA_UTILS_H
 #define GCC_IPA_UTILS_H
-#include "cgraph.h"
 
 struct ipa_dfs_info {
   int dfn_number;
Index: lto-streamer.h
===================================================================
--- lto-streamer.h	(revision 216736)
+++ lto-streamer.h	(working copy)
@@ -27,7 +27,6 @@
 #include "hash-table.h"
 #include "hash-map.h"
 #include "target.h"
-#include "cgraph.h"
 #include "vec.h"
 #include "alloc-pool.h"
 #include "gcov-io.h"

Attachment: C2.patch.gz
Description: application/gzip

Attachment: C3.patch.gz
Description: application/gzip


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]