summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorraeburn <raeburn@138bc75d-0d04-0410-961f-82ee72b054a4>1998-04-07 13:24:41 +0000
committerraeburn <raeburn@138bc75d-0d04-0410-961f-82ee72b054a4>1998-04-07 13:24:41 +0000
commit4c6850154f71dfe2196adf04daa6193d52b7197f (patch)
treebf79d75abdc3cd25b8178e72cb02346c7d041e99
parent1f38cbd3d8fb3beaec2ded87d4d040d5b554ca4e (diff)
downloadgcc-4c6850154f71dfe2196adf04daa6193d52b7197f.tar.gz
Sync up MEMORY_MOVE_COST changes with FSF.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@19032 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r--gcc/ChangeLog24
-rw-r--r--gcc/ChangeLog.1219
-rw-r--r--gcc/regclass.c37
-rw-r--r--gcc/tm.texi35
4 files changed, 68 insertions, 47 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 58ec0effa89..9d70161c3a6 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -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.
diff --git a/gcc/ChangeLog.12 b/gcc/ChangeLog.12
index a7585f71090..a87955ef19a 100644
--- a/gcc/ChangeLog.12
+++ b/gcc/ChangeLog.12
@@ -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.
diff --git a/gcc/regclass.c b/gcc/regclass.c
index e964e99a82c..e4dff7921c8 100644
--- a/gcc/regclass.c
+++ b/gcc/regclass.c
@@ -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;
diff --git a/gcc/tm.texi b/gcc/tm.texi
index 9f704032f63..9b447126f81 100644
--- a/gcc/tm.texi
+++ b/gcc/tm.texi
@@ -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