On Wed, Sep 12, 2012 at 8:27 PM, Steven Bosscher <stevenb....@gmail.com> wrote: > Hello, > > This patch cleans up some things that annoyed me in ipa-reference.c > and ipa-pure-const.c. These two passes are very important but they > show all the signs of being developed when GCC's IPA infrastructure > was still (or at least even more than today) in its infancy: Walking > cycles of collapsed nodes is clumsy, handling of multiple functions > uses langhooks, and there are many, many style issues, most of which > can be traced back to change upon change in the SVN repository as the > IPA infrastructure developed. > > The first block of the ChangeLog entry is a simple cleanup in > ipa-pure-const.c, which doesn't and shouldn't have to use langhooks to > print a function name. > > The biggest cleanup is in ipa-reference.c, the second block in the > ChangeLog entry: > 1. A new function "ipa_get_nodes_in_cycle" returns a VEC of cgraph > nodes (much like get_loop_body) that can be walked in sequence. > 2. The management of sets is clarified using functions with intuitive > names that also help reduce the cost of the transitive closure by > detecting when a set union(X,Y) is the maximum set (reducing the > memory footprint from 3 GB to just ~120MB for a large C++ test case) > 3. Add helper functions to dump and copy sets > > The third block of the ChangeLog entry is some prep work for > structural analysis code that Kenny wrote 7 years ago, and that I'm > trying to bring in a shape where I can do something useful with it. I > know of a few places where the empty_bb_p hook can be used, and I'll > submit patches for that later. The other hook is for splitting a block > to create a region header. It has no uses in the trunk but it would > help if it can go in now already anyway :-) > > Bootstrapped&tested on {x86_64,powerpc64}-unknown-linux-gnu. OK for trunk?
Yay! First reference! +static bool +union_static_var_sets (bitmap &x, bitmap y) ;) +/* Compute X &= Y, taking into account the possibility that + X may become the maximum set. */ Hmm, how can X become the maximum set if it was not the maximum set before? Thus, shouldn't this simply be if (y == all_module_statics) /* do nothing */; else ... ? Otherwise ok (the patch could have been split though). Thanks, Richard. > Ciao! > Steven > > * ipa-pure-const.c (state_from_flags, local_pure_const): Use > current_function_name instead of lang_hooks.decl_printable_name. > > * function.h (fndecl_name): New prototype. > * function.c (fndecl_name): New function. > * vecir.h (cgraph_node_p): New standard IR VEC type. > * trans-mem.c (cgraph_node_p): No need anymore to define it here. > * ipa-utils.h (ipa_get_nodes_in_cycle): New prototype. > * ipa-utils.c (ipa_get_nodes_in_cycle): New function. > * ipa-reference.c: Don't include langhooks.h, and certainly not twice. > Fix many formatting issues (long lines, short lines, spacing, etc.). > (get_static_name): Use fndecl_name. > (dump_static_vars_set_to_file): New function split out from propagate. > (union_static_var_sets): New function, union two sets and collapse > to all_module_statics as quickly as possible. > (intersect_static_var_sets): New function, similar to above. > (copy_static_var_set): Renamed from copy_global_bitmap and rewritten > to allocate a copy on the same bitmap_obstack as the source set. > (propagate_bits): Simplify, and clarify by using > union_static_var_sets. > (generate_summary): Remove bm_temp. Print UID of promotable globals. > (read_write_all_from_decl): Use pass-by-reference, bless C++. > (get_read_write_all_from_node): New function, split out from > propagate. > (propagate): Simplify and clarify with helper functions. Use > ipa_get_nodes_in_cycle to walk all nodes in a reduced node. > (ipa_reference_read_optimization_summary): Use fndecl_name instead of > lang_hooks.decl_printable_name. > > * rtl.h (print_rtl_single_with_indent): New prototype. > * print-rtl.c (print_rtl_single_with_indent): New function. > * cfghooks.h (empty_block_p, split_block_before_cond_jump): New hooks. > * cfghooks.c (empty_block_p, split_block_before_cond_jump): Implement. > * cfgrtl.c (rtl_block_empty_p, rtl_split_block_before_cond_jump): > Implement RTL specific hooks. > (rtl_cfg_hooks, cfg_layout_rtl_cfg_hooks): Register the new hooks. > * tree-cfg.c (gimple_empty_block_p, > gimple_split_block_before_cond_jump): Implement GIMPLE specific hooks. > (gimple_cfg_hooks): Register the new hooks. > * tree-ssa-phiopt.c (empty_block_p): Remove in favor of new hook.