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] Access single_exit through accessor functions


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?


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 _ ?

Nice cleanup, thanks,
Sebastian


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