diff options
-rw-r--r-- | gcc/ChangeLog | 11 | ||||
-rw-r--r-- | gcc/gimple.c | 37 | ||||
-rw-r--r-- | gcc/gimple.h | 1 | ||||
-rw-r--r-- | gcc/tree-cfg.c | 5 | ||||
-rw-r--r-- | gcc/tree-profile.c | 15 | ||||
-rw-r--r-- | gcc/tree-ssa-propagate.c | 15 | ||||
-rw-r--r-- | gcc/tree-ssa-propagate.h | 1 |
7 files changed, 57 insertions, 28 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 6c661c86594..94b0624623a 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,14 @@ +2010-07-07 Richard Guenther <rguenther@suse.de> + + * tree-ssa-propagate.h (valid_gimple_call_p): Remove. + * tree-ssa-propagate.c (valid_gimple_call_p): Make static. Fix. + * gimple.h (is_gimple_operand): Remove. + * gimple.c (is_gimple_operand): Likewise. + (walk_gimple_op): Fix wi->val_only setting for calls. + * tree-cfg.c (verify_gimple_call): Fix argument validation. + * tree-profile.c (tree_gen_ic_func_profiler): Do not create + invalid gimple calls. + 2010-07-06 Jan Hubicka <jh@suse.cz> * lto-cgraph.c (output_cgraph): Output toplevel asms only into first diff --git a/gcc/gimple.c b/gcc/gimple.c index fa5b8041ae9..707d4e4b7c3 100644 --- a/gcc/gimple.c +++ b/gcc/gimple.c @@ -1383,7 +1383,10 @@ walk_gimple_op (gimple stmt, walk_tree_fn callback_op, case GIMPLE_CALL: if (wi) - wi->is_lhs = false; + { + wi->is_lhs = false; + wi->val_only = true; + } ret = walk_tree (gimple_call_chain_ptr (stmt), callback_op, wi, pset); if (ret) @@ -1395,21 +1398,32 @@ walk_gimple_op (gimple stmt, walk_tree_fn callback_op, for (i = 0; i < gimple_call_num_args (stmt); i++) { + if (wi) + wi->val_only = is_gimple_reg_type (gimple_call_arg (stmt, i)); ret = walk_tree (gimple_call_arg_ptr (stmt, i), callback_op, wi, pset); if (ret) return ret; } - if (wi) - wi->is_lhs = true; + if (gimple_call_lhs (stmt)) + { + if (wi) + { + wi->is_lhs = true; + wi->val_only = is_gimple_reg_type (gimple_call_lhs (stmt)); + } - ret = walk_tree (gimple_call_lhs_ptr (stmt), callback_op, wi, pset); - if (ret) - return ret; + ret = walk_tree (gimple_call_lhs_ptr (stmt), callback_op, wi, pset); + if (ret) + return ret; + } if (wi) - wi->is_lhs = false; + { + wi->is_lhs = false; + wi->val_only = true; + } break; case GIMPLE_CATCH: @@ -2538,15 +2552,6 @@ const unsigned char gimple_rhs_class_table[] = { /* Validation of GIMPLE expressions. */ -/* Return true if OP is an acceptable tree node to be used as a GIMPLE - operand. */ - -bool -is_gimple_operand (const_tree op) -{ - return op && get_gimple_rhs_class (TREE_CODE (op)) == GIMPLE_SINGLE_RHS; -} - /* Returns true iff T is a valid RHS for an assignment to a renamed user -- or front-end generated artificial -- variable. */ diff --git a/gcc/gimple.h b/gcc/gimple.h index 7d2289b5ddd..ec7fc932d28 100644 --- a/gcc/gimple.h +++ b/gcc/gimple.h @@ -879,7 +879,6 @@ tree gimple_get_lhs (const_gimple); void gimple_set_lhs (gimple, tree); void gimple_replace_lhs (gimple, tree); gimple gimple_copy (gimple); -bool is_gimple_operand (const_tree); void gimple_set_modified (gimple, bool); void gimple_cond_get_ops_from_tree (tree, enum tree_code *, tree *, tree *); gimple gimple_build_cond_from_tree (tree, tree, tree); diff --git a/gcc/tree-cfg.c b/gcc/tree-cfg.c index 87603e70037..e55a60bd0a2 100644 --- a/gcc/tree-cfg.c +++ b/gcc/tree-cfg.c @@ -3114,7 +3114,10 @@ verify_gimple_call (gimple stmt) for (i = 0; i < gimple_call_num_args (stmt); ++i) { tree arg = gimple_call_arg (stmt, i); - if (!is_gimple_operand (arg)) + if ((is_gimple_reg_type (TREE_TYPE (arg)) + && !is_gimple_val (arg)) + || (!is_gimple_reg_type (TREE_TYPE (arg)) + && !is_gimple_lvalue (arg))) { error ("invalid argument to gimple call"); debug_generic_expr (arg); diff --git a/gcc/tree-profile.c b/gcc/tree-profile.c index 127082e1530..a854c50f77e 100644 --- a/gcc/tree-profile.c +++ b/gcc/tree-profile.c @@ -340,7 +340,7 @@ tree_gen_ic_func_profiler (void) basic_block bb; edge_iterator ei; gimple stmt1, stmt2; - tree tree_uid, cur_func; + tree tree_uid, cur_func, counter_ptr, ptr_var; if (cgraph_only_called_directly_p (c_node)) return; @@ -358,13 +358,16 @@ tree_gen_ic_func_profiler (void) build_addr (current_function_decl, current_function_decl), true, NULL_TREE, - true, GSI_SAME_STMT); + true, GSI_NEW_STMT); + counter_ptr = force_gimple_operand_gsi (&gsi, ic_gcov_type_ptr_var, + true, NULL_TREE, false, + GSI_NEW_STMT); + ptr_var = force_gimple_operand_gsi (&gsi, ic_void_ptr_var, + true, NULL_TREE, false, + GSI_NEW_STMT); tree_uid = build_int_cst (gcov_type_node, c_node->pid); stmt1 = gimple_build_call (tree_indirect_call_profiler_fn, 4, - ic_gcov_type_ptr_var, - tree_uid, - cur_func, - ic_void_ptr_var); + counter_ptr, tree_uid, cur_func, ptr_var); gsi_insert_after (&gsi, stmt1, GSI_NEW_STMT); gcc_assert (EDGE_COUNT (bb->succs) == 1); bb = split_edge (EDGE_I (bb->succs, 0)); diff --git a/gcc/tree-ssa-propagate.c b/gcc/tree-ssa-propagate.c index 5f2ecce08b6..6f50fc5453a 100644 --- a/gcc/tree-ssa-propagate.c +++ b/gcc/tree-ssa-propagate.c @@ -639,7 +639,7 @@ valid_gimple_rhs_p (tree expr) as a single GIMPLE_CALL statement. If the arguments require further gimplification, return false. */ -bool +static bool valid_gimple_call_p (tree expr) { unsigned i, nargs; @@ -649,8 +649,17 @@ valid_gimple_call_p (tree expr) nargs = call_expr_nargs (expr); for (i = 0; i < nargs; i++) - if (! is_gimple_operand (CALL_EXPR_ARG (expr, i))) - return false; + { + tree arg = CALL_EXPR_ARG (expr, i); + if (is_gimple_reg_type (arg)) + { + if (!is_gimple_val (arg)) + return false; + } + else + if (!is_gimple_lvalue (arg)) + return false; + } return true; } diff --git a/gcc/tree-ssa-propagate.h b/gcc/tree-ssa-propagate.h index 029d28a2650..c5bb9731c5e 100644 --- a/gcc/tree-ssa-propagate.h +++ b/gcc/tree-ssa-propagate.h @@ -116,7 +116,6 @@ typedef bool (*ssa_prop_fold_stmt_fn) (gimple_stmt_iterator *gsi); /* In tree-ssa-propagate.c */ void ssa_propagate (ssa_prop_visit_stmt_fn, ssa_prop_visit_phi_fn); bool valid_gimple_rhs_p (tree); -bool valid_gimple_call_p (tree); void move_ssa_defining_stmt_for_defs (gimple, gimple); bool update_call_from_tree (gimple_stmt_iterator *, tree); bool stmt_makes_single_store (gimple); |