aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorRichard Kenner <kenner@gcc.gnu.org>1993-03-11 19:02:37 -0500
committerRichard Kenner <kenner@gcc.gnu.org>1993-03-11 19:02:37 -0500
commitac07e0665d5044978a404837c22bfbf4adbe7ffa (patch)
tree4ef9a2b59072639d19ba94b25d59d086f4c19dee /gcc
parent9f67be131826be3d9058424fc3c93d3929e4cdde (diff)
downloadgcc-ac07e0665d5044978a404837c22bfbf4adbe7ffa.zip
gcc-ac07e0665d5044978a404837c22bfbf4adbe7ffa.tar.gz
gcc-ac07e0665d5044978a404837c22bfbf4adbe7ffa.tar.bz2
(CHEAP_REG): New macro; makes virtual regs cheap too.
(COST): Use CHEAP_REG. (rtx_cost, case REG): Use CHEAP_REG to return zero for some REGs. From-SVN: r3708
Diffstat (limited to 'gcc')
-rw-r--r--gcc/cse.c20
1 files changed, 13 insertions, 7 deletions
diff --git a/gcc/cse.c b/gcc/cse.c
index 979df3f..948160e 100644
--- a/gcc/cse.c
+++ b/gcc/cse.c
@@ -446,15 +446,20 @@ struct table_elt
#endif
/* Compute cost of X, as stored in the `cost' field of a table_elt. Fixed
- hard registers are the cheapest with a cost of 0. Next come pseudos
- with a cost of one and other hard registers with a cost of 2. Aside
- from these special cases, call `rtx_cost'. */
+ hard registers and pointers into the frame are the cheapest with a cost
+ of 0. Next come pseudos with a cost of one and other hard registers with
+ a cost of 2. Aside from these special cases, call `rtx_cost'. */
+
+#define CHEAP_REG(N) \
+ ((N) == FRAME_POINTER_REGNUM || (N) == STACK_POINTER_REGNUM \
+ || (N) == ARG_POINTER_REGNUM \
+ || (N) >= FIRST_VIRTUAL_REGISTER && (N) <= LAST_VIRTUAL_REGISTER \
+ || (FIXED_REGNO_P (N) && REGNO_REG_CLASS (N) != NO_REGS))
#define COST(X) \
(GET_CODE (X) == REG \
- ? (REGNO (X) >= FIRST_PSEUDO_REGISTER ? 1 \
- : (FIXED_REGNO_P (REGNO (X)) \
- && REGNO_REG_CLASS (REGNO (X)) != NO_REGS) ? 0 \
+ ? (CHEAP_REG (REGNO (X)) ? 0 \
+ : REGNO (X) >= FIRST_PSEUDO_REGISTER ? 1 \
: 2) \
: rtx_cost (X, SET) * 2)
@@ -697,7 +702,8 @@ rtx_cost (x, outer_code)
switch (code)
{
case REG:
- return 1;
+ return ! CHEAP_REG (REGNO (x));
+
case SUBREG:
/* If we can't tie these modes, make this expensive. The larger
the mode, the more expensive it is. */