[patch] single_succ/pred

Zdenek Dvorak rakdver@atrey.karlin.mff.cuni.cz
Fri Mar 11 09:32:00 GMT 2005


Hello,

> One minor nit though. The comments for single_succ_edge, 
> single_pred_edge,
> single_succ and single_pred do not indicated whether the function 
> requires
> that BB has a single successor/predecessor. For the edge case, this is
> immediately clear from the assert just below, but this is not the case
> for single_succ and single_pred.
> 
> From your message I gather it is an error if the passed BB has more
> than one successor/predecessor for single_succ and single_pred 
> respectively,
> but this is hard to derive from the code.  Could you add a comment 
> about this?

I forgot to add this in the commit, but I comitted the following
obvious followup patch.

Zdenek

Index: ChangeLog
===================================================================
RCS file: /cvs/gcc/gcc/gcc/ChangeLog,v
retrieving revision 2.7784
diff -c -3 -p -r2.7784 ChangeLog
*** ChangeLog	11 Mar 2005 09:04:20 -0000	2.7784
--- ChangeLog	11 Mar 2005 09:29:51 -0000
***************
*** 1,6 ****
--- 1,11 ----
  2005-03-11  Zdenek Dvorak  <dvorakz@suse.cz>
  
  	* basic-block.h (single_succ_p, single_pred_p, single_succ_edge,
+ 	single_pred_edge, single_succ, single_pred): Improve comments.
+ 
+ 2005-03-11  Zdenek Dvorak  <dvorakz@suse.cz>
+ 
+ 	* basic-block.h (single_succ_p, single_pred_p, single_succ_edge,
  	single_pred_edge, single_succ, single_pred): New inline functions.
  	* bb-reorder.c (rotate_loop, find_traces_1_round,
  	add_labels_and_missing_jumps, fix_up_fall_thru_edges,
Index: basic-block.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/basic-block.h,v
retrieving revision 1.242
diff -c -3 -p -r1.242 basic-block.h
*** basic-block.h	11 Mar 2005 09:04:46 -0000	1.242
--- basic-block.h	11 Mar 2005 09:29:52 -0000
*************** single_pred_p (basic_block bb)
*** 563,569 ****
    return EDGE_COUNT (bb->preds) == 1;
  }
  
! /* Returns the single successor edge of basic block BB.  */
  
  static inline edge
  single_succ_edge (basic_block bb)
--- 563,570 ----
    return EDGE_COUNT (bb->preds) == 1;
  }
  
! /* Returns the single successor edge of basic block BB.  Aborts if
!    BB does not have exactly one successor.  */
  
  static inline edge
  single_succ_edge (basic_block bb)
*************** single_succ_edge (basic_block bb)
*** 572,578 ****
    return EDGE_SUCC (bb, 0);
  }
  
! /* Returns the single predecessor edge of basic block BB.  */
  
  static inline edge
  single_pred_edge (basic_block bb)
--- 573,580 ----
    return EDGE_SUCC (bb, 0);
  }
  
! /* Returns the single predecessor edge of basic block BB.  Aborts
!    if BB does not have exactly one predecessor.  */
  
  static inline edge
  single_pred_edge (basic_block bb)
*************** single_pred_edge (basic_block bb)
*** 581,587 ****
    return EDGE_PRED (bb, 0);
  }
  
! /* Returns the single successor block of basic block BB.  */
  
  static inline basic_block
  single_succ (basic_block bb)
--- 583,590 ----
    return EDGE_PRED (bb, 0);
  }
  
! /* Returns the single successor block of basic block BB.  Aborts
!    if BB does not have exactly one successor.  */
  
  static inline basic_block
  single_succ (basic_block bb)
*************** single_succ (basic_block bb)
*** 589,595 ****
    return single_succ_edge (bb)->dest;
  }
  
! /* Returns the single predecessor block of basic block BB.  */
  
  static inline basic_block
  single_pred (basic_block bb)
--- 592,599 ----
    return single_succ_edge (bb)->dest;
  }
  
! /* Returns the single predecessor block of basic block BB.  Aborts
!    if BB does not have exactly one predecessor.*/
  
  static inline basic_block
  single_pred (basic_block bb)



More information about the Gcc-patches mailing list