Message ID | 558C01D2.3070909@redhat.com |
---|---|
State | New |
Headers | show |
On 06/25/2015 07:27 AM, Andrew MacLeod wrote: > > 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? It doesn't feel to me like ipa_opt_pass belongs in coretypes.h. I'd really prefer to not need ipa_opt_pass in cgraph.h, but as an interm step this seems fine. > > 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 > > > 4-cgraph.patch > > > * 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. OK. jeff
On 06/25/2015 12:22 PM, Jeff Law wrote: > On 06/25/2015 07:27 AM, Andrew MacLeod wrote: >> >> 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? > It doesn't feel to me like ipa_opt_pass belongs in coretypes.h. I'd > really prefer to not need ipa_opt_pass in cgraph.h, but as an interm > step this seems fine. yeah, the problem is that a cgraph node has a vector of these elements: /* Interprocedural passes scheduled to have their transform functions applied next time we execute local pass on them. We maintain it per-function in order to allow IPA passes to introduce new functions. */ vec<ipa_opt_pass> GTY((skip)) ipa_transforms_to_apply; I think its a shortcoming of the GTY parsing that I cant say vec<struct ipa_opt_pass_d *> GTY((skip)) ipa_transforms_to_apply; I tried that, and no cigar :-P its not straightforward to get rid of completely without trickery. I'll leave it as is for now. Andrew
* 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)