i386.c (ix86_set_move_mem_attrs): New function.
authorRichard Kenner <kenner@vlsi1.ultra.nyu.edu>
Sun, 25 Feb 2001 01:28:23 +0000 (01:28 +0000)
committerRichard Kenner <kenner@gcc.gnu.org>
Sun, 25 Feb 2001 01:28:23 +0000 (20:28 -0500)
* config/i386/i386.c (ix86_set_move_mem_attrs): New function.
(ix86_set_move_mem_attrs_1): Likewise.
* config/i386/i386-protos.h (ix86_set_move_mem_attrs): New declaration.
* config/i386/i386.md (movstrsi): Call it.

From-SVN: r40046

gcc/ChangeLog
gcc/config/i386/i386-protos.h
gcc/config/i386/i386.c
gcc/config/i386/i386.md

index 2d2f0413594bde262698445628c07754de6b2c24..cd686a8414d6388a69cedf10af4cc1a8af22523b 100644 (file)
@@ -1,3 +1,10 @@
+Sat Feb 24 20:25:29 2001  Richard Kenner  <kenner@vlsi1.ultra.nyu.edu>
+
+       * config/i386/i386.c (ix86_set_move_mem_attrs): New function.
+       (ix86_set_move_mem_attrs_1): Likewise.
+       * config/i386/i386-protos.h (ix86_set_move_mem_attrs): New declaration.
+       * config/i386/i386.md (movstrsi): Call it.
+
 2001-02-24  Zack Weinberg  <zackw@stanford.edu>
 
        * config.gcc: Expunge references to alpha/t-pe, pa/t-openbsd,
index 72ea6d99eaa66757be530d8d0f79ffb1546e7493..1b24df821243bb9401293a23d822a18ab042b98c 100644 (file)
@@ -1,6 +1,6 @@
 /* Definitions of target machine for GNU compiler for IA-32.
-   Copyright (C) 1988, 1992, 1994, 1995, 1996, 1996, 1997, 1998, 1999, 2000
-   Free Software Foundation, Inc.
+   Copyright (C) 1988, 1992, 1994, 1995, 1996, 1996, 1997, 1998, 1999,
+   2000, 2001 Free Software Foundation, Inc.
 
 This file is part of GNU CC.
 
@@ -152,6 +152,8 @@ extern rtx ix86_expand_builtin PARAMS ((tree, rtx, rtx, enum machine_mode, int))
 
 #endif
 
+extern void ix86_set_move_mem_attrs PARAMS ((rtx, rtx, rtx, rtx, rtx));
+
 #ifdef TREE_CODE
 extern int ix86_valid_decl_attribute_p PARAMS ((tree, tree, tree, tree));
 extern int ix86_valid_type_attribute_p PARAMS ((tree, tree, tree, tree));
index e90cc0da6c1a33ac692a5e72b21155047aa75080..32ae6d4984acc061dd2dd7a803ac6d362b3b4bc3 100644 (file)
@@ -507,6 +507,7 @@ static int ix86_nsaved_regs PARAMS((void));
 static void ix86_emit_save_regs PARAMS((void));
 static void ix86_emit_restore_regs_using_mov PARAMS ((rtx, int));
 static void ix86_emit_epilogue_esp_adjustment PARAMS((int));
+static void ix86_set_move_mem_attrs_1 PARAMS ((rtx, rtx, rtx, rtx, rtx));
 static void ix86_sched_reorder_pentium PARAMS((rtx *, rtx *));
 static void ix86_sched_reorder_ppro PARAMS((rtx *, rtx *));
 static HOST_WIDE_INT ix86_GOT_alias_set PARAMS ((void));
@@ -7363,6 +7364,52 @@ ix86_variable_issue (dump, sched_verbose, insn, can_issue_more)
     }
 }
 \f
+/* Walk through INSNS and look for MEM references whose address is DSTREG or
+   SRCREG and set the memory attribute to those of DSTREF and SRCREF, as
+   appropriate.  */
+
+void
+ix86_set_move_mem_attrs (insns, dstref, srcref, dstreg, srcreg)
+     rtx insns;
+     rtx dstref, srcref, dstreg, srcreg;
+{
+  rtx insn;
+
+  for (insn = insns; insn != 0 ; insn = NEXT_INSN (insn))
+    if (INSN_P (insn))
+      ix86_set_move_mem_attrs_1 (PATTERN (insn), dstref, srcref,
+                                dstreg, srcreg);
+}
+
+/* Subroutine of above to actually do the updating by recursively walking
+   the rtx.  */
+
+static void
+ix86_set_move_mem_attrs_1 (x, dstref, srcref, dstreg, srcreg)
+     rtx x;
+     rtx dstref, srcref, dstreg, srcreg;
+{
+  enum rtx_code code = GET_CODE (x);
+  const char *format_ptr = GET_RTX_FORMAT (code);
+  int i, j;
+
+  if (code == MEM && XEXP (x, 0) == dstreg)
+    MEM_COPY_ATTRIBUTES (x, dstref);
+  else if (code == MEM && XEXP (x, 0) == srcreg)
+    MEM_COPY_ATTRIBUTES (x, srcref);
+
+  for (i = 0; i < GET_RTX_LENGTH (code); i++, format_ptr++)
+    {
+      if (*format_ptr == 'e')
+       ix86_set_move_mem_attrs_1 (XEXP (x, i), dstref, srcref,
+                                  dstreg, srcreg);
+      else if (*format_ptr == 'E')
+       for (j = XVECLEN (x, i) - 1; j >= 0; j--)
+         ix86_set_move_mem_attrs_1 (XVECEXP (x, i, j), dstref, srcreg,
+                                    dstreg, srcreg);
+    }
+}
+\f
 /* Compute the alignment given to a constant that is being placed in memory.
    EXP is the constant and ALIGN is the alignment that the object would
    ordinarily have.
index 350af1cedbdb37e86f256715a5684e271c5df2e0..2fad7e137b45e90c63bfd6f9013e52f12090f9ca 100644 (file)
@@ -1,5 +1,5 @@
 ;; GCC machine description for IA-32.
-;; Copyright (C) 1988, 1994, 1995, 1996, 1997, 1998, 1999, 2000
+;; Copyright (C) 1988, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001
 ;; Free Software Foundation, Inc.
 ;; Mostly by William Schelter.
 ;;
   rtx srcreg, destreg, countreg;
   int align = 0;
   int count = -1;
+  rtx insns;
+
+  start_sequence ();
 
   if (GET_CODE (operands[3]) == CONST_INT)
     align = INTVAL (operands[3]);
   destreg = copy_to_mode_reg (Pmode, XEXP (operands[0], 0));
   srcreg = copy_to_mode_reg (Pmode, XEXP (operands[1], 0));
 
-  emit_insn (gen_cld());
+  emit_insn (gen_cld ());
 
   /* When optimizing for size emit simple rep ; movsb instruction for
      counts not divisible by 4.  */
          LABEL_NUSES (label) = 1;
        }
     }
+
+  insns = get_insns ();
+  end_sequence ();
+
+  ix86_set_move_mem_attrs (insns, operands[0], operands[1], destreg, srcreg);
+  emit_insns (insns);
   DONE;
 }")