public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [patch 4/4] Remove options.h/tm.h and function.h as dependencies and include compile time prerequisites in cgraph.h
@ 2015-06-25 13:31 Andrew MacLeod
  2015-06-25 16:22 ` Jeff Law
  0 siblings, 1 reply; 3+ messages in thread
From: Andrew MacLeod @ 2015-06-25 13:31 UTC (permalink / raw)
  To: gcc-patches

[-- Attachment #1: Type: text/plain, Size: 1276 bytes --]

This patch removes a couple more dependencies cgraph.h has.

The function address_can_be_compared_p makes reference to 
flag_merge_constants which comes from options.h via tm.h. By moving it 
to cgraph.c instead of inlining it in the header file, options.h and 
thus tm.h is no longer needed.

ipa_opt_pass is given a forward declaration in function.h, but it really 
consumed by cgraph.h   By moving that forward declaration to cgraph, it 
no longer requires function.h to be in the include path.   It actually 
defined in tree-pass.h, the the *right* thing would be to require 
tree-pass.h, but that seems unnecessary. Another option would be to do 
the forward declaration in coretypes.h.. maybe that would be better?

The final thing I did was include ipa-ref.h and plugin-api.h from 
cgraph.h.  There are hard requirements for compiling cgraph.h, and are 
needed almost no where else, This is the first consolidation step.  Its 
the right place to include them as indicated by the second part of the 
patch which removes these 2 includes from all the source files in the 
compiler, allowing them to just come from cgraph.h

Bootstraps on x86_64-unknown-linux-gnu with no new regressions. Also 
builds stage 1 on all the targets in config-list.mk.

OK for trunk?

Andrew


[-- Attachment #2: 4-cgraph.patch --]
[-- Type: text/x-patch, Size: 3894 bytes --]


	* function.h (ipa_opt_pass, ipa_opt_pass_d): Move forward declarations.
	* cgraph.h: Include ipa-ref.h and plugin-api.h.
	(ipa_opt_pass, ipa_opt_pass_d)): Relocate forward declarations here.
	(symtab_node::address_can_be_compared_p): Move function.
	* cgraph.c (symtab_node::address_can_be_compared_p): Relocate function
	definition here.


Index: function.h
===================================================================
*** function.h	(revision 224602)
--- function.h	(working copy)
*************** struct gimple_df;
*** 156,165 ****
  struct call_site_record_d;
  struct dw_fde_node;
  
- class ipa_opt_pass_d;
- typedef ipa_opt_pass_d *ipa_opt_pass;
- 
- 
  struct GTY(()) varasm_status {
    /* If we're using a per-function constant pool, this is it.  */
    struct rtx_constant_pool *pool;
--- 156,161 ----
Index: cgraph.h
===================================================================
*** cgraph.h	(revision 224602)
--- cgraph.h	(working copy)
*************** along with GCC; see the file COPYING3.
*** 21,26 ****
--- 21,31 ----
  #ifndef GCC_CGRAPH_H
  #define GCC_CGRAPH_H
  
+ #include "ipa-ref.h"
+ #include "plugin-api.h"
+ 
+ class ipa_opt_pass_d;
+ typedef ipa_opt_pass_d *ipa_opt_pass;
  
  /* Symbol table consists of functions and variables.
     TODO: add labels and CONST_DECLs.  */
*************** varpool_node::call_for_symbol_and_aliase
*** 3046,3074 ****
    return false;
  }
  
- /* Return true if NODE's address can be compared.  */
- 
- inline bool
- symtab_node::address_can_be_compared_p ()
- {
-   /* Address of virtual tables and functions is never compared.  */
-   if (DECL_VIRTUAL_P (decl))
-     return false;
-   /* Address of C++ cdtors is never compared.  */
-   if (is_a <cgraph_node *> (this)
-       && (DECL_CXX_CONSTRUCTOR_P (decl)
- 	  || DECL_CXX_DESTRUCTOR_P (decl)))
-     return false;
-   /* Constant pool symbols addresses are never compared.
-      flag_merge_constants permits us to assume the same on readonly vars.  */
-   if (is_a <varpool_node *> (this)
-       && (DECL_IN_CONSTANT_POOL (decl)
- 	  || (flag_merge_constants >= 2
- 	      && TREE_READONLY (decl) && !TREE_THIS_VOLATILE (decl))))
-     return false;
-   return true;
- }
- 
  /* Return true if refernece may be used in address compare.  */
  
  inline bool
--- 3051,3056 ----
Index: cgraph.c
===================================================================
*** cgraph.c	(revision 224602)
--- cgraph.c	(working copy)
*************** along with GCC; see the file COPYING3.
*** 44,53 ****
  #include "dominance.h"
  #include "cfg.h"
  #include "basic-block.h"
- #include "plugin-api.h"
  #include "hard-reg-set.h"
  #include "function.h"
- #include "ipa-ref.h"
  #include "cgraph.h"
  #include "intl.h"
  #include "tree-ssa-alias.h"
--- 44,51 ----
*************** function_version_hasher::equal (cgraph_f
*** 159,164 ****
--- 157,185 ----
  static GTY(()) struct cgraph_function_version_info *
    version_info_node = NULL;
  
+ /* Return true if NODE's address can be compared.  */
+ 
+ bool
+ symtab_node::address_can_be_compared_p ()
+ {
+   /* Address of virtual tables and functions is never compared.  */
+   if (DECL_VIRTUAL_P (decl))
+     return false;
+   /* Address of C++ cdtors is never compared.  */
+   if (is_a <cgraph_node *> (this)
+       && (DECL_CXX_CONSTRUCTOR_P (decl)
+ 	  || DECL_CXX_DESTRUCTOR_P (decl)))
+     return false;
+   /* Constant pool symbols addresses are never compared.
+      flag_merge_constants permits us to assume the same on readonly vars.  */
+   if (is_a <varpool_node *> (this)
+       && (DECL_IN_CONSTANT_POOL (decl)
+ 	  || (flag_merge_constants >= 2
+ 	      && TREE_READONLY (decl) && !TREE_THIS_VOLATILE (decl))))
+     return false;
+   return true;
+ }
+ 
  /* Get the cgraph_function_version_info node corresponding to node.  */
  cgraph_function_version_info *
  cgraph_node::function_version (void)

[-- Attachment #3: 4-rest.patch.Z --]
[-- Type: application/x-compress, Size: 15153 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2015-06-25 16:42 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-06-25 13:31 [patch 4/4] Remove options.h/tm.h and function.h as dependencies and include compile time prerequisites in cgraph.h Andrew MacLeod
2015-06-25 16:22 ` Jeff Law
2015-06-25 16:44   ` Andrew MacLeod

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).