This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] checking version of rtl flag access macros


This patch provides a checking version of the macros that access RTL
flags to ensure that each macro is only used with expected rtx codes.
It updates the comments for the flags and the macros in rtl.h to more
accurately document how the flags are used It changes the order of some
instructions in reload1.c to avoid using a macro with the wrong rtx
code and adds a check before using a macro in ia64.c.  The internal
documentation section "Flags in an RTL expression" is updated in a
separate patch.

The patch does not provide a mechanism to turn on this checking; I'd
like some advice about the best way to do that.  Currently, the checking
is enabled when a new macro, ENABLE_RTL_FLAG_CHECKING, is defined.  For
my testing I added a #define line in rtl.h to turn it on.  If this
should remain a separate checking flag then I'll submit a patch to
modify config.in, configure.in, and configure to set it.  Should it be
separate, or should this be included as part of ENABLE_RTL_CHECKING or
some other checking flag?  The flag checking doesn't add a noticeable
amount of time to a mainline bootstrap and test run.

Some of the flag usage looks dubious to me, and I plan to occasionally
try patches to clear flags when an rtx is changed to a new code or to
check the code before setting some flags.  That will be easier after
these checking macros are committed.  Looking for a particular usage is
easy; just remove the code from the macro and see what fails.

Tested by bootstrap with ENABLE_RTL_FLAG_CHECKING defined, plus
regression testing, on ia64-unknown-gnu, and bootstrap without and
without ENABLE_RTL_FLAG_CHECKING defined on i686-pc-linux-gnu.

OK for the mainline?

2002-05-06  Janis Johnson  <janis187@us.ibm.com>

	* rtl.h (struct rtx_def): Update comments.
	(RTL_FLAG_CHECK[12345678]): New.  (rtl_check_failed_flag): Declare.
	(RTL_FLAG): New.  (CLEAR_RTX_FLAGS): New.  (flag access macros): Use
	RTL_FLAG_CHECK macros with list of expected RTL codes.
	* rtl.c (copy_rtx, shallow_copy_rtx): Use RTX_FLAG macro.
	(rtl_check_failed_flag): New.
	* reload1.c (reload): Use REG macro before changing rtx to MEM.
	(reload_cse_noop_set_p): Check rtx code before using access macro.
	* config/ia64/ia64.c (process_for_unwind_directive): Check rtx code
	before using access macro.

Index: rtl.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/rtl.h,v
retrieving revision 1.340
diff -u -p -r1.340 rtl.h
--- rtl.h	29 Apr 2002 22:34:33 -0000	1.340
+++ rtl.h	6 May 2002 18:03:59 -0000
@@ -127,31 +127,30 @@ struct rtx_def
   /* The kind of value the expression has.  */
   ENUM_BITFIELD(machine_mode) mode : 8;
 
-  /* 1 in an INSN if it can alter flow of control
-     within this function.
-     MEM_KEEP_ALIAS_SET_P in a MEM.
-     SET_IS_RETURN_P in a SET.  */
+  /* 1 in a MEM if we should keep the alias set for this mem unchanged
+     when we access a component.
+     1 in a CALL_INSN if it is a sibling call.
+     1 in a SET that is for a return.  */
   unsigned int jump : 1;
-  /* 1 in an INSN if it can call another function.  */
+  /* This flag is currently unused.  */
   unsigned int call : 1;
-  /* 1 in a REG if value of this expression will never change during
-     the current function, even though it is not manifestly constant.
-     1 in a MEM if contents of memory are constant.  This does not
-     necessarily mean that the value of this expression is constant.
-     1 in a SUBREG if it is from a promoted variable that is unsigned.
+  /* 1 in a REG, MEM, or CONCAT if the value is set at most once, anywhere.
+     1 in a SUBREG if it references an unsigned object whose mode has been
+     from a promoted to a wider mode.
      1 in a SYMBOL_REF if it addresses something in the per-function
      constants pool.
-     1 in a CALL_INSN if it is a const call.
-     1 in a JUMP_INSN if it is a branch that should be annulled.  Valid from
-     reorg until end of compilation; cleared before used.  */
+     1 in a CALL_INSN, NOTE, or EXPR_LIST for a const or pure call.
+     1 in an INSN in the delay slot of a branch insn if an annulling branch
+     should be used.  */
   unsigned int unchanging : 1;
-  /* 1 in a MEM expression if contents of memory are volatile.
-     1 in an INSN, CALL_INSN, JUMP_INSN, CODE_LABEL or BARRIER
-     if it is deleted.
-     1 in a REG expression if corresponds to a variable declared by the user.
+  /* 1 in a MEM or ASM_OPERANDS expression if the memory reference is volatile.
+     1 in an INSN, CALL_INSN, JUMP_INSN, CODE_LABEL, BARRIER, or NOTE
+     if it has been deleted.
+     1 in a REG expression if corresponds to a variable declared by the user,
      0 for an internally generated temporary.
-     In a SYMBOL_REF, this flag is used for machine-specific purposes.
-     In a LABEL_REF or in a REG_LABEL note, this is LABEL_REF_NONLOCAL_P.  */
+     1 in a SUBREG with a negative value.
+     1 in a LABEL_REF or in a REG_LABEL note for a non-local label.
+     In a SYMBOL_REF, this flag is used for machine-specific purposes.  */
   unsigned int volatil : 1;
   /* 1 in a MEM referring to a field of an aggregate.
      0 if the MEM was a variable or the result of a * operator in C;
@@ -163,23 +162,25 @@ struct rtx_def
      and must not be deleted even if its count is zero.
      1 in a LABEL_REF if this is a reference to a label outside the
      current loop.
-     1 in an INSN, JUMP_INSN, or CALL_INSN if this insn must be scheduled
-     together with the preceding insn.  Valid only within sched.
+     1 in an INSN, JUMP_INSN, CALL_INSN, CODE_LABEL, BARRIER, or NOTE if
+     this insn must be scheduled together with the preceding insn.  Valid
+     only within sched.
      1 in an INSN, JUMP_INSN, or CALL_INSN if insn is in a delay slot and
      from the target of a branch.  Valid from reorg until end of compilation;
      cleared before used.
-     1 in an INSN if this insn is dead code.  Valid only during
+     1 in an INSN in a delay slot that is the target of a branch, during reorg.
+     1 in an INSN or related rtx if this insn is dead code.  Valid only during
      dead-code elimination phase; cleared before use.  */
   unsigned int in_struct : 1;
-  /* 1 if this rtx is used.  This is used for copying shared structure.
-     See `unshare_all_rtl'.
+  /* At the end of RTL generation, 1 if this rtx is used.  This is used for
+     copying shared structure.  See `unshare_all_rtl'.
      In a REG, this is not needed for that purpose, and used instead
      in `leaf_renumber_regs_insn'.
-     In a SYMBOL_REF, means that emit_library_call
+     1 in a SYMBOL_REF, means that emit_library_call
      has used it as the function.  */
   unsigned int used : 1;
   /* Nonzero if this rtx came from procedure integration.
-     In a REG, nonzero means this reg refers to the return value
+     1 in a REG means this reg refers to the return value
      of the current function.
      1 in a SYMBOL_REF if the symbol is weak.  */
   unsigned integrated : 1;
@@ -209,11 +210,6 @@ struct rtx_def
 #define GET_MODE(RTX)	    ((enum machine_mode) (RTX)->mode)
 #define PUT_MODE(RTX, MODE) ((RTX)->mode = (ENUM_BITFIELD(machine_mode)) (MODE))
 
-#define RTX_FLAG(RTX,FLAG) ((RTX)->FLAG)
-#define RTX_INTEGRATED_P(RTX) ((RTX)->integrated)
-#define RTX_UNCHANGING_P(RTX) ((RTX)->unchanging)
-#define RTX_FRAME_RELATED_P(RTX) ((RTX)->frame_related)
-
 /* RTL vector.  These appear inside RTX's when there is a need
    for a variable number of things.  The principle use is inside
    PARALLEL expressions.  */
@@ -336,6 +332,103 @@ extern void rtvec_check_failed_bounds PA
 
 #endif
 
+/* General accessor macros for accessing the flags of an rtx.  */
+
+/* Access an individual rtx flag, with no checking of any kind.  */
+#define RTX_FLAG(RTX, FLAG)	((RTX)->FLAG)
+
+#if defined ENABLE_RTL_FLAG_CHECKING
+#define RTL_FLAG_CHECK1(RTX, C1) __extension__			\
+({ rtx const _rtx = (RTX);						\
+   if (GET_CODE(_rtx) != C1)						\
+     rtl_check_failed_flag  (_rtx, __FILE__, __LINE__, __FUNCTION__);	\
+   _rtx; })
+
+#define RTL_FLAG_CHECK2(RTX, C1, C2) __extension__		\
+({ rtx const _rtx = (RTX);						\
+   if (GET_CODE(_rtx) != C1 && GET_CODE(_rtx) != C2)			\
+     rtl_check_failed_flag  (_rtx, __FILE__, __LINE__, __FUNCTION__);	\
+   _rtx; })
+
+#define RTL_FLAG_CHECK3(RTX, C1, C2, C3) __extension__		\
+({ rtx const _rtx = (RTX);						\
+   if (GET_CODE(_rtx) != C1 && GET_CODE(_rtx) != C2 			\
+       && GET_CODE(_rtx) != C3)						\
+     rtl_check_failed_flag  (_rtx, __FILE__, __LINE__, __FUNCTION__);	\
+   _rtx; })
+
+#define RTL_FLAG_CHECK4(RTX, C1, C2, C3, C4) __extension__	\
+({ rtx const _rtx = (RTX);						\
+   if (GET_CODE(_rtx) != C1 && GET_CODE(_rtx) != C2	 		\
+       && GET_CODE(_rtx) != C3 && GET_CODE(_rtx) != C4)			\
+     rtl_check_failed_flag  (_rtx, __FILE__, __LINE__, __FUNCTION__);	\
+   _rtx; })
+
+#define RTL_FLAG_CHECK5(RTX, C1, C2, C3, C4, C5) __extension__	\
+({ rtx const _rtx = (RTX);						\
+   if (GET_CODE(_rtx) != C1 && GET_CODE(_rtx) != C2	 		\
+       && GET_CODE(_rtx) != C3 && GET_CODE(_rtx) != C4			\
+       && GET_CODE(_rtx) != C5)						\
+     rtl_check_failed_flag  (_rtx, __FILE__, __LINE__, __FUNCTION__);	\
+   _rtx; })
+
+#define RTL_FLAG_CHECK6(RTX, C1, C2, C3, C4, C5, C6) __extension__	\
+({ rtx const _rtx = (RTX);						\
+   if (GET_CODE(_rtx) != C1 && GET_CODE(_rtx) != C2	 		\
+       && GET_CODE(_rtx) != C3 && GET_CODE(_rtx) != C4			\
+       && GET_CODE(_rtx) != C5 && GET_CODE(_rtx) != C6)			\
+     rtl_check_failed_flag  (_rtx, __FILE__, __LINE__, __FUNCTION__);	\
+   _rtx; })
+
+#define RTL_FLAG_CHECK7(RTX, C1, C2, C3, C4, C5, C6, C7) __extension__	\
+({ rtx const _rtx = (RTX);						\
+   if (GET_CODE(_rtx) != C1 && GET_CODE(_rtx) != C2	 		\
+       && GET_CODE(_rtx) != C3 && GET_CODE(_rtx) != C4			\
+       && GET_CODE(_rtx) != C5 && GET_CODE(_rtx) != C6			\
+       && GET_CODE(_rtx) != C7)						\
+     rtl_check_failed_flag  (_rtx, __FILE__, __LINE__, __FUNCTION__);	\
+   _rtx; })
+
+#define RTL_FLAG_CHECK8(RTX, C1, C2, C3, C4, C5, C6, C7, C8) __extension__ \
+({ rtx const _rtx = (RTX);						\
+   if (GET_CODE(_rtx) != C1 && GET_CODE(_rtx) != C2	 		\
+       && GET_CODE(_rtx) != C3 && GET_CODE(_rtx) != C4			\
+       && GET_CODE(_rtx) != C5 && GET_CODE(_rtx) != C6			\
+       && GET_CODE(_rtx) != C7 && GET_CODE(_rtx) != C8)			\
+     rtl_check_failed_flag  (_rtx, __FILE__, __LINE__, __FUNCTION__);	\
+   _rtx; })
+
+extern void rtl_check_failed_flag PARAMS ((rtx, const char *, int,
+      					 const char *))
+    ATTRIBUTE_NORETURN
+    ;
+
+#else	/* not ENABLE_RTL_FLAG_CHECKING */
+
+#define RTL_FLAG_CHECK1(RTX, C1)			(RTX)
+#define RTL_FLAG_CHECK2(RTX, C1, C2)			(RTX)
+#define RTL_FLAG_CHECK3(RTX, C1, C2, C3)		(RTX)
+#define RTL_FLAG_CHECK4(RTX, C1, C2, C3, C4)		(RTX)
+#define RTL_FLAG_CHECK5(RTX, C1, C2, C3, C4, C5)  	(RTX)
+#define RTL_FLAG_CHECK6(RTX, C1, C2, C3, C4, C5, C6)	(RTX)
+#define RTL_FLAG_CHECK7(RTX, C1, C2, C3, C4, C5, C6, C7) (RTX)
+#define RTL_FLAG_CHECK8(RTX, C1, C2, C3, C4, C5, C6, C7, C8) (RTX)
+#endif
+
+#define CLEAR_RTX_FLAGS(RTX)	\
+do {				\
+  rtx const _rtx = (RTX);	\
+  _rtx->call = 0;		\
+  _rtx->frame_related = 0;	\
+  _rtx->in_struct = 0;		\
+  _rtx->integrated = 0;		\
+  _rtx->jump = 0;		\
+  _rtx->unchanging = 0;		\
+  _rtx->used = 0;		\
+  _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)
@@ -412,27 +505,39 @@ extern void rtvec_check_failed_bounds PA
    They are always in the same basic block as this insn.  */
 #define LOG_LINKS(INSN)	XEXP(INSN, 5)
 
+#define RTX_INTEGRATED_P(RTX)	\
+  (RTL_FLAG_CHECK8((RTX), INSN, CALL_INSN, JUMP_INSN, INSN_LIST,	\
+		   BARRIER, CODE_LABEL, CONST, NOTE)->integrated)
+#define RTX_UNCHANGING_P(RTX)		\
+  (RTL_FLAG_CHECK3((RTX), REG, MEM, CONCAT)->unchanging)
+#define RTX_FRAME_RELATED_P(RTX)	\
+  (RTL_FLAG_CHECK5((RTX), INSN, CALL_INSN, JUMP_INSN, BARRIER,	\
+		   SET)->frame_related)
+
 /* 1 if insn has been deleted.  */
-#define INSN_DELETED_P(INSN) ((INSN)->volatil)
+#define INSN_DELETED_P(RTX)	\
+  (RTL_FLAG_CHECK6((RTX), INSN, CALL_INSN, JUMP_INSN, CODE_LABEL,	\
+		   BARRIER, NOTE)->volatil)
 
 /* 1 if insn is a call to a const or pure function.  */
-#define CONST_OR_PURE_CALL_P(INSN) ((INSN)->unchanging)
+#define CONST_OR_PURE_CALL_P(RTX)	\
+  (RTL_FLAG_CHECK3((RTX), CALL_INSN, NOTE, EXPR_LIST)->unchanging)
 
 /* 1 if insn (assumed to be a CALL_INSN) is a sibling call.  */
-#define SIBLING_CALL_P(INSN) ((INSN)->jump)
+#define SIBLING_CALL_P(INSN) (RTL_FLAG_CHECK1((INSN), CALL_INSN)->jump)
 
-/* 1 if insn is a branch that should not unconditionally execute its
-   delay slots, i.e., it is an annulled branch.  */
-#define INSN_ANNULLED_BRANCH_P(INSN) ((INSN)->unchanging)
+/* 1 in an INSN in the delay slot of a branch insn if an annulling branch
+   should be used.  */
+#define INSN_ANNULLED_BRANCH_P(RTX) (RTL_FLAG_CHECK1((RTX), INSN)->unchanging)
 
 /* 1 if insn is a dead code.  Valid only for dead-code elimination phase.  */
-#define INSN_DEAD_CODE_P(INSN) ((INSN)->in_struct)
+#define INSN_DEAD_CODE_P(RTX) (RTL_FLAG_CHECK1((RTX), INSN)->in_struct)
 
 /* 1 if insn is in a delay slot and is from the target of the branch.  If
    the branch insn has INSN_ANNULLED_BRANCH_P set, this insn should only be
    executed if the branch is taken.  For annulled branches with this bit
    clear, the insn should be executed only if the branch is not taken.  */
-#define INSN_FROM_TARGET_P(INSN) ((INSN)->in_struct)
+#define INSN_FROM_TARGET_P(RTX) (RTL_FLAG_CHECK1((RTX), INSN)->in_struct)
 
 #define ADDR_DIFF_VEC_FLAGS(RTX) X0ADVFLAGS(RTX, 4)
 
@@ -792,13 +897,13 @@ extern const char * const note_insn_name
 /* For a REG rtx, REG_FUNCTION_VALUE_P is nonzero if the reg
    is the current function's return value.  */
 
-#define REG_FUNCTION_VALUE_P(RTX) ((RTX)->integrated)
+#define REG_FUNCTION_VALUE_P(RTX) (RTL_FLAG_CHECK1((RTX), REG)->integrated)
 
 /* 1 in a REG rtx if it corresponds to a variable declared by the user.  */
-#define REG_USERVAR_P(RTX) ((RTX)->volatil)
+#define REG_USERVAR_P(RTX) (RTL_FLAG_CHECK1((RTX), REG)->volatil)
 
 /* 1 in a REG rtx if the register is a pointer.  */
-#define REG_POINTER(RTX) ((RTX)->frame_related)
+#define REG_POINTER(RTX) (RTL_FLAG_CHECK1((RTX), REG)->frame_related)
 
 /* 1 if the given register REG corresponds to a hard register.  */
 #define HARD_REGISTER_P(REG) (HARD_REGISTER_NUM_P (REGNO (REG)))
@@ -851,9 +956,10 @@ extern unsigned int subreg_regno 	PARAMS
    When used as a LHS, is means that this extension must be done
    when assigning to SUBREG_REG.  */
 
-#define SUBREG_PROMOTED_VAR_P(RTX) ((RTX)->in_struct)
+#define SUBREG_PROMOTED_VAR_P(RTX) (RTL_FLAG_CHECK1((RTX), SUBREG)->in_struct)
 #define SUBREG_PROMOTED_UNSIGNED_SET(RTX, VAL)	\
 do {						\
+  RTL_FLAG_CHECK1((RTX), SUBREG);		\
   if ((VAL) < 0)				\
     (RTX)->volatil = 1;				\
   else {					\
@@ -861,7 +967,8 @@ do {						\
     (RTX)->unchanging = (VAL);			\
   }						\
 } while (0)
-#define SUBREG_PROMOTED_UNSIGNED_P(RTX) ((RTX)->volatil ? -1 : (RTX)->unchanging)
+#define SUBREG_PROMOTED_UNSIGNED_P(RTX)	\
+  ((RTL_FLAG_CHECK1((RTX), SUBREG)->volatil) ? -1 : (RTX)->unchanging)
 
 /* Access various components of an ASM_OPERANDS rtx.  */
 
@@ -884,20 +991,20 @@ do {						\
 /* For a MEM RTX, 1 if we should keep the alias set for this mem
    unchanged when we access a component.  Set to 1, or example, when we
    are already in a non-addressable component of an aggregate.  */
-#define MEM_KEEP_ALIAS_SET_P(RTX) ((RTX)->jump)
+#define MEM_KEEP_ALIAS_SET_P(RTX) (RTL_FLAG_CHECK1((RTX), MEM)->jump)
 
 /* For a MEM rtx, 1 if it's a volatile reference.
    Also in an ASM_OPERANDS rtx.  */
-#define MEM_VOLATILE_P(RTX) ((RTX)->volatil)
+#define MEM_VOLATILE_P(RTX) (RTL_FLAG_CHECK2((RTX), MEM, ASM_OPERANDS)->volatil)
 
 /* For a MEM rtx, 1 if it refers to an aggregate, either to the
    aggregate itself of to a field of the aggregate.  If zero, RTX may
    or may not be such a reference.  */
-#define MEM_IN_STRUCT_P(RTX) ((RTX)->in_struct)
+#define MEM_IN_STRUCT_P(RTX) (RTL_FLAG_CHECK1((RTX), MEM)->in_struct)
 
 /* For a MEM rtx, 1 if it refers to a scalar.  If zero, RTX may or may
    not refer to a scalar.  */
-#define MEM_SCALAR_P(RTX) ((RTX)->frame_related)
+#define MEM_SCALAR_P(RTX) (RTL_FLAG_CHECK1((RTX), MEM)->frame_related)
 
 /* If VAL is non-zero, set MEM_IN_STRUCT_P and clear MEM_SCALAR_P in
    RTX.  Otherwise, vice versa.  Use this macro only when you are
@@ -965,27 +1072,31 @@ do {						\
 
 /* For a LABEL_REF, 1 means that this reference is to a label outside the
    loop containing the reference.  */
-#define LABEL_OUTSIDE_LOOP_P(RTX) ((RTX)->in_struct)
+#define LABEL_OUTSIDE_LOOP_P(RTX) (RTL_FLAG_CHECK1((RTX), LABEL_REF)->in_struct)
 
 /* For a LABEL_REF, 1 means it is for a nonlocal label.  */
 /* Likewise in an EXPR_LIST for a REG_LABEL note.  */
-#define LABEL_REF_NONLOCAL_P(RTX) ((RTX)->volatil)
+#define LABEL_REF_NONLOCAL_P(RTX)	\
+  (RTL_FLAG_CHECK2((RTX), LABEL_REF, REG_LABEL)->volatil)
 
 /* For a CODE_LABEL, 1 means always consider this label to be needed.  */
-#define LABEL_PRESERVE_P(RTX) ((RTX)->in_struct)
+#define LABEL_PRESERVE_P(RTX) \
+  (RTL_FLAG_CHECK2((RTX), CODE_LABEL, NOTE)->in_struct)
 
 /* For a REG, 1 means the register is used only in an exit test of a loop.  */
-#define REG_LOOP_TEST_P(RTX) ((RTX)->in_struct)
+#define REG_LOOP_TEST_P(RTX) (RTL_FLAG_CHECK1((RTX), REG)->in_struct)
 
 /* During sched, for an insn, 1 means that the insn must be scheduled together
    with the preceding insn.  */
-#define SCHED_GROUP_P(INSN) ((INSN)->in_struct)
+#define SCHED_GROUP_P(RTX)	\
+  (RTL_FLAG_CHECK6((RTX), INSN, JUMP_INSN, CALL_INSN, CODE_LABEL, \
+		          BARRIER, NOTE)->in_struct)
 
 /* For a SET rtx, SET_DEST is the place that is set
    and SET_SRC is the value it is set to.  */
 #define SET_DEST(RTX) XC2EXP(RTX, 0, SET, CLOBBER)
 #define SET_SRC(RTX) XCEXP(RTX, 1, SET)
-#define SET_IS_RETURN_P(RTX) ((RTX)->jump)
+#define SET_IS_RETURN_P(RTX) (RTL_FLAG_CHECK1((RTX), SET)->jump)
 
 /* For a TRAP_IF rtx, TRAP_CONDITION is an expression.  */
 #define TRAP_CONDITION(RTX) XCEXP (RTX, 0, TRAP_IF)
@@ -998,19 +1109,21 @@ do {						\
 #define COND_EXEC_CODE(RTX) XCEXP (RTX, 1, COND_EXEC)
 
 /* 1 in a SYMBOL_REF if it addresses this function's constants pool.  */
-#define CONSTANT_POOL_ADDRESS_P(RTX) ((RTX)->unchanging)
+#define CONSTANT_POOL_ADDRESS_P(RTX)	\
+  (RTL_FLAG_CHECK1((RTX), SYMBOL_REF)->unchanging)
 
 /* 1 in a SYMBOL_REF if it addresses this function's string constant pool.  */
-#define STRING_POOL_ADDRESS_P(RTX) ((RTX)->frame_related)
+#define STRING_POOL_ADDRESS_P(RTX)	\
+  (RTL_FLAG_CHECK1((RTX), SYMBOL_REF)->frame_related)
 
 /* Flag in a SYMBOL_REF for machine-specific purposes.  */
-#define SYMBOL_REF_FLAG(RTX) ((RTX)->volatil)
+#define SYMBOL_REF_FLAG(RTX) (RTL_FLAG_CHECK1((RTX), SYMBOL_REF)->volatil)
 
 /* 1 means a SYMBOL_REF has been the library function in emit_library_call.  */
-#define SYMBOL_REF_USED(RTX) ((RTX)->used)
+#define SYMBOL_REF_USED(RTX) (RTL_FLAG_CHECK1((RTX), SYMBOL_REF)->used)
 
 /* 1 means a SYMBOL_REF is weak.  */
-#define SYMBOL_REF_WEAK(RTX) ((RTX)->integrated)
+#define SYMBOL_REF_WEAK(RTX) (RTL_FLAG_CHECK1((RTX), SYMBOL_REF)->integrated)
 
 /* Define a macro to look for REG_INC notes,
    but save time on machines where they never exist.  */
Index: rtl.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/rtl.c,v
retrieving revision 1.111
diff -u -p -r1.111 rtl.c
--- rtl.c	19 Apr 2002 00:14:49 -0000	1.111
+++ rtl.c	6 May 2002 18:04:13 -0000
@@ -331,13 +331,13 @@ copy_rtx (orig)
 
   /* We do not copy the USED flag, which is used as a mark bit during
      walks over the RTL.  */
-  copy->used = 0;
+  RTX_FLAG (copy, used) = 0;
 
   /* We do not copy FRAME_RELATED for INSNs.  */
   if (GET_RTX_CLASS (code) == 'i')
-    copy->frame_related = 0;
-  copy->jump = orig->jump;
-  copy->call = orig->call;
+    RTX_FLAG (copy, frame_related) = 0;
+  RTX_FLAG (copy, jump) = RTX_FLAG (orig, jump);
+  RTX_FLAG (copy, call) = RTX_FLAG (orig, call);
 
   format_ptr = GET_RTX_FORMAT (GET_CODE (copy));
 
@@ -390,11 +390,11 @@ shallow_copy_rtx (orig)
   rtx copy = rtx_alloc (code);
 
   PUT_MODE (copy, GET_MODE (orig));
-  copy->in_struct = orig->in_struct;
-  copy->volatil = orig->volatil;
-  copy->unchanging = orig->unchanging;
-  copy->integrated = orig->integrated;
-  copy->frame_related = orig->frame_related;
+  RTX_FLAG (copy, in_struct) = RTX_FLAG (orig, in_struct);
+  RTX_FLAG (copy, volatil) = RTX_FLAG (orig, volatil);
+  RTX_FLAG (copy, unchanging) = RTX_FLAG (orig, unchanging);
+  RTX_FLAG (copy, integrated) = RTX_FLAG (orig, integrated);
+  RTX_FLAG (copy, frame_related) = RTX_FLAG (orig, frame_related);
 
   for (i = 0; i < GET_RTX_LENGTH (code); i++)
     copy->fld[i] = orig->fld[i];
@@ -637,3 +637,17 @@ rtvec_check_failed_bounds (r, n, file, l
      n, GET_NUM_ELEM (r) - 1, func, trim_filename (file), line);
 }
 #endif /* ENABLE_RTL_CHECKING */
+
+#if defined ENABLE_RTL_FLAG_CHECKING
+void
+rtl_check_failed_flag (r, file, line, func)
+    rtx r;
+    const char *file;
+    int line;
+    const char *func;
+{
+  internal_error
+    ("RTL flag check: access macro used with unexpected rtx code `%s' in %s, at %s:%d",
+     GET_RTX_NAME (GET_CODE (r)), func, trim_filename (file), line);
+}
+#endif /* ENABLE_RTL_FLAG_CHECKING */
Index: reload1.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/reload1.c,v
retrieving revision 1.333
diff -u -p -r1.333 reload1.c
--- reload1.c	29 Apr 2002 21:23:57 -0000	1.333
+++ reload1.c	6 May 2002 18:04:30 -0000
@@ -1160,9 +1160,9 @@ reload (first, global)
 	    {
 	      rtx reg = regno_reg_rtx[i];
 
+	      REG_USERVAR_P (reg) = 0;
 	      PUT_CODE (reg, MEM);
 	      XEXP (reg, 0) = addr;
-	      REG_USERVAR_P (reg) = 0;
 	      if (reg_equiv_memory_loc[i])
 		MEM_COPY_ATTRIBUTES (reg, reg_equiv_memory_loc[i]);
 	      else
@@ -8079,7 +8079,8 @@ reload_cse_simplify (insn)
       if (!count && reload_cse_noop_set_p (body))
 	{
 	  rtx value = SET_DEST (body);
-	  if (! REG_FUNCTION_VALUE_P (SET_DEST (body)))
+	  if (GET_CODE (body) == REG
+	      && ! REG_FUNCTION_VALUE_P (SET_DEST (body)))
 	    value = 0;
 	  reload_cse_delete_noop_set (insn, value);
 	  return;
Index: config/ia64/ia64.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/ia64/ia64.c,v
retrieving revision 1.160
diff -u -p -r1.160 ia64.c
--- config/ia64/ia64.c	4 May 2002 01:04:18 -0000	1.160
+++ config/ia64/ia64.c	6 May 2002 18:04:46 -0000
@@ -7225,7 +7225,7 @@ process_for_unwind_directive (asm_out_fi
 	    }
 	}
 
-      if (! RTX_FRAME_RELATED_P (insn))
+      if (GET_CODE (insn) == NOTE || ! RTX_FRAME_RELATED_P (insn))
 	return;
 
       pat = find_reg_note (insn, REG_FRAME_RELATED_EXPR, NULL_RTX);


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]