[patch] Access single_exit through accessor functions

Zdenek Dvorak rakdver@atrey.karlin.mff.cuni.cz
Tue Nov 21 10:13:00 GMT 2006


Hello,

> On 11/21/06, Zdenek Dvorak <rakdver@atrey.karlin.mff.cuni.cz> wrote:
> >+
> >+ /* Returns the single exit edge of LOOP, or NULL if LOOP has either no 
> >exit
> >+    or more than one exit.  */
> >+
> >+ edge
> >+ single_exit (const struct loop *loop)
> >+ {
> >+   return loop->single_exit_;
> >+ }
> >+
> >+ /* Records E as a single exit edge of LOOP.  */
> >+
> >+ void
> >+ set_single_exit (struct loop *loop, edge e)
> >+ {
> >+   loop->single_exit_ = e;
> >+ }
> 
> Why not static inline for those two functions?

set_single_exit is going to disappear and single_exit is going to become
a bit more complicated in the future, so I did not bother with this.

> >Index: cfgloop.h
> >===================================================================
> >*** cfgloop.h   (revision 119039)
> >--- cfgloop.h   (working copy)
> >*************** struct loop
> >*** 148,154 ****
> >
> >    /* If not NULL, loop has just single exit edge stored here (edges to 
> >    the
> >       EXIT_BLOCK_PTR do not count.  */
> >!   edge single_exit;
> >
> >    /* True when the loop does not carry data dependences, and
> >       consequently the iterations can be executed in any order.  False
> >--- 148,154 ----
> >
> >    /* If not NULL, loop has just single exit edge stored here (edges to 
> >    the
> >       EXIT_BLOCK_PTR do not count.  */
> >!   edge single_exit_;
> >
> 
> I would have preferred a warning in the comment, something like:
> "do not use this filed directly, use the access functions..."
> Also a point on which I'm not sure, is it okay to have the name
> of the field ending on _ ?

yes, see e.g. basic-block.h:rtl_bb_info.

Zdenek



More information about the Gcc-patches mailing list