On Mon, 23 Mar 2015, Richard Biener wrote:

> On Fri, 20 Mar 2015, David Malcolm wrote:
> 
> > 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  <rguent...@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?
> 
> Well, as you noted below...
> 
> > > +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.
> 
> ...it would have required building all sorts of targets.
> 
> But sure, as this is now stage1 stuff I'll see to make it rtx_insns.

Ick.  Even bb-reorder.c isn't safe for that and stuff like
block_label () doesn't return a rtx_insn * either.

Thus I'll go for the original patch.

Thanks,
Richard.

Reply via email to