Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/gnu/dist/toolchain/gcc/config/vax More merging. Move GO_IF_...
details: https://anonhg.NetBSD.org/src/rev/2caef3635cb3
branches: trunk
changeset: 501011:2caef3635cb3
user: matt <matt%NetBSD.org@localhost>
date: Fri Dec 22 06:16:45 2000 +0000
description:
More merging. Move GO_IF_LEGITIMATE_ADDRESS stuff into vax.c from vax.h.
Extend it to properly deal with indirect and indexed addressing modes.
Add preliminary PIC support.
diffstat:
gnu/dist/toolchain/gcc/config/vax/vax.c | 198 ++++++++++++++++++++++++++++++-
gnu/dist/toolchain/gcc/config/vax/vax.h | 163 +++-----------------------
2 files changed, 208 insertions(+), 153 deletions(-)
diffs (truncated from 493 to 300 lines):
diff -r 9c47e85e31b4 -r 2caef3635cb3 gnu/dist/toolchain/gcc/config/vax/vax.c
--- a/gnu/dist/toolchain/gcc/config/vax/vax.c Fri Dec 22 06:04:21 2000 +0000
+++ b/gnu/dist/toolchain/gcc/config/vax/vax.c Fri Dec 22 06:16:45 2000 +0000
@@ -43,8 +43,9 @@
int i;
/* Split operands. */
- low[0] = low[1] = low[2] = 0;
- for (i = 0; i < 3; i++)
+ for (i = 0; i < n; i++)
+ low[i] = 0;
+ for (i = 0; i < n; i++)
{
if (low[i])
/* it's already been figured out */;
@@ -52,7 +53,7 @@
&& (GET_CODE (XEXP (operands[i], 0)) == POST_INC))
{
rtx addr = XEXP (operands[i], 0);
- operands[i] = low[i] = gen_rtx (MEM, SImode, addr);
+ operands[i] = low[i] = gen_rtx_MEM (SImode, addr);
if (which_alternative == 0 && i == 0)
{
addr = XEXP (operands[i], 0);
@@ -249,7 +250,7 @@
}
}
-char *
+const char *
rev_cond_name (op)
rtx op;
{
@@ -286,8 +287,10 @@
register rtx c;
{
register enum machine_mode mode;
+#if HOST_FLOAT_FORMAT == VAX_FLOAT_FORMAT
int i;
union {double d; int i[2];} val;
+#endif
if (GET_CODE (c) != CONST_DOUBLE)
return 0;
@@ -323,7 +326,8 @@
2 - indirect */
-int vax_address_cost(addr)
+int
+vax_address_cost (addr)
register rtx addr;
{
int reg = 0, indexed = 0, indir = 0, offset = 0, predec = 0;
@@ -365,6 +369,8 @@
indir = 2; /* 3 on VAX 2 */
addr = XEXP (addr, 0);
goto restart;
+ default:
+ break;
}
/* Up to 3 things can be added in an address. They are stored in
@@ -402,7 +408,7 @@
enum machine_mode mode = GET_MODE (x);
register int c;
int i = 0; /* may be modified in switch */
- char *fmt = GET_RTX_FORMAT (code); /* may be modified in switch */
+ const char *fmt = GET_RTX_FORMAT (code); /* may be modified in switch */
switch (code)
{
@@ -427,6 +433,8 @@
case QImode:
c = 10; /* 3-4 on VAX 9000, 20-28 on VAX 2 */
break;
+ default:
+ break;
}
break;
case UDIV:
@@ -582,7 +590,7 @@
/* Check a `double' value for validity for a particular machine mode. */
-static char *float_strings[] =
+static const char *const float_strings[] =
{
"1.70141173319264430e+38", /* 2^127 (2^24 - 1) / 2^24 */
"-1.70141173319264430e+38",
@@ -621,7 +629,7 @@
if ((mode) == SFmode)
{
REAL_VALUE_TYPE r;
- bcopy ((char *) d, (char *) &r, sizeof (REAL_VALUE_TYPE));
+ memcpy (&r, d, sizeof (REAL_VALUE_TYPE));
if (REAL_VALUES_LESS (float_values[0], r))
{
bcopy ((char *) &float_values[0], (char *) d,
@@ -651,6 +659,178 @@
return 0;
}
+/* Nonzero if X is a hard reg that can be used as an index. */
+#define XREG_OK_FOR_INDEX_P(X, STRICT) (!(STRICT) || REGNO_OK_FOR_INDEX_P (REGNO (X)))
+/* Nonzero if X is a hard reg that can be used as a base reg. */
+#define XREG_OK_FOR_BASE_P(X, STRICT) (!(STRICT) || REGNO_OK_FOR_BASE_P (REGNO (X)))
+
+#ifdef NO_EXTERNAL_INDIRECT_ADDRESS
+
+/* Re-definition of CONSTANT_ADDRESS_P, which is true only when there
+ are no SYMBOL_REFs for external symbols present and allow valid
+ addressing modes. */
+
+#define INDIRECTABLE_CONSTANT_ADDRESS_P(X, INDEXED, INDIRECT) \
+ (GET_CODE (X) == LABEL_REF \
+ || (!INDEXED && GET_CODE (X) == SYMBOL_REF \
+ && (!INDIRECT || SYMBOL_REF_FLAG (X))) \
+ || (!INDEXED && GET_CODE (X) == CONST \
+ && GET_CODE (XEXP ((X), 0)) == PLUS \
+ && GET_CODE (XEXP (XEXP ((X), 0), 0)) == SYMBOL_REF \
+ && ((!INDIRECT && !(flag_pic)) \
+ || SYMBOL_REF_FLAG (XEXP (XEXP ((X), 0), 0)))) \
+ || GET_CODE (X) == CONST_INT)
+
+/* Non-zero if X is an address which can be indirected. External symbols
+ could be in a sharable image library, so we disallow those. */
+
+#define INDIRECTABLE_ADDRESS_P(X, STRICT, INDEXED, INDIRECT) \
+ (INDIRECTABLE_CONSTANT_ADDRESS_P (X, INDEXED, INDIRECT) \
+ || (GET_CODE (X) == REG && XREG_OK_FOR_BASE_P (X, STRICT)) \
+ || (GET_CODE (X) == PLUS \
+ && GET_CODE (XEXP (X, 0)) == REG \
+ && XREG_OK_FOR_BASE_P (XEXP (X, 0), STRICT) \
+ && GET_CODE (XEXP (X, 1)) != SYMBOL_REF \
+ && !(GET_CODE (XEXP (X, 1)) == CONST \
+ && GET_CODE (XEXP (XEXP (X, 1), 0)) == PLUS \
+ && GET_CODE (XEXP (XEXP (XEXP (X, 1), 0), 0)) == SYMBOL_REF) \
+ && INDIRECTABLE_CONSTANT_ADDRESS_P (XEXP (X, 1), INDEXED, INDIRECT)))
+
+#else /* not NO_EXTERNAL_INDIRECT_ADDRESS */
+
+#define INDIRECTABLE_CONSTANT_ADDRESS_P(X, INDEXED, INDIRECT) \
+ CONSTANT_ADDRESS_P (X)
+
+/* Non-zero if X is an address which can be indirected. */
+#define INDIRECTABLE_ADDRESS_P(X, STRICT, INDEXED, INDIRECT) \
+ (INDIRECTABLE_CONSTANT_ADDRESS_P (X, INDEXED, INDIRECT) \
+ || (GET_CODE (X) == REG && XREG_OK_FOR_BASE_P (X, STRICT)) \
+ || (GET_CODE (X) == PLUS \
+ && GET_CODE (XEXP (X, 0)) == REG \
+ && XREG_OK_FOR_BASE_P (XEXP (X, 0), STRICT) \
+ && CONSTANT_ADDRESS_P (XEXP (X, 1))))
+
+#endif /* not NO_EXTERNAL_INDIRECT_ADDRESS */
+
+/* Go to ADDR if X is a valid address not using indexing.
+ (This much is the easy part.) */
+#define GO_IF_NONINDEXED_ADDRESS(X, ADDR, STRICT, INDEXED) \
+{ register rtx xfoob = (X); \
+ if (GET_CODE (X) == REG) \
+ { \
+ extern rtx *reg_equiv_mem; \
+ if (! reload_in_progress \
+ || (xfoob = reg_equiv_mem[REGNO (X)]) == 0 \
+ || INDIRECTABLE_ADDRESS_P (xfoob, STRICT, INDEXED, 0)) \
+ goto ADDR; \
+ } \
+ if (INDIRECTABLE_CONSTANT_ADDRESS_P (X, INDEXED, 0)) goto ADDR; \
+ if (INDIRECTABLE_ADDRESS_P (X, STRICT, INDEXED, 0)) goto ADDR; \
+ xfoob = XEXP (X, 0); \
+ if (GET_CODE (X) == MEM \
+ && INDIRECTABLE_ADDRESS_P (xfoob, STRICT, INDEXED, \
+ (flag_pic))) \
+ goto ADDR; \
+ if ((GET_CODE (X) == PRE_DEC || GET_CODE (X) == POST_INC) \
+ && GET_CODE (xfoob) == REG \
+ && XREG_OK_FOR_BASE_P (xfoob, STRICT)) \
+ goto ADDR; }
+
+/* 1 if PROD is either a reg times size of mode MODE
+ or just a reg, if MODE is just one byte.
+ This macro's expansion uses the temporary variables xfoo0 and xfoo1
+ that must be declared in the surrounding context. */
+#define INDEX_TERM_P(PROD, MODE, STRICT) \
+(GET_MODE_SIZE (MODE) == 1 \
+ ? (GET_CODE (PROD) == REG && XREG_OK_FOR_BASE_P (PROD, STRICT)) \
+ : (GET_CODE (PROD) == MULT \
+ && \
+ (xfoo0 = XEXP (PROD, 0), xfoo1 = XEXP (PROD, 1), \
+ ((GET_CODE (xfoo0) == CONST_INT \
+ && GET_CODE (xfoo1) == REG \
+ && INTVAL (xfoo0) == (int)GET_MODE_SIZE (MODE) \
+ && XREG_OK_FOR_INDEX_P (xfoo1, STRICT)) \
+ || \
+ (GET_CODE (xfoo1) == CONST_INT \
+ && GET_CODE (xfoo0) == REG \
+ && INTVAL (xfoo1) == (int)GET_MODE_SIZE (MODE) \
+ && XREG_OK_FOR_INDEX_P (xfoo0, STRICT))))))
+
+/* Go to ADDR if X is the sum of a register
+ and a valid index term for mode MODE. */
+#define GO_IF_REG_PLUS_INDEX(X, MODE, ADDR, STRICT) \
+{ register rtx xfooa; \
+ if (GET_CODE (X) == PLUS) \
+ { if (GET_CODE (XEXP (X, 0)) == REG \
+ && XREG_OK_FOR_BASE_P (XEXP (X, 0), STRICT) \
+ && (xfooa = XEXP (X, 1), \
+ INDEX_TERM_P (xfooa, MODE, STRICT))) \
+ goto ADDR; \
+ if (GET_CODE (XEXP (X, 1)) == REG \
+ && XREG_OK_FOR_BASE_P (XEXP (X, 1), STRICT) \
+ && (xfooa = XEXP (X, 0), \
+ INDEX_TERM_P (xfooa, MODE, STRICT))) \
+ goto ADDR; } }
+
+int
+legitimate_pic_operand_p(x, strict)
+ register rtx x;
+ int strict ATTRIBUTE_UNUSED;
+{
+ if (GET_CODE (x) != SYMBOL_REF
+ && !(GET_CODE (x) == CONST
+ && GET_CODE (XEXP (x, 0)) == PLUS
+ && GET_CODE (XEXP (XEXP (x, 0), 0)) == SYMBOL_REF))
+ {
+ return 1;
+ }
+ return 0;
+}
+
+int
+legitimate_address_p(mode, xbar, strict)
+ enum machine_mode mode;
+ register rtx xbar;
+ int strict;
+{
+ register rtx xfoo, xfoo0, xfoo1;
+ GO_IF_NONINDEXED_ADDRESS (xbar, win, strict, 0);
+ if (GET_CODE (xbar) == PLUS)
+ {
+ /* Handle <address>[index] represented with index-sum outermost */
+ xfoo = XEXP (xbar, 0);
+ if (INDEX_TERM_P (xfoo, mode, strict))
+ {
+ GO_IF_NONINDEXED_ADDRESS (XEXP (xbar, 1), win, strict, 1);
+ }
+ xfoo = XEXP (xbar, 1);
+ if (INDEX_TERM_P (xfoo, mode, strict))
+ {
+ GO_IF_NONINDEXED_ADDRESS (XEXP (xbar, 0), win, strict, 1);
+ }
+ /* Handle offset(reg)[index] with offset added outermost */
+ if (INDIRECTABLE_CONSTANT_ADDRESS_P (XEXP (xbar, 0), 1, 0))
+ {
+ if (GET_CODE (XEXP (xbar, 1)) == REG
+ && XREG_OK_FOR_BASE_P (XEXP (xbar, 1), strict))
+ goto win;
+ GO_IF_REG_PLUS_INDEX (XEXP (xbar, 1), mode, win, strict);
+ }
+ if (INDIRECTABLE_CONSTANT_ADDRESS_P (XEXP (xbar, 1), 1, 0))
+ {
+ if (GET_CODE (XEXP (xbar, 0)) == REG
+ && XREG_OK_FOR_BASE_P (XEXP (xbar, 0), strict))
+ goto win;
+ GO_IF_REG_PLUS_INDEX (XEXP (xbar, 0), mode, win, strict);
+ }
+ }
+ }
+ return 0;
+
+ win:
+ return 1;
+}
+
#ifdef VMS_TARGET
/* Additional support code for VMS target. */
@@ -661,7 +841,7 @@
static
struct extern_list {
struct extern_list *next; /* next external */
- char *name; /* name of the external */
+ const char *name; /* name of the external */
int size; /* external's actual size */
int in_const; /* section type flag */
} *extern_head = 0, *pending_head = 0;
diff -r 9c47e85e31b4 -r 2caef3635cb3 gnu/dist/toolchain/gcc/config/vax/vax.h
--- a/gnu/dist/toolchain/gcc/config/vax/vax.h Fri Dec 22 06:04:21 2000 +0000
+++ b/gnu/dist/toolchain/gcc/config/vax/vax.h Fri Dec 22 06:16:45 2000 +0000
@@ -69,14 +69,14 @@
An empty string NAME is used to identify the default VALUE. */
#define TARGET_SWITCHES \
- { {"unix", MASK_UNIX_ASM}, \
- {"gnu", -MASK_UNIX_ASM}, \
- {"vaxc-alignment", MASK_VAXC_ALIGNMENT}, \
- {"g", MASK_G_FLOAT}, \
- {"g-float", MASK_G_FLOAT}, \
- {"d", -MASK_G_FLOAT}, \
Home |
Main Index |
Thread Index |
Old Index