calls.c (expand_call): Check DECL_BUILT_IN_CLASS before accessing DECL_FUNCTION_CODE.

* calls.c (expand_call): Check DECL_BUILT_IN_CLASS before
	accessing DECL_FUNCTION_CODE.
	* dojump.c (do_jump): Likewise.
	* gimplify.c (gimplify_call_expr): Likewise.
	* predict.c (expr_expected_value): Likewise.
	(strip_builtin_expect): Likewise.
	* tree-inline.c (estimate_num_insns_1): Likewise.
	* tree-ssa-loop-im.c (stmt_cost): Likewise
	* fold-const.c (fold): Test for BUILT_IN_NORMAL.
	(tree_expr_nonnegative_p): Likewise.

From-SVN: r93864
This commit is contained in:
Eric Botcazou 2005-01-19 00:06:59 +01:00 committed by Eric Botcazou
parent 2b009f5f3f
commit 8c96cd51c7
8 changed files with 24 additions and 12 deletions

View File

@ -1,3 +1,16 @@
2005-01-18 Eric Botcazou <ebotcazou@libertysurf.fr>
* calls.c (expand_call): Check DECL_BUILT_IN_CLASS before
accessing DECL_FUNCTION_CODE.
* dojump.c (do_jump): Likewise.
* gimplify.c (gimplify_call_expr): Likewise.
* predict.c (expr_expected_value): Likewise.
(strip_builtin_expect): Likewise.
* tree-inline.c (estimate_num_insns_1): Likewise.
* tree-ssa-loop-im.c (stmt_cost): Likewise
* fold-const.c (fold): Test for BUILT_IN_NORMAL.
(tree_expr_nonnegative_p): Likewise.
2005-01-18 Eric Botcazou <ebotcazou@libertysurf.fr>
* config/sparc/sparc.c (load_pic_register): Emit the appropriate

View File

@ -2722,7 +2722,7 @@ expand_call (tree exp, rtx target, int ignore)
end_sequence ();
if (flag_unsafe_math_optimizations
&& fndecl
&& DECL_BUILT_IN (fndecl)
&& DECL_BUILT_IN_CLASS (fndecl) == BUILT_IN_NORMAL
&& (DECL_FUNCTION_CODE (fndecl) == BUILT_IN_SQRT
|| DECL_FUNCTION_CODE (fndecl) == BUILT_IN_SQRTF
|| DECL_FUNCTION_CODE (fndecl) == BUILT_IN_SQRTL))

View File

@ -527,7 +527,7 @@ do_jump (tree exp, rtx if_false_label, rtx if_true_label)
tree arglist = TREE_OPERAND (exp, 1);
if (fndecl
&& DECL_BUILT_IN (fndecl)
&& DECL_BUILT_IN_CLASS (fndecl) == BUILT_IN_NORMAL
&& DECL_FUNCTION_CODE (fndecl) == BUILT_IN_EXPECT
&& arglist != NULL_TREE
&& TREE_CHAIN (arglist) != NULL_TREE)

View File

@ -8982,8 +8982,7 @@ fold (tree expr)
tree arglist;
if (fndecl
&& DECL_BUILT_IN (fndecl)
&& DECL_BUILT_IN_CLASS (fndecl) != BUILT_IN_MD
&& DECL_BUILT_IN_CLASS (fndecl) == BUILT_IN_NORMAL
&& DECL_FUNCTION_CODE (fndecl) == BUILT_IN_STRLEN
&& (arglist = TREE_OPERAND (arg0, 1))
&& TREE_CODE (TREE_TYPE (TREE_VALUE (arglist))) == POINTER_TYPE
@ -9809,9 +9808,7 @@ tree_expr_nonnegative_p (tree t)
{
tree fndecl = get_callee_fndecl (t);
tree arglist = TREE_OPERAND (t, 1);
if (fndecl
&& DECL_BUILT_IN (fndecl)
&& DECL_BUILT_IN_CLASS (fndecl) != BUILT_IN_MD)
if (fndecl && DECL_BUILT_IN_CLASS (fndecl) == BUILT_IN_NORMAL)
switch (DECL_FUNCTION_CODE (fndecl))
{
#define CASE_BUILTIN_F(BUILT_IN_FN) \

View File

@ -1748,7 +1748,8 @@ gimplify_call_expr (tree *expr_p, tree *pre_p, bool want_value)
return GS_OK;
}
if (DECL_FUNCTION_CODE (decl) == BUILT_IN_VA_START)
if (DECL_BUILT_IN_CLASS (decl) == BUILT_IN_NORMAL
&& DECL_FUNCTION_CODE (decl) == BUILT_IN_VA_START)
{
tree arglist = TREE_OPERAND (*expr_p, 1);

View File

@ -947,7 +947,8 @@ expr_expected_value (tree expr, bitmap visited)
tree decl = get_callee_fndecl (expr);
if (!decl)
return NULL;
if (DECL_BUILT_IN (decl) && DECL_FUNCTION_CODE (decl) == BUILT_IN_EXPECT)
if (DECL_BUILT_IN_CLASS (decl) == BUILT_IN_NORMAL
&& DECL_FUNCTION_CODE (decl) == BUILT_IN_EXPECT)
{
tree arglist = TREE_OPERAND (expr, 1);
tree val;
@ -1006,7 +1007,7 @@ strip_builtin_expect (void)
if (TREE_CODE (stmt) == MODIFY_EXPR
&& TREE_CODE (TREE_OPERAND (stmt, 1)) == CALL_EXPR
&& (fndecl = get_callee_fndecl (TREE_OPERAND (stmt, 1)))
&& DECL_BUILT_IN (fndecl)
&& DECL_BUILT_IN_CLASS (fndecl) == BUILT_IN_NORMAL
&& DECL_FUNCTION_CODE (fndecl) == BUILT_IN_EXPECT
&& (arglist = TREE_OPERAND (TREE_OPERAND (stmt, 1), 1))
&& TREE_CHAIN (arglist))

View File

@ -1348,7 +1348,7 @@ estimate_num_insns_1 (tree *tp, int *walk_subtrees, void *data)
{
tree decl = get_callee_fndecl (x);
if (decl && DECL_BUILT_IN (decl))
if (decl && DECL_BUILT_IN_CLASS (decl) == BUILT_IN_NORMAL)
switch (DECL_FUNCTION_CODE (decl))
{
case BUILT_IN_CONSTANT_P:

View File

@ -376,7 +376,7 @@ stmt_cost (tree stmt)
/* Unless the call is a builtin_constant_p; this always folds to a
constant, so moving it is useless. */
rhs = get_callee_fndecl (rhs);
if (DECL_BUILT_IN (rhs)
if (DECL_BUILT_IN_CLASS (rhs) == BUILT_IN_NORMAL
&& DECL_FUNCTION_CODE (rhs) == BUILT_IN_CONSTANT_P)
return 0;