aboutsummaryrefslogtreecommitdiff
path: root/gcc/rtl.h
diff options
context:
space:
mode:
authorRichard Sandiford <rsandifo@redhat.com>2003-10-18 18:45:16 +0000
committerRichard Sandiford <rsandifo@gcc.gnu.org>2003-10-18 18:45:16 +0000
commite1de1560216d6b5d287db5a0add0247063f36413 (patch)
tree91b7d116f9e6b75c28d6f4aed91f37ed9b955621 /gcc/rtl.h
parent8a2b3848ff373b6333ee44b38133d864b7c0dcfa (diff)
downloadgcc-e1de1560216d6b5d287db5a0add0247063f36413.zip
gcc-e1de1560216d6b5d287db5a0add0247063f36413.tar.gz
gcc-e1de1560216d6b5d287db5a0add0247063f36413.tar.bz2
rtl.h (rtl_size): Declare.
* rtl.h (rtl_size): Declare. (rtunion): Remove rtwint. (rtx_def): Replace 'fld' with a union of an rtunion or a HOST_WIDE_INT. (RTX_HDR_SIZE, RTX_SIZE): New macros. (RTL_CHECK1): Adjust for new rtx_def layout. (RTL_CHECK2, RTL_CHECKC1, RTL_CHECKC2): Likewise. (XWINT, XCWINT): Likewise. Access the rtx structure directly. (X0WINT): Remove. (X0ANY): New macro. * rtl.def: Adjust comments for new rtx_def layout. * ggc.h (ggc_alloc_rtx): Take the rtx code as argument, not the number of slots. * rtl.c (rtx_size): New array. (rtx_alloc): Adjust call to ggc_alloc_rtx. Use RTX_HDR_SIZE. (copy_rtx): Use RTX_HDR_SIZE. Adjust for new rtx_def layout. (shallow_copy_rtx): Adjust call to ggc_alloc_rtx. Use RTX_SIZE. * integrate.c (copy_rtx_and_substitute): Use X0ANY to copy '0' fields. * emit-rtl.c (copy_most_rtx): Likewise. (copy_rtx_if_shared): Use RTX_SIZE. (copy_insn_1): Use RTX_HDR_SIZE. Adjust for new rtx_def layout. * gengenrtl.c (gendef): Adjust ggc_alloc_rtx call. Use RTX_HDR_SIZE. * gengtype.c (write_rtx_next): Use RTX_HDR_SIZE. (adjust_field_rtx_def): Expect "rtx_def" to be a union rather than an array. Adjust output for new rtx_def layout. * ggc-page.c (RTL_SIZE): Use RTX_HDR_SIZE. * reload1.c (eliminate_regs): Use RTX_SIZE. * rtlanal.c (loc_mentioned_in_p): Adjust for new rtx_def layout. * gdbinit.in (pi): Likewise. From-SVN: r72647
Diffstat (limited to 'gcc/rtl.h')
-rw-r--r--gcc/rtl.h58
1 files changed, 43 insertions, 15 deletions
diff --git a/gcc/rtl.h b/gcc/rtl.h
index ddbda98..8967193 100644
--- a/gcc/rtl.h
+++ b/gcc/rtl.h
@@ -64,6 +64,7 @@ extern const char * const rtx_format[NUM_RTX_CODE];
extern const char rtx_class[NUM_RTX_CODE];
#define GET_RTX_CLASS(CODE) (rtx_class[(int) (CODE)])
+extern const unsigned char rtx_size[NUM_RTX_CODE];
extern const unsigned char rtx_next[NUM_RTX_CODE];
/* The flags and bitfields of an ADDR_DIFF_VEC. BASE is the base label
@@ -117,7 +118,6 @@ typedef struct reg_attrs GTY(())
union rtunion_def
{
- HOST_WIDE_INT rtwint;
int rtint;
unsigned int rtuint;
const char *rtstr;
@@ -215,10 +215,18 @@ struct rtx_def GTY((chain_next ("RTX_NEXT (&%h)"),
/* The first element of the operands of this rtx.
The number of operands and their types are controlled
by the `code' field, according to rtl.def. */
- rtunion GTY ((special ("rtx_def"),
- desc ("GET_CODE (&%0)"))) fld[1];
+ union u {
+ rtunion fld[1];
+ HOST_WIDE_INT hwint[1];
+ } GTY ((special ("rtx_def"), desc ("GET_CODE (&%0)"))) u;
};
+/* The size in bytes of an rtx header (code, mode and flags). */
+#define RTX_HDR_SIZE offsetof (struct rtx_def, u)
+
+/* The size in bytes of an rtx with code CODE. */
+#define RTX_SIZE(CODE) rtx_size[CODE]
+
#define NULL_RTX (rtx) 0
/* The "next" and "previous" RTX, relative to this one. */
@@ -303,7 +311,7 @@ struct rtvec_def GTY(()) {
if (GET_RTX_FORMAT(_code)[_n] != C1) \
rtl_check_failed_type1 (_rtx, _n, C1, __FILE__, __LINE__, \
__FUNCTION__); \
- &_rtx->fld[_n]; }))
+ &_rtx->u.fld[_n]; }))
#define RTL_CHECK2(RTX, N, C1, C2) __extension__ \
(*({ rtx const _rtx = (RTX); const int _n = (N); \
@@ -315,14 +323,14 @@ struct rtvec_def GTY(()) {
&& GET_RTX_FORMAT(_code)[_n] != C2) \
rtl_check_failed_type2 (_rtx, _n, C1, C2, __FILE__, __LINE__, \
__FUNCTION__); \
- &_rtx->fld[_n]; }))
+ &_rtx->u.fld[_n]; }))
#define RTL_CHECKC1(RTX, N, C) __extension__ \
(*({ rtx const _rtx = (RTX); const int _n = (N); \
if (GET_CODE (_rtx) != (C)) \
rtl_check_failed_code1 (_rtx, (C), __FILE__, __LINE__, \
__FUNCTION__); \
- &_rtx->fld[_n]; }))
+ &_rtx->u.fld[_n]; }))
#define RTL_CHECKC2(RTX, N, C1, C2) __extension__ \
(*({ rtx const _rtx = (RTX); const int _n = (N); \
@@ -330,7 +338,7 @@ struct rtvec_def GTY(()) {
if (_code != (C1) && _code != (C2)) \
rtl_check_failed_code2 (_rtx, (C1), (C2), __FILE__, __LINE__, \
__FUNCTION__); \
- &_rtx->fld[_n]; }))
+ &_rtx->u.fld[_n]; }))
#define RTVEC_ELT(RTVEC, I) __extension__ \
(*({ rtvec const _rtvec = (RTVEC); const int _i = (I); \
@@ -339,6 +347,24 @@ struct rtvec_def GTY(()) {
__FUNCTION__); \
&_rtvec->elem[_i]; }))
+#define XWINT(RTX, N) __extension__ \
+(*({ rtx const _rtx = (RTX); const int _n = (N); \
+ const enum rtx_code _code = GET_CODE (_rtx); \
+ if (_n < 0 || _n >= GET_RTX_LENGTH (_code)) \
+ rtl_check_failed_bounds (_rtx, _n, __FILE__, __LINE__, \
+ __FUNCTION__); \
+ if (GET_RTX_FORMAT(_code)[_n] != 'w') \
+ rtl_check_failed_type1 (_rtx, _n, 'w', __FILE__, __LINE__, \
+ __FUNCTION__); \
+ &_rtx->u.hwint[_n]; }))
+
+#define XCWINT(RTX, N, C) __extension__ \
+(*({ rtx const _rtx = (RTX); \
+ if (GET_CODE (_rtx) != (C)) \
+ rtl_check_failed_code1 (_rtx, (C), __FILE__, __LINE__, \
+ __FUNCTION__); \
+ &_rtx->u.hwint[N]; }))
+
extern void rtl_check_failed_bounds (rtx, int, const char *, int,
const char *)
ATTRIBUTE_NORETURN;
@@ -360,11 +386,13 @@ extern void rtvec_check_failed_bounds (rtvec, int, const char *, int,
#else /* not ENABLE_RTL_CHECKING */
-#define RTL_CHECK1(RTX, N, C1) ((RTX)->fld[N])
-#define RTL_CHECK2(RTX, N, C1, C2) ((RTX)->fld[N])
-#define RTL_CHECKC1(RTX, N, C) ((RTX)->fld[N])
-#define RTL_CHECKC2(RTX, N, C1, C2) ((RTX)->fld[N])
+#define RTL_CHECK1(RTX, N, C1) ((RTX)->u.fld[N])
+#define RTL_CHECK2(RTX, N, C1, C2) ((RTX)->u.fld[N])
+#define RTL_CHECKC1(RTX, N, C) ((RTX)->u.fld[N])
+#define RTL_CHECKC2(RTX, N, C1, C2) ((RTX)->u.fld[N])
#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])
#endif
@@ -475,7 +503,6 @@ do { \
_rtx->volatil = 0; \
} while (0)
-#define XWINT(RTX, N) (RTL_CHECK1 (RTX, N, 'w').rtwint)
#define XINT(RTX, N) (RTL_CHECK2 (RTX, N, 'i', 'n').rtint)
#define XSTR(RTX, N) (RTL_CHECK2 (RTX, N, 's', 'S').rtstr)
#define XEXP(RTX, N) (RTL_CHECK2 (RTX, N, 'e', 'u').rtx)
@@ -489,10 +516,9 @@ do { \
#define XVECEXP(RTX, N, M) RTVEC_ELT (XVEC (RTX, N), M)
#define XVECLEN(RTX, N) GET_NUM_ELEM (XVEC (RTX, N))
-/* These are like XWINT, etc. except that they expect a '0' field instead
+/* These are like XINT, etc. except that they expect a '0' field instead
of the normal type code. */
-#define X0WINT(RTX, N) (RTL_CHECK1 (RTX, N, '0').rtwint)
#define X0INT(RTX, N) (RTL_CHECK1 (RTX, N, '0').rtint)
#define X0UINT(RTX, N) (RTL_CHECK1 (RTX, N, '0').rtuint)
#define X0STR(RTX, N) (RTL_CHECK1 (RTX, N, '0').rtstr)
@@ -507,7 +533,9 @@ do { \
#define X0MEMATTR(RTX, N) (RTL_CHECKC1 (RTX, N, MEM).rtmem)
#define X0REGATTR(RTX, N) (RTL_CHECKC1 (RTX, N, REG).rtreg)
-#define XCWINT(RTX, N, C) (RTL_CHECKC1 (RTX, N, C).rtwint)
+/* Access a '0' field with any type. */
+#define X0ANY(RTX, N) RTL_CHECK1 (RTX, N, '0')
+
#define XCINT(RTX, N, C) (RTL_CHECKC1 (RTX, N, C).rtint)
#define XCUINT(RTX, N, C) (RTL_CHECKC1 (RTX, N, C).rtuint)
#define XCSTR(RTX, N, C) (RTL_CHECKC1 (RTX, N, C).rtstr)