[patch] Change type of instruction pointers for cfghooks

Zdenek Dvorak rakdver@atrey.karlin.mff.cuni.cz
Tue Dec 13 00:18:00 GMT 2005


Hello,

> > cfg hooks currently use void * pointers when expression or position of
> > an instruction needs to be passed to them, so that they can be used for
> > both trees and rtl.  This patch makes them use union containing rtx and
> > tree instead, for the following reasons:
> > 
> > 1) Better for type checking -- we would now get a warning or error if
> >    an argument of wrong type is passed to them.
> > 2) It might turn out useful to change the type for trees to
> >    block_stmt_iterator, in which case this change makes it easier to
> >    spot the places where the change needs to be done.
> 
> Hmmm, to me this seems sort of ugly and verbose, and it still doesn't
> give us strong type checking--it doesn't check whether we correctly
> passed a tree or an rtx as appropriate.
> 
> If we want strong type checking here, I think we should just use tiny
> functions as wrappers around the hooks--e.g. split_block_rtl and
> split_block_tree.

I do not see much benefits of this idea -- one of the reasons for having
cfghooks is to enable sharing as much of the code between rtl and tree
cfg, which would force us to use these wrappers on some place, and
directly call the original untyped hooks on other places.  This seems
like an unnecessary complication to me.

Not really an important issue, anyway.  If nobody else sees any
advantage in the proposed solution, let's probably leave it as it is.

Zdenek



More information about the Gcc-patches mailing list