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]

Fix minor problems in expr.c


Three of these are warnings removals.  The one in VIEW_CONVERT_EXPR is
a source of some failures.  The change to division in highest_pow2_factor
is due to my realization that the old code was wrong and likewise adding
the MIN and MAX cases.

Tested on alphaev56-dec-osf4.0c.

Fri Dec  7 07:06:17 2001  Richard Kenner  <kenner@vlsi1.ultra.nyu.edu>

	* expr.c (store_field): Remove warning.
	(expand_expr, case COMPONENT_REF, case VIEW_CONVERT_EXPR): Likewise.
	(highest_pow2_factor, case MIN_EXPR, case MAX_EXPR): Add cases.
	(highest_pow2_factor, case *_DIV_EXPR): Only can do something if
	divisor constant power of 2.
	(highest_pow2_factor, case COMPOUND_EXPR): Look at operand 1.

*** expr.c	2001/12/05 22:37:26	1.393
--- expr.c	2001/12/07 12:07:59
*************** store_field (target, bitsize, bitpos, mo
*** 5044,5048 ****
  	 big-endian machine, we want the upper BITSIZE bits.  */
        if (BYTES_BIG_ENDIAN && GET_MODE_CLASS (GET_MODE (temp)) == MODE_INT
! 	  && bitsize < GET_MODE_BITSIZE (GET_MODE (temp))
  	  && TREE_CODE (TREE_TYPE (exp)) == RECORD_TYPE)
  	temp = expand_shift (RSHIFT_EXPR, GET_MODE (temp), temp,
--- 5044,5048 ----
  	 big-endian machine, we want the upper BITSIZE bits.  */
        if (BYTES_BIG_ENDIAN && GET_MODE_CLASS (GET_MODE (temp)) == MODE_INT
! 	  && bitsize < (HOST_WIDE_INT) GET_MODE_BITSIZE (GET_MODE (temp))
  	  && TREE_CODE (TREE_TYPE (exp)) == RECORD_TYPE)
  	temp = expand_shift (RSHIFT_EXPR, GET_MODE (temp), temp,
*************** highest_pow2_factor (exp)
*** 5791,5795 ****
        break;
  
!     case PLUS_EXPR:  case MINUS_EXPR:
        c0 = highest_pow2_factor (TREE_OPERAND (exp, 0));
        c1 = highest_pow2_factor (TREE_OPERAND (exp, 1));
--- 5791,5795 ----
        break;
  
!     case PLUS_EXPR:  case MINUS_EXPR:  case MIN_EXPR:  case MAX_EXPR:
        c0 = highest_pow2_factor (TREE_OPERAND (exp, 0));
        c1 = highest_pow2_factor (TREE_OPERAND (exp, 1));
*************** highest_pow2_factor (exp)
*** 5803,5814 ****
      case ROUND_DIV_EXPR:  case TRUNC_DIV_EXPR:  case FLOOR_DIV_EXPR:
      case CEIL_DIV_EXPR:
!       c0 = highest_pow2_factor (TREE_OPERAND (exp, 0));
!       c1 = highest_pow2_factor (TREE_OPERAND (exp, 1));
!       return MAX (1, c0 / c1);
  
      case NON_LVALUE_EXPR:  case NOP_EXPR:  case CONVERT_EXPR:
!     case COMPOUND_EXPR:    case SAVE_EXPR: case WITH_RECORD_EXPR:
        return highest_pow2_factor (TREE_OPERAND (exp, 0));
  
      case COND_EXPR:
        c0 = highest_pow2_factor (TREE_OPERAND (exp, 1));
--- 5803,5822 ----
      case ROUND_DIV_EXPR:  case TRUNC_DIV_EXPR:  case FLOOR_DIV_EXPR:
      case CEIL_DIV_EXPR:
!       if (integer_pow2p (TREE_OPERAND (exp, 1))
! 	  && host_integerp (TREE_OPERAND (exp, 1), 1))
! 	{
! 	  c0 = highest_pow2_factor (TREE_OPERAND (exp, 0));
! 	  c1 = tree_low_cst (TREE_OPERAND (exp, 1), 1);
! 	  return MAX (1, c0 / c1);
! 	}
!       break;
  
      case NON_LVALUE_EXPR:  case NOP_EXPR:  case CONVERT_EXPR:
!     case SAVE_EXPR: case WITH_RECORD_EXPR:
        return highest_pow2_factor (TREE_OPERAND (exp, 0));
  
+     case COMPOUND_EXPR:
+       return highest_pow2_factor (TREE_OPERAND (exp, 1));
+ 
      case COND_EXPR:
        c0 = highest_pow2_factor (TREE_OPERAND (exp, 1));
*************** expand_expr (exp, target, tmode, modifie
*** 6933,6937 ****
  	    if (TREE_CODE (type) == RECORD_TYPE && BYTES_BIG_ENDIAN
  		&& GET_MODE_CLASS (GET_MODE (op0)) == MODE_INT
! 		&& bitsize < GET_MODE_BITSIZE (GET_MODE (op0)))
  	      op0 = expand_shift (LSHIFT_EXPR, GET_MODE (op0), op0,
  				  size_int (GET_MODE_BITSIZE (GET_MODE (op0))
--- 6941,6945 ----
  	    if (TREE_CODE (type) == RECORD_TYPE && BYTES_BIG_ENDIAN
  		&& GET_MODE_CLASS (GET_MODE (op0)) == MODE_INT
! 		&& bitsize < (HOST_WIDE_INT) GET_MODE_BITSIZE (GET_MODE (op0)))
  	      op0 = expand_shift (LSHIFT_EXPR, GET_MODE (op0), op0,
  				  size_int (GET_MODE_BITSIZE (GET_MODE (op0))
*************** expand_expr (exp, target, tmode, modifie
*** 7306,7311 ****
  	    {
  	      tree inner_type = TREE_TYPE (TREE_OPERAND (exp, 0));
! 	      HOST_WIDE_INT temp_size = MAX (int_size_in_bytes (inner_type),
! 					     GET_MODE_SIZE (TYPE_MODE (type)));
  	      rtx new = assign_stack_temp_for_type (TYPE_MODE (type),
  						    temp_size, 0, type);
--- 7314,7320 ----
  	    {
  	      tree inner_type = TREE_TYPE (TREE_OPERAND (exp, 0));
! 	      HOST_WIDE_INT temp_size
! 		= MAX (int_size_in_bytes (inner_type),
! 		       (HOST_WIDE_INT) GET_MODE_SIZE (TYPE_MODE (type)));
  	      rtx new = assign_stack_temp_for_type (TYPE_MODE (type),
  						    temp_size, 0, type);


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