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]

Loop IV info patch 1



Another stepping stone patch that introduces a new accessor macro for
accessing BIV info.

2000-12-29  Michael Hayes  <mhayes@redhat.com>

	* loop.h (REG_IV_CLASS): New accessor macro.
	* loop.c (REG_IV_CLASS): Use it instead of reg_iv_class array.
	* unroll.c (REG_IV_CLASS): Likewise.

*** loop-6.c	Thu Dec 28 15:57:08 2000
--- loop.c	Thu Dec 28 15:58:06 2000
*************** loop_bivs_init_find (loop)
*** 3743,3749 ****
  	  && (test = get_condition_for_loop (loop, p)) != 0
  	  && GET_CODE (XEXP (test, 0)) == REG
  	  && REGNO (XEXP (test, 0)) < max_reg_before_loop
! 	  && (bl = ivs->reg_biv_class[REGNO (XEXP (test, 0))]) != 0
  	  && valid_initial_value_p (XEXP (test, 1), p, call_seen, loop->start)
  	  && bl->init_insn == 0)
  	{
--- 3743,3749 ----
  	  && (test = get_condition_for_loop (loop, p)) != 0
  	  && GET_CODE (XEXP (test, 0)) == REG
  	  && REGNO (XEXP (test, 0)) < max_reg_before_loop
! 	  && (bl = REG_IV_CLASS (ivs, REGNO (XEXP (test, 0)))) != 0
  	  && valid_initial_value_p (XEXP (test, 1), p, call_seen, loop->start)
  	  && bl->init_insn == 0)
  	{
*************** record_biv (loop, v, insn, dest_reg, inc
*** 4917,4923 ****
    /* Add this to the reg's iv_class, creating a class
       if this is the first incrementation of the reg.  */
  
!   bl = ivs->reg_biv_class[REGNO (dest_reg)];
    if (bl == 0)
      {
        /* Create and initialize new iv_class.  */
--- 4917,4923 ----
    /* Add this to the reg's iv_class, creating a class
       if this is the first incrementation of the reg.  */
  
!   bl = REG_IV_CLASS (ivs, REGNO (dest_reg));
    if (bl == 0)
      {
        /* Create and initialize new iv_class.  */
*************** record_biv (loop, v, insn, dest_reg, inc
*** 4948,4954 ****
        ivs->loop_iv_list = bl;
  
        /* Put it in the array of biv register classes.  */
!       ivs->reg_biv_class[REGNO (dest_reg)] = bl;
      }
  
    /* Update IV_CLASS entry for this biv.  */
--- 4948,4954 ----
        ivs->loop_iv_list = bl;
  
        /* Put it in the array of biv register classes.  */
!       REG_IV_CLASS (ivs, REGNO (dest_reg)) = bl;
      }
  
    /* Update IV_CLASS entry for this biv.  */
*************** record_giv (loop, v, insn, src_reg, dest
*** 5077,5083 ****
  
    /* Add the giv to the class of givs computed from one biv.  */
  
!   bl = ivs->reg_biv_class[REGNO (src_reg)];
    if (bl)
      {
        v->next_iv = bl->giv;
--- 5077,5083 ----
  
    /* Add the giv to the class of givs computed from one biv.  */
  
!   bl = REG_IV_CLASS (ivs, REGNO (src_reg));
    if (bl)
      {
        v->next_iv = bl->giv;
*************** check_final_value (loop, v)
*** 5269,5275 ****
    struct iv_class *bl;
    rtx final_value = 0;
  
!   bl = ivs->reg_biv_class[REGNO (v->src_reg)];
  
    /* DEST_ADDR givs will never reach here, because they are always marked
       replaceable above in record_giv.  */
--- 5269,5275 ----
    struct iv_class *bl;
    rtx final_value = 0;
  
!   bl = REG_IV_CLASS (ivs, REGNO (v->src_reg));
  
    /* DEST_ADDR givs will never reach here, because they are always marked
       replaceable above in record_giv.  */
*************** maybe_eliminate_biv_1 (loop, x, insn, bl
*** 8227,8233 ****
  	      if (v->ignore || v->maybe_dead || v->mode != mode)
  		continue;
  
! 	      for (tv = ivs->reg_biv_class[REGNO (arg)]->giv; tv; tv = tv->next_iv)
  		if (! tv->ignore && ! tv->maybe_dead
  		    && rtx_equal_p (tv->mult_val, v->mult_val)
  		    && rtx_equal_p (tv->add_val, v->add_val)
--- 8227,8234 ----
  	      if (v->ignore || v->maybe_dead || v->mode != mode)
  		continue;
  
! 	      for (tv = REG_IV_CLASS (ivs, REGNO (arg))->giv; tv; 
! 		   tv = tv->next_iv)
  		if (! tv->ignore && ! tv->maybe_dead
  		    && rtx_equal_p (tv->mult_val, v->mult_val)
  		    && rtx_equal_p (tv->add_val, v->add_val)
*************** record_initial (dest, set, data)
*** 8325,8331 ****
        || REG_IV_TYPE (ivs, REGNO (dest)) != BASIC_INDUCT)
      return;
  
!   bl = ivs->reg_biv_class[REGNO (dest)];
  
    /* If this is the first set found, record it.  */
    if (bl->init_insn == 0)
--- 8326,8332 ----
        || REG_IV_TYPE (ivs, REGNO (dest)) != BASIC_INDUCT)
      return;
  
!   bl = REG_IV_CLASS (ivs, REGNO (dest));
  
    /* If this is the first set found, record it.  */
    if (bl->init_insn == 0)
*** loop-6.h	Thu Dec 28 15:57:12 2000
--- loop.h	Thu Dec 28 15:58:03 2000
*************** extern FILE *loop_dump_stream;
*** 359,364 ****
--- 359,365 ----
    (*(enum iv_mode *) &VARRAY_INT(ivs->reg_iv_type, (n)))
  #define REG_IV_INFO(ivs, n) \
    (*(struct induction **) &VARRAY_GENERIC_PTR(ivs->reg_iv_info, (n)))
+ #define REG_IV_CLASS(ivs, n) ivs->reg_biv_class[n]
  
  /* Forward declarations for non-static functions declared in loop.c and
     unroll.c.  */
*** unroll-1.c	Thu Dec 28 15:55:12 2000
--- unroll.c	Fri Dec 29 21:42:15 2000
*************** copy_loop_body (loop, copy_start, copy_e
*** 1770,1776 ****
  	      unsigned int regno = REGNO (SET_DEST (set));
  
  	      v = addr_combined_regs[REGNO (SET_DEST (set))];
! 	      bl = ivs->reg_biv_class[REGNO (v->src_reg)];
  
  	      /* Although the giv_inc amount is not needed here, we must call
  		 calculate_giv_inc here since it might try to delete the
--- 1770,1776 ----
  	      unsigned int regno = REGNO (SET_DEST (set));
  
  	      v = addr_combined_regs[REGNO (SET_DEST (set))];
! 	      bl = REG_IV_CLASS (ivs, REGNO (v->src_reg));
  
  	      /* Although the giv_inc amount is not needed here, we must call
  		 calculate_giv_inc here since it might try to delete the
*************** copy_loop_body (loop, copy_start, copy_e
*** 1915,1921 ****
  		  if (regno < max_reg_before_loop
  		      && REG_IV_TYPE (ivs, regno) == BASIC_INDUCT)
  		    {
! 		      giv_src_reg = ivs->reg_biv_class[regno]->biv->src_reg;
  		      giv_dest_reg = giv_src_reg;
  		    }
  
--- 1915,1921 ----
  		  if (regno < max_reg_before_loop
  		      && REG_IV_TYPE (ivs, regno) == BASIC_INDUCT)
  		    {
! 		      giv_src_reg = REG_IV_CLASS (ivs, regno)->biv->src_reg;
  		      giv_dest_reg = giv_src_reg;
  		    }
  
*************** find_splittable_givs (loop, bl, unroll_t
*** 3030,3036 ****
  	{
  	  int count = 1;
  	  if (! v->ignore)
! 	    count = ivs->reg_biv_class[REGNO (v->src_reg)]->biv_count;
  
  	  splittable_regs_updates[REGNO (v->new_reg)] = count;
  	}
--- 3030,3036 ----
  	{
  	  int count = 1;
  	  if (! v->ignore)
! 	    count = REG_IV_CLASS (ivs, REGNO (v->src_reg))->biv_count;
  
  	  splittable_regs_updates[REGNO (v->new_reg)] = count;
  	}
*************** final_giv_value (loop, v)
*** 3226,3232 ****
    rtx loop_end = loop->end;
    unsigned HOST_WIDE_INT n_iterations = LOOP_INFO (loop)->n_iterations;
  
!   bl = ivs->reg_biv_class[REGNO (v->src_reg)];
  
    /* The final value for givs which depend on reversed bivs must be calculated
       differently than for ordinary givs.  In this case, there is already an
--- 3226,3232 ----
    rtx loop_end = loop->end;
    unsigned HOST_WIDE_INT n_iterations = LOOP_INFO (loop)->n_iterations;
  
!   bl = REG_IV_CLASS (ivs, REGNO (v->src_reg));
  
    /* The final value for givs which depend on reversed bivs must be calculated
       differently than for ordinary givs.  In this case, there is already an
*************** loop_iterations (loop)
*** 3598,3604 ****
  	abort ();
  
        /* Grab initial value, only useful if it is a constant.  */
!       bl = ivs->reg_biv_class[REGNO (iteration_var)];
        initial_value = bl->initial_value;
  
        increment = biv_total_increment (bl);
--- 3598,3604 ----
  	abort ();
  
        /* Grab initial value, only useful if it is a constant.  */
!       bl = REG_IV_CLASS (ivs, REGNO (iteration_var));
        initial_value = bl->initial_value;
  
        increment = biv_total_increment (bl);
*************** loop_iterations (loop)
*** 3612,3618 ****
        if (REGNO (v->src_reg) >= max_reg_before_loop)
  	abort ();
  
!       bl = ivs->reg_biv_class[REGNO (v->src_reg)];
  
        /* Increment value is mult_val times the increment value of the biv.  */
  
--- 3612,3618 ----
        if (REGNO (v->src_reg) >= max_reg_before_loop)
  	abort ();
  
!       bl = REG_IV_CLASS (ivs, REGNO (v->src_reg));
  
        /* Increment value is mult_val times the increment value of the biv.  */
  
*************** remap_split_bivs (loop, x)
*** 4014,4020 ****
  #endif
        if (REGNO (x) < max_reg_before_loop
  	  && REG_IV_TYPE (ivs, REGNO (x)) == BASIC_INDUCT)
! 	return ivs->reg_biv_class[REGNO (x)]->biv->src_reg;
        break;
  
      default:
--- 4014,4020 ----
  #endif
        if (REGNO (x) < max_reg_before_loop
  	  && REG_IV_TYPE (ivs, REGNO (x)) == BASIC_INDUCT)
! 	return REG_IV_CLASS (ivs, REGNO (x))->biv->src_reg;
        break;
  
      default:

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