summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gcc/ChangeLog14
-rw-r--r--gcc/Makefile.in2
-rw-r--r--gcc/emit-rtl.c2
-rw-r--r--gcc/real.h2
-rw-r--r--gcc/rtl.c15
-rw-r--r--gcc/rtl.h29
6 files changed, 58 insertions, 6 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index afd4b12cb90..cbc564b5388 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,17 @@
+2005-08-01 Ian Lance Taylor <ian@airs.com>
+ Richard Henderson <rth@redhat.com>
+
+ * Makefile.in (RTL_BASE_H): Add real.h.
+ * real.h (REAL_VALUE_FROM_CONST_DOUBLE): Use structure copy
+ instead of memcpy.
+ * emit-rtl.c (const_double_from_real_value): Likewise; use rtx.u.rv
+ directly.
+ * rtl.c (rtl_check_failed_code_mode): New.
+ * rtl.h (struct rtx_def): Add u.rv.
+ (XCMWINT, XCNMPRV): New.
+ (CONST_DOUBLE_LOW, CONST_DOUBLE_HIGH): Use XCMWINT.
+ (CONST_DOUBLE_REAL_VALUE): Use XCNMPRV; constify.
+
2005-08-01 Richard Henderson <rth@redhat.com>
* dwarf2out.c (mem_loc_descriptor): Use XEXP, not SUBREG_REG,
diff --git a/gcc/Makefile.in b/gcc/Makefile.in
index c8023300cb3..ab3a1640b98 100644
--- a/gcc/Makefile.in
+++ b/gcc/Makefile.in
@@ -716,7 +716,7 @@ HOSTHOOKS_DEF_H = hosthooks-def.h $(HOOKS_H)
LANGHOOKS_DEF_H = langhooks-def.h $(HOOKS_H)
TARGET_DEF_H = target-def.h $(HOOKS_H)
RTL_BASE_H = rtl.h rtl.def $(MACHMODE_H) reg-notes.def insn-notes.def \
- input.h statistics.h
+ input.h real.h statistics.h
RTL_H = $(RTL_BASE_H) genrtl.h
PARAMS_H = params.h params.def
TREE_H = tree.h tree.def $(MACHMODE_H) tree-check.h builtins.def \
diff --git a/gcc/emit-rtl.c b/gcc/emit-rtl.c
index ba3ae57dcba..01a224f3b32 100644
--- a/gcc/emit-rtl.c
+++ b/gcc/emit-rtl.c
@@ -426,7 +426,7 @@ const_double_from_real_value (REAL_VALUE_TYPE value, enum machine_mode mode)
rtx real = rtx_alloc (CONST_DOUBLE);
PUT_MODE (real, mode);
- memcpy (&CONST_DOUBLE_LOW (real), &value, sizeof (REAL_VALUE_TYPE));
+ real->u.rv = value;
return lookup_const_double (real);
}
diff --git a/gcc/real.h b/gcc/real.h
index 95380930b65..23605639db9 100644
--- a/gcc/real.h
+++ b/gcc/real.h
@@ -364,7 +364,7 @@ REAL_VALUE_TYPE real_value_from_int_cst (tree, tree);
/* Given a CONST_DOUBLE in FROM, store into TO the value it represents. */
#define REAL_VALUE_FROM_CONST_DOUBLE(to, from) \
- memcpy (&(to), &CONST_DOUBLE_LOW ((from)), sizeof (REAL_VALUE_TYPE))
+ ((to) = *CONST_DOUBLE_REAL_VALUE (from))
/* Return a CONST_DOUBLE with value R and mode M. */
#define CONST_DOUBLE_FROM_REAL_VALUE(r, m) \
diff --git a/gcc/rtl.c b/gcc/rtl.c
index 08b463b428b..eee870cb0d2 100644
--- a/gcc/rtl.c
+++ b/gcc/rtl.c
@@ -515,6 +515,21 @@ rtl_check_failed_code2 (rtx r, enum rtx_code code1, enum rtx_code code2,
func, trim_filename (file), line);
}
+void
+rtl_check_failed_code_mode (rtx r, enum rtx_code code, enum machine_mode mode,
+ bool not_mode, const char *file, int line,
+ const char *func)
+{
+ internal_error ((not_mode
+ ? ("RTL check: expected code '%s' and not mode '%s', "
+ "have code '%s' and mode '%s' in %s, at %s:%d")
+ : ("RTL check: expected code '%s' and mode '%s', "
+ "have code '%s' and mode '%s' in %s, at %s:%d")),
+ GET_RTX_NAME (code), GET_MODE_NAME (mode),
+ GET_RTX_NAME (GET_CODE (r)), GET_MODE_NAME (GET_MODE (r)),
+ func, trim_filename (file), line);
+}
+
/* XXX Maybe print the vector? */
void
rtvec_check_failed_bounds (rtvec r, int n, const char *file, int line,
diff --git a/gcc/rtl.h b/gcc/rtl.h
index da43bf8ca84..3b47e24d509 100644
--- a/gcc/rtl.h
+++ b/gcc/rtl.h
@@ -25,6 +25,7 @@ Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA
#include "statistics.h"
#include "machmode.h"
#include "input.h"
+#include "real.h"
#undef FFS /* Some systems predefine this symbol; don't let it interfere. */
#undef FLOAT /* Likewise. */
@@ -249,6 +250,7 @@ struct rtx_def GTY((chain_next ("RTX_NEXT (&%h)"),
union u {
rtunion fld[1];
HOST_WIDE_INT hwint[1];
+ struct real_value rv;
} GTY ((special ("rtx_def"), desc ("GET_CODE (&%0)"))) u;
};
@@ -454,6 +456,20 @@ struct rtvec_def GTY(()) {
__FUNCTION__); \
&_rtx->u.hwint[N]; }))
+#define XCMWINT(RTX, N, C, M) __extension__ \
+(*({ rtx const _rtx = (RTX); \
+ if (GET_CODE (_rtx) != (C) || GET_MODE (_rtx) != (M)) \
+ rtl_check_failed_code_mode (_rtx, (C), (M), false, __FILE__, \
+ __LINE__, __FUNCTION__); \
+ &_rtx->u.hwint[N]; }))
+
+#define XCNMPRV(RTX, C, M) __extension__ \
+({ rtx const _rtx = (RTX); \
+ if (GET_CODE (_rtx) != (C) || GET_MODE (_rtx) == (M)) \
+ rtl_check_failed_code_mode (_rtx, (C), (M), true, __FILE__, \
+ __LINE__, __FUNCTION__); \
+ &_rtx->u.rv; })
+
extern void rtl_check_failed_bounds (rtx, int, const char *, int,
const char *)
ATTRIBUTE_NORETURN;
@@ -469,6 +485,9 @@ extern void rtl_check_failed_code1 (rtx, enum rtx_code, const char *,
extern void rtl_check_failed_code2 (rtx, enum rtx_code, enum rtx_code,
const char *, int, const char *)
ATTRIBUTE_NORETURN;
+extern void rtl_check_failed_code_mode (rtx, enum rtx_code, enum machine_mode,
+ bool, const char *, int, const char *)
+ ATTRIBUTE_NORETURN;
extern void rtvec_check_failed_bounds (rtvec, int, const char *, int,
const char *)
ATTRIBUTE_NORETURN;
@@ -482,6 +501,9 @@ extern void rtvec_check_failed_bounds (rtvec, int, const char *, int,
#define RTVEC_ELT(RTVEC, I) ((RTVEC)->elem[I])
#define XWINT(RTX, N) ((RTX)->u.hwint[N])
#define XCWINT(RTX, N, C) ((RTX)->u.hwint[N])
+#define XCMWINT(RTX, N, C, M) ((RTX)->u.hwint[N])
+#define XCNMWINT(RTX, N, C, M) ((RTX)->u.hwint[N])
+#define XCNMPRV(RTX, C, M) (&(RTX)->u.rv)
#endif
@@ -916,9 +938,10 @@ enum label_kind
low-order word and ..._HIGH the high-order.
For a float, there is a REAL_VALUE_TYPE structure, and
CONST_DOUBLE_REAL_VALUE(r) is a pointer to it. */
-#define CONST_DOUBLE_LOW(r) XCWINT (r, 0, CONST_DOUBLE)
-#define CONST_DOUBLE_HIGH(r) XCWINT (r, 1, CONST_DOUBLE)
-#define CONST_DOUBLE_REAL_VALUE(r) ((struct real_value *)&CONST_DOUBLE_LOW(r))
+#define CONST_DOUBLE_LOW(r) XCMWINT (r, 0, CONST_DOUBLE, VOIDmode)
+#define CONST_DOUBLE_HIGH(r) XCMWINT (r, 1, CONST_DOUBLE, VOIDmode)
+#define CONST_DOUBLE_REAL_VALUE(r) \
+ ((const struct real_value *) XCNMPRV (r, CONST_DOUBLE, VOIDmode))
/* For a CONST_VECTOR, return element #n. */
#define CONST_VECTOR_ELT(RTX, N) XCVECEXP (RTX, 0, N, CONST_VECTOR)