From a8073039599c9a0e1bf7606228dcf9d407d4c4c7 Mon Sep 17 00:00:00 2001 From: ebotcazou Date: Tue, 18 Jan 2005 23:06:59 +0000 Subject: [PATCH] * 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. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@93864 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 13 +++++++++++++ gcc/calls.c | 2 +- gcc/dojump.c | 2 +- gcc/fold-const.c | 7 ++----- gcc/gimplify.c | 3 ++- gcc/predict.c | 5 +++-- gcc/tree-inline.c | 2 +- gcc/tree-ssa-loop-im.c | 2 +- 8 files changed, 24 insertions(+), 12 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index a8c2a0a87b0..aa1a18106dd 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,5 +1,18 @@ 2005-01-18 Eric Botcazou + * 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 + * config/sparc/sparc.c (load_pic_register): Emit the appropriate variant of the load_pcrel_sym pattern. * config/sparc/sparc.md (P macro): Move to the top. diff --git a/gcc/calls.c b/gcc/calls.c index 72cba491403..9e228ac0e3f 100644 --- a/gcc/calls.c +++ b/gcc/calls.c @@ -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)) diff --git a/gcc/dojump.c b/gcc/dojump.c index 650e51aeb14..c10ea39c366 100644 --- a/gcc/dojump.c +++ b/gcc/dojump.c @@ -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) diff --git a/gcc/fold-const.c b/gcc/fold-const.c index f22411d924e..cdefe7611fb 100644 --- a/gcc/fold-const.c +++ b/gcc/fold-const.c @@ -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) \ diff --git a/gcc/gimplify.c b/gcc/gimplify.c index 29c733bd52e..d86379ca2c8 100644 --- a/gcc/gimplify.c +++ b/gcc/gimplify.c @@ -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); diff --git a/gcc/predict.c b/gcc/predict.c index daf98398f29..c6e9b7dfe71 100644 --- a/gcc/predict.c +++ b/gcc/predict.c @@ -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)) diff --git a/gcc/tree-inline.c b/gcc/tree-inline.c index a578e1cad84..247c6873e4d 100644 --- a/gcc/tree-inline.c +++ b/gcc/tree-inline.c @@ -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: diff --git a/gcc/tree-ssa-loop-im.c b/gcc/tree-ssa-loop-im.c index 05970f8d2e1..d032fee28e8 100644 --- a/gcc/tree-ssa-loop-im.c +++ b/gcc/tree-ssa-loop-im.c @@ -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; -- 2.11.4.GIT