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]

[patch] for target_mem_ref related ICE on arm


Hello,

arm does not like usage of virtual pseudoregisters in addresses, thus
causing tree-ssa-address to believe that no addressing mode is available
at all, which causes an ICE.  Fixed by choosing numbers of non-virtual
pseudos for testing which addressing modes are valid.

The patch also fixes a few places in ivopts where some similar problem
could occur.

Bootstrapped & regtested on i686.

Zdenek

	* tree-ssa-address.c (addr_for_mem_ref): Use LAST_VIRTUAL_REGISTER
	instead of FIRST_PSEUDO_REGISTER for creating pseudoregisters.
	* tree-ssa-loop-ivopts.c (add_cost, multiply_by_cost,
	multiplier_allowed_in_address_p, get_address_cost): Ditto.

Index: tree-ssa-address.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/tree-ssa-address.c,v
retrieving revision 2.1
diff -c -3 -p -r2.1 tree-ssa-address.c
*** tree-ssa-address.c	7 Jun 2005 12:01:28 -0000	2.1
--- tree-ssa-address.c	8 Jun 2005 14:34:35 -0000
*************** addr_for_mem_ref (struct mem_address *ad
*** 198,205 ****
  
  	  templates_initialized = true;
  	  sym = gen_rtx_SYMBOL_REF (Pmode, ggc_strdup ("test_symbol"));
! 	  bse = gen_raw_REG (Pmode, FIRST_PSEUDO_REGISTER);
! 	  idx = gen_raw_REG (Pmode, FIRST_PSEUDO_REGISTER + 1);
  
  	  for (i = 0; i < 32; i++)
  	    gen_addr_rtx ((i & 16 ? sym : NULL_RTX),
--- 198,205 ----
  
  	  templates_initialized = true;
  	  sym = gen_rtx_SYMBOL_REF (Pmode, ggc_strdup ("test_symbol"));
! 	  bse = gen_raw_REG (Pmode, LAST_VIRTUAL_REGISTER + 1);
! 	  idx = gen_raw_REG (Pmode, LAST_VIRTUAL_REGISTER + 2);
  
  	  for (i = 0; i < 32; i++)
  	    gen_addr_rtx ((i & 16 ? sym : NULL_RTX),
Index: tree-ssa-loop-ivopts.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/tree-ssa-loop-ivopts.c,v
retrieving revision 2.78
diff -c -3 -p -r2.78 tree-ssa-loop-ivopts.c
*** tree-ssa-loop-ivopts.c	7 Jun 2005 22:44:56 -0000	2.78
--- tree-ssa-loop-ivopts.c	8 Jun 2005 14:34:35 -0000
*************** add_cost (enum machine_mode mode)
*** 3149,3156 ****
  
    start_sequence ();
    force_operand (gen_rtx_fmt_ee (PLUS, mode,
! 				 gen_raw_REG (mode, FIRST_PSEUDO_REGISTER),
! 				 gen_raw_REG (mode, FIRST_PSEUDO_REGISTER + 1)),
  		 NULL_RTX);
    seq = get_insns ();
    end_sequence ();
--- 3149,3156 ----
  
    start_sequence ();
    force_operand (gen_rtx_fmt_ee (PLUS, mode,
! 				 gen_raw_REG (mode, LAST_VIRTUAL_REGISTER + 1),
! 				 gen_raw_REG (mode, LAST_VIRTUAL_REGISTER + 2)),
  		 NULL_RTX);
    seq = get_insns ();
    end_sequence ();
*************** multiply_by_cost (HOST_WIDE_INT cst, enu
*** 3221,3228 ****
    (*cached)->cst = cst;
  
    start_sequence ();
!   expand_mult (mode, gen_raw_REG (mode, FIRST_PSEUDO_REGISTER), GEN_INT (cst),
! 	       NULL_RTX, 0);
    seq = get_insns ();
    end_sequence ();
    
--- 3221,3228 ----
    (*cached)->cst = cst;
  
    start_sequence ();
!   expand_mult (mode, gen_raw_REG (mode, LAST_VIRTUAL_REGISTER + 1),
! 	       gen_int_mode (cst, mode), NULL_RTX, 0);
    seq = get_insns ();
    end_sequence ();
    
*************** multiplier_allowed_in_address_p (HOST_WI
*** 3247,3253 ****
    
    if (!valid_mult)
      {
!       rtx reg1 = gen_raw_REG (Pmode, FIRST_PSEUDO_REGISTER);
        rtx addr;
        HOST_WIDE_INT i;
  
--- 3247,3253 ----
    
    if (!valid_mult)
      {
!       rtx reg1 = gen_raw_REG (Pmode, LAST_VIRTUAL_REGISTER + 1);
        rtx addr;
        HOST_WIDE_INT i;
  
*************** get_address_cost (bool symbol_present, b
*** 3305,3316 ****
        HOST_WIDE_INT i;
        initialized = true;
  
!       reg1 = gen_raw_REG (Pmode, FIRST_PSEUDO_REGISTER);
  
        addr = gen_rtx_fmt_ee (PLUS, Pmode, reg1, NULL_RTX);
        for (i = 1; i <= 1 << 20; i <<= 1)
  	{
! 	  XEXP (addr, 1) = GEN_INT (i);
  	  if (!memory_address_p (Pmode, addr))
  	    break;
  	}
--- 3305,3316 ----
        HOST_WIDE_INT i;
        initialized = true;
  
!       reg1 = gen_raw_REG (Pmode, LAST_VIRTUAL_REGISTER + 1);
  
        addr = gen_rtx_fmt_ee (PLUS, Pmode, reg1, NULL_RTX);
        for (i = 1; i <= 1 << 20; i <<= 1)
  	{
! 	  XEXP (addr, 1) = gen_int_mode (i, Pmode);
  	  if (!memory_address_p (Pmode, addr))
  	    break;
  	}
*************** get_address_cost (bool symbol_present, b
*** 3319,3325 ****
  
        for (i = 1; i <= 1 << 20; i <<= 1)
  	{
! 	  XEXP (addr, 1) = GEN_INT (-i);
  	  if (!memory_address_p (Pmode, addr))
  	    break;
  	}
--- 3319,3325 ----
  
        for (i = 1; i <= 1 << 20; i <<= 1)
  	{
! 	  XEXP (addr, 1) = gen_int_mode (-i, Pmode);
  	  if (!memory_address_p (Pmode, addr))
  	    break;
  	}
*************** get_address_cost (bool symbol_present, b
*** 3368,3377 ****
      {
        acost = 0;
        
!       addr = gen_raw_REG (Pmode, FIRST_PSEUDO_REGISTER);
!       reg1 = gen_raw_REG (Pmode, FIRST_PSEUDO_REGISTER + 1);
        if (ratio_p)
! 	addr = gen_rtx_fmt_ee (MULT, Pmode, addr, GEN_INT (rat));
  
        if (var_present)
  	addr = gen_rtx_fmt_ee (PLUS, Pmode, addr, reg1);
--- 3368,3377 ----
      {
        acost = 0;
        
!       addr = gen_raw_REG (Pmode, LAST_VIRTUAL_REGISTER + 1);
!       reg1 = gen_raw_REG (Pmode, LAST_VIRTUAL_REGISTER + 2);
        if (ratio_p)
! 	addr = gen_rtx_fmt_ee (MULT, Pmode, addr, gen_int_mode (rat, Pmode));
  
        if (var_present)
  	addr = gen_rtx_fmt_ee (PLUS, Pmode, addr, reg1);
*************** get_address_cost (bool symbol_present, b
*** 3383,3392 ****
  	    base = gen_rtx_fmt_e (CONST, Pmode,
  				  gen_rtx_fmt_ee (PLUS, Pmode,
  						  base,
! 						  GEN_INT (off)));
  	}
        else if (offset_p)
! 	base = GEN_INT (off);
        else
  	base = NULL_RTX;
      
--- 3383,3392 ----
  	    base = gen_rtx_fmt_e (CONST, Pmode,
  				  gen_rtx_fmt_ee (PLUS, Pmode,
  						  base,
! 						  gen_int_mode (off, Pmode)));
  	}
        else if (offset_p)
! 	base = gen_int_mode (off, Pmode);
        else
  	base = NULL_RTX;
      


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