diff options
author | amacleod <amacleod@138bc75d-0d04-0410-961f-82ee72b054a4> | 2013-10-01 15:46:53 +0000 |
---|---|---|
committer | amacleod <amacleod@138bc75d-0d04-0410-961f-82ee72b054a4> | 2013-10-01 15:46:53 +0000 |
commit | 8f6fa493f6996ec343ead1770530605326197ff9 (patch) | |
tree | eaa52ec7e3d23ca35b23922da83d4e62a0837824 /gcc/tree-ssa-operands.c | |
parent | 24e28cb5278924fc604ac2c61162db3fa3b8f201 (diff) | |
download | gcc-8f6fa493f6996ec343ead1770530605326197ff9.tar.gz |
* tree-into-ssa.c (enum need_phi_state): Relocate from tree-flow.h.
(dump_decl_set): Move to gimple.c.
* gimple.h: Don't include tree-ssa-operands.h.
(dump_decl_set): Add prototype.
(gimple_vuse_op, gimple_vdef_op, update_stmt, update_stmt_if_modified):
Move to gimple-ssa.h.
(phi_ssa_name_p, phi_nodes, phi_nodes_ptr, gimple_phi_arg_def,
gimple_phi_arg_def_ptr, gimple_phi_arg_edge, gimple_phi_arg_location,
gimple_phi_arg_location_from_edge, gimple_phi_arg_set_location,
gimple_phi_arg_has_location): Relocate from tree-flow-inline.h
* gimple.c (walk_stmt_load_store_ops): Use gimple_phi_arg_def rather
than PHI_ARG_DEF.
(dump_decl_set): Relocate here.
* gimple-ssa.h: New file.
(gimple_vuse_op, gimple_vdef_op, update_stmt, update_stmt_if_modified):
Relocate from gimple.h.
* tree-cfg.c (has_zero_uses_1, single_imm_use_1): Move to...
* tree-ssa-operands.c (swap_ssa_operands): Rename from
swap_tree_operands and remove non-ssa path.
(has_zero_uses_1, single_imm_use_1): Relocate from tree-cfg.c.
* tree-ssa-reassoc.c (linearize_expr_tree, repropagate_negates): Use
swap_ssa_operands.
* tree-vect-loop.c (destroy_loop_vec_info, vect_is_slp_reduction,
vect_is_simple_reduction_1): Use swap_ssa_operands.
* tree-flow.h: Move various prototypes to tree-phinodes.h.
(enum need_phi_state): Move to tree-into-ssa.c.
(struct immediate_use_iterator_d, FOR_EACH_IMM_*,
BREAK_FROM_IMM_USE_STMT): Move to ssa-iterators.h.
(swap_tree_operands): Rename and move prototype to tree-ssa-operands.h.
* tree-flow-inline.h (delink_imm_use, link_imm_use_to_list,
link_imm_use, set_ssa_use_from_ptr, link_imm_use_stmt, relink_imm_use,
relink_imm_use_stmt, end_readonly_imm_use_p, first_readonly_imm_use,
next_readonly_imm_use, has_zero_uses, has_single_use, single_imm_use,
num_imm_uses): Move to ssa-iterators.h.
(get_use_from_ptr, get_def_from_ptr): Move to tree-ssa-operands.h
(gimple_phi_arg_imm_use_ptr, phi_arg_index_from_use): Move to
tree-phinodes.h.
(op_iter_done, op_iter_next_def, op_iter_next_tree,
clear_and_done_ssa_iter, op_iter_init, op_iter_init_use,
op_iter_init_def, op_iter_init_tree, single_ssa_tree_operand,
single_ssa_use_operand, single_ssa_def_operand, zero_ssa_operands,
num_ssa_operands, delink_stmt_imm_use, single_phi_def,
op_iter_init_phiuse, op_iter_init_phidef, end_imm_use_stmt_p,
end_imm_use_stmt_traverse, move_use_after_head, link_use_stmts_after,
first_imm_use_stmt, next_imm_use_stmt, first_imm_use_on_stmt,
end_imm_use_on_stmt_p, next_imm_use_on_stmt): Move to ssa-iterators.h.
(gimple_phi_arg_def, gimple_phi_arg_def_ptr, gimple_phi_arg_edge,
gimple_phi_arg_location, gimple_phi_arg_location_from_edge,
gimple_phi_arg_set_location, gimple_phi_arg_has_location, phi_nodes,
phi_nodes_ptr, phi_ssa_name_p): Move to gimple.h.
(set_phi_nodes): Move to tree-phinodes.h.
* tree-ssa-operands.h (enum ssa_op_iter_type,
struct ssa_operand_iterator_d, SSA_OP*, FOR_EACH_SSA*, SINGLE_SSA*,
ZERO_SSA_OPERANDS, NUM_SSA_OPERANDS): Move to ssa-iterators.h.
(dump_decl_set): Remove prototype.
(get_use_from_ptr, get_def_from_ptr): Relocate from tree-flow.h.
* tree-phinodes.h: New file. Move some prototypes from tree-flow.h.
(set_phi_nodes): Relocate from tree-flow-inline.h.
(gimple_phi_arg_imm_use_ptr, phi_arg_index_from_use): Relocate from
tree-flow-inline.h
* tree-ssa.h: Add tree-phinodes.h, gimple-ssa.h, ssa-iterators.h to
include list. Temporarily add gimple.h to include list.
* ssa-iterators.h: New file.
(struct immediate_use_iterator_d, FOR_EACH_IMM_*,
BREAK_FROM_IMM_USE_STMT): Relocate from tree-flow.h.
(enum ssa_op_iter_type, struct ssa_operand_iterator_d, SSA_OP*,
FOR_EACH_SSA*, SINGLE_SSA*, ZERO_SSA_OPERANDS, NUM_SSA_OPERANDS):
Relocate from tree-ssa-operands.h.
(delink_imm_use, link_imm_use_to_list, link_imm_use,
set_ssa_use_from_ptr, link_imm_use_stmt, relink_imm_use,
relink_imm_use_stmt, end_readonly_imm_use_p, first_readonly_imm_use,
next_readonly_imm_use, has_zero_uses, has_single_use, single_imm_use,
num_imm_uses, get_use_from_ptr, get_def_from_ptr,
phi_arg_index_from_use, op_iter_done, op_iter_next_def,
op_iter_next_tree, clear_and_done_ssa_iter, op_iter_init,
op_iter_init_use, op_iter_init_def, op_iter_init_tree,
single_ssa_tree_operand, single_ssa_use_operand, single_ssa_def_operand,
zero_ssa_operands, num_ssa_operands, delink_stmt_imm_use,
single_phi_def, op_iter_init_phiuse, op_iter_init_phidef,
end_imm_use_stmt_p, end_imm_use_stmt_traverse, move_use_after_head,
link_use_stmts_after, first_imm_use_stmt, next_imm_use_stmt,
first_imm_use_on_stmt, end_imm_use_on_stmt_p, next_imm_use_on_stmt):
Relocate from tree-flow-inline.h.
* tree-outof-ssa.h: Change _SSAEXPAND_H macro to GCC_TREE_OUTOF_SSA_H.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@203068 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/tree-ssa-operands.c')
-rw-r--r-- | gcc/tree-ssa-operands.c | 65 |
1 files changed, 55 insertions, 10 deletions
diff --git a/gcc/tree-ssa-operands.c b/gcc/tree-ssa-operands.c index 6bb36729617..22dee7f0533 100644 --- a/gcc/tree-ssa-operands.c +++ b/gcc/tree-ssa-operands.c @@ -1092,18 +1092,19 @@ update_stmt_operands (gimple stmt) to test the validity of the swap operation. */ void -swap_tree_operands (gimple stmt, tree *exp0, tree *exp1) +swap_ssa_operands (gimple stmt, tree *exp0, tree *exp1) { tree op0, op1; op0 = *exp0; op1 = *exp1; - /* If the operand cache is active, attempt to preserve the relative - positions of these two operands in their respective immediate use - lists by adjusting their use pointer to point to the new - operand position. */ - if (ssa_operands_active (cfun) && op0 != op1) + gcc_checking_assert (ssa_operands_active (cfun)); + + if (op0 != op1) { + /* Attempt to preserve the relative positions of these two operands in + their * respective immediate use lists by adjusting their use pointer + to point to the new operand position. */ use_optype_p use0, use1, ptr; use0 = use1 = NULL; @@ -1128,11 +1129,11 @@ swap_tree_operands (gimple stmt, tree *exp0, tree *exp1) USE_OP_PTR (use0)->use = exp1; if (use1) USE_OP_PTR (use1)->use = exp0; - } - /* Now swap the data. */ - *exp0 = op1; - *exp1 = op0; + /* Now swap the data. */ + *exp0 = op1; + *exp1 = op0; + } } @@ -1322,3 +1323,47 @@ unlink_stmt_vdef (gimple stmt) SSA_NAME_OCCURS_IN_ABNORMAL_PHI (vuse) = 1; } + +/* Return true if the var whose chain of uses starts at PTR has no + nondebug uses. */ +bool +has_zero_uses_1 (const ssa_use_operand_t *head) +{ + const ssa_use_operand_t *ptr; + + for (ptr = head->next; ptr != head; ptr = ptr->next) + if (!is_gimple_debug (USE_STMT (ptr))) + return false; + + return true; +} + + +/* Return true if the var whose chain of uses starts at PTR has a + single nondebug use. Set USE_P and STMT to that single nondebug + use, if so, or to NULL otherwise. */ +bool +single_imm_use_1 (const ssa_use_operand_t *head, + use_operand_p *use_p, gimple *stmt) +{ + ssa_use_operand_t *ptr, *single_use = 0; + + for (ptr = head->next; ptr != head; ptr = ptr->next) + if (!is_gimple_debug (USE_STMT (ptr))) + { + if (single_use) + { + single_use = NULL; + break; + } + single_use = ptr; + } + + if (use_p) + *use_p = single_use; + + if (stmt) + *stmt = single_use ? single_use->loc.stmt : NULL; + + return single_use; +} |