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]

[tree-ssa] Small changes to tree-cfg


Hello,

this patch adds a few minor changes to tree-cfg.c:
  -- makes remove_unreachable_blocks not to use FOR_EACH_BB (it is not
     quite clear that it is correct when the basic block is removed)
  -- adds a new debugging function
  -- removes one forgotten instance of LOOP_EXPR

Commited as obvious.

Zdenek

	* tree-cfg.c (remove_unreachable_blocks): Clean up.
	(debug_tree_bb_n): New.
	(is_ctrl_structure): Remove LOOP_EXPR.
	* tree-flow.h (debug_tree_bb_n): Declare.

Index: tree-cfg.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/Attic/tree-cfg.c,v
retrieving revision 1.1.4.162
diff -c -3 -p -r1.1.4.162 tree-cfg.c
*** tree-cfg.c	11 Sep 2003 15:13:04 -0000	1.1.4.162
--- tree-cfg.c	13 Sep 2003 16:40:37 -0000
*************** remove_useless_stmts_and_vars (tree *fir
*** 1751,1768 ****
  bool
  remove_unreachable_blocks (void)
  {
!   basic_block bb;
    bool ret = false;
  
    find_unreachable_blocks ();
  
    /* Remove unreachable blocks in reverse.  That will expose more unnecessary
       COMPOUND_EXPRs that we can remove.  */
!   FOR_EACH_BB_REVERSE (bb)
      {
        /* The block may have been removed in a previous iteration if it was
  	 inside an unreachable control structure.  */
!       if (bb == NULL || bb->index == INVALID_BLOCK)
  	continue;
  
        if (!(bb->flags & BB_REACHABLE))
--- 1751,1771 ----
  bool
  remove_unreachable_blocks (void)
  {
!   int i;
    bool ret = false;
+   basic_block bb;
  
    find_unreachable_blocks ();
  
    /* Remove unreachable blocks in reverse.  That will expose more unnecessary
       COMPOUND_EXPRs that we can remove.  */
!   for (i = last_basic_block - 1; i >= 0; i--)
      {
+       bb = BASIC_BLOCK (i);
+ 
        /* The block may have been removed in a previous iteration if it was
  	 inside an unreachable control structure.  */
!       if (bb == NULL)
  	continue;
  
        if (!(bb->flags & BB_REACHABLE))
*************** debug_tree_bb (basic_block bb)
*** 2723,2728 ****
--- 2726,2739 ----
    dump_tree_bb (stderr, "", bb, 0);
  }
  
+ /* Dump a basic block N on stderr.  */
+ 
+ basic_block
+ debug_tree_bb_n (int n)
+ {
+   debug_tree_bb (BASIC_BLOCK (n));
+   return BASIC_BLOCK (n);
+ }	 
  
  /* Dump the CFG on stderr.
  
*************** is_ctrl_structure (tree t)
*** 2998,3004 ****
  #endif
  
    return (TREE_CODE (t) == COND_EXPR
- 	  || TREE_CODE (t) == LOOP_EXPR
  	  || TREE_CODE (t) == CATCH_EXPR
  	  || TREE_CODE (t) == EH_FILTER_EXPR
  	  || TREE_CODE (t) == TRY_CATCH_EXPR
--- 3009,3014 ----
Index: tree-flow.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/Attic/tree-flow.h,v
retrieving revision 1.1.4.112
diff -c -3 -p -r1.1.4.112 tree-flow.h
*** tree-flow.h	11 Sep 2003 15:13:04 -0000	1.1.4.112
--- tree-flow.h	13 Sep 2003 16:40:37 -0000
*************** extern bool is_ctrl_altering_stmt (tree)
*** 414,419 ****
--- 414,420 ----
  extern bool is_computed_goto (tree);
  extern void dump_tree_bb (FILE *, const char *, basic_block, int);
  extern void debug_tree_bb (basic_block);
+ extern basic_block debug_tree_bb_n (int);
  extern void dump_tree_cfg (FILE *, int);
  extern void debug_tree_cfg (int);
  extern void dump_cfg_stats (FILE *);


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