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]

Re: EXPR_LIST and INSN_LIST waste reduction patch



  In message <199908121810.LAA02518@cygint.cygnus.com>you write:
  > The following patch takes the routines in haifa-sched.c which are used to
  > cache INSN_LIST and EXPR_LIST notes, genericizes them, and globalizes them 
  > so 
  > they can be used anywhere. The cacheing list is initialized once early, and
  > is available for use throughout the optimization passes.  I also add uses 
  > of these routines in gcse.c where appropriate.
  > 
  > I couldn't really find a 'right' place to put the routines, the bottom 
  > of flow.c was as close as I found... Im open to other suggestions.
  > (I could have left them in haifa.c I suppose... I just didnt like them ther
  > e.)
  > rtlanal.c and rtl.c can't be used because they are used in building
  > some of the gen routines, and the gen_rtx_* things aren't available then.
  > Perhaps we should have another file (rtlaux.c?) which can be used for
  > common rtl manipulation routines without restrictions like those 2
  > files have. I seem to recall comments in other files saying something
  > was put there because it couldn't be put in rtl.c or rtlanal.c.
  > 
  > Anyway, I want to apply this to devo and egcs, although egcs will see none
  > of the gcse.c changes since they are all within the CYGNUS LOCAL banner.
  > 
  > Andrew
  > 
  > 
  > 	* flow.c (unused_insn_list, unused_expr_list): New statics for 
  > 	maintaining a cache of available INSN_LIST and EXPR_LIST nodes.
  > 	(free_list): Static function for freeing a list of INSN/EXPR nodes.
  > 	(alloc_INSN_LIST): Function to get a free INSN_LIST node.
  > 	(alloc_EXPR_LIST): Function to get a free EXPR_LIST node.
  > 	(init_EXPR_INSN_LIST_cache): Initialize the cache lists.
  > 	(free_EXPR_LIST_list): Free an entire list of EXPR_LIST nodes.
  > 	(free_INSN_LIST_list): Free an entire list of INSN_LIST nodes.
  > 	(free_EXPR_LIST_node): Free an individual EXPR_LIST node.
  > 	(free_INSN_LIST_node): Free an individual INSN_LIST node.
  > 	* gcse.c (alloc_gcse_mem): Clear modify_mem_list when allocated.
  > 	(free_gcse_mem): Re-cache any LIST nodes in modify_mem_list.
  > 	(record_last_mem_set_info): Use alloc routine instead of gen_rtx.
  > 	(compute_hash_table): Re-cache nodes in modify_mem_list instead of 
  > 	freeing them.
  > 	(next_set): Re-cache nodes in modify_mem_list instead of freeing.
  > 	(pre_delete): Use alloc routine instead of gen_rtx.
  > 	(pre_gcse): Re-cache EXPR_LIST nodes not needed.
  > 	* haifa-sched.c (unused_insn_list, unused_expr_list): Moved to flow.c
  > 	(free_list, alloc_INSN_LIST, alloc_EXPR_LIST): Moved to flow.c
  > 	(remove_dependence, free_pending_lists): Use new global routines.
  > 	(flush_pending_lists, sched_analyze_insn): Use new global routines.
  > 	(sched_analyze, compute_block_backward_dependences): Use new routines.
  > 	(schedule_insns): Use new global routines.
  > 	* rtl.h (init_EXPR_INSN_LIST_cache, free_EXPR_LIST_list): Add function
  > 	prototypes.
  > 	(free_INSN_LIST_list, free_EXPR_LIST_node): Add prototypes.
  > 	(free_INSN_LIST_node, alloc_INSN_LIST, alloc_EXPR_LIST): Add function
  > 	prototypes.
  > 	* toplev.c (rest_of_compilation): Initialize node cache.
Looks good.  You might consider putting the new routines in a new file since
they are not specific to flow.c.  When I first started playing with this idea
I created "lists.c".

In the back of my mind was the idea that we could also move other list related
code into that file like routines that manipulate the doubly linked insn
chain, stuff to search INSN_LIST & EXPR_LIST chains, etc.

Approved as-is or with the list routines in their own file (with appropriate
Makefile.in changes).

Another thought that you might want to look into -- scavenge EXPR_LIST and
INSN_LIST nodes as we delete insns :-)  I never had the chance to play with
that, but it was also in the back of my mind as a stop-gap until we have
a garbage collector.

jeff


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