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: patch that caused regression PR optimization/7154


On Tue, Dec 17, 2002 at 04:20:03PM -0800, Janis Johnson wrote:
> The regression reported in PR optimization/7154 showed up starting
> with this patch:
> 
> 2002-05-28  Richard Henderson  <rth@redhat.com>
> 
> 	* config/i386/i386.c (ix86_save_reg): Examine regs_ever_live,
>	...

Fixed thus.


r~


        PR opt/7507
        * stmt.c (expand_asm_operands): Validize memory operands.
        * gcc.dg/20030120-1.c: New.

Index: stmt.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/stmt.c,v
retrieving revision 1.284
diff -c -p -d -r1.284 stmt.c
*** stmt.c	16 Jan 2003 15:13:19 -0000	1.284
--- stmt.c	21 Jan 2003 07:32:20 -0000
*************** expand_asm_operands (string, outputs, in
*** 1610,1615 ****
--- 1610,1616 ----
        bool is_inout;
        bool allows_reg;
        bool allows_mem;
+       rtx op;
  
        if (!parse_output_constraint (&constraints[i], i, ninputs,
  				    noutputs, &allows_mem, &allows_reg,
*************** expand_asm_operands (string, outputs, in
*** 1633,1656 ****
  	  || ! allows_reg
  	  || is_inout)
  	{
! 	  output_rtx[i] = expand_expr (val, NULL_RTX, VOIDmode, EXPAND_WRITE);
  
! 	  if (! allows_reg && GET_CODE (output_rtx[i]) != MEM)
  	    error ("output number %d not directly addressable", i);
! 	  if ((! allows_mem && GET_CODE (output_rtx[i]) == MEM)
! 	      || GET_CODE (output_rtx[i]) == CONCAT)
  	    {
! 	      real_output_rtx[i] = protect_from_queue (output_rtx[i], 1);
! 	      output_rtx[i] = gen_reg_rtx (GET_MODE (output_rtx[i]));
  	      if (is_inout)
! 		emit_move_insn (output_rtx[i], real_output_rtx[i]);
  	    }
  	}
        else
  	{
! 	  output_rtx[i] = assign_temp (type, 0, 0, 1);
! 	  TREE_VALUE (tail) = make_tree (type, output_rtx[i]);
  	}
  
        generating_concat_p = old_generating_concat_p;
  
--- 1634,1661 ----
  	  || ! allows_reg
  	  || is_inout)
  	{
! 	  op = expand_expr (val, NULL_RTX, VOIDmode, EXPAND_WRITE);
! 	  if (GET_CODE (op) == MEM)
! 	    op = validize_mem (op);
  
! 	  if (! allows_reg && GET_CODE (op) != MEM)
  	    error ("output number %d not directly addressable", i);
! 	  if ((! allows_mem && GET_CODE (op) == MEM)
! 	      || GET_CODE (op) == CONCAT)
  	    {
! 	      real_output_rtx[i] = protect_from_queue (op, 1);
! 	      op = gen_reg_rtx (GET_MODE (op));
  	      if (is_inout)
! 		emit_move_insn (op, real_output_rtx[i]);
  	    }
  	}
        else
  	{
! 	  op = assign_temp (type, 0, 0, 1);
! 	  op = validize_mem (op);
! 	  TREE_VALUE (tail) = make_tree (type, op);
  	}
+       output_rtx[i] = op;
  
        generating_concat_p = old_generating_concat_p;
  
*************** expand_asm_operands (string, outputs, in
*** 1702,1707 ****
--- 1707,1714 ----
        /* Never pass a CONCAT to an ASM.  */
        if (GET_CODE (op) == CONCAT)
  	op = force_reg (GET_MODE (op), op);
+       else if (GET_CODE (op) == MEM)
+ 	op = validize_mem (op);
  
        if (asm_operand_ok (op, constraint) <= 0)
  	{
*************** expand_asm_operands (string, outputs, in
*** 1711,1717 ****
  	    warning ("asm operand %d probably doesn't match constraints",
  		     i + noutputs);
  	  else if (CONSTANT_P (op))
! 	    op = force_const_mem (TYPE_MODE (type), op);
  	  else if (GET_CODE (op) == REG
  		   || GET_CODE (op) == SUBREG
  		   || GET_CODE (op) == ADDRESSOF
--- 1718,1727 ----
  	    warning ("asm operand %d probably doesn't match constraints",
  		     i + noutputs);
  	  else if (CONSTANT_P (op))
! 	    {
! 	      op = force_const_mem (TYPE_MODE (type), op);
! 	      op = validize_mem (op);
! 	    }
  	  else if (GET_CODE (op) == REG
  		   || GET_CODE (op) == SUBREG
  		   || GET_CODE (op) == ADDRESSOF
*************** expand_asm_operands (string, outputs, in
*** 1721,1727 ****
  						     (TYPE_QUALS (type)
  						      | TYPE_QUAL_CONST));
  	      rtx memloc = assign_temp (qual_type, 1, 1, 1);
! 
  	      emit_move_insn (memloc, op);
  	      op = memloc;
  	    }
--- 1731,1737 ----
  						     (TYPE_QUALS (type)
  						      | TYPE_QUAL_CONST));
  	      rtx memloc = assign_temp (qual_type, 1, 1, 1);
! 	      memloc = validize_mem (memloc);
  	      emit_move_insn (memloc, op);
  	      op = memloc;
  	    }
Index: testsuite/gcc.dg/20030120-1.c
===================================================================
RCS file: testsuite/gcc.dg/20030120-1.c
diff -N testsuite/gcc.dg/20030120-1.c
*** /dev/null	1 Jan 1970 00:00:00 -0000
--- testsuite/gcc.dg/20030120-1.c	21 Jan 2003 07:32:20 -0000
***************
*** 0 ****
--- 1,10 ----
+ /* PR 7154 */
+ /* { dg-do compile } */
+ /* { dg-options "-O -fpic" } */
+ /* { dg-warning "not supported" "PIC unsupported" { target cris-*-elf* mmix-*-* } 0 } */
+ 
+ const int x[1]={ 1 };
+ void foo(int i, int *p)
+ {
+   asm volatile("" : "+r"(i) : "m" (x[0]), "r"(p));
+ }


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