This is the mail archive of the gcc@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]

[RFC] Use accessor macros for the head and end of a basic block


On Monday 08 December 2003 16:30, Steven Bosscher wrote:
> Hello,
>
> For tree-ssa I would like to make the basic block head/end a union because
> we now have a head and end for both RTL and trees, and obviously we only
> can use one at a time so one field at least is redundant.
>
> Problem is, everything uses bb->head instead of BLOCK_HEAD (bb), and
> bb->end instead of BLOCK_END (bb).  Is there a reason for this?  Would a
> patch to update _all_ of these to use the macro be acceptable in stage3 if
> it prevents merge trouble for the tree-ssa branch maintainers?

Of course the BLOCK_HEAD and BLOCK_END macros aren't the right ones. We'd need 
two new macros...

(BLOCK_{HEAD,END} are hardly used, and it seems that at least in reload we 
could use a pointer to a basic block instead of an int in insn_chain.  But 
that's for later.)

Now, here's the change I'd like to make.  This is probably already the largest 
patch I've ever submitted, but it should have no effect whatsoever.  
Basically all this does is replace all occurences of "<bb>->{head,end}" with 
"BB_{HEAD,END} (<bb>).
(Diego, this is one of those changes I was talking about last week, and as you 
can see it touched matter all over the map.)

This patch does not convert all files at once, because this was a large (and 
RSI-prone ;-) amount of work, I'm extremely lazy and if this is unacceptable 
then I won't have to do the rest of them.

If a patch like this is not OK for mainline at this stage, then some CFG work 
that I had in mind for tree-ssa (putting will have to be postponed until 
after 3.4 branches.  But really, I'd like to put this in now because:
1. It is quite safe.
2. Not doing it makes it very impractical to make basic_block_def a bit
   smaller for tree-ssa, where this is needed especially now that we
   have a garbage collectable CFG.

Opinions? Should I finish this patch or is this just a big no-no?

Gr.
Steven

	* basic-block.h (BLOCK_HEAD, BLOCK_END): Remove.
	(BLOCK_HEAD_TREE, BLOCK_END_TREE): Remove.
	(BB_HEAD, BB_END): New accessor macros for the `head' and `end' fields
	of a basic_block.
	* bb-reorder.c, bt-load.c, caller-save.c, cfg.c, cfganal.c, cfgbuild.c,
	cfgcleanup.c, cfglayout.c, cfgloop.c, cfgloopanal.c, cfgloopmanip.c, 
	cfgrtl.c, combine.c, conflict.c, df.c, emit-rtl.c, gcse.c, haifa-sched.c,
	local-alloc.c, regmove.c, resource.c, sched-rgn.c: Use the BB_HEAD and
	BB_END macros instead of accessing the `head' and `end' fields of a
	basic block directly.

Attachment: patch.gz
Description: GNU Zip compressed data


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