This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
PATCH to add 'r' and 's' to IS_EXPR_CODE_CLASS
- From: Jason Merrill <jason at redhat dot com>
- To: gcc-patches at gcc dot gnu dot org
- Date: Wed, 20 Aug 2003 17:44:28 -0400
- Subject: PATCH to add 'r' and 's' to IS_EXPR_CODE_CLASS
Almost every use of IS_EXPR_CODE_CLASS also tests for either 'r' or 's' or
both; I don't see any reason why they should be considered expression
classes as well.
Tested athlon-pc-linux-gnu, applied to trunk.
2003-08-20 Jason Merrill <jason@redhat.com>
* tree.h (IS_EXPR_CODE_CLASS): Also include 'r' and 's'.
(EXPR_CHECK): Don't check for 'r' or 's' if we're
checking IS_EXPR_CODE_CLASS.
* calls.c (calls_function_1): Likewise.
* fold-const.c (fold): Likewise.
* tree.c (iterative_hash_expr): Likewise.
* tree-inline.c (walk_tree, copy_tree_r): Likewise.
*** calls.c.~1~ Wed Aug 20 15:32:50 2003
--- calls.c Wed Aug 20 15:29:01 2003
*************** calls_function_1 (tree exp, int which)
*** 262,269 ****
break;
}
! /* Only expressions, references, and blocks can contain calls. */
! if (! IS_EXPR_CODE_CLASS (class) && class != 'r' && class != 'b')
return 0;
for (i = 0; i < length; i++)
--- 262,269 ----
break;
}
! /* Only expressions and blocks can contain calls. */
! if (! IS_EXPR_CODE_CLASS (class) && class != 'b')
return 0;
for (i = 0; i < length; i++)
*** fold-const.c.~1~ Wed Aug 20 15:32:50 2003
--- fold-const.c Wed Aug 20 15:29:00 2003
*************** fold (tree expr)
*** 5032,5038 ****
do arithmetic on them. */
wins = 0;
}
! else if (IS_EXPR_CODE_CLASS (kind) || kind == 'r')
{
int len = first_rtl_op (code);
int i;
--- 5032,5038 ----
do arithmetic on them. */
wins = 0;
}
! else if (IS_EXPR_CODE_CLASS (kind))
{
int len = first_rtl_op (code);
int i;
*** tree.c.~1~ Wed Aug 20 15:32:50 2003
--- tree.c Wed Aug 20 15:28:55 2003
*************** iterative_hash_expr (tree t, hashval_t v
*** 3527,3533 ****
else
abort ();
}
! else if (IS_EXPR_CODE_CLASS (class) || class == 'r')
{
val = iterative_hash_object (code, val);
--- 3527,3533 ----
else
abort ();
}
! else if (IS_EXPR_CODE_CLASS (class))
{
val = iterative_hash_object (code, val);
*** tree.h.~1~ Wed Aug 20 15:32:50 2003
--- tree.h Wed Aug 20 15:28:56 2003
*************** extern const char tree_code_type[];
*** 57,63 ****
expression. */
#define IS_EXPR_CODE_CLASS(CLASS) \
! ((CLASS) == '<' || (CLASS) == '1' || (CLASS) == '2' || (CLASS) == 'e')
/* Number of argument-words in each kind of tree-node. */
--- 57,64 ----
expression. */
#define IS_EXPR_CODE_CLASS(CLASS) \
! ((CLASS) == '<' || (CLASS) == '1' || (CLASS) == '2' || (CLASS) == 'e' \
! || (CLASS) == 'r' || (CLASS) == 's')
/* Number of argument-words in each kind of tree-node. */
*************** struct tree_common GTY(())
*** 291,297 ****
#define EXPR_CHECK(T) __extension__ \
({ const tree __t = (T); \
char const __c = TREE_CODE_CLASS (TREE_CODE (__t)); \
! if (!IS_EXPR_CODE_CLASS (__c) && __c != 'r' && __c != 's') \
tree_class_check_failed (__t, 'e', __FILE__, __LINE__, \
__FUNCTION__); \
__t; })
--- 292,298 ----
#define EXPR_CHECK(T) __extension__ \
({ const tree __t = (T); \
char const __c = TREE_CODE_CLASS (TREE_CODE (__t)); \
! if (!IS_EXPR_CODE_CLASS (__c)) \
tree_class_check_failed (__t, 'e', __FILE__, __LINE__, \
__FUNCTION__); \
__t; })
*** tree-inline.c.~1~ Wed Aug 20 15:32:50 2003
--- tree-inline.c Wed Aug 20 15:30:30 2003
*************** walk_tree (tree *tp, walk_tree_fn func,
*** 1661,1675 ****
}
/* Handle common cases up front. */
! if (IS_EXPR_CODE_CLASS (TREE_CODE_CLASS (code))
! || TREE_CODE_CLASS (code) == 'r'
! || TREE_CODE_CLASS (code) == 's')
#else /* INLINER_FOR_JAVA */
if (code != EXIT_BLOCK_EXPR
&& code != SAVE_EXPR
! && (IS_EXPR_CODE_CLASS (TREE_CODE_CLASS (code))
! || TREE_CODE_CLASS (code) == 'r'
! || TREE_CODE_CLASS (code) == 's'))
#endif /* INLINER_FOR_JAVA */
{
int i, len;
--- 1661,1671 ----
}
/* Handle common cases up front. */
! if (IS_EXPR_CODE_CLASS (TREE_CODE_CLASS (code)))
#else /* INLINER_FOR_JAVA */
if (code != EXIT_BLOCK_EXPR
&& code != SAVE_EXPR
! && IS_EXPR_CODE_CLASS (TREE_CODE_CLASS (code)))
#endif /* INLINER_FOR_JAVA */
{
int i, len;
*************** copy_tree_r (tree *tp, int *walk_subtree
*** 1862,1870 ****
/* We make copies of most nodes. */
if (IS_EXPR_CODE_CLASS (TREE_CODE_CLASS (code))
- || TREE_CODE_CLASS (code) == 'r'
|| TREE_CODE_CLASS (code) == 'c'
- || TREE_CODE_CLASS (code) == 's'
|| code == TREE_LIST
|| code == TREE_VEC
|| (*lang_hooks.tree_inlining.tree_chain_matters_p) (*tp))
--- 1858,1864 ----