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: Review of the 2nd piece of the machine-independent part of selective scheduler


Hello Vlad,

Vladimir Makarov wrote:
The most serious mistake is wrong work with POSIX include files and
functions.  It should be fixed in anyway bu using macros generated by
configure.  See comments for pwd.h, unistd.h, and fcntl.h.
This was part of the debug infrastructure that I have removed. The unneeded debug flags and related code was also removed; I have sent it in the previous mail. The other problems are fixed by this patch.

Thanks, Andrey

2008-08-22 Andrey Belevantsev <abel@ispras.ru>

	* sel-sched.c (move_exprs_to_boundary): Do not call print_marker_to_log.
	* sel-sched-ir.c (regset_pool, nop_pool): Document fields.
	(finish_insns): Move forward declaration up.
	(def_list_add): Add blank line.
	(_advance_deps_context_sched_deps_info): Remove underscore in name,
	adjust all users, add comment.
	(merge_fences): Document parameters.
	(get_regset_from_pool): Document return value.
	(get_clear_regset_from_pool): Likewise.
	(return_regset_to_pool): Document function.
	(cmp_v_in_regset_pool): Document function and parameters.
	(free_regset_pool): Likewise.  Use #ifdef ENABLE_CHECKING instead of
	ENABLE_SEL_CHECKING.  Add new page symbol after the function.
	(skip_unspecs_callback): Document parameters.
	(hash_with_unspec_callback): Likewise.
	(vinsn_init): Likewise.
	(find_in_history_vect_1): Likewise.
	(find_in_history_vect): Likewise.
	(insert_in_history_vect): Likewise.
	(update_target_availability): Likewise.
	(update_speculative_bits): Likewise.
	(merge_expr): Likewise.
	(speculate_expr): Likewise.
	(sel_init_global_and_expr): Likewise.  Remove extra parentheses.
	(deps_init_id_data): Document fields.
	(deps_init_id_sched_deps_info, const_deps_init_id_sched_deps_info):
	Document variables.
	(has_dependence_sched_deps_info, const_has_dependence_sched_deps_info):
	Likewise.
	(sel_clear_has_dependence): Document function.
	(has_dependence_p): Document parameters.
	(tidy_control_flow): Likewise.
	(copy_lv_set_from): Likewise.
	(get_av_set): Document return parameter.
	(tick_check_dep_with_dw): Remove assert.
	(_tick_check_sched_deps_info): Remove underscore, document.
	(verify_backedges): Move comment before the function.
	(has_dependence_data): When declaring, remove _has_dependence_data.
	(succs_info_pool): Document fields.
	(compute_succs_info): Document parameters.
	(sel_remove_empty_bb): Likewise.
	(change_loops_latches): Likewise.
	(sel_create_recovery_block): Likewise.
	(create_vinsn_from_insn_rtx): Likewise.
	(setup_nop_and_exit_insns): Remove extra parentheses.
	(get_all_loop_exits): Likewise.
	(bb_top_order_comparator): Fix comment.
	* sel-sched-ir.h (ENABLE_SEL_CHECKING): Remove.
	(struct _expr): Document usefulness field.
	(struct _bnd): Document fields.
	(_list_iterator): Likewise.
	(struct idata_def): Remove commented field.
	(struct transformed_insns): Document fields.
	(INSN_NOP_P): Fix typo in comment.
	(IN_CURRENT_FENCE_P): Likewise.
	* sel-sched-dump.c: Do not include unistd.h.
	(switch_dump): Document.  Add assert.
	(sched_dump1): Rename to saved_sched_dump.
	(restore_dump): Document.
	(dump_vinsn_flags, debug_vinsn_flags, debug_expr_flags,
	debug_insn_flags): Likewise.
	(dump_all): Remove.  Update all code.
	(dump_insn_rtx_1): Document.
	(dump_insn_rtx): Likewise.
	(debug_insn_rtx): Likewise.
	(dump_vinsn_1): Likewise.
	(dump_vinsn): Likewise.
	(debug_vinsn): Likewise.
	(dump_expr, debug_expr): Likewise.
	(debug_insn): Likewise.
	(dump_insn_1): Remove dead code.
	(sel_prepare_string_for_dot_label): Make arrays static.
	(insn_uid, block_for_insn, bb_av_set, insn_pattern, insn_code,
	insn_is_set_p, hard_regno_rename_ok): Remove.
	* sel-sched-dump.h (SEL_DUMP_CFG_*): Remove.
	(enum sel_dump_cfg_def): Document fields.
	(enum dump_insn_rtx_def): Likewise.  Kill first underscore from name,
	add def suffix.
	(enum dump_vinsn_def): Likewise.
	(enum dump_expr_def): Likewise.
	(enum dump_insn_def): Likewise.  Remove unneeded entries.
	(enum _dump_idata): Remove.
	(sel_print_to_dot, sel_print): Document macros.
	(print_marker_to_log, insn_uid, block_for_insn, bb_av_set,
	insn_pattern, insn_code, insn_is_set_p, hard_regno_rename_ok): Remove
	declarations.
	(debug_find_insn_loop, debug_find_unreachable_blocks, sel_debug_cfg,
	mem_test, in_range_p, av_set_contains_insn_with_uid, av_set_for_bb_n,
	sel_get_stat_file): Likewise.
	* rtl.c (rtx_equal_p_cb): Remove unneeded blank line before function.


Index: gcc/sel-sched.c
===================================================================
*** gcc/sel-sched.c	(revision 139437)
--- gcc/sel-sched.c	(working copy)
*************** move_exprs_to_boundary (bnd_t bnd, expr_
*** 4834,4845 ****
    bitmap_iterator bi;
    int n_bookkeeping_copies_before_moveop;
  
- #ifdef ENABLE_CHECKING  
-   /* Marker is useful to bind .dot dumps and the log.  */
-   if (sched_verbose >= 6)
-     print_marker_to_log ();
- #endif
- 
    /* Make a move.  This call will remove the original operation,
       insert all necessary bookkeeping instructions and update the
       data sets.  After that all we have to do is add the operation
--- 4834,4839 ----
Index: gcc/sel-sched-ir.c
===================================================================
*** gcc/sel-sched-ir.c	(revision 139437)
--- gcc/sel-sched-ir.c	(working copy)
*************** static int rev_top_order_index_len = -1;
*** 88,112 ****
  /* A regset pool structure.  */
  static struct
  {
    regset *v;
    int n;
    int s;
  
!   /* In VV we accumulate all generated regsets so that, when destucting the
       pool, we can compare it with V and check that every regset was returned
       back to pool.  */
    regset *vv;
    int nn;
    int ss;
  
    int diff;
  } regset_pool = { NULL, 0, 0, NULL, 0, 0, 0 };
  
  /* This represents the nop pool.  */
  static struct
  {
    insn_t *v;
    int n;
    int s;  
  } nop_pool = { NULL, 0, 0 };
  
--- 88,127 ----
  /* A regset pool structure.  */
  static struct
  {
+   /* The stack to which regsets are returned.  */
    regset *v;
+ 
+   /* Its pointer.  */
    int n;
+ 
+   /* Its size.  */
    int s;
  
!   /* In VV we save all generated regsets so that, when destructing the
       pool, we can compare it with V and check that every regset was returned
       back to pool.  */
    regset *vv;
+ 
+   /* The pointer of VV stack.  */
    int nn;
+ 
+   /* Its size.  */
    int ss;
  
+   /* The difference between allocated and returned regsets.  */
    int diff;
  } regset_pool = { NULL, 0, 0, NULL, 0, 0, 0 };
  
  /* This represents the nop pool.  */
  static struct
  {
+   /* The vector which holds previously emitted nops.  */
    insn_t *v;
+ 
+   /* Its pointer.  */
    int n;
+ 
+   /* Its size.  */
    int s;  
  } nop_pool = { NULL, 0, 0 };
  
*************** static void create_initial_data_sets (ba
*** 145,150 ****
--- 160,166 ----
  static void invalidate_av_set (basic_block);
  static void extend_insn_data (void);
  static void sel_init_new_insn (insn_t, int);
+ static void finish_insns (void);
  
  /* Various list functions.  */
  
*************** void
*** 300,305 ****
--- 316,322 ----
  def_list_add (def_list_t *dl, insn_t original_insn, bool crosses_call)
  {
    def_t d;
+   
    _list_add (dl);
    d = DEF_LIST_DEF (*dl);
  
*************** def_list_add (def_list_t *dl, insn_t ori
*** 314,322 ****
     that there are no uninitialized (null) target contexts.  */
  static tc_t bulk_tc = (tc_t) 1;
  
! /* Target hooks wrappers.
!    Possibly it would be nice to provide some default implementations for
!    them. */
  
  /* Allocate a store for the target context.  */
  static tc_t
--- 331,338 ----
     that there are no uninitialized (null) target contexts.  */
  static tc_t bulk_tc = (tc_t) 1;
  
! /* Target hooks wrappers.  In the future we can provide some default 
!    implementations for them.  */
  
  /* Allocate a store for the target context.  */
  static tc_t
*************** reset_deps_context (deps_t dc)
*** 470,476 ****
    init_deps (dc);
  }
  
! static struct sched_deps_info_def _advance_deps_context_sched_deps_info =
    {
      NULL,
  
--- 486,494 ----
    init_deps (dc);
  }
  
! /* This structure describes the dependence analysis hooks for advancing 
!    dependence context.  */
! static struct sched_deps_info_def advance_deps_context_sched_deps_info =
    {
      NULL,
  
*************** static struct sched_deps_info_def _advan
*** 493,499 ****
  void
  advance_deps_context (deps_t dc, insn_t insn)
  {
!   sched_deps_info = &_advance_deps_context_sched_deps_info;
    deps_analyze_insn (dc, insn);
  }
  
--- 511,517 ----
  void
  advance_deps_context (deps_t dc, insn_t insn)
  {
!   sched_deps_info = &advance_deps_context_sched_deps_info;
    deps_analyze_insn (dc, insn);
  }
  
*************** init_fences (insn_t old_fence)
*** 603,613 ****
      }
  }
  
! /* Merges two fences (filling fields of OLD_FENCE with resulting values) by
     following rules: 1) state, target context and last scheduled insn are
     propagated from fallthrough edge if it is available; 
     2) deps context and cycle is propagated from more probable edge;
!    3) all other fields are set to corresponding constant values.  */
  static void
  merge_fences (fence_t f, insn_t insn,
  	      state_t state, deps_t dc, void *tc, 
--- 621,635 ----
      }
  }
  
! /* Merges two fences (filling fields of fence F with resulting values) by
     following rules: 1) state, target context and last scheduled insn are
     propagated from fallthrough edge if it is available; 
     2) deps context and cycle is propagated from more probable edge;
!    3) all other fields are set to corresponding constant values.  
! 
!    INSN, STATE, DC, TC, LAST_SCHEDULED_INSN, EXECUTING_INSNS, 
!    READY_TICKS, READY_TICKS_SIZE, SCHED_NEXT, CYCLE and AFTER_STALL_P
!    are the corresponding fields of the second fence.  */
  static void
  merge_fences (fence_t f, insn_t insn,
  	      state_t state, deps_t dc, void *tc, 
*************** add_dirty_fence_to_fences (flist_tail_t 
*** 870,875 ****
--- 892,899 ----
  
  /* Functions to work with regset and nop pools.  */
  
+ /* Returns the new regset from pool.  It might have some of the bits set
+    from the previous usage.  */
  regset
  get_regset_from_pool (void)
  {
*************** get_regset_from_pool (void)
*** 893,898 ****
--- 917,923 ----
    return rs;
  }
  
+ /* Same as above, but returns the empty regset.  */
  regset
  get_clear_regset_from_pool (void)
  {
*************** get_clear_regset_from_pool (void)
*** 902,907 ****
--- 927,933 ----
    return rs;
  }
  
+ /* Return regset RS to the pool for future use.  */
  void
  return_regset_to_pool (regset rs)
  {
*************** return_regset_to_pool (regset rs)
*** 913,962 ****
    regset_pool.v[regset_pool.n++] = rs;
  }
  
  static int
  cmp_v_in_regset_pool (const void *x, const void *xx)
  {
    return *((const regset *) x) - *((const regset *) xx);
  }
  
  void
  free_regset_pool (void)
  {
!   if (ENABLE_SEL_CHECKING)
!     {
!       regset *v = regset_pool.v;
!       int i = 0;
!       int n = regset_pool.n;
! 
!       regset *vv = regset_pool.vv;
!       int ii = 0;
!       int nn = regset_pool.nn;
! 
!       int diff = 0;
! 
!       gcc_assert (n <= nn);
! 
!       /* Sort both vectors so it will be possible to compare them.  */
!       qsort (v, n, sizeof (*v), cmp_v_in_regset_pool);
!       qsort (vv, nn, sizeof (*vv), cmp_v_in_regset_pool);
! 
!       while (ii < nn)
! 	{
! 	  if (v[i] == vv[ii])
! 	    i++;
! 	  else
! 	    /* VV[II] was lost.  */
! 	    diff++;
! 
! 	  ii++;
! 	}
! 
!       gcc_assert (diff == regset_pool.diff);
!     }
! 
    /* If not true - we have a memory leak.  */
    gcc_assert (regset_pool.diff == 0);
! 
    while (regset_pool.n)
      {
        --regset_pool.n;
--- 939,992 ----
    regset_pool.v[regset_pool.n++] = rs;
  }
  
+ /* This is used as a qsort callback for sorting regset pool stacks.
+    X and XX are addresses of two regsets.  They are never equal.  */
  static int
  cmp_v_in_regset_pool (const void *x, const void *xx)
  {
    return *((const regset *) x) - *((const regset *) xx);
  }
  
+ /*  Free the regset pool possibly checking for memory leaks.  */
  void
  free_regset_pool (void)
  {
! #ifdef ENABLE_CHECKING
!   {
!     regset *v = regset_pool.v;
!     int i = 0;
!     int n = regset_pool.n;
!     
!     regset *vv = regset_pool.vv;
!     int ii = 0;
!     int nn = regset_pool.nn;
!     
!     int diff = 0;
!     
!     gcc_assert (n <= nn);
!     
!     /* Sort both vectors so it will be possible to compare them.  */
!     qsort (v, n, sizeof (*v), cmp_v_in_regset_pool);
!     qsort (vv, nn, sizeof (*vv), cmp_v_in_regset_pool);
!     
!     while (ii < nn)
!       {
!         if (v[i] == vv[ii])
!           i++;
!         else
!           /* VV[II] was lost.  */
!           diff++;
!         
!         ii++;
!       }
!     
!     gcc_assert (diff == regset_pool.diff);
!   }
! #endif
!   
    /* If not true - we have a memory leak.  */
    gcc_assert (regset_pool.diff == 0);
!   
    while (regset_pool.n)
      {
        --regset_pool.n;
*************** free_regset_pool (void)
*** 974,979 ****
--- 1004,1010 ----
  
    regset_pool.diff = 0;
  }
+ 
  
  /* Functions to work with nop pools.  NOP insns are used as temporary 
     placeholders of the insns being scheduled to allow correct update of 
*************** free_nop_pool (void)
*** 1033,1039 ****
  }
  
  
! /* Skip unspec to support ia64 speculation. Called from rtx_equal_p_cb.  */
  static int
  skip_unspecs_callback (const_rtx *xx, const_rtx *yy, rtx *nx, rtx* ny)
  {
--- 1064,1072 ----
  }
  
  
! /* Skip unspec to support ia64 speculation. Called from rtx_equal_p_cb.  
!    The callback is given two rtxes XX and YY and writes the new rtxes
!    to NX and NY in case some needs to be skipped.  */
  static int
  skip_unspecs_callback (const_rtx *xx, const_rtx *yy, rtx *nx, rtx* ny)
  {
*************** skip_unspecs_callback (const_rtx *xx, co
*** 1061,1075 ****
    return 0;
  }
  
! /* Callback, called from hash_rtx_cb.
!    Helps to hash UNSPEC rtx in a correct way to support ia64 speculation. */
  static int
  hash_with_unspec_callback (const_rtx x, enum machine_mode mode ATTRIBUTE_UNUSED,
                             rtx *nx, enum machine_mode* nmode)
  {
    if (GET_CODE (x) == UNSPEC 
        && targetm.sched.skip_rtx_p
!       && targetm.sched.skip_rtx_p(x))
      {
        *nx = XVECEXP (x, 0 ,0);
        *nmode = 0;
--- 1094,1109 ----
    return 0;
  }
  
! /* Callback, called from hash_rtx_cb.  Helps to hash UNSPEC rtx X in a correct way 
!    to support ia64 speculation.  When changes are needed, new rtx X and new mode
!    NMODE are written, and the callback returns true.  */
  static int
  hash_with_unspec_callback (const_rtx x, enum machine_mode mode ATTRIBUTE_UNUSED,
                             rtx *nx, enum machine_mode* nmode)
  {
    if (GET_CODE (x) == UNSPEC 
        && targetm.sched.skip_rtx_p
!       && targetm.sched.skip_rtx_p (x))
      {
        *nx = XVECEXP (x, 0 ,0);
        *nmode = 0;
*************** lhs_and_rhs_separable_p (rtx lhs, rtx rh
*** 1115,1121 ****
    return true;
  }
  
! /* Initialize vinsn VI for INSN.  Only for use from vinsn_create ().  */
  static void
  vinsn_init (vinsn_t vi, insn_t insn, bool force_unique_p)
  {
--- 1149,1157 ----
    return true;
  }
  
! /* Initialize vinsn VI for INSN.  Only for use from vinsn_create ().  When 
!    FORCE_UNIQUE_P is true, the resulting vinsn will not be clonable.  This is 
!    used e.g. for insns from recovery blocks.  */
  static void
  vinsn_init (vinsn_t vi, insn_t insn, bool force_unique_p)
  {
*************** sel_move_insn (expr_t expr, int seqno, i
*** 1373,1381 ****
  
  /* Functions to work with right-hand sides.  */
  
! /* Search for a hash value HASH in a sorted vector VECT and return true
!    when found.  Write to INDP the index on which the search has stopped,
!    such that inserting HASH at INDP will retain VECT's sort order.  */
  static bool
  find_in_history_vect_1 (VEC(expr_history_def, heap) *vect, 
                          unsigned uid, vinsn_t new_vinsn, 
--- 1409,1419 ----
  
  /* Functions to work with right-hand sides.  */
  
! /* Search for a hash value determined by UID/NEW_VINSN in a sorted vector 
!    VECT and return true when found.  Use NEW_VINSN for comparison only when
!    COMPARE_VINSNS is true.  Write to INDP the index on which 
!    the search has stopped, such that inserting the new element at INDP will 
!    retain VECT's sort order.  */
  static bool
  find_in_history_vect_1 (VEC(expr_history_def, heap) *vect, 
                          unsigned uid, vinsn_t new_vinsn, 
*************** find_in_history_vect_1 (VEC(expr_history
*** 1418,1424 ****
    return false;
  }
  
! /* Search for a uid of INSN a sorted vector VECT.  Return 
     the position found or -1, if no such value is in vector.  
     Search also for UIDs of insn's originators, if ORIGINATORS_P is true.  */
  int
--- 1456,1462 ----
    return false;
  }
  
! /* Search for a uid of INSN and NEW_VINSN in a sorted vector VECT.  Return 
     the position found or -1, if no such value is in vector.  
     Search also for UIDs of insn's originators, if ORIGINATORS_P is true.  */
  int
*************** find_in_history_vect (VEC(expr_history_d
*** 1444,1451 ****
    return -1;
  }
  
! /* Insert HASH in a sorted vector pointed to by PVECT, if HASH is
!    not there already.  */
  void
  insert_in_history_vect (VEC (expr_history_def, heap) **pvect,
                          unsigned uid, enum local_trans_type type,
--- 1482,1491 ----
    return -1;
  }
  
! /* Insert new element in a sorted history vector pointed to by PVECT, 
!    if it is not there already.  The element is searched using 
!    UID/NEW_EXPR_VINSN pair.  TYPE, OLD_EXPR_VINSN and SPEC_DS save
!    the history of a transformation.  */
  void
  insert_in_history_vect (VEC (expr_history_def, heap) **pvect,
                          unsigned uid, enum local_trans_type type,
*************** prepare_insn_expr (insn_t insn, int seqn
*** 1651,1657 ****
    free_history_vect (&EXPR_HISTORY_OF_CHANGES (expr));
  }
  
! /* Update target_available bits when merging exprs TO and FROM.  */
  static void
  update_target_availability (expr_t to, expr_t from, insn_t split_point)
  {
--- 1691,1699 ----
    free_history_vect (&EXPR_HISTORY_OF_CHANGES (expr));
  }
  
! /* Update target_available bits when merging exprs TO and FROM.  SPLIT_POINT
!    is non-null when expressions are merged from different successors at 
!    a split point.  */
  static void
  update_target_availability (expr_t to, expr_t from, insn_t split_point)
  {
*************** update_target_availability (expr_t to, e
*** 1682,1688 ****
      }
  }
  
! /* Update speculation bits when merging exprs TO and FROM.  */
  static void
  update_speculative_bits (expr_t to, expr_t from, insn_t split_point)
  {
--- 1724,1732 ----
      }
  }
  
! /* Update speculation bits when merging exprs TO and FROM.  SPLIT_POINT
!    is non-null when expressions are merged from different successors at 
!    a split point.  */
  static void
  update_speculative_bits (expr_t to, expr_t from, insn_t split_point)
  {
*************** merge_expr_data (expr_t to, expr_t from,
*** 1784,1790 ****
    update_speculative_bits (to, from, split_point);
  }
  
! /* Merge bits of FROM expr to TO expr.  Vinsns in the exprs should correlate.  */
  void
  merge_expr (expr_t to, expr_t from, insn_t split_point)
  {
--- 1828,1836 ----
    update_speculative_bits (to, from, split_point);
  }
  
! /* Merge bits of FROM expr to TO expr.  Vinsns in the exprs should be equal
!    in terms of vinsn_equal_p.  SPLIT_POINT is non-null when expressions 
!    are merged from different successors at a split point.  */
  void
  merge_expr (expr_t to, expr_t from, insn_t split_point)
  {
*************** set_unavailable_target_for_expr (expr_t 
*** 1875,1881 ****
  
  /* Try to make EXPR speculative.  Return 1 when EXPR's pattern 
     or dependence status have changed, 2 when also the target register
!    became unavailable, 0 if nothing had to be changed. */
  int
  speculate_expr (expr_t expr, ds_t ds)
  {
--- 1921,1927 ----
  
  /* Try to make EXPR speculative.  Return 1 when EXPR's pattern 
     or dependence status have changed, 2 when also the target register
!    became unavailable, 0 if nothing had to be changed.  */
  int
  speculate_expr (expr_t expr, ds_t ds)
  {
*************** av_set_intersect (av_set_t *avp, av_set_
*** 2286,2301 ****
  
  /* Dependence hooks to initialize insn data.  */
  
  static struct
  {
    deps_where_t where;
    idata_t id;
    bool force_unique_p;
    bool force_use_p;
  } deps_init_id_data;
  
  
! /* Setup ID for INSN.  */
  static void
  setup_id_for_insn (idata_t id, insn_t insn, bool force_unique_p)
  {
--- 2332,2357 ----
  
  /* Dependence hooks to initialize insn data.  */
  
+ /* This is used in hooks callable from dependence analysis when initializing
+    instruction's data.  */
  static struct
  {
+   /* Where the dependence was found (lhs/rhs).  */
    deps_where_t where;
+ 
+   /* The actual data object to initialize.  */
    idata_t id;
+ 
+   /* True when the insn should not be made clonable.  */
    bool force_unique_p;
+ 
+   /* True when insn should be treated as of type USE, i.e. never renamed.  */
    bool force_use_p;
  } deps_init_id_data;
  
  
! /* Setup ID for INSN.  FORCE_UNIQUE_P is true when INSN should not be 
!    clonable.  */
  static void
  setup_id_for_insn (idata_t id, insn_t insn, bool force_unique_p)
  {
*************** deps_init_id_finish_insn (void)
*** 2444,2449 ****
--- 2500,2509 ----
    deps_init_id_data.where = DEPS_IN_NOWHERE;
  }
  
+ /* This is dependence info used for initializing insn's data.  */
+ static struct sched_deps_info_def deps_init_id_sched_deps_info;
+ 
+ /* This initializes most of the static part of the above structure.  */
  static const struct sched_deps_info_def const_deps_init_id_sched_deps_info =
    {
      NULL,
*************** static const struct sched_deps_info_def 
*** 2465,2473 ****
      0 /* generate_spec_deps */
    };
  
! static struct sched_deps_info_def deps_init_id_sched_deps_info;
! 
! /* Initialize INSN's lhs and rhs in ID.  */
  static void
  setup_id_lhs_rhs (idata_t id, insn_t insn, bool force_unique_p)
  {
--- 2525,2532 ----
      0 /* generate_spec_deps */
    };
  
! /* Initialize INSN's lhs and rhs in ID.  When FORCE_UNIQUE_P is true,
!    we don't actually need information about lhs and rhs.  */
  static void
  setup_id_lhs_rhs (idata_t id, insn_t insn, bool force_unique_p)
  {
*************** init_global_and_expr_for_insn (insn_t in
*** 2807,2828 ****
    init_first_time_insn_data (insn);
  }
  
! /* Scan the region and initialize instruction data.  */
  void
  sel_init_global_and_expr (bb_vec_t bbs)
  {
!   {
!     /* ??? It would be nice to implement push / pop scheme for sched_infos.  */
!     const struct sched_scan_info_def ssi =
!       {
! 	NULL, /* extend_bb */
! 	init_global_and_expr_for_bb, /* init_bb */
! 	extend_insn_data, /* extend_insn */
! 	init_global_and_expr_for_insn /* init_insn */
!       };
! 
!     sched_scan (&ssi, bbs, NULL, NULL, NULL);
!   }
  }
  
  /* Finalize region-scope data structures for basic blocks.  */
--- 2866,2885 ----
    init_first_time_insn_data (insn);
  }
  
! /* Scan the region and initialize instruction data for basic blocks BBS.  */
  void
  sel_init_global_and_expr (bb_vec_t bbs)
  {
!   /* ??? It would be nice to implement push / pop scheme for sched_infos.  */
!   const struct sched_scan_info_def ssi =
!     {
!       NULL, /* extend_bb */
!       init_global_and_expr_for_bb, /* init_bb */
!       extend_insn_data, /* extend_insn */
!       init_global_and_expr_for_insn /* init_insn */
!     };
!   
!   sched_scan (&ssi, bbs, NULL, NULL, NULL);
  }
  
  /* Finalize region-scope data structures for basic blocks.  */
*************** finish_global_and_expr_insn (insn_t insn
*** 2856,2863 ****
      }
  }
  
- static void finish_insns (void);
- 
  /* Finalize per instruction data for the whole region.  */
  void
  sel_finish_global_and_expr (void)
--- 2913,2918 ----
*************** sel_finish_global_and_expr (void)
*** 2896,2902 ****
     when we'll start caching dependence requests.  */
  
  /* Container to hold information for dependency analysis.  */
! static struct _has_dependence_data
  {
    deps_t dc;
  
--- 2951,2957 ----
     when we'll start caching dependence requests.  */
  
  /* Container to hold information for dependency analysis.  */
! static struct
  {
    deps_t dc;
  
*************** sel_mark_hard_insn (rtx insn)
*** 3093,3098 ****
--- 3148,3158 ----
      has_dependence_data.has_dep_p[i] &= ~SPECULATIVE;
  }
  
+ /* This structure holds the hooks for the dependency analysis used when
+    actually processing dependencies in the scheduler.  */
+ static struct sched_deps_info_def has_dependence_sched_deps_info;
+ 
+ /* This initializes most of the fields of the above structure.  */
  static const struct sched_deps_info_def const_has_dependence_sched_deps_info =
    {
      NULL,
*************** static const struct sched_deps_info_def 
*** 3114,3121 ****
      0 /* generate_spec_deps */
    };
  
! static struct sched_deps_info_def has_dependence_sched_deps_info;
! 
  static void
  setup_has_dependence_sched_deps_info (void)
  {
--- 3174,3180 ----
      0 /* generate_spec_deps */
    };
  
! /* Initialize has_dependence_sched_deps_info with extra spec field.  */
  static void
  setup_has_dependence_sched_deps_info (void)
  {
*************** setup_has_dependence_sched_deps_info (vo
*** 3129,3134 ****
--- 3188,3194 ----
    sched_deps_info = &has_dependence_sched_deps_info;
  }
  
+ /* Remove all dependences found and recorded in has_dependence_data array.  */
  void
  sel_clear_has_dependence (void)
  {
*************** sel_clear_has_dependence (void)
*** 3138,3144 ****
      has_dependence_data.has_dep_p[i] = 0;
  }
  
! /* Return nonzero if EXPR has is dependent upon PRED.  */
  ds_t
  has_dependence_p (expr_t expr, insn_t pred, ds_t **has_dep_pp)
  {
--- 3198,3205 ----
      has_dependence_data.has_dep_p[i] = 0;
  }
  
! /* Return nonzero if EXPR has is dependent upon PRED.  Return the pointer
!    to the dependence information array in HAS_DEP_PP.  */
  ds_t
  has_dependence_p (expr_t expr, insn_t pred, ds_t **has_dep_pp)
  {
*************** tick_check_dep_with_dw (insn_t pro_insn,
*** 3227,3247 ****
        enum reg_note dt;
        int tick;
  
!       if (/* PROducer was removed from above due to pipelining.  See PR8.  */
  	  !INSN_IN_STREAM_P (pro_insn)
  	  /* Or PROducer was originally on the next iteration regarding the
  	     CONsumer.  */
  	  || (INSN_SCHED_TIMES (pro_insn)
  	      - EXPR_SCHED_TIMES (con_expr)) > 1)
  	/* Don't count this dependence.  */
! 	{
! 	  /* ??? This assert fails on a large testcase.  It is not clear
! 	     to me if the assert is right so defer debugging until a smaller
! 	     testcase is avalailable.  */
! 	  gcc_assert (1 || pipelining_p);
! 
! 	  return;
! 	}
  
        dt = ds_to_dt (ds);
        if (dt == REG_DEP_TRUE)
--- 3288,3301 ----
        enum reg_note dt;
        int tick;
  
!       if (/* PROducer was removed from above due to pipelining.  */
  	  !INSN_IN_STREAM_P (pro_insn)
  	  /* Or PROducer was originally on the next iteration regarding the
  	     CONsumer.  */
  	  || (INSN_SCHED_TIMES (pro_insn)
  	      - EXPR_SCHED_TIMES (con_expr)) > 1)
  	/* Don't count this dependence.  */
!         return;
  
        dt = ds_to_dt (ds);
        if (dt == REG_DEP_TRUE)
*************** tick_check_note_mem_dep (rtx mem1, rtx m
*** 3285,3291 ****
    tick_check_dep_with_dw (pro, ds, dw);
  }
  
! static struct sched_deps_info_def _tick_check_sched_deps_info =
    {
      NULL,
  
--- 3339,3347 ----
    tick_check_dep_with_dw (pro, ds, dw);
  }
  
! /* This structure contains hooks for dependence analysis used when determining
!    whether an insn is ready for scheduling.  */
! static struct sched_deps_info_def tick_check_sched_deps_info =
    {
      NULL,
  
*************** tick_check_p (expr_t expr, deps_t dc, fe
*** 3314,3320 ****
    tick_check_data.expr = expr;
    tick_check_data.cycle = 0;
    tick_check_data.seen_true_dep_p = false;
!   sched_deps_info = &_tick_check_sched_deps_info;
    
    gcc_assert (!dc->readonly);
    dc->readonly = 1;
--- 3370,3376 ----
    tick_check_data.expr = expr;
    tick_check_data.cycle = 0;
    tick_check_data.seen_true_dep_p = false;
!   sched_deps_info = &tick_check_sched_deps_info;
    
    gcc_assert (!dc->readonly);
    dc->readonly = 1;
*************** insn_is_the_only_one_in_bb_p (insn_t ins
*** 3400,3410 ****
  }
  
  #ifdef ENABLE_CHECKING
  static void
  verify_backedges (void)
  {
-   /* Check that the region we're scheduling still has at most one 
-      backedge.  */
    if (pipelining_p)
      {
        int i, n = 0;
--- 3456,3466 ----
  }
  
  #ifdef ENABLE_CHECKING
+ /* Check that the region we're scheduling still has at most one 
+    backedge.  */
  static void
  verify_backedges (void)
  {
    if (pipelining_p)
      {
        int i, n = 0;
*************** maybe_tidy_empty_bb (basic_block bb)
*** 3498,3504 ****
  }
  
  /* Tidy the control flow after we have removed original insn from 
!    XBB.  Return true if we have removed some blocks.  */
  bool
  tidy_control_flow (basic_block xbb, bool full_tidying)
  {
--- 3554,3561 ----
  }
  
  /* Tidy the control flow after we have removed original insn from 
!    XBB.  Return true if we have removed some blocks.  When FULL_TIDYING
!    is true, also try to optimize control flow on non-empty blocks.  */
  bool
  tidy_control_flow (basic_block xbb, bool full_tidying)
  {
*************** init_lv_set (basic_block bb)
*** 3906,3911 ****
--- 3963,3969 ----
    BB_LV_SET_VALID_P (bb) = true;
  }
  
+ /* Copy liveness information to BB from FROM_BB.  */
  static void
  copy_lv_set_from (basic_block bb, basic_block from_bb)
  {
*************** copy_data_sets (basic_block to, basic_bl
*** 4061,4066 ****
--- 4119,4125 ----
      }
  }
  
+ /* Return an av set for INSN, if any.  */
  av_set_t
  get_av_set (insn_t insn)
  {
*************** static VEC (basic_block, heap) *last_add
*** 4103,4110 ****
  /* A pool for allocating successor infos.  */
  static struct
  {
    struct succs_info *stack;
!   int size, top, max_top;
  }  succs_info_pool;
  
  /* Functions to work with control-flow graph.  */
--- 4162,4178 ----
  /* A pool for allocating successor infos.  */
  static struct
  {
+   /* A stack for saving succs_info structures.  */
    struct succs_info *stack;
! 
!   /* Its size.  */
!   int size;
! 
!   /* Top of the stack.  */
!   int top;
! 
!   /* Maximal value of the top.  */
!   int max_top;
  }  succs_info_pool;
  
  /* Functions to work with control-flow graph.  */
*************** free_succs_info (struct succs_info * sin
*** 4314,4321 ****
    sinfo->all_succs_n = 0;
  }
  
! /* Same as above, but fill PROBS vector with probabilities of corresponding
!    successors depending on INSN.  */
  struct succs_info *
  compute_succs_info (insn_t insn, short flags)
  {
--- 4382,4389 ----
    sinfo->all_succs_n = 0;
  }
  
! /* Compute successor info for INSN.  FLAGS are the flags passed 
!    to the FOR_EACH_SUCC_1 iterator.  */
  struct succs_info *
  compute_succs_info (insn_t insn, short flags)
  {
*************** move_bb_info (basic_block merge_bb, basi
*** 4836,4842 ****
  
  /* Remove an empty basic block EMPTY_BB.  When MERGE_UP_P is true, we put 
     EMPTY_BB's note lists into its predecessor instead of putting them 
!    into the successor.  */
  void
  sel_remove_empty_bb (basic_block empty_bb, bool merge_up_p,
  		     bool remove_from_cfg_p)
--- 4904,4911 ----
  
  /* Remove an empty basic block EMPTY_BB.  When MERGE_UP_P is true, we put 
     EMPTY_BB's note lists into its predecessor instead of putting them 
!    into the successor.  When REMOVE_FROM_CFG_P is true, also remove 
!    the empty block.  */
  void
  sel_remove_empty_bb (basic_block empty_bb, bool merge_up_p,
  		     bool remove_from_cfg_p)
*************** sel_init_only_bb (basic_block bb, basic_
*** 4981,4987 ****
    rgn_make_new_region_out_of_new_block (bb);
  }
  
! /* Update the latch when we've splitted or merged it.
     This should be checked for all outer loops, too.  */
  static void
  change_loops_latches (basic_block from, basic_block to)
--- 5050,5056 ----
    rgn_make_new_region_out_of_new_block (bb);
  }
  
! /* Update the latch when we've splitted or merged it from FROM block to TO.
     This should be checked for all outer loops, too.  */
  static void
  change_loops_latches (basic_block from, basic_block to)
*************** sel_create_empty_bb (basic_block after)
*** 5138,5144 ****
    return new_bb;
  }
  
! /* Implement sched_create_recovery_block ().  */
  basic_block
  sel_create_recovery_block (insn_t orig_insn)
  {
--- 5207,5214 ----
    return new_bb;
  }
  
! /* Implement sched_create_recovery_block.  ORIG_INSN is where block
!    will be splitted to insert a check.  */
  basic_block
  sel_create_recovery_block (insn_t orig_insn)
  {
*************** sel_redirect_edge_and_branch (edge e, ba
*** 5247,5252 ****
--- 5317,5323 ----
      sel_init_new_insn (jump, INSN_INIT_TODO_LUID | INSN_INIT_TODO_SIMPLEJUMP);
  }
  
+ /* This variable holds the cfg hooks used by the selective scheduler.  */
  static struct cfg_hooks sel_cfg_hooks;
  
  /* Register sel-sched cfg hooks.  */
*************** sel_unregister_cfg_hooks (void)
*** 5279,5286 ****
  }
  
  
! /* Emit an insn rtx based on PATTERN and ICE if the result is not a valid
!    insn.  */
  rtx
  create_insn_rtx_from_pattern (rtx pattern, rtx label)
  {
--- 5350,5357 ----
  }
  
  
! /* Emit an insn rtx based on PATTERN.  If a jump insn is wanted,
!    LABEL is where this jump should be directed.  */
  rtx
  create_insn_rtx_from_pattern (rtx pattern, rtx label)
  {
*************** create_insn_rtx_from_pattern (rtx patter
*** 5310,5316 ****
    return insn_rtx;
  }
  
! /* Create a new vinsn for INSN_RTX.  */
  vinsn_t
  create_vinsn_from_insn_rtx (rtx insn_rtx, bool force_unique_p)
  {
--- 5381,5388 ----
    return insn_rtx;
  }
  
! /* Create a new vinsn for INSN_RTX.  FORCE_UNIQUE_P is true when the vinsn
!    must not be clonable.  */
  vinsn_t
  create_vinsn_from_insn_rtx (rtx insn_rtx, bool force_unique_p)
  {
*************** setup_nop_and_exit_insns (void)
*** 5375,5387 ****
  
    nop_pattern = gen_nop ();
  
!   {
!     start_sequence ();
!     emit_insn (nop_pattern);
!     exit_insn = get_insns ();
!     end_sequence ();
!     set_block_for_insn (exit_insn, EXIT_BLOCK_PTR);
!   }
  }
  
  /* Free special insns used in the scheduler.  */
--- 5447,5457 ----
  
    nop_pattern = gen_nop ();
  
!   start_sequence ();
!   emit_insn (nop_pattern);
!   exit_insn = get_insns ();
!   end_sequence ();
!   set_block_for_insn (exit_insn, EXIT_BLOCK_PTR);
  }
  
  /* Free special insns used in the scheduler.  */
*************** sel_setup_sched_infos (void)
*** 5442,5447 ****
--- 5512,5518 ----
    
    sel_set_sched_flags ();
  }
+ 
  
  /* Adds basic block BB to region RGN at the position *BB_ORD_INDEX,
     *BB_ORD_INDEX after that is increased.  */
*************** sel_create_new_region (void)
*** 5487,5493 ****
    return new_rgn_number;
  }
  
! /* If BB1 has a smaller topological sort number than BB2, returns -1;
     if greater, returns 1.  */
  static int
  bb_top_order_comparator (const void *x, const void *y)
--- 5558,5564 ----
    return new_rgn_number;
  }
  
! /* If X has a smaller topological sort number than Y, returns -1;
     if greater, returns 1.  */
  static int
  bb_top_order_comparator (const void *x, const void *y)
Index: gcc/sel-sched-ir.h
===================================================================
*** gcc/sel-sched-ir.h	(revision 139437)
--- gcc/sel-sched-ir.h	(working copy)
*************** along with GCC; see the file COPYING3.  
*** 21,33 ****
  #ifndef GCC_SEL_SCHED_IR_H
  #define GCC_SEL_SCHED_IR_H
  
- /* A define to use ENABLE_CHECKING logic inside conditionals.  */
- #ifdef ENABLE_CHECKING
- #define ENABLE_SEL_CHECKING 1
- #else
- #define ENABLE_SEL_CHECKING 0
- #endif
- 
  /* For state_t.  */
  #include "insn-attr.h"
  /* For regset_head.  */
--- 21,26 ----
*************** struct _expr
*** 121,128 ****
       control on scheduling.  */
    int spec;
  
!   /* Degree of speculativeness too.  Shows the chance of the result of 
!      instruction to be actually used if it is moved to the current point.  */
    int usefulness;
  
    /* A priority of this expression.  */
--- 114,122 ----
       control on scheduling.  */
    int spec;
  
!   /* Degree of speculativeness measured as probability of executing 
!      instruction's original basic block given relative to 
!      the current scheduling point.  */
    int usefulness;
  
    /* A priority of this expression.  */
*************** struct _def
*** 214,234 ****
  typedef struct _def *def_t;
  
  
! /* Availability sets arae sets of expressions we're scheduling.  */
  typedef _list_t av_set_t;
  #define _AV_SET_EXPR(L) (&(L)->u.expr)
  #define _AV_SET_NEXT(L) (_LIST_NEXT (L))
  
  
! /* Scheduling boundary.  This now corresponds to fence as we finish a cycle
!    at the end of bb.  */
  struct _bnd
  {
    insn_t to;
    ilist_t ptr;
    av_set_t av;
    av_set_t av1;
!   /* Deps Context at this boundary.  As long as we have one boundary per fence,
       this is just a pointer to the same deps context as in the corresponding
       fence.  */
    deps_t dc;
--- 208,235 ----
  typedef struct _def *def_t;
  
  
! /* Availability sets are sets of expressions we're scheduling.  */
  typedef _list_t av_set_t;
  #define _AV_SET_EXPR(L) (&(L)->u.expr)
  #define _AV_SET_NEXT(L) (_LIST_NEXT (L))
  
  
! /* Boundary of the current fence group.  */
  struct _bnd
  {
+   /* The actual boundary instruction.  */
    insn_t to;
+ 
+   /* Its path to the fence.  */
    ilist_t ptr;
+ 
+   /* Availability set at the boundary.  */
    av_set_t av;
+ 
+   /* This set moved to the fence.  */
    av_set_t av1;
!   
!   /* Deps context at this boundary.  As long as we have one boundary per fence,
       this is just a pointer to the same deps context as in the corresponding
       fence.  */
    deps_t dc;
*************** _list_clear (_list_t *l)
*** 406,413 ****
--- 407,419 ----
  /* List iterator backend.  */
  typedef struct
  {
+   /* The list we're iterating.  */
    _list_t *lp;
+ 
+   /* True when this iterator supprts removing.  */
    bool can_remove_p;
+ 
+   /* True when we've actually removed something.  */
    bool removed_p;
  } _list_iterator;
  
*************** _list_iter_remove_nofree (_list_iterator
*** 451,460 ****
         _list_iter_cond_##TYPE (*(I).lp, &(ELEM));		\
         _list_iter_next (&(I)))
  
! #define _FOR_EACH_1(TYPE, ELEM, I, LP)			\
!   for (_list_iter_start (&(I), (LP), true);		\
!        _list_iter_cond_##TYPE (*(I).lp, &(ELEM));	\
!        _list_iter_next (&(I)))
  
  
  /* _xlist_t functions.  */
--- 457,466 ----
         _list_iter_cond_##TYPE (*(I).lp, &(ELEM));		\
         _list_iter_next (&(I)))
  
! #define _FOR_EACH_1(TYPE, ELEM, I, LP)                              \
!   for (_list_iter_start (&(I), (LP), true);                         \
!        _list_iter_cond_##TYPE (*(I).lp, &(ELEM));                   \
!        _list_iter_next (&(I))) 
  
  
  /* _xlist_t functions.  */
*************** struct idata_def
*** 590,598 ****
    regset reg_clobbers;
  
    regset reg_uses;
- 
-   /* I hope that our renaming infrastructure handles this.  */
-   /* bool has_internal_dep; */
  };
  
  #define IDATA_TYPE(ID) ((ID)->type)
--- 596,601 ----
*************** struct idata_def
*** 604,609 ****
--- 607,615 ----
  
  /* Type to represent all needed info to emit an insn.
     This is a virtual equivalent of the insn.
+    Every insn in the stream has an associated vinsn.  This is used
+    to reduce memory consumption basing on the fact that many insns
+    don't change through the scheduler.
  
     vinsn can be either normal or unique.
     * Normal vinsn is the one, that can be cloned multiple times and typically
*************** struct transformed_insns
*** 662,675 ****
--- 668,686 ----
  {
    /* Previous vinsn.  Used to find the proper element.  */
    vinsn_t vinsn_old;
+ 
    /* A new vinsn.  */
    vinsn_t vinsn_new;
+ 
    /* Speculative status.  */
    ds_t ds;
+ 
    /* Type of transformation happened.  */
    enum local_trans_type type;
+ 
    /* Whether a conflict on the target register happened.  */
    BOOL_BITFIELD was_target_conflict : 1;
+ 
    /* Whether a check was needed.  */
    BOOL_BITFIELD needs_check : 1;
  };
*************** struct transformed_insns
*** 678,690 ****
     a single instruction that is in the stream.  */
  struct _sel_insn_data
  {
!   /* Every insn in the stream has an associated vinsn.  This is used
!      to reduce memory consumption and give use the fact that many insns
!      (all of them at the moment) don't change through the scheduler.
! 
!      Much of the information, that reflect information about the insn itself
!      (e.g. not about where it stands in CFG) is contained in the VINSN_ID
!      field of this home VI.  */
    expr_def expr;
  
    /* If (WS_LEVEL == GLOBAL_LEVEL) then AV is empty.  */
--- 689,696 ----
     a single instruction that is in the stream.  */
  struct _sel_insn_data
  {
!   /* The expression that contains vinsn for this insn and some
!      flow-sensitive data like priority.  */
    expr_def expr;
  
    /* If (WS_LEVEL == GLOBAL_LEVEL) then AV is empty.  */
*************** extern rtx exit_insn;
*** 811,817 ****
  /* Initialize data for simplejump.  */
  #define INSN_INIT_TODO_SIMPLEJUMP (4)
  
! /* Return true is INSN is a local NOP.  The nop is local in the sense that
     it was emitted by the scheduler as a temporary insn and will soon be
     deleted.  These nops are identified by their pattern.  */
  #define INSN_NOP_P(INSN) (PATTERN (INSN) == nop_pattern)
--- 817,823 ----
  /* Initialize data for simplejump.  */
  #define INSN_INIT_TODO_SIMPLEJUMP (4)
  
! /* Return true if INSN is a local NOP.  The nop is local in the sense that
     it was emitted by the scheduler as a temporary insn and will soon be
     deleted.  These nops are identified by their pattern.  */
  #define INSN_NOP_P(INSN) (PATTERN (INSN) == nop_pattern)
*************** extern rtx exit_insn;
*** 822,828 ****
     == (NEXT_INSN (INSN) == NULL_RTX)) is valid.  */
  #define INSN_IN_STREAM_P(INSN) (PREV_INSN (INSN) && NEXT_INSN (INSN))
  
! /* Return true in INSN is in current fence.  */
  #define IN_CURRENT_FENCE_P(INSN) (flist_lookup (fences, INSN) != NULL)
  
  /* Marks loop as being considered for pipelining.  */
--- 828,834 ----
     == (NEXT_INSN (INSN) == NULL_RTX)) is valid.  */
  #define INSN_IN_STREAM_P(INSN) (PREV_INSN (INSN) && NEXT_INSN (INSN))
  
! /* Return true if INSN is in current fence.  */
  #define IN_CURRENT_FENCE_P(INSN) (flist_lookup (fences, INSN) != NULL)
  
  /* Marks loop as being considered for pipelining.  */
*************** extern regset sel_all_regs;
*** 951,960 ****
--- 957,975 ----
  /* Successor iterator backend.  */
  typedef struct
  {
+   /* True if we're at BB end.  */
    bool bb_end;
+ 
+   /* An edge on which we're iterating.  */
    edge e1;
+ 
+   /* The previous edge saved after skipping empty blocks.  */
    edge e2;
+   
+   /* Edge iterator used when there are successors in other basic blocks.  */
    edge_iterator ei;
+ 
+   /* Successor block we're traversing.  */
    basic_block bb;
  
    /* Flags that are passed to the iterator.  We return only successors
*************** get_all_loop_exits (basic_block bb)
*** 1085,1105 ****
    if (inner_loop_header_p (bb))
      {
        struct loop *this_loop;
        int i;
        edge e;
! 
!       {
! 	struct loop *pred_loop = NULL;
! 
! 	for (this_loop = bb->loop_father;
! 	     this_loop && this_loop != current_loop_nest;
! 	     this_loop = loop_outer (this_loop))
! 	  pred_loop = this_loop;
! 
! 	this_loop = pred_loop;
! 
! 	gcc_assert (this_loop != NULL);
!       }
  
        exits = get_loop_exit_edges_unique_dests (this_loop);
  
--- 1100,1116 ----
    if (inner_loop_header_p (bb))
      {
        struct loop *this_loop;
+       struct loop *pred_loop = NULL;
        int i;
        edge e;
!       
!       for (this_loop = bb->loop_father;
!            this_loop && this_loop != current_loop_nest;
!            this_loop = loop_outer (this_loop))
!         pred_loop = this_loop;
!       
!       this_loop = pred_loop;
!       gcc_assert (this_loop != NULL);
  
        exits = get_loop_exit_edges_unique_dests (this_loop);
  
*************** get_all_loop_exits (basic_block bb)
*** 1133,1146 ****
  }
  
  /* Flags to pass to compute_succs_info and FOR_EACH_SUCC.
!    NB: Any successor will fall into exactly one category.   */
  
  /* Include normal successors.  */
  #define SUCCS_NORMAL (1)
  /* Include back-edge successors.  */
  #define SUCCS_BACK (2)
  /* Include successors that are outside of the current region.  */
  #define SUCCS_OUT (4)
  /* When pipelining of the outer loops is enabled, skip innermost loops 
     to their exits.  */
  #define SUCCS_SKIP_TO_LOOP_EXITS (8)
--- 1144,1160 ----
  }
  
  /* Flags to pass to compute_succs_info and FOR_EACH_SUCC.
!    Any successor will fall into exactly one category.   */
  
  /* Include normal successors.  */
  #define SUCCS_NORMAL (1)
+ 
  /* Include back-edge successors.  */
  #define SUCCS_BACK (2)
+ 
  /* Include successors that are outside of the current region.  */
  #define SUCCS_OUT (4)
+ 
  /* When pipelining of the outer loops is enabled, skip innermost loops 
     to their exits.  */
  #define SUCCS_SKIP_TO_LOOP_EXITS (8)
Index: gcc/sel-sched-dump.c
===================================================================
*** gcc/sel-sched-dump.c	(revision 139436)
--- gcc/sel-sched-dump.c	(working copy)
*************** along with GCC; see the file COPYING3.  
*** 36,43 ****
  #include "cselib.h"
  #include "sel-sched-ir.h"
  #include "sel-sched-dump.h"
- 
- #include <unistd.h>
  
  
  /* These variables control high-level pretty printing.  */
--- 36,41 ----
*************** static int dump_flist_insn_flags = (DUMP
*** 65,107 ****
                                      | DUMP_INSN_SEQNO);
  
  
! static FILE *sched_dump1;
  
  static void
  switch_dump (FILE *to)
  {
!   sched_dump1 = sched_dump;
    sched_dump = to;
  }
  
  static void
  restore_dump (void)
  {
!   sched_dump = sched_dump1;
! }
! 
! void 
! print_marker_to_log (void)
! {
!   sel_print ("Marker: %d\n:", sel_dump_cfg_fileno);
  }
  
  
  /* Functions for dumping instructions, av sets, and exprs.  */ 
  
! static int dump_all = 0;
  static int dump_insn_rtx_flags = DUMP_INSN_RTX_PATTERN;
  static int dump_vinsn_flags = (DUMP_VINSN_INSN_RTX | DUMP_VINSN_TYPE
  			       | DUMP_VINSN_COUNT);
! static int debug_vinsn_flags = 1;
! static int debug_insn_rtx_flags = 1;
  static int dump_expr_flags = DUMP_EXPR_ALL;
- static int debug_expr_flags = 1;
  
! /* Controls how an insn should be dumped.  It can be changed from debugger.  */
! static int dump_insn_flags = (DUMP_INSN_EXPR | DUMP_INSN_SCHED_CYCLE);
! static int debug_insn_flags = 1;
  
  
  /* Print an rtx X.  */
  void
--- 63,114 ----
                                      | DUMP_INSN_SEQNO);
  
  
! /* The variable used to hold the value of sched_dump when temporarily
!    switching dump output to the other source, e.g. the .dot file.  */
! static FILE *saved_sched_dump = NULL;
  
+ /* Switch sched_dump to TO.  It must not be called twice.  */
  static void
  switch_dump (FILE *to)
  {
!   gcc_assert (saved_sched_dump == NULL);
!   
!   saved_sched_dump = sched_dump;
    sched_dump = to;
  }
  
+ /* Restore previously switched dump.  */
  static void
  restore_dump (void)
  {
!   sched_dump = saved_sched_dump;
!   saved_sched_dump = NULL;
  }
  
  
  /* Functions for dumping instructions, av sets, and exprs.  */ 
  
! /* Default flags for dumping insns.  */
  static int dump_insn_rtx_flags = DUMP_INSN_RTX_PATTERN;
+ 
+ /* Default flags for dumping vinsns.  */
  static int dump_vinsn_flags = (DUMP_VINSN_INSN_RTX | DUMP_VINSN_TYPE
  			       | DUMP_VINSN_COUNT);
! 
! /* Default flags for dumping expressions.  */
  static int dump_expr_flags = DUMP_EXPR_ALL;
  
! /* Default flags for dumping insns when debugging.  */
! static int debug_insn_rtx_flags = DUMP_INSN_RTX_ALL;
  
+ /* Default flags for dumping vinsns when debugging.  */
+ static int debug_vinsn_flags = DUMP_VINSN_ALL;
+ 
+ /* Default flags for dumping expressions when debugging.  */
+ static int debug_expr_flags = DUMP_EXPR_ALL;
+ 
+ /* Controls how an insn from stream should be dumped when debugging.  */
+ static int debug_insn_flags = DUMP_INSN_ALL;
  
  /* Print an rtx X.  */
  void
*************** sel_print_rtl (rtx x)
*** 110,121 ****
    print_rtl_single (sched_dump, x);
  }
  
  void
  dump_insn_rtx_1 (rtx insn, int flags)
  {
    int all;
  
!   all = (flags & 1) | dump_all;
    if (all)
      flags |= DUMP_INSN_RTX_ALL;
  
--- 117,130 ----
    print_rtl_single (sched_dump, x);
  }
  
+ /* Dump insn INSN honoring FLAGS.  */
  void
  dump_insn_rtx_1 (rtx insn, int flags)
  {
    int all;
  
!   /* flags == -1 also means dumping all.  */
!   all = (flags & 1);;
    if (all)
      flags |= DUMP_INSN_RTX_ALL;
  
*************** dump_insn_rtx_1 (rtx insn, int flags)
*** 142,153 ****
--- 151,166 ----
    sel_print (")");
  }
  
+ 
+ /* Dump INSN with default flags.  */
  void
  dump_insn_rtx (rtx insn)
  {
    dump_insn_rtx_1 (insn, dump_insn_rtx_flags);
  }
  
+ 
+ /* Dump INSN to stderr.  */
  void
  debug_insn_rtx (rtx insn)
  {
*************** debug_insn_rtx (rtx insn)
*** 157,168 ****
    restore_dump ();
  }
  
  void
  dump_vinsn_1 (vinsn_t vi, int flags)
  {
    int all;
  
!   all = (flags & 1) | dump_all;
    if (all)
      flags |= DUMP_VINSN_ALL;
  
--- 170,183 ----
    restore_dump ();
  }
  
+ /* Dump vinsn VI honoring flags.  */
  void
  dump_vinsn_1 (vinsn_t vi, int flags)
  {
    int all;
  
!   /* flags == -1 also means dumping all.  */
!   all = flags & 1;
    if (all)
      flags |= DUMP_VINSN_ALL;
  
*************** dump_vinsn_1 (vinsn_t vi, int flags)
*** 188,199 ****
--- 203,216 ----
    sel_print (")");
  }
  
+ /* Dump vinsn VI with default flags.  */
  void
  dump_vinsn (vinsn_t vi)
  {
    dump_vinsn_1 (vi, dump_vinsn_flags);
  }
  
+ /* Dump vinsn VI to stderr.  */
  void
  debug_vinsn (vinsn_t vi)
  {
*************** debug_vinsn (vinsn_t vi)
*** 203,215 ****
    restore_dump ();
  }
  
! /* Dump EXPR.  */
  void
  dump_expr_1 (expr_t expr, int flags)
  {
    int all;
  
!   all = (flags & 1) | dump_all;
    if (all)
      flags |= DUMP_EXPR_ALL;
  
--- 220,233 ----
    restore_dump ();
  }
  
! /* Dump EXPR honoring flags.  */
  void
  dump_expr_1 (expr_t expr, int flags)
  {
    int all;
  
!   /* flags == -1 also means dumping all.  */
!   all = flags & 1;
    if (all)
      flags |= DUMP_EXPR_ALL;
  
*************** dump_expr_1 (expr_t expr, int flags)
*** 266,277 ****
--- 284,297 ----
    sel_print ("]");
  }
  
+ /* Dump expression EXPR with default flags.  */
  void
  dump_expr (expr_t expr)
  {
    dump_expr_1 (expr, dump_expr_flags);
  }
  
+ /* Dump expression EXPR to stderr.  */
  void
  debug_expr (expr_t expr)
  {
*************** dump_insn_1 (insn_t i, int flags)
*** 287,305 ****
  {
    int all;
  
!   all = (flags & 1) | dump_all;
    if (all)
      flags |= DUMP_INSN_ALL;
  
    if (!sched_dump_to_dot_p)
      sel_print ("(");
  
-   if (flags & DUMP_INSN_ASM_P)
-     flags = flags;
- 
-   if (flags & DUMP_INSN_SCHED_NEXT)
-     flags = flags;
- 
    if (flags & DUMP_INSN_EXPR)
      {
        dump_expr_1 (INSN_EXPR (i), dump_expr_flags | all);
--- 307,319 ----
  {
    int all;
  
!   all = flags & 1;
    if (all)
      flags |= DUMP_INSN_ALL;
  
    if (!sched_dump_to_dot_p)
      sel_print ("(");
  
    if (flags & DUMP_INSN_EXPR)
      {
        dump_expr_1 (INSN_EXPR (i), dump_expr_flags | all);
*************** dump_insn_1 (insn_t i, int flags)
*** 313,327 ****
    else if (flags & DUMP_INSN_UID)
      sel_print ("uid:%d;", INSN_UID (i));
  
-   if (flags & DUMP_INSN_AV)
-     flags = flags;
- 
    if (flags & DUMP_INSN_SEQNO)
      sel_print ("seqno:%d;", INSN_SEQNO (i));
  
-   if (flags & DUMP_INSN_AFTER_STALL_P)
-     flags = flags;
-  
    if (flags & DUMP_INSN_SCHED_CYCLE)
      {
        int cycle = INSN_SCHED_CYCLE (i);
--- 327,335 ----
*************** dump_insn_1 (insn_t i, int flags)
*** 338,346 ****
  void
  dump_insn (insn_t i)
  {
!   dump_insn_1 (i, dump_insn_flags);
  }
  
  void
  debug_insn (insn_t insn)
  {
--- 346,355 ----
  void
  dump_insn (insn_t i)
  {
!   dump_insn_1 (i, DUMP_INSN_EXPR | DUMP_INSN_SCHED_CYCLE);
  }
  
+ /* Dump INSN to stderr.  */
  void
  debug_insn (insn_t insn)
  {
*************** dump_insn_vector (rtx_vec_t succs)
*** 461,467 ****
        sel_print ("NULL ");
  }
  
! /* Dumps a hard reg set SET to FILE using PREFIX. */
  static void
  print_hard_reg_set (FILE *file, const char *prefix, HARD_REG_SET set)
  {
--- 470,476 ----
        sel_print ("NULL ");
  }
  
! /* Dumps a hard reg set SET to FILE using PREFIX.  */
  static void
  print_hard_reg_set (FILE *file, const char *prefix, HARD_REG_SET set)
  {
*************** replace_str_in_buf (char *buf, const cha
*** 557,566 ****
  void
  sel_prepare_string_for_dot_label (char *buf)
  {
!   char specials_from[7][2] = { "<", ">", "{", "|", "}", "\"",
! 			       "\n" };
!   char specials_to[7][3] = { "\\<", "\\>", "\\{", "\\|", "\\}", "\\\"",
! 			     "\\l" };
    unsigned i;
  
    for (i = 0; i < 7; i++)
--- 566,575 ----
  void
  sel_prepare_string_for_dot_label (char *buf)
  {
!   static char specials_from[7][2] = { "<", ">", "{", "|", "}", "\"",
!                                       "\n" };
!   static char specials_to[7][3] = { "\\<", "\\>", "\\{", "\\|", "\\}", 
!                                     "\\\"", "\\l" };
    unsigned i;
  
    for (i = 0; i < 7; i++)
*************** sel_debug_cfg_1 (int flags)
*** 848,897 ****
    sel_dump_cfg_p = t1;
  }
  
! 
! /* Functions callable from a debugger.  */
! int
! insn_uid (rtx insn)
! {
!   return INSN_UID (insn);
! }
! 
! basic_block
! block_for_insn (rtx insn)
! {
!   return BLOCK_FOR_INSN (insn);
! }
! 
! av_set_t
! bb_av_set (basic_block bb)
! {
!   return BB_AV_SET (bb);
! }
! 
! rtx insn_pattern (rtx insn)
! {
!   return PATTERN (insn);
! }
! 
! int insn_code (rtx insn)
! {
!   return GET_CODE (insn);
! }
! 
! bool insn_is_set_p (rtx insn)
! {
!   return GET_CODE (PATTERN (insn)) == SET;
! }
! 
! #ifdef HARD_REGNO_RENAME_OK
! int
! hard_regno_rename_ok (int i ATTRIBUTE_UNUSED, int j ATTRIBUTE_UNUSED)
! {
!   return HARD_REGNO_RENAME_OK (i, j);
! }
! #endif
! 
! /* Dumps av_set AV to stderr. */
  void
  debug_av_set (av_set_t av)
  {
--- 857,863 ----
    sel_dump_cfg_p = t1;
  }
  
! /* Dumps av_set AV to stderr.  */
  void
  debug_av_set (av_set_t av)
  {
Index: gcc/sel-sched-dump.h
===================================================================
*** gcc/sel-sched-dump.h	(revision 139436)
--- gcc/sel-sched-dump.h	(working copy)
*************** along with GCC; see the file COPYING3.  
*** 22,60 ****
  #define GCC_SEL_SCHED_DUMP_H
  
  #include "sel-sched-ir.h"
- /* Debug and dumping functions.  */
  
- /* Dump only current region.  */
- #define SEL_DUMP_CFG_CURRENT_REGION (2)
- /* Dump note_list for each bb.  */
- #define SEL_DUMP_CFG_BB_NOTES_LIST (4)
- /* Dump av_set from the bb_header.  */
- #define SEL_DUMP_CFG_AV_SET (8)
- #define SEL_DUMP_CFG_LV_SET (16)
- #define SEL_DUMP_CFG_BB_INSNS (32)
- #define SEL_DUMP_CFG_FENCES (64)
- #define SEL_DUMP_CFG_INSN_SEQNO (128)
- #define SEL_DUMP_CFG_INSN_FLAGS (0)
- #define SEL_DUMP_CFG_FUNCTION_NAME (256)
- #define SEL_DUMP_CFG_BB_LIVE (512)
- #define SEL_DUMP_CFG_BB_LOOP (1024)
- /* The default flags for cfg dumping.  */
- #define SEL_DUMP_CFG_FLAGS (SEL_DUMP_CFG_CURRENT_REGION \
- 			    | SEL_DUMP_CFG_BB_NOTES_LIST \
-                             | SEL_DUMP_CFG_AV_SET \
-                             | SEL_DUMP_CFG_LV_SET \
- 			    | SEL_DUMP_CFG_BB_INSNS \
-                             | SEL_DUMP_CFG_FENCES \
-                             | SEL_DUMP_CFG_INSN_SEQNO \
-                             | SEL_DUMP_CFG_INSN_FLAGS \
- 			    | SEL_DUMP_CFG_BB_LOOP)
  
! enum _dump_insn_rtx
    {
      DUMP_INSN_RTX_UID = 2,
      DUMP_INSN_RTX_PATTERN = 4,
      DUMP_INSN_RTX_BBN = 8,
  
      DUMP_INSN_RTX_ALL = (DUMP_INSN_RTX_UID | DUMP_INSN_RTX_PATTERN
  			 | DUMP_INSN_RTX_BBN)
    };
--- 22,83 ----
  #define GCC_SEL_SCHED_DUMP_H
  
  #include "sel-sched-ir.h"
  
  
! /* These values control the dumping of control flow graph to the .dot file.  */
! enum sel_dump_cfg_def
    {
+     /* Dump only current region.  */
+     SEL_DUMP_CFG_CURRENT_REGION = 2,
+ 
+     /* Dump note_list for this bb.  */
+     SEL_DUMP_CFG_BB_NOTES_LIST = 4,
+ 
+     /* Dump availability set from the bb header.  */
+     SEL_DUMP_CFG_AV_SET = 8,
+ 
+     /* Dump liveness set from the bb header.  */
+     SEL_DUMP_CFG_LV_SET = 16,
+ 
+     /* Dump insns of the given block.  */
+     SEL_DUMP_CFG_BB_INSNS = 32,
+ 
+     /* Show current fences when dumping cfg.  */
+     SEL_DUMP_CFG_FENCES = 64,
+ 
+     /* Show insn's seqnos when dumping cfg.  */
+     SEL_DUMP_CFG_INSN_SEQNO = 128,
+ 
+     /* Dump function name when dumping cfg.  */
+     SEL_DUMP_CFG_FUNCTION_NAME = 256,
+ 
+     /* Dump loop father number of the given bb.  */
+     SEL_DUMP_CFG_BB_LOOP = 512,
+ 
+     /* The default flags for cfg dumping.  */
+     SEL_DUMP_CFG_FLAGS = (SEL_DUMP_CFG_CURRENT_REGION   
+                           | SEL_DUMP_CFG_BB_NOTES_LIST   
+                           | SEL_DUMP_CFG_AV_SET         
+                           | SEL_DUMP_CFG_LV_SET         
+                           | SEL_DUMP_CFG_BB_INSNS       
+                           | SEL_DUMP_CFG_FENCES         
+                           | SEL_DUMP_CFG_INSN_SEQNO     
+                           | SEL_DUMP_CFG_BB_LOOP)
+   };
+ 
+ /* These values control the dumping of insns containing in expressions.  */
+ enum dump_insn_rtx_def
+   {
+     /* Dump insn's UID.  */
      DUMP_INSN_RTX_UID = 2,
+ 
+     /* Dump insn's pattern.  */
      DUMP_INSN_RTX_PATTERN = 4,
+ 
+     /* Dump insn's basic block number.  */
      DUMP_INSN_RTX_BBN = 8,
  
+     /* Dump all of the above.  */
      DUMP_INSN_RTX_ALL = (DUMP_INSN_RTX_UID | DUMP_INSN_RTX_PATTERN
  			 | DUMP_INSN_RTX_BBN)
    };
*************** extern void dump_insn_rtx_1 (rtx, int);
*** 63,91 ****
  extern void dump_insn_rtx (rtx);
  extern void debug_insn_rtx (rtx);
  
! enum _dump_idata
!   {
!     DUMP_IDATA_TYPE = 2,
!     DUMP_IDATA_LHS = 4,
!     DUMP_IDATA_RHS = 8,
!     DUMP_IDATA_REG_SETS = 16,
!     DUMP_IDATA_REG_USES = 32,
! 
!     DUMP_IDATA_ALL = (DUMP_IDATA_TYPE | DUMP_IDATA_LHS | DUMP_IDATA_RHS
! 		      | DUMP_IDATA_REG_SETS | DUMP_IDATA_REG_USES)
!   };
! 
! extern void dump_idata_1 (idata_t id, int);
! extern void dump_idata (idata_t id);
! extern void debug_idata (idata_t id);
! 
! enum _dump_vinsn
    {
      DUMP_VINSN_INSN_RTX = 2,
      DUMP_VINSN_TYPE = 4,
      DUMP_VINSN_COUNT = 8,
      DUMP_VINSN_COST = 16,
  
      DUMP_VINSN_ALL = (DUMP_VINSN_INSN_RTX | DUMP_VINSN_TYPE | DUMP_VINSN_COUNT
  		      | DUMP_VINSN_COST)
    };
--- 86,108 ----
  extern void dump_insn_rtx (rtx);
  extern void debug_insn_rtx (rtx);
  
! /* These values control dumping of vinsns.  The meaning of different fields
!    of a vinsn is explained in sel-sched-ir.h.  */
! enum dump_vinsn_def
    {
+     /* Dump the insn behind this vinsn.  */
      DUMP_VINSN_INSN_RTX = 2,
+ 
+     /* Dump vinsn's type.  */
      DUMP_VINSN_TYPE = 4,
+ 
+     /* Dump vinsn's count.  */
      DUMP_VINSN_COUNT = 8,
+ 
+     /* Dump the cost (default latency) of the insn behind this vinsn.  */
      DUMP_VINSN_COST = 16,
  
+     /* Dump all of the above.  */
      DUMP_VINSN_ALL = (DUMP_VINSN_INSN_RTX | DUMP_VINSN_TYPE | DUMP_VINSN_COUNT
  		      | DUMP_VINSN_COST)
    };
*************** extern void dump_vinsn_1 (vinsn_t, int);
*** 94,109 ****
  extern void dump_vinsn (vinsn_t);
  extern void debug_vinsn (vinsn_t);
  
! enum _dump_expr
    {
      DUMP_EXPR_VINSN = 2,
      DUMP_EXPR_SPEC = 4,
      DUMP_EXPR_PRIORITY = 8,
      DUMP_EXPR_SCHED_TIMES = 16,
      DUMP_EXPR_SPEC_DONE_DS = 32,
      DUMP_EXPR_ORIG_BB = 64,
      DUMP_EXPR_USEFULNESS = 128,
  
      DUMP_EXPR_ALL = (DUMP_EXPR_VINSN | DUMP_EXPR_SPEC | DUMP_EXPR_PRIORITY
  		     | DUMP_EXPR_SCHED_TIMES | DUMP_EXPR_SPEC_DONE_DS
  		     | DUMP_EXPR_ORIG_BB | DUMP_EXPR_USEFULNESS)
--- 111,142 ----
  extern void dump_vinsn (vinsn_t);
  extern void debug_vinsn (vinsn_t);
  
! /* These values control dumping of expressions.  The meaning of the fields
!    is explained in sel-sched-ir.h.  */
! enum dump_expr_def
    {
+     /* Dump the vinsn behind this expression.  */
      DUMP_EXPR_VINSN = 2,
+     
+     /* Dump expression's SPEC parameter.  */
      DUMP_EXPR_SPEC = 4,
+ 
+     /* Dump expression's priority.  */
      DUMP_EXPR_PRIORITY = 8,
+ 
+     /* Dump the number of times this expression was scheduled.  */
      DUMP_EXPR_SCHED_TIMES = 16,
+ 
+     /* Dump speculative status of the expression.  */
      DUMP_EXPR_SPEC_DONE_DS = 32,
+ 
+     /* Dump the basic block number which originated this expression.  */
      DUMP_EXPR_ORIG_BB = 64,
+ 
+     /* Dump expression's usefulness.  */
      DUMP_EXPR_USEFULNESS = 128,
  
+     /* Dump all of the above.  */
      DUMP_EXPR_ALL = (DUMP_EXPR_VINSN | DUMP_EXPR_SPEC | DUMP_EXPR_PRIORITY
  		     | DUMP_EXPR_SCHED_TIMES | DUMP_EXPR_SPEC_DONE_DS
  		     | DUMP_EXPR_ORIG_BB | DUMP_EXPR_USEFULNESS)
*************** extern void dump_expr_1 (expr_t, int);
*** 113,136 ****
  extern void dump_expr (expr_t);
  extern void debug_expr (expr_t);
  
! /* A enumeration for dumping flags of an insn.  */
! enum _dump_insn
  {
!   DUMP_INSN_ASM_P = 2,
!   DUMP_INSN_SCHED_NEXT = 4,
!   DUMP_INSN_EXPR = 8,
!   DUMP_INSN_AV = 16,
!   DUMP_INSN_SEQNO = 32,
!   DUMP_INSN_AFTER_STALL_P = 64,
!   DUMP_INSN_SCHED_CYCLE = 128,
!   DUMP_INSN_UID = 256,
!   DUMP_INSN_BBN = 512,
!   DUMP_INSN_PATTERN = 1024,
  
!   DUMP_INSN_ALL = (DUMP_INSN_ASM_P | DUMP_INSN_SCHED_NEXT | DUMP_INSN_EXPR
! 		   | DUMP_INSN_AV | DUMP_INSN_SEQNO | DUMP_INSN_AFTER_STALL_P
! 		   | DUMP_INSN_SCHED_CYCLE | DUMP_INSN_UID | DUMP_INSN_BBN
! 		   | DUMP_INSN_PATTERN)
  };
  
  extern void dump_insn_1 (insn_t, int);
--- 146,176 ----
  extern void dump_expr (expr_t);
  extern void debug_expr (expr_t);
  
! /* A enumeration for dumping flags of an insn.  The difference from 
!    dump_insn_rtx_def is that these fields are for insns in stream only.  */
! enum dump_insn_def
  {
!   /* Dump expression of this insn.  */
!   DUMP_INSN_EXPR = 2,
  
!   /* Dump insn's seqno.  */
!   DUMP_INSN_SEQNO = 4,
! 
!   /* Dump the cycle on which insn was scheduled.  */
!   DUMP_INSN_SCHED_CYCLE = 8,
! 
!   /* Dump insn's UID.  */
!   DUMP_INSN_UID = 16,
! 
!   /* Dump insn's pattern.  */
!   DUMP_INSN_PATTERN = 32,
! 
!   /* Dump insn's basic block number.  */
!   DUMP_INSN_BBN = 64,
! 
!   /* Dump all of the above.  */
!   DUMP_INSN_ALL = (DUMP_INSN_EXPR | DUMP_INSN_SEQNO | DUMP_INSN_BBN
! 		   | DUMP_INSN_SCHED_CYCLE | DUMP_INSN_UID | DUMP_INSN_PATTERN)
  };
  
  extern void dump_insn_1 (insn_t, int);
*************** extern void dump_insn (insn_t);
*** 138,147 ****
--- 178,190 ----
  extern void debug_insn (insn_t);
  
  extern void sel_prepare_string_for_dot_label (char *);
+ 
  /* When this flag is on, we are dumping to the .dot file.
     When it is off, we are dumping to log.  */
  extern bool sched_dump_to_dot_p;
  
+ /* This macro acts like printf but dumps information to the .dot file.  
+    Used when dumping control flow.  */
  #define sel_print_to_dot(...)                           \
    do {                                                  \
      int __j = 1 + 2 * snprintf (NULL, 0, __VA_ARGS__);  \
*************** extern bool sched_dump_to_dot_p;
*** 151,156 ****
--- 194,200 ----
      fprintf (sched_dump, "%s", __s);                    \
    } while (0)
  
+ /* This macro acts like printf but dumps to the sched_dump file.  */
  #define sel_print(...)					\
    do {							\
      if (sched_dump_to_dot_p)                            \
*************** extern void block_finish (void);
*** 169,175 ****
  extern int get_print_blocks_num (void);
  extern void line_start (void);
  extern void line_finish (void);
- extern void print_marker_to_log (void);
  
  extern void sel_print_rtl (rtx x);
  extern void dump_insn_1 (insn_t, int);
--- 213,218 ----
*************** extern void sel_debug_cfg (void);
*** 187,200 ****
  extern void setup_dump_cfg_params (void);
  
  /* Debug functions.  */
- extern int insn_uid (rtx);
- extern basic_block block_for_insn (rtx insn);
- extern av_set_t bb_av_set (basic_block bb);
- extern rtx insn_pattern (rtx);
- extern int insn_code (rtx);
- extern bool insn_is_set_p (rtx);
- extern int hard_regno_rename_ok (int, int);
- 
  extern void debug_expr (expr_t);
  extern void debug_av_set (av_set_t);
  extern void debug_lv_set (regset);
--- 230,235 ----
*************** extern void debug_blist (blist_t);
*** 203,215 ****
  extern void debug_insn_vector (rtx_vec_t);
  extern void debug_hard_reg_set (HARD_REG_SET);
  extern rtx debug_mem_addr_value (rtx);
- extern bool debug_find_insn_loop (void);
- extern bool debug_find_unreachable_blocks (void);
- extern void sel_debug_cfg (void);
- extern void mem_test (int);
- extern bool in_range_p (int, const char *, bool *);
- extern bool av_set_contains_insn_with_uid (av_set_t av, int insn_uid);
- extern av_set_t av_set_for_bb_n (int n);
- extern FILE *sel_get_stat_file (void);
- 
  #endif
--- 238,241 ----
Index: gcc/rtl.c
===================================================================
*** gcc/rtl.c	(revision 139433)
--- gcc/rtl.c	(working copy)
*************** int currently_expanding_to_rtl;
*** 337,343 ****
  /* Same as rtx_equal_p, but call CB on each pair of rtx if CB is not NULL.  
     When the callback returns true, we continue with the new pair.  */
  
- 
  int
  rtx_equal_p_cb (const_rtx x, const_rtx y, rtx_equal_p_callback_function cb)
  {
--- 337,342 ----

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