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]

Re: [PATCH] Make split_block and create_basic_block type-safe


On Thu, 2015-03-12 at 14:20 +0100, Richard Biener wrote:
> After noticing tree-parloop.c passing crap to split_block (a tree
> rather than a gimple or an rtx) I noticed those CFG functions simply
> take void * pointers.  The following patch fixes that and adds
> two overloads, one for GIMPLE use and one for RTL use.
> 
> Bootstrapped on x86_64-unknown-linux-gnu, testing in progress.
> 
> Ok at this stage?
> 
> Thanks,
> Richard.
> 
> 2015-03-12  Richard Biener  <rguenther@suse.de>
> 
> 	* cfghooks.h (create_basic_block): Replace with two overloads
> 	for RTL and GIMPLE.
> 	(split_block): Likewise.
> 	* cfghooks.c (split_block): Rename to ...
> 	(split_block_1): ... this.
> 	(split_block): Add two type-safe overloads for RTL and GIMPLE.
> 	(split_block_after_labels): Call split_block_1.
> 	(create_basic_block): Rename to ...
> 	(create_basic_block_1): ... this.
> 	(create_basic_block): Add two type-safe overloads for RTL and GIMPLE.
> 	(create_empty_bb): Call create_basic_block_1.
> 	* cfgrtl.c (fixup_fallthru_exit_predecessor): Use
> 	split_block_after_labels.
> 	* omp-low.c (expand_parallel_call): Likewise.
> 	(expand_omp_target): Likewise.
> 	(simd_clone_adjust): Likewise.
> 	* tree-chkp.c (chkp_get_entry_block): Likewise.
> 	* cgraphunit.c (init_lowered_empty_function): Use the GIMPLE
> 	create_basic_block overload.
> 	(cgraph_node::expand_thunk): Likewise.
> 	* tree-cfg.c (make_blocks): Likewise.
> 	(handle_abnormal_edges): Likewise.
> 	* tree-inline.c (copy_bb): Likewise.
> 
> Index: gcc/cfghooks.c
> ===================================================================
> --- gcc/cfghooks.c	(revision 221379)
> +++ gcc/cfghooks.c	(working copy)

[...snip...]

> +edge
> +split_block (basic_block bb, rtx i)
> +{
> +  return split_block_1 (bb, i);
> +}

Possibly a dumb question, but could this take an rtx_insn * rather than
a plain rtx?

> +basic_block
> +create_basic_block (rtx head, rtx end, basic_block after)
> +{
> +  return create_basic_block_1 (head, end, after);
> +}

Likewise for head and end... though I see a fix would be needed in
bfin.c:hwloop_optimize, at least.

 
> Index: gcc/cfghooks.h
> ===================================================================
> --- gcc/cfghooks.h	(revision 221379)
> +++ gcc/cfghooks.h	(working copy)

> -extern edge split_block (basic_block, void *);
> +extern edge split_block (basic_block, rtx);
(etc)

> -extern basic_block create_basic_block (void *, void *, basic_block);
> +extern basic_block create_basic_block (rtx, rtx, basic_block);
(etc)



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