More alignment stuff

Richard Kenner kenner@vlsi1.ultra.nyu.edu
Thu Mar 30 05:49:00 GMT 2000


This makes REGNO_POINTER_ALIGN be in bits too and fixes a missing case
in my last change.

Thu Mar 30 06:32:51 2000  Richard Kenner  <kenner@vlsi1.ultra.nyu.edu>

	* calls.c (expand_call): Pass bit alignment to mark_reg_pointer.
	* explow.c (memory_address, allocate_dynamic_stack_space): Likewise.
	* function.c (assign_parms): Likewise.
	* integrate.c (expand_inline_function): Likewise.
	* stmt.c (expand_decl): Likewise.
	(copy_rtx_and_substitute): Likewise.
	* expr.c (expand_expr, expand_expr_unaligned): Likewise.
 	(clear_by_pieces): Fix error in last change.
	* emit-rtl.c (init_emit): Set known registers alignment in bits.
	* function.h (regno_pointer_align): Now unsigned.
	* config/arm/arm.c (alignable_memory_operand): REGNO_POINTER_ALIGN
	is in bits.
	* config/i386/i386.c (aligned_operand): Likewise.
	* config/sparc/sparc.c (mem_min_alignment): Likewise.
	* config/alpha/alpha.c (aligned_memory_operand): Likewise.
	(unaligned_memory_operand): Likewise.
	(alpha_expand_block_move, alpha_expand_block_clear): Likewise.
	Also make alignments and sizes unsigned and some whitespace cleanup.
	(alpha_va_start): Do nothing if VALIST's type is error_mark_node.

*** calls.c	2000/03/30 11:47:05	1.110
--- calls.c	2000/03/30 13:16:40
*************** expand_call (exp, target, ignore)
*** 2759,2766 ****
  	  /* Mark the return value as a pointer if needed.  */
  	  if (TREE_CODE (TREE_TYPE (exp)) == POINTER_TYPE)
! 	    {
! 	      tree pointed_to = TREE_TYPE (TREE_TYPE (exp));
! 	      mark_reg_pointer (temp, TYPE_ALIGN (pointed_to) / BITS_PER_UNIT);
! 	    }
  
  	  /* Construct an "equal form" for the value which mentions all the
--- 2759,2763 ----
  	  /* Mark the return value as a pointer if needed.  */
  	  if (TREE_CODE (TREE_TYPE (exp)) == POINTER_TYPE)
! 	    mark_reg_pointer (temp, TYPE_ALIGN (TREE_TYPE (TREE_TYPE (exp))));
  
  	  /* Construct an "equal form" for the value which mentions all the
*************** expand_call (exp, target, ignore)
*** 2796,2800 ****
  	  /* The return value from a malloc-like function is a pointer. */
  	  if (TREE_CODE (TREE_TYPE (exp)) == POINTER_TYPE)
! 	    mark_reg_pointer (temp, BIGGEST_ALIGNMENT / BITS_PER_UNIT);
  
  	  emit_move_insn (temp, valreg);
--- 2793,2797 ----
  	  /* The return value from a malloc-like function is a pointer. */
  	  if (TREE_CODE (TREE_TYPE (exp)) == POINTER_TYPE)
! 	    mark_reg_pointer (temp, BIGGEST_ALIGNMENT);
  
  	  emit_move_insn (temp, valreg);
*** emit-rtl.c	2000/03/25 18:34:01	1.119
--- emit-rtl.c	2000/03/30 13:16:55
*************** init_emit ()
*** 3840,3858 ****
  
  #ifdef STACK_BOUNDARY
!   REGNO_POINTER_ALIGN (STACK_POINTER_REGNUM) = STACK_BOUNDARY / BITS_PER_UNIT;
!   REGNO_POINTER_ALIGN (FRAME_POINTER_REGNUM) = STACK_BOUNDARY / BITS_PER_UNIT;
!   REGNO_POINTER_ALIGN (HARD_FRAME_POINTER_REGNUM)
!     = STACK_BOUNDARY / BITS_PER_UNIT;
!   REGNO_POINTER_ALIGN (ARG_POINTER_REGNUM) = STACK_BOUNDARY / BITS_PER_UNIT;
  
!   REGNO_POINTER_ALIGN (VIRTUAL_INCOMING_ARGS_REGNUM)
!     = STACK_BOUNDARY / BITS_PER_UNIT;
!   REGNO_POINTER_ALIGN (VIRTUAL_STACK_VARS_REGNUM)
!     = STACK_BOUNDARY / BITS_PER_UNIT;
!   REGNO_POINTER_ALIGN (VIRTUAL_STACK_DYNAMIC_REGNUM)
!     = STACK_BOUNDARY / BITS_PER_UNIT;
!   REGNO_POINTER_ALIGN (VIRTUAL_OUTGOING_ARGS_REGNUM)
!     = STACK_BOUNDARY / BITS_PER_UNIT;
!   REGNO_POINTER_ALIGN (VIRTUAL_CFA_REGNUM) = UNITS_PER_WORD;
  #endif
  
--- 3840,3853 ----
  
  #ifdef STACK_BOUNDARY
!   REGNO_POINTER_ALIGN (STACK_POINTER_REGNUM) = STACK_BOUNDARY;
!   REGNO_POINTER_ALIGN (FRAME_POINTER_REGNUM) = STACK_BOUNDARY;
!   REGNO_POINTER_ALIGN (HARD_FRAME_POINTER_REGNUM) = STACK_BOUNDARY;
!   REGNO_POINTER_ALIGN (ARG_POINTER_REGNUM) = STACK_BOUNDARY;
  
!   REGNO_POINTER_ALIGN (VIRTUAL_INCOMING_ARGS_REGNUM) = STACK_BOUNDARY;
!   REGNO_POINTER_ALIGN (VIRTUAL_STACK_VARS_REGNUM) = STACK_BOUNDARY;
!   REGNO_POINTER_ALIGN (VIRTUAL_STACK_DYNAMIC_REGNUM) = STACK_BOUNDARY;
!   REGNO_POINTER_ALIGN (VIRTUAL_OUTGOING_ARGS_REGNUM) = STACK_BOUNDARY;
!   REGNO_POINTER_ALIGN (VIRTUAL_CFA_REGNUM) = BITS_PER_WORD;
  #endif
  
*** explow.c	2000/03/25 18:34:01	1.43
--- explow.c	2000/03/30 13:17:01
*************** memory_address (mode, x)
*** 584,592 ****
      return x;
    else if (GET_CODE (x) == REG)
!     mark_reg_pointer (x, 1);
    else if (GET_CODE (x) == PLUS
  	   && GET_CODE (XEXP (x, 0)) == REG
  	   && GET_CODE (XEXP (x, 1)) == CONST_INT)
!     mark_reg_pointer (XEXP (x, 0), 1);
  
    /* OLDX may have been the address on a temporary.  Update the address
--- 584,592 ----
      return x;
    else if (GET_CODE (x) == REG)
!     mark_reg_pointer (x, BITS_PER_UNIT);
    else if (GET_CODE (x) == PLUS
  	   && GET_CODE (XEXP (x, 0)) == REG
  	   && GET_CODE (XEXP (x, 1)) == CONST_INT)
!     mark_reg_pointer (XEXP (x, 0), BITS_PER_UNIT);
  
    /* OLDX may have been the address on a temporary.  Update the address
*************** allocate_dynamic_stack_space (size, targ
*** 1306,1310 ****
      target = gen_reg_rtx (Pmode);
  
!   mark_reg_pointer (target, known_align / BITS_PER_UNIT);
  
    /* Perform the required allocation from the stack.  Some systems do
--- 1306,1310 ----
      target = gen_reg_rtx (Pmode);
  
!   mark_reg_pointer (target, known_align);
  
    /* Perform the required allocation from the stack.  Some systems do
*** expr.c	2000/03/30 11:47:05	1.224
--- expr.c	2000/03/30 13:17:39
*************** clear_by_pieces (to, len, align)
*** 2292,2296 ****
    if (! SLOW_UNALIGNED_ACCESS (word_mode, align)
        || align > MOVE_MAX * BITS_PER_UNIT || align >= BIGGEST_ALIGNMENT)
!     align = MOVE_MAX;
  
    /* First move what we can in the largest integer mode, then go to
--- 2292,2296 ----
    if (! SLOW_UNALIGNED_ACCESS (word_mode, align)
        || align > MOVE_MAX * BITS_PER_UNIT || align >= BIGGEST_ALIGNMENT)
!     align = MOVE_MAX * BITS_PER_UNIT;
  
    /* First move what we can in the largest integer mode, then go to
*************** expand_expr (exp, target, tmode, modifie
*** 5974,5979 ****
  	{
  	  if (GET_CODE (temp) == MEM && GET_CODE (XEXP (temp, 0)) == REG)
! 	    mark_reg_pointer (XEXP (temp, 0),
! 			      DECL_ALIGN (exp) / BITS_PER_UNIT);
  
  	  return temp;
--- 5974,5978 ----
  	{
  	  if (GET_CODE (temp) == MEM && GET_CODE (XEXP (temp, 0)) == REG)
! 	    mark_reg_pointer (XEXP (temp, 0), DECL_ALIGN (exp));
  
  	  return temp;
*************** expand_expr (exp, target, tmode, modifie
*** 6802,6806 ****
  
  	    if (GET_CODE (op0) == MEM && GET_CODE (XEXP (op0, 0)) == REG)
! 	      mark_reg_pointer (XEXP (op0, 0), alignment / BITS_PER_UNIT);
  
  	    op0 = extract_bit_field (op0, bitsize, bitpos,
--- 6801,6805 ----
  
  	    if (GET_CODE (op0) == MEM && GET_CODE (XEXP (op0, 0)) == REG)
! 	      mark_reg_pointer (XEXP (op0, 0), alignment);
  
  	    op0 = extract_bit_field (op0, bitsize, bitpos,
*************** expand_expr (exp, target, tmode, modifie
*** 6853,6857 ****
   
  	if (GET_CODE (XEXP (op0, 0)) == REG)
! 	  mark_reg_pointer (XEXP (op0, 0), alignment / BITS_PER_UNIT);
  
  	MEM_SET_IN_STRUCT_P (op0, 1);
--- 6852,6856 ----
   
  	if (GET_CODE (XEXP (op0, 0)) == REG)
! 	  mark_reg_pointer (XEXP (op0, 0), alignment);
  
  	MEM_SET_IN_STRUCT_P (op0, 1);
*************** expand_expr (exp, target, tmode, modifie
*** 8279,8283 ****
        if (GET_CODE (op0) == REG
  	  && ! REG_USERVAR_P (op0))
! 	mark_reg_pointer (op0, TYPE_ALIGN (TREE_TYPE (type)) / BITS_PER_UNIT);
  
        /* If we might have had a temp slot, add an equivalent address
--- 8278,8282 ----
        if (GET_CODE (op0) == REG
  	  && ! REG_USERVAR_P (op0))
! 	mark_reg_pointer (op0, TYPE_ALIGN (TREE_TYPE (type)));
  
        /* If we might have had a temp slot, add an equivalent address
*************** expand_expr_unaligned (exp, palign)
*** 8759,8763 ****
  
  	if (GET_CODE (XEXP (op0, 0)) == REG)
! 	  mark_reg_pointer (XEXP (op0, 0), alignment / BITS_PER_UNIT);
  
  	MEM_IN_STRUCT_P (op0) = 1;
--- 8758,8762 ----
  
  	if (GET_CODE (XEXP (op0, 0)) == REG)
! 	  mark_reg_pointer (XEXP (op0, 0), alignment);
  
  	MEM_IN_STRUCT_P (op0) = 1;
*** function.c	2000/03/30 11:47:06	1.185
--- function.c	2000/03/30 13:18:00
*************** assign_parms (fndecl)
*** 4764,4769 ****
  	  if (POINTER_TYPE_P (TREE_TYPE (parm)))
  	    mark_reg_pointer (parmreg,
! 			      (TYPE_ALIGN (TREE_TYPE (TREE_TYPE (parm)))
! 			       / BITS_PER_UNIT));
  	}
        else
--- 4764,4769 ----
  	  if (POINTER_TYPE_P (TREE_TYPE (parm)))
  	    mark_reg_pointer (parmreg,
! 			      TYPE_ALIGN (TREE_TYPE (TREE_TYPE (parm))));
! 
  	}
        else
*** function.h	2000/03/25 18:34:02	1.52
--- function.h	2000/03/30 13:18:02
*************** struct emit_status
*** 109,113 ****
       for that pseudo (if regno_pointer_flag is set).
       Allocated in parallel with regno_pointer_flag.  */
!   char *regno_pointer_align;
  
    /* Indexed by pseudo register number, gives the rtx for that pseudo.
--- 109,113 ----
       for that pseudo (if regno_pointer_flag is set).
       Allocated in parallel with regno_pointer_flag.  */
!   unsigned char *regno_pointer_align;
  
    /* Indexed by pseudo register number, gives the rtx for that pseudo.
*** integrate.c	2000/03/26 19:09:36	1.99
--- integrate.c	2000/03/30 13:18:09
*************** expand_inline_function (fndecl, parms, t
*** 757,762 ****
  	  && POINTER_TYPE_P (TREE_TYPE (formal)))
  	mark_reg_pointer (arg_vals[i],
! 			  (TYPE_ALIGN (TREE_TYPE (TREE_TYPE (formal)))
! 			   / BITS_PER_UNIT));
      }
  	
--- 757,761 ----
  	  && POINTER_TYPE_P (TREE_TYPE (formal)))
  	mark_reg_pointer (arg_vals[i],
o! 			  TYPE_ALIGN (TREE_TYPE (TREE_TYPE (formal))));
      }
  	
*************** copy_rtx_and_substitute (orig, map, for_
*** 1762,1767 ****
  
  #ifdef STACK_BOUNDARY
! 	      mark_reg_pointer (map->reg_map[regno],
! 				STACK_BOUNDARY / BITS_PER_UNIT);
  #endif
  
--- 1761,1765 ----
  
  #ifdef STACK_BOUNDARY
! 	      mark_reg_pointer (map->reg_map[regno], STACK_BOUNDARY);
  #endif
  
*************** copy_rtx_and_substitute (orig, map, for_
*** 1796,1801 ****
  
  #ifdef STACK_BOUNDARY
! 	      mark_reg_pointer (map->reg_map[regno],
! 				STACK_BOUNDARY / BITS_PER_UNIT);
  #endif
  
--- 1794,1798 ----
  
  #ifdef STACK_BOUNDARY
! 	      mark_reg_pointer (map->reg_map[regno], STACK_BOUNDARY);
  #endif
  
*** stmt.c	2000/03/30 11:47:07	1.138
--- stmt.c	2000/03/30 13:18:33
*************** expand_decl (decl)
*** 3792,3797 ****
        if (POINTER_TYPE_P (type))
  	mark_reg_pointer (DECL_RTL (decl),
! 			  (TYPE_ALIGN (TREE_TYPE (TREE_TYPE (decl)))
! 			   / BITS_PER_UNIT));
      }
  
--- 3792,3797 ----
        if (POINTER_TYPE_P (type))
  	mark_reg_pointer (DECL_RTL (decl),
! 			  TYPE_ALIGN (TREE_TYPE (TREE_TYPE (decl))));
! 			  
      }
  
*** config/alpha/alpha.c	2000/03/22 23:09:29	1.121
--- config/alpha/alpha.c	2000/03/30 13:18:55
*************** aligned_memory_operand (op, mode)
*** 829,834 ****
      }
  
!   return (GET_CODE (base) == REG
! 	  && REGNO_POINTER_ALIGN (REGNO (base)) >= 4);
  }
  
--- 829,833 ----
      }
  
!   return (GET_CODE (base) == REG && REGNO_POINTER_ALIGN (REGNO (base)) >= 32);
  }
  
*************** unaligned_memory_operand (op, mode)
*** 874,879 ****
      }
  
!   return (GET_CODE (base) == REG
! 	  && REGNO_POINTER_ALIGN (REGNO (base)) < 4);
  }
  
--- 873,877 ----
      }
  
!   return (GET_CODE (base) == REG && REGNO_POINTER_ALIGN (REGNO (base)) < 32);
  }
  
*************** alpha_expand_block_move (operands)
*** 2502,2517 ****
    rtx align_rtx = operands[3];
    HOST_WIDE_INT orig_bytes = INTVAL (bytes_rtx);
!   HOST_WIDE_INT bytes = orig_bytes;
!   HOST_WIDE_INT src_align = INTVAL (align_rtx);
!   HOST_WIDE_INT dst_align = src_align;
!   rtx orig_src	= operands[1];
!   rtx orig_dst	= operands[0];
!   rtx data_regs[2*MAX_MOVE_WORDS+16];
    rtx tmp;
!   int i, words, ofs, nregs = 0;
    
!   if (bytes <= 0)
      return 1;
!   if (bytes > MAX_MOVE_WORDS*8)
      return 0;
  
--- 2500,2515 ----
    rtx align_rtx = operands[3];
    HOST_WIDE_INT orig_bytes = INTVAL (bytes_rtx);
!   unsigned HOST_WIDE_INT bytes = orig_bytes;
!   unsigned HOST_WIDE_INT src_align = INTVAL (align_rtx) * BITS_PER_UNIT;
!   unsigned HOST_WIDE_INT dst_align = src_align;
!   rtx orig_src = operands[1];
!   rtx orig_dst = operands[0];
!   rtx data_regs[2 * MAX_MOVE_WORDS + 16];
    rtx tmp;
!   unsigned int i, words, ofs, nregs = 0;
    
!   if (orig_bytes <= 0)
      return 1;
!   else if (bytes > MAX_MOVE_WORDS * BITS_PER_UNIT)
      return 0;
  
*************** alpha_expand_block_move (operands)
*** 2520,2542 ****
    tmp = XEXP (orig_src, 0);
    if (GET_CODE (tmp) == REG)
!     {
!       if (REGNO_POINTER_ALIGN (REGNO (tmp)) > src_align)
! 	src_align = REGNO_POINTER_ALIGN (REGNO (tmp));
!     }
    else if (GET_CODE (tmp) == PLUS
  	   && GET_CODE (XEXP (tmp, 0)) == REG
  	   && GET_CODE (XEXP (tmp, 1)) == CONST_INT)
      {
!       HOST_WIDE_INT c = INTVAL (XEXP (tmp, 1));
!       int a = REGNO_POINTER_ALIGN (REGNO (XEXP (tmp, 0)));
  
        if (a > src_align)
  	{
!           if (a >= 8 && c % 8 == 0)
! 	    src_align = 8;
!           else if (a >= 4 && c % 4 == 0)
! 	    src_align = 4;
!           else if (a >= 2 && c % 2 == 0)
! 	    src_align = 2;
  	}
      }
--- 2518,2537 ----
    tmp = XEXP (orig_src, 0);
    if (GET_CODE (tmp) == REG)
!     src_align = MAX (src_align, REGNO_POINTER_ALIGN (REGNO (tmp)));
    else if (GET_CODE (tmp) == PLUS
  	   && GET_CODE (XEXP (tmp, 0)) == REG
  	   && GET_CODE (XEXP (tmp, 1)) == CONST_INT)
      {
!       unsigned HOST_WIDE_INT c = INTVAL (XEXP (tmp, 1));
!       unsigned int a = REGNO_POINTER_ALIGN (REGNO (XEXP (tmp, 0)));
  
        if (a > src_align)
  	{
!           if (a >= 64 && c % 8 == 0)
! 	    src_align = 64;
!           else if (a >= 32 && c % 4 == 0)
! 	    src_align = 32;
!           else if (a >= 16 && c % 2 == 0)
! 	    src_align = 16;
  	}
      }
*************** alpha_expand_block_move (operands)
*** 2544,2576 ****
    tmp = XEXP (orig_dst, 0);
    if (GET_CODE (tmp) == REG)
!     {
!       if (REGNO_POINTER_ALIGN (REGNO (tmp)) > dst_align)
! 	dst_align = REGNO_POINTER_ALIGN (REGNO (tmp));
!     }
    else if (GET_CODE (tmp) == PLUS
  	   && GET_CODE (XEXP (tmp, 0)) == REG
  	   && GET_CODE (XEXP (tmp, 1)) == CONST_INT)
      {
!       HOST_WIDE_INT c = INTVAL (XEXP (tmp, 1));
!       int a = REGNO_POINTER_ALIGN (REGNO (XEXP (tmp, 0)));
  
        if (a > dst_align)
  	{
!           if (a >= 8 && c % 8 == 0)
! 	    dst_align = 8;
!           else if (a >= 4 && c % 4 == 0)
! 	    dst_align = 4;
!           else if (a >= 2 && c % 2 == 0)
! 	    dst_align = 2;
  	}
      }
- 
-   /*
-    * Load the entire block into registers.
-    */
  
    if (GET_CODE (XEXP (orig_src, 0)) == ADDRESSOF)
      {
        enum machine_mode mode;
        tmp = XEXP (XEXP (orig_src, 0), 0);
  
--- 2539,2566 ----
    tmp = XEXP (orig_dst, 0);
    if (GET_CODE (tmp) == REG)
!     dst_align = MAX (dst_align, REGNO_POINTER_ALIGN (REGNO (tmp)));
    else if (GET_CODE (tmp) == PLUS
  	   && GET_CODE (XEXP (tmp, 0)) == REG
  	   && GET_CODE (XEXP (tmp, 1)) == CONST_INT)
      {
!       unsigned HOST_WIDE_INT c = INTVAL (XEXP (tmp, 1));
!       unsigned int a = REGNO_POINTER_ALIGN (REGNO (XEXP (tmp, 0)));
  
        if (a > dst_align)
  	{
!           if (a >= 64 && c % 8 == 0)
! 	    dst_align = 64;
!           else if (a >= 32 && c % 4 == 0)
! 	    dst_align = 32;
!           else if (a >= 16 && c % 2 == 0)
! 	    dst_align = 16;
  	}
      }
  
+   /* Load the entire block into registers.  */
    if (GET_CODE (XEXP (orig_src, 0)) == ADDRESSOF)
      {
        enum machine_mode mode;
+ 
        tmp = XEXP (XEXP (orig_src, 0), 0);
  
*************** alpha_expand_block_move (operands)
*** 2590,2593 ****
--- 2580,2584 ----
  	  else
  	    data_regs[nregs++] = gen_lowpart (mode, tmp);
+ 
  	  goto src_done;
  	}
*************** alpha_expand_block_move (operands)
*** 2599,2616 ****
  
    ofs = 0;
!   if (src_align >= 8 && bytes >= 8)
      {
        words = bytes / 8;
  
        for (i = 0; i < words; ++i)
! 	data_regs[nregs+i] = gen_reg_rtx(DImode);
  
        for (i = 0; i < words; ++i)
! 	{
! 	  emit_move_insn (data_regs[nregs+i],
! 			  change_address (orig_src, DImode,
! 					  plus_constant (XEXP (orig_src, 0),
! 							 ofs + i*8)));
! 	}
  
        nregs += words;
--- 2590,2605 ----
  
    ofs = 0;
!   if (src_align >= 64 && bytes >= 8)
      {
        words = bytes / 8;
  
        for (i = 0; i < words; ++i)
! 	data_regs[nregs + i] = gen_reg_rtx(DImode);
  
        for (i = 0; i < words; ++i)
! 	emit_move_insn (data_regs[nregs + i],
! 			change_address (orig_src, DImode,
! 					plus_constant (XEXP (orig_src, 0), 
! 						       ofs + i * 8)));
  
        nregs += words;
*************** alpha_expand_block_move (operands)
*** 2618,2635 ****
        ofs += words * 8;
      }
!   if (src_align >= 4 && bytes >= 4)
      {
        words = bytes / 4;
  
        for (i = 0; i < words; ++i)
! 	data_regs[nregs+i] = gen_reg_rtx(SImode);
  
        for (i = 0; i < words; ++i)
! 	{
! 	  emit_move_insn (data_regs[nregs+i],
! 			  change_address (orig_src, SImode,
! 					  plus_constant (XEXP (orig_src, 0),
! 							 ofs + i*4)));
! 	}
  
        nregs += words;
--- 2607,2623 ----
        ofs += words * 8;
      }
! 
!   if (src_align >= 32 && bytes >= 4)
      {
        words = bytes / 4;
  
        for (i = 0; i < words; ++i)
! 	data_regs[nregs + i] = gen_reg_rtx(SImode);
  
        for (i = 0; i < words; ++i)
! 	emit_move_insn (data_regs[nregs + i],
! 			change_address (orig_src, SImode,
! 					plus_constant (XEXP (orig_src, 0),
! 						       ofs + i * 4)));
  
        nregs += words;
*************** alpha_expand_block_move (operands)
*** 2637,2640 ****
--- 2625,2629 ----
        ofs += words * 4;
      }
+ 
    if (bytes >= 16)
      {
*************** alpha_expand_block_move (operands)
*** 2642,2646 ****
  
        for (i = 0; i < words+1; ++i)
! 	data_regs[nregs+i] = gen_reg_rtx(DImode);
  
        alpha_expand_unaligned_load_words (data_regs + nregs, orig_src,
--- 2631,2635 ----
  
        for (i = 0; i < words+1; ++i)
! 	data_regs[nregs + i] = gen_reg_rtx(DImode);
  
        alpha_expand_unaligned_load_words (data_regs + nregs, orig_src,
*************** alpha_expand_block_move (operands)
*** 2651,2655 ****
        ofs += words * 8;
      }
!   if (!TARGET_BWX && bytes >= 8)
      {
        data_regs[nregs++] = tmp = gen_reg_rtx (DImode);
--- 2640,2645 ----
        ofs += words * 8;
      }
! 
!   if (! TARGET_BWX && bytes >= 8)
      {
        data_regs[nregs++] = tmp = gen_reg_rtx (DImode);
*************** alpha_expand_block_move (operands)
*** 2658,2662 ****
        ofs += 8;
      }
!   if (!TARGET_BWX && bytes >= 4)
      {
        data_regs[nregs++] = tmp = gen_reg_rtx (SImode);
--- 2648,2653 ----
        ofs += 8;
      }
! 
!   if (! TARGET_BWX && bytes >= 4)
      {
        data_regs[nregs++] = tmp = gen_reg_rtx (SImode);
*************** alpha_expand_block_move (operands)
*** 2665,2671 ****
        ofs += 4;
      }
    if (bytes >= 2)
      {
!       if (src_align >= 2)
  	{
  	  do {
--- 2656,2663 ----
        ofs += 4;
      }
+ 
    if (bytes >= 2)
      {
!       if (src_align >= 16)
  	{
  	  do {
*************** alpha_expand_block_move (operands)
*** 2679,2683 ****
  	  } while (bytes >= 2);
  	}
!       else if (!TARGET_BWX)
  	{
  	  data_regs[nregs++] = tmp = gen_reg_rtx (HImode);
--- 2671,2676 ----
  	  } while (bytes >= 2);
  	}
! 
!       else if (! TARGET_BWX)
  	{
  	  data_regs[nregs++] = tmp = gen_reg_rtx (HImode);
*************** alpha_expand_block_move (operands)
*** 2687,2690 ****
--- 2680,2684 ----
  	}
      }
+ 
    while (bytes > 0)
      {
*************** alpha_expand_block_move (operands)
*** 2697,2708 ****
        ofs += 1;
      }
   src_done:
  
!   if (nregs > (int)(sizeof(data_regs)/sizeof(*data_regs)))
!     abort();
  
!   /*
!    * Now save it back out again.
!    */
  
    i = 0, ofs = 0;
--- 2691,2701 ----
        ofs += 1;
      }
+ 
   src_done:
  
!   if (nregs > sizeof data_regs / sizeof *data_regs)
!     abort ();
  
!   /* Now save it back out again.  */
  
    i = 0, ofs = 0;
*************** alpha_expand_block_move (operands)
*** 2722,2725 ****
--- 2715,2719 ----
  	      goto dst_done;
  	    }
+ 
  	  else if (nregs == 2 && mode == TImode)
  	    {
*************** alpha_expand_block_move (operands)
*** 2728,2734 ****
  	      if (GET_CODE (data_regs[0]) == SUBREG
  		  && GET_MODE (SUBREG_REG (data_regs[0])) == TImode)
! 		{
! 		  emit_move_insn (tmp, SUBREG_REG (data_regs[0]));
! 		}
  	      else
  		{
--- 2722,2726 ----
  	      if (GET_CODE (data_regs[0]) == SUBREG
  		  && GET_MODE (SUBREG_REG (data_regs[0])) == TImode)
! 		emit_move_insn (tmp, SUBREG_REG (data_regs[0]));
  	      else
  		{
*************** alpha_expand_block_move (operands)
*** 2761,2765 ****
  
    /* Write out the data in whatever chunks reading the source allowed.  */
!   if (dst_align >= 8)
      {
        while (i < nregs && GET_MODE (data_regs[i]) == DImode)
--- 2753,2757 ----
  
    /* Write out the data in whatever chunks reading the source allowed.  */
!   if (dst_align >= 64)
      {
        while (i < nregs && GET_MODE (data_regs[i]) == DImode)
*************** alpha_expand_block_move (operands)
*** 2773,2777 ****
  	}
      }
!   if (dst_align >= 4)
      {
        /* If the source has remaining DImode regs, write them out in
--- 2765,2770 ----
  	}
      }
! 
!   if (dst_align >= 32)
      {
        /* If the source has remaining DImode regs, write them out in
*************** alpha_expand_block_move (operands)
*** 2788,2792 ****
  	  emit_move_insn (change_address (orig_dst, SImode,
  					  plus_constant (XEXP (orig_dst, 0),
! 							 ofs+4)),
  			  gen_lowpart (SImode, tmp));
  	  ofs += 8;
--- 2781,2785 ----
  	  emit_move_insn (change_address (orig_dst, SImode,
  					  plus_constant (XEXP (orig_dst, 0),
! 							 ofs + 4)),
  			  gen_lowpart (SImode, tmp));
  	  ofs += 8;
*************** alpha_expand_block_move (operands)
*** 2804,2813 ****
  	}
      }
    if (i < nregs && GET_MODE (data_regs[i]) == DImode)
      {
        /* Write out a remaining block of words using unaligned methods.  */
  
!       for (words = 1; i+words < nregs ; ++words)
! 	if (GET_MODE (data_regs[i+words]) != DImode)
  	  break;
  
--- 2797,2807 ----
  	}
      }
+ 
    if (i < nregs && GET_MODE (data_regs[i]) == DImode)
      {
        /* Write out a remaining block of words using unaligned methods.  */
  
!       for (words = 1; i + words < nregs; words++)
! 	if (GET_MODE (data_regs[i + words]) != DImode)
  	  break;
  
*************** alpha_expand_block_move (operands)
*** 2815,2819 ****
  	alpha_expand_unaligned_store (orig_dst, data_regs[i], 8, ofs);
        else
!         alpha_expand_unaligned_store_words (data_regs+i, orig_dst, words, ofs);
       
        i += words;
--- 2809,2814 ----
  	alpha_expand_unaligned_store (orig_dst, data_regs[i], 8, ofs);
        else
!         alpha_expand_unaligned_store_words (data_regs + i, orig_dst,
! 					    words, ofs);
       
        i += words;
*************** alpha_expand_block_move (operands)
*** 2831,2835 ****
      }
  
!   if (dst_align >= 2)
      while (i < nregs && GET_MODE (data_regs[i]) == HImode)
        {
--- 2826,2830 ----
      }
  
!   if (dst_align >= 16)
      while (i < nregs && GET_MODE (data_regs[i]) == HImode)
        {
*************** alpha_expand_block_move (operands)
*** 2848,2851 ****
--- 2843,2847 ----
  	ofs += 2;
        }
+ 
    while (i < nregs && GET_MODE (data_regs[i]) == QImode)
      {
*************** alpha_expand_block_move (operands)
*** 2857,2864 ****
        ofs += 1;
      }
   dst_done:
  
    if (i != nregs)
!     abort();
  
    return 1;
--- 2853,2861 ----
        ofs += 1;
      }
+ 
   dst_done:
  
    if (i != nregs)
!     abort ();
  
    return 1;
*************** alpha_expand_block_clear (operands)
*** 2871,2881 ****
    rtx bytes_rtx	= operands[1];
    rtx align_rtx = operands[2];
!   HOST_WIDE_INT bytes = INTVAL (bytes_rtx);
!   HOST_WIDE_INT align = INTVAL (align_rtx);
!   rtx orig_dst	= operands[0];
    rtx tmp;
!   HOST_WIDE_INT i, words, ofs = 0;
    
!   if (bytes <= 0)
      return 1;
    if (bytes > MAX_MOVE_WORDS*8)
--- 2868,2879 ----
    rtx bytes_rtx	= operands[1];
    rtx align_rtx = operands[2];
!   HOST_WIDE_INT orig_bytes = INTVAL (bytes_rtx);
!   unsigned HOST_WIDE_INT bytes = orig_bytes;
!   unsigned HOST_WIDE_INT align = INTVAL (align_rtx);
!   rtx orig_dst = operands[0];
    rtx tmp;
!   unsigned HOST_WIDE_INT i, words, ofs = 0;
    
!   if (orig_bytes <= 0)
      return 1;
    if (bytes > MAX_MOVE_WORDS*8)
*************** alpha_expand_block_clear (operands)
*** 2883,2910 ****
  
    /* Look for stricter alignment.  */
- 
    tmp = XEXP (orig_dst, 0);
    if (GET_CODE (tmp) == REG)
!     {
!       if (REGNO_POINTER_ALIGN (REGNO (tmp)) > align)
! 	align = REGNO_POINTER_ALIGN (REGNO (tmp));
!     }
    else if (GET_CODE (tmp) == PLUS
  	   && GET_CODE (XEXP (tmp, 0)) == REG
  	   && GET_CODE (XEXP (tmp, 1)) == CONST_INT)
      {
!       HOST_WIDE_INT c = INTVAL (XEXP (tmp, 1));
!       int a = REGNO_POINTER_ALIGN (REGNO (XEXP (tmp, 0)));
  
        if (a > align)
  	{
!           if (a >= 8 && c % 8 == 0)
! 	    align = 8;
!           else if (a >= 4 && c % 4 == 0)
! 	    align = 4;
!           else if (a >= 2 && c % 2 == 0)
! 	    align = 2;
  	}
      }
    else if (GET_CODE (tmp) == ADDRESSOF)
      {
--- 2881,2905 ----
  
    /* Look for stricter alignment.  */
    tmp = XEXP (orig_dst, 0);
    if (GET_CODE (tmp) == REG)
!     align = MAX (align, REGNO_POINTER_ALIGN (REGNO (tmp)));
    else if (GET_CODE (tmp) == PLUS
  	   && GET_CODE (XEXP (tmp, 0)) == REG
  	   && GET_CODE (XEXP (tmp, 1)) == CONST_INT)
      {
!       unsigned HOST_WIDE_INT c = INTVAL (XEXP (tmp, 1));
!       unsigned int a = REGNO_POINTER_ALIGN (REGNO (XEXP (tmp, 0)));
  
        if (a > align)
  	{
!           if (a >= 64 && c % 8 == 0)
! 	    align = 64;
!           else if (a >= 32 && c % 4 == 0)
! 	    align = 32;
!           else if (a >= 16 && c % 2 == 0)
! 	    align = 16;
  	}
      }
+ 
    else if (GET_CODE (tmp) == ADDRESSOF)
      {
*************** alpha_expand_block_clear (operands)
*** 2926,2959 ****
    /* Handle a block of contiguous words first.  */
  
!   if (align >= 8 && bytes >= 8)
      {
        words = bytes / 8;
  
        for (i = 0; i < words; ++i)
! 	{
! 	  emit_move_insn (change_address(orig_dst, DImode,
! 					 plus_constant (XEXP (orig_dst, 0),
! 							ofs + i*8)),
  			  const0_rtx);
- 	}
  
        bytes -= words * 8;
        ofs += words * 8;
      }
!   if (align >= 4 && bytes >= 4)
      {
        words = bytes / 4;
  
        for (i = 0; i < words; ++i)
! 	{
! 	  emit_move_insn (change_address (orig_dst, SImode,
! 					  plus_constant (XEXP (orig_dst, 0),
! 							 ofs + i*4)),
! 			  const0_rtx);
! 	}
  
        bytes -= words * 4;
        ofs += words * 4;
      }
    if (bytes >= 16)
      {
--- 2921,2952 ----
    /* Handle a block of contiguous words first.  */
  
!   if (align >= 64 && bytes >= 8)
      {
        words = bytes / 8;
  
        for (i = 0; i < words; ++i)
! 	emit_move_insn (change_address(orig_dst, DImode,
! 				       plus_constant (XEXP (orig_dst, 0),
! 						      ofs + i * 8)),
  			  const0_rtx);
  
        bytes -= words * 8;
        ofs += words * 8;
      }
! 
!   if (align >= 16 && bytes >= 4)
      {
        words = bytes / 4;
  
        for (i = 0; i < words; ++i)
! 	emit_move_insn (change_address (orig_dst, SImode,
! 					plus_constant (XEXP (orig_dst, 0),
! 						       ofs + i * 4)),
! 			const0_rtx);
  
        bytes -= words * 4;
        ofs += words * 4;
      }
+ 
    if (bytes >= 16)
      {
*************** alpha_expand_block_clear (operands)
*** 2969,2973 ****
       block move that there are no aligned SImode or DImode hunks left.  */
  
!   if (!TARGET_BWX && bytes >= 8)
      {
        alpha_expand_unaligned_store (orig_dst, const0_rtx, 8, ofs);
--- 2962,2966 ----
       block move that there are no aligned SImode or DImode hunks left.  */
  
!   if (! TARGET_BWX && bytes >= 8)
      {
        alpha_expand_unaligned_store (orig_dst, const0_rtx, 8, ofs);
*************** alpha_expand_block_clear (operands)
*** 2975,2978 ****
--- 2968,2972 ----
        ofs += 8;
      }
+ 
    if (!TARGET_BWX && bytes >= 4)
      {
*************** alpha_expand_block_clear (operands)
*** 2981,2987 ****
        ofs += 4;
      }
    if (bytes >= 2)
      {
!       if (align >= 2)
  	{
  	  do {
--- 2975,2982 ----
        ofs += 4;
      }
+ 
    if (bytes >= 2)
      {
!       if (align >= 16)
  	{
  	  do {
*************** alpha_expand_block_clear (operands)
*** 2994,2998 ****
  	  } while (bytes >= 2);
  	}
!       else if (!TARGET_BWX)
  	{
  	  alpha_expand_unaligned_store (orig_dst, const0_rtx, 2, ofs);
--- 2989,2993 ----
  	  } while (bytes >= 2);
  	}
!       else if (! TARGET_BWX)
  	{
  	  alpha_expand_unaligned_store (orig_dst, const0_rtx, 2, ofs);
*************** alpha_expand_block_clear (operands)
*** 3001,3004 ****
--- 2996,3000 ----
  	}
      }
+ 
    while (bytes > 0)
      {
*************** alpha_expand_block_clear (operands)
*** 3013,3017 ****
    return 1;
  }
- 
  
  /* Adjust the cost of a scheduling dependency.  Return the new cost of
--- 3009,3012 ----
*************** alpha_va_start (stdarg_p, valist, nextar
*** 3756,3759 ****
--- 3751,3757 ----
    HOST_WIDE_INT offset;
    tree t, offset_field, base_field;
+ 
+   if (TREE_CODE (TREE_TYPE (valist)) == ERROR_MARK)
+     return;
  
    if (TARGET_OPEN_VMS)
*** config/arm/arm.c	2000/03/29 19:15:36	1.90
--- config/arm/arm.c	2000/03/30 13:19:23
*************** alignable_memory_operand (op, mode)
*** 2488,2492 ****
  		   || (GET_CODE (XEXP (op, 0)) == SUBREG
  		       && GET_CODE (reg = SUBREG_REG (XEXP (op, 0))) == REG))))
! 	  && REGNO_POINTER_ALIGN (REGNO (reg)) >= 4);
  }
  
--- 2488,2492 ----
  		   || (GET_CODE (XEXP (op, 0)) == SUBREG
  		       && GET_CODE (reg = SUBREG_REG (XEXP (op, 0))) == REG))))
! 	  && REGNO_POINTER_ALIGN (REGNO (reg)) >= 32);
  }
  
*** config/i386.c	2000/03/29 13:10:42	1.150
--- config/i386.c	2000/03/30 13:19:43
*************** aligned_operand (op, mode)
*** 1450,1459 ****
      {
        if (parts.scale < 4
! 	  && REGNO_POINTER_ALIGN (REGNO (parts.index)) < 4)
  	return 0;
      }
    if (parts.base)
      {
!       if (REGNO_POINTER_ALIGN (REGNO (parts.base)) < 4)
  	return 0;
      }
--- 1450,1459 ----
      {
        if (parts.scale < 4
! 	  && REGNO_POINTER_ALIGN (REGNO (parts.index)) < 32)
  	return 0;
      }
    if (parts.base)
      {
!       if (REGNO_POINTER_ALIGN (REGNO (parts.base)) < 32)
  	return 0;
      }
*** config/sparc/sparc.c	2000/03/26 16:46:27	1.118
--- config/sparc/sparc.c	2000/03/30 13:20:23
*************** mem_min_alignment (mem, desired)
*** 2939,2945 ****
  	     If not running global_alloc, reload might give us
  	     unaligned pointer to local stack though.  */
! 	  if (((cfun != 0 && REGNO_POINTER_ALIGN (regno) >= desired)
  	       || (optimize && reload_completed))
! 	      && ((INTVAL (offset) & (desired - 1)) == 0))
  	    return 1;
  	}
--- 2939,2946 ----
  	     If not running global_alloc, reload might give us
  	     unaligned pointer to local stack though.  */
! 	  if (((cfun != 0
! 		&& REGNO_POINTER_ALIGN (regno) >= desired * BITS_PER_UNIT)
  	       || (optimize && reload_completed))
! 	      && (INTVAL (offset) & (desired - 1)) == 0)
  	    return 1;
  	}


More information about the Gcc-patches mailing list