Two bugfixes in expr.c

Richard Kenner kenner@vlsi1.ultra.nyu.edu
Fri Apr 14 15:15:00 GMT 2000


This fixes two bugs in move insn handling in expr.c.

(1) When checking whether the operand satisfy the predicates for
movstr, we can allow volatile since a move insn and is indeed likely
to be the preferred move insn for volatile objects.

(2) If we have a multi-word move during reload, see if we have
replacements within the addresses.

Fri Apr 14 18:07:30 2000  Richard Kenner  <kenner@vlsi1.ultra.nyu.edu>

	* expr.c (reload.h): Now included.
	(emit_block_move): Set volatile_ok when checking for movstr.
	(emit_move_1): Check for replacements in addresses in multi-word case.
	* Makefile.in (expr.o): Now includes reload.h.

*** Makefile.in	2000/04/07 21:37:56	1.419
--- Makefile.in	2000/04/14 17:00:38
*************** expr.o : expr.c $(CONFIG_H) system.h $(R
*** 1534,1538 ****
     $(REGS_H) insn-flags.h insn-codes.h $(EXPR_H) insn-config.h $(RECOG_H) \
     output.h typeclass.h hard-reg-set.h toplev.h hard-reg-set.h except.h \
!    $(GGC_H) intl.h
  builtins.o : builtins.c $(CONFIG_H) system.h $(RTL_H) $(TREE_H) flags.h \
     function.h $(REGS_H) insn-flags.h insn-codes.h $(EXPR_H) insn-config.h \
--- 1534,1538 ----
     $(REGS_H) insn-flags.h insn-codes.h $(EXPR_H) insn-config.h $(RECOG_H) \
     output.h typeclass.h hard-reg-set.h toplev.h hard-reg-set.h except.h \
!    reload.h $(GGC_H) intl.h
  builtins.o : builtins.c $(CONFIG_H) system.h $(RTL_H) $(TREE_H) flags.h \
     function.h $(REGS_H) insn-flags.h insn-codes.h $(EXPR_H) insn-config.h \
*** expr.c	2000/04/10 11:46:08	1.229
--- expr.c	2000/04/14 17:01:14
*************** Boston, MA 02111-1307, USA.  */
*** 38,41 ****
--- 38,42 ----
  #include "expr.h"
  #include "recog.h"
+ #include "reload.h"
  #include "output.h"
  #include "typeclass.h"
*************** emit_block_move (x, y, size, align)
*** 1627,1630 ****
--- 1628,1634 ----
        enum machine_mode mode;
  
+       /* Since this is a move insn, we don't care about volatility.  */
+       volatile_ok = 1;
+ 
        for (mode = GET_CLASS_NARROWEST_MODE (MODE_INT); mode != VOIDmode;
  	   mode = GET_MODE_WIDER_MODE (mode))
*************** emit_block_move (x, y, size, align)
*** 1662,1665 ****
--- 1666,1670 ----
  		{
  		  emit_insn (pat);
+ 		  volatile_ok = 0;
  		  return 0;
  		}
*************** emit_block_move (x, y, size, align)
*** 1669,1672 ****
--- 1674,1679 ----
  	}
  
+       volatile_ok = 0;
+ 
        /* X, Y, or SIZE may have been passed through protect_from_queue.
  
*************** emit_move_insn_1 (x, y)
*** 2721,2725 ****
      {
        rtx last_insn = 0;
!       rtx seq;
        int need_clobber;
        
--- 2728,2732 ----
      {
        rtx last_insn = 0;
!       rtx seq, inner;
        int need_clobber;
        
*************** emit_move_insn_1 (x, y)
*** 2735,2738 ****
--- 2742,2768 ----
  #endif
  			     
+       /* If we are in reload, see if either operand is a MEM whose address
+ 	 is scheduled for replacement.  */
+       if (reload_in_progress && GET_CODE (x) == MEM
+ 	  && (inner = find_replacement (&XEXP (x, 0))) != XEXP (x, 0))
+ 	{
+ 	  rtx new = gen_rtx_MEM (GET_MODE (x), inner);
+ 
+ 	  RTX_UNCHANGING_P (new) = RTX_UNCHANGING_P (x);
+ 	  MEM_COPY_ATTRIBUTES (new, x);
+ 	  MEM_ALIAS_SET (new) = MEM_ALIAS_SET (x);
+ 	  x = new;
+ 	}
+       if (reload_in_progress && GET_CODE (y) == MEM
+ 	  && (inner = find_replacement (&XEXP (y, 0))) != XEXP (y, 0))
+ 	{
+ 	  rtx new = gen_rtx_MEM (GET_MODE (y), inner);
+ 
+ 	  RTX_UNCHANGING_P (new) = RTX_UNCHANGING_P (y);
+ 	  MEM_COPY_ATTRIBUTES (new, y);
+ 	  MEM_ALIAS_SET (new) = MEM_ALIAS_SET (y);
+ 	  y = new;
+ 	}
+ 
        start_sequence ();
  


More information about the Gcc-patches mailing list