Sync up MEMORY_MOVE_COST changes with FSF.
authorKen Raeburn <raeburn@cygnus.com>
Tue, 7 Apr 1998 13:24:41 +0000 (13:24 +0000)
committerKen Raeburn <raeburn@gcc.gnu.org>
Tue, 7 Apr 1998 13:24:41 +0000 (13:24 +0000)
From-SVN: r19032

gcc/ChangeLog
gcc/ChangeLog.12
gcc/regclass.c
gcc/tm.texi

index 58ec0effa89806205479aaf1450f8dfdf7968e3b..9d70161c3a6bd20bbc5878ebbafc3191e0f70abe 100644 (file)
@@ -940,25 +940,6 @@ Mon Mar 16 15:50:20 EST 1998 Andrew MacLeod <amacleod@cygnus.com>
        * config/sparc/sparc.md: Add calls to 'in_same_eh_region' in 4 
        peepholes involving calls and unconditional branches. 
 
-Mon Mar 16 12:12:36 1998  Ken Raeburn  <raeburn@cygnus.com>
-
-       * reload.h (MEMORY_MOVE_COST): Define here if not already defined;
-       if HAVE_SECONDARY_RELOADS, factor in copying cost.
-       (memory_move_secondary_cost): Declare.
-       * regclass.c (MEMORY_MOVE_COST): Don't define default here.
-       (memory_move_secondary_cost) [HAVE_SECONDARY_RELOADS]: New
-       function.
-       (regclass, record_reg_classes, copy_cost, record_address_regs):
-       Pass register class and direction of move to MEMORY_MOVE_COST.
-       * reload1.c (MEMORY_MOVE_COST): Don't define default here.
-       (emit_reload_insns, reload_cse_simplify_set): Pass register class
-       and direction of move to MEMORY_MOVE_COST.
-       * 1750a.c, a29k.h, alpha.h, arc.h, arm.h, dsp16xx.h, i386.h,
-       m32r.h, m88k.h, rs6000.h (MEMORY_MOVE_COST): Add extra ignored
-       arguments to definition, even in comments.
-       * mips.h (MEMORY_MOVE_COST): Add extra arguments; add
-       memory_move_secondary_cost result to cpu-specific cost.
-
 Mon Mar 16 11:16:50 1998  Jim Wilson  <wilson@cygnus.com>
 
        * README.gnat: New file.
@@ -1652,11 +1633,6 @@ Fri Feb 27 11:02:47 1998  Andreas Schwab  <schwab@issan.informatik.uni-dortmund.
        * config/m68k/m68k.md (movsf+1): Optimize moving a CONST_DOUBLE
        zero.
 
-1998-02-26  Ken Raeburn  <raeburn@cygnus.com>
-
-       * regclass.c (init_reg_sets): Move init of move cost tables...
-       (init_reg_sets_1): ...to here.
-
 Thu Feb 26 00:13:21 1998  Ian Lance Taylor  <ian@cygnus.com>
 
        * choose-temp.c: Fix handling of sys/file.h to work in libiberty.
index a7585f71090e0817b7ddc26c69bc70bca317f771..a87955ef19a61dd9a0b9a35f88ca3cbb9d3af612 100644 (file)
@@ -1,3 +1,22 @@
+Thu Apr  2 06:19:25 1998  Ken Raeburn  <raeburn@cygnus.com>
+
+       * reload.h (MEMORY_MOVE_COST): Define here if not already defined.
+       (memory_move_secondary_cost): Declare.
+       * regclass.c (MEMORY_MOVE_COST): Don't define default here.
+       (memory_move_secondary_cost) [HAVE_SECONDARY_RELOADS]: New function.
+       (regclass, record_reg_classes, copy_cost, record_address_regs):
+       Pass register class and direction of move to MEMORY_MOVE_COST.
+       (top_of_stack) [HAVE_SECONDARY_RELOADS]: New static array.
+       (init_regs) [HAVE_SECONDARY_RELOADS]: Initialize it.
+       * reload1.c (MEMORY_MOVE_COST): Don't define default here.
+       (emit_reload_insns, reload_cse_simplify_set): Pass register class
+       and direction of move to MEMORY_MOVE_COST.
+       * 1750a.h (MEMORY_MOVE_COST): Add extra ignored arguments.
+       * a29k.h, alpha.h, arc.h, arm.h, dsp16xx.h, i386.h, m32r.h: Likewise.
+       * m88k.h, rs6000.h: Likewise.
+       * mips.h (MEMORY_MOVE_COST): Likewise.
+       Add memory_move_secondary_cost result to cpu-specific cost.
+
 Mon Mar 30 13:56:30 1998  Jim Wilson  <wilson@cygnus.com>
 
        * mips/ultrix.h (SUBTARGET_CPP_SPEC): Define.
index e964e99a82c03d8e950aafb68e912f2b61bca36a..e4dff7921c8215861e59c8cc1ef01750e1730968 100644 (file)
@@ -183,6 +183,14 @@ static char *in_inc_dec;
 
 #endif /* FORBIDDEN_INC_DEC_CLASSES */
 
+#ifdef HAVE_SECONDARY_RELOADS
+
+/* Sample MEM values for use by memory_move_secondary_cost.  */
+
+static rtx top_of_stack[MAX_MACHINE_MODE];
+
+#endif /* HAVE_SECONDARY_RELOADS */
+
 /* Function called only once to initialize the above data on reg usage.
    Once this is done, various switches may override.  */
 
@@ -422,11 +430,23 @@ init_regs ()
   init_reg_sets_1 ();
 
   init_reg_modes ();
+
+#ifdef HAVE_SECONDARY_RELOADS
+  {
+    /* Make some fake stack-frame MEM references for use in
+       memory_move_secondary_cost.  */
+    int i;
+    for (i = 0; i < MAX_MACHINE_MODE; i++)
+      top_of_stack[i] = gen_rtx (MEM, i, stack_pointer_rtx);
+  }
+#endif
 }
 
 #ifdef HAVE_SECONDARY_RELOADS
+
 /* Compute extra cost of moving registers to/from memory due to reloads.
    Only needed if secondary reloads are required for memory moves.  */
+
 int
 memory_move_secondary_cost (mode, class, in)
      enum machine_mode mode;
@@ -435,23 +455,26 @@ memory_move_secondary_cost (mode, class, in)
 {
   enum reg_class altclass;
   int partial_cost = 0;
-  rtx mem;
-
   /* We need a memory reference to feed to SECONDARY... macros.  */
-  mem = gen_rtx (MEM, mode, stack_pointer_rtx);
+  rtx mem = top_of_stack[(int) mode];
 
   if (in)
+    {
 #ifdef SECONDARY_INPUT_RELOAD_CLASS
-    altclass = SECONDARY_INPUT_RELOAD_CLASS (class, mode, mem);
+      altclass = SECONDARY_INPUT_RELOAD_CLASS (class, mode, mem);
 #else
-    altclass = NO_REGS;
+      altclass = NO_REGS;
 #endif
+    }
   else
+    {
 #ifdef SECONDARY_OUTPUT_RELOAD_CLASS
-    altclass = SECONDARY_OUTPUT_RELOAD_CLASS (class, mode, mem);
+      altclass = SECONDARY_OUTPUT_RELOAD_CLASS (class, mode, mem);
 #else
-    altclass = NO_REGS;
+      altclass = NO_REGS;
 #endif
+    }
+
   if (altclass == NO_REGS)
     return 0;
 
index 9f704032f637ba2a0ff34047b6cdbd5203ce03eb..9b447126f81d58db929b7da3109b4a32feb2e40b 100644 (file)
@@ -4574,22 +4574,25 @@ if the @samp{mov@var{m}} pattern's constraints do not allow such copying.
 @item MEMORY_MOVE_COST (@var{mode}, @var{class}, @var{in})
 A C expression for the cost of moving data of mode @var{mode} between a
 register of class @var{class} and memory; @var{in} is zero if the value
-is to be written to memory, non-zero if it is to be read in.  If this
-macro is not defined, the default cost is assumed to be 4, plus any costs
-that would be incurred copying via a secondary reload register, if
-needed.  This cost is relative to those in @code{REGISTER_MOVE_COST}.
-
-If moving between registers and memory is more expensive than between
-two registers, you should define this macro to express the relative cost.
-
-If a secondary reload register would be required for @var{class}, but the
-reload mechanism is more complex than copying via an intermediate, this
-macro should be defined to reflect the actual cost of the move.
-
-The function @code{memory_move_secondary_cost}, which is defined if
-secondary reloads are needed, will compute the costs due to copying; you
-can use this function if you need to take other factors into account as
-well, or if the default base value of 4 is not correct for your machine.
+is to be written to memory, non-zero if it is to be read in.  This cost
+is relative to those in @code{REGISTER_MOVE_COST}.  If moving between
+registers and memory is more expensive than between two registers, you
+should define this macro to express the relative cost.
+
+If you do not define this macro, GNU CC uses a default cost of 4 plus
+the cost of copying copying via a secondary reload register, if one is
+needed.  If your machine requires a secondary reload register to copy
+between memory and a register of @var{class} but the reload mechanism is
+more complex than copying via an intermediate, define this macro to
+reflect the actual cost of the move.
+
+GNU CC defines the function @code{memory_move_secondary_cost} if
+secondary reloads are needed.  It computes the costs due to copying via
+a secondary register.  If your machine copies from memory using a
+secondary register in the conventional way but the default base value of
+4 is not correct for your machine, define this macro to add some other
+value to the result of that function.  The arguments to that function
+are the same as to this macro.
 
 @findex BRANCH_COST
 @item BRANCH_COST