diff options
author | Michael Matz <matz@suse.de> | 2012-10-23 16:29:03 +0000 |
---|---|---|
committer | Michael Matz <matz@gcc.gnu.org> | 2012-10-23 16:29:03 +0000 |
commit | 4b671e64d4d84a4090ce484e638c6032ed5ba17a (patch) | |
tree | dfe78d2bb02f7a92114b50acf3f8662a56351922 /gcc/tree-flow-inline.h | |
parent | 85fc19ad7e950cd015f02b0a4ae8c756727f1398 (diff) | |
download | gcc-4b671e64d4d84a4090ce484e638c6032ed5ba17a.zip gcc-4b671e64d4d84a4090ce484e638c6032ed5ba17a.tar.gz gcc-4b671e64d4d84a4090ce484e638c6032ed5ba17a.tar.bz2 |
tree-ssa-operands.h (struct def_optype_d, [...]): Remove.
* tree-ssa-operands.h (struct def_optype_d, def_optype_p): Remove.
(ssa_operands.free_defs): Remove.
(DEF_OP_PTR, DEF_OP): Remove.
(struct ssa_operand_iterator_d): Remove 'defs', add 'flags'
members, rename 'phi_stmt' to 'stmt', 'phi_i' to 'i' and 'num_phi'
to 'numops'.
* gimple.h (gimple_statement_with_ops.def_ops): Remove.
(gimple_def_ops, gimple_set_def_ops): Remove.
(gimple_vdef_op): Don't take const gimple, adjust.
(gimple_asm_input_op, gimple_asm_input_op_ptr,
gimple_asm_set_input_op, gimple_asm_output_op,
gimple_asm_output_op_ptr, gimple_asm_set_output_op): Adjust asserts,
and rewrite to move def operands to front.
(gimple_asm_clobber_op, gimple_asm_set_clobber_op,
gimple_asm_label_op, gimple_asm_set_label_op): Correct asserts.
* tree-ssa-operands.c (build_defs): Remove.
(init_ssa_operands): Don't initialize it.
(fini_ssa_operands): Don't free it.
(cleanup_build_arrays): Don't truncate it.
(finalize_ssa_stmt_operands): Don't assert on it.
(alloc_def, add_def_op, append_def): Remove.
(finalize_ssa_defs): Remove building of def_ops list.
(finalize_ssa_uses): Don't mark for SSA renaming here, ...
(add_stmt_operand): ... but here, don't call append_def.
(get_indirect_ref_operands): Remove recurse_on_base argument.
(get_expr_operands): Adjust call to get_indirect_ref_operands.
(verify_ssa_operands): Don't check def operands.
(free_stmt_operands): Don't free def operands.
* gimple.c (gimple_copy): Don't clear def operands.
* tree-flow-inline.h (op_iter_next_use): Adjust to explicitely
handle def operand.
(op_iter_next_tree, op_iter_next_def): Ditto.
(clear_and_done_ssa_iter): Clear new fields.
(op_iter_init): Adjust to setup new iterator structure.
(op_iter_init_phiuse): Adjust.
From-SVN: r192721
Diffstat (limited to 'gcc/tree-flow-inline.h')
-rw-r--r-- | gcc/tree-flow-inline.h | 101 |
1 files changed, 75 insertions, 26 deletions
diff --git a/gcc/tree-flow-inline.h b/gcc/tree-flow-inline.h index 6c55da6..64177ce 100644 --- a/gcc/tree-flow-inline.h +++ b/gcc/tree-flow-inline.h @@ -580,9 +580,9 @@ op_iter_next_use (ssa_op_iter *ptr) ptr->uses = ptr->uses->next; return use_p; } - if (ptr->phi_i < ptr->num_phi) + if (ptr->i < ptr->numops) { - return PHI_ARG_DEF_PTR (ptr->phi_stmt, (ptr->phi_i)++); + return PHI_ARG_DEF_PTR (ptr->stmt, (ptr->i)++); } ptr->done = true; return NULL_USE_OPERAND_P; @@ -592,14 +592,33 @@ op_iter_next_use (ssa_op_iter *ptr) static inline def_operand_p op_iter_next_def (ssa_op_iter *ptr) { - def_operand_p def_p; gcc_checking_assert (ptr->iter_type == ssa_op_iter_def); - if (ptr->defs) + if (ptr->flags & SSA_OP_VDEF) { - def_p = DEF_OP_PTR (ptr->defs); - ptr->defs = ptr->defs->next; - return def_p; + tree *p; + ptr->flags &= ~SSA_OP_VDEF; + p = gimple_vdef_ptr (ptr->stmt); + if (p && *p) + return p; } + if (ptr->flags & SSA_OP_DEF) + { + while (ptr->i < ptr->numops) + { + tree *val = gimple_op_ptr (ptr->stmt, ptr->i); + ptr->i++; + if (*val) + { + if (TREE_CODE (*val) == TREE_LIST) + val = &TREE_VALUE (*val); + if (TREE_CODE (*val) == SSA_NAME + || is_gimple_reg (*val)) + return val; + } + } + ptr->flags &= ~SSA_OP_DEF; + } + ptr->done = true; return NULL_DEF_OPERAND_P; } @@ -616,16 +635,32 @@ op_iter_next_tree (ssa_op_iter *ptr) ptr->uses = ptr->uses->next; return val; } - if (ptr->defs) + if (ptr->flags & SSA_OP_VDEF) { - val = DEF_OP (ptr->defs); - ptr->defs = ptr->defs->next; - return val; + ptr->flags &= ~SSA_OP_VDEF; + if ((val = gimple_vdef (ptr->stmt))) + return val; + } + if (ptr->flags & SSA_OP_DEF) + { + while (ptr->i < ptr->numops) + { + val = gimple_op (ptr->stmt, ptr->i); + ptr->i++; + if (val) + { + if (TREE_CODE (val) == TREE_LIST) + val = TREE_VALUE (val); + if (TREE_CODE (val) == SSA_NAME + || is_gimple_reg (val)) + return val; + } + } + ptr->flags &= ~SSA_OP_DEF; } ptr->done = true; return NULL_TREE; - } @@ -636,13 +671,13 @@ op_iter_next_tree (ssa_op_iter *ptr) static inline void clear_and_done_ssa_iter (ssa_op_iter *ptr) { - ptr->defs = NULL; + ptr->i = 0; + ptr->numops = 0; ptr->uses = NULL; ptr->iter_type = ssa_op_iter_none; - ptr->phi_i = 0; - ptr->num_phi = 0; - ptr->phi_stmt = NULL; + ptr->stmt = NULL; ptr->done = true; + ptr->flags = 0; } /* Initialize the iterator PTR to the virtual defs in STMT. */ @@ -655,21 +690,34 @@ op_iter_init (ssa_op_iter *ptr, gimple stmt, int flags) gcc_checking_assert (gimple_code (stmt) != GIMPLE_PHI && (!(flags & SSA_OP_VDEF) || (flags & SSA_OP_DEF)) && (!(flags & SSA_OP_VUSE) || (flags & SSA_OP_USE))); - ptr->defs = (flags & (SSA_OP_DEF|SSA_OP_VDEF)) ? gimple_def_ops (stmt) : NULL; - if (!(flags & SSA_OP_VDEF) - && ptr->defs - && gimple_vdef (stmt) != NULL_TREE) - ptr->defs = ptr->defs->next; + ptr->numops = 0; + if (flags & (SSA_OP_DEF | SSA_OP_VDEF)) + { + switch (gimple_code (stmt)) + { + case GIMPLE_ASSIGN: + case GIMPLE_CALL: + ptr->numops = 1; + break; + case GIMPLE_ASM: + ptr->numops = gimple_asm_noutputs (stmt); + break; + default: + ptr->numops = 0; + flags &= ~(SSA_OP_DEF | SSA_OP_VDEF); + break; + } + } ptr->uses = (flags & (SSA_OP_USE|SSA_OP_VUSE)) ? gimple_use_ops (stmt) : NULL; if (!(flags & SSA_OP_VUSE) && ptr->uses && gimple_vuse (stmt) != NULL_TREE) ptr->uses = ptr->uses->next; ptr->done = false; + ptr->i = 0; - ptr->phi_i = 0; - ptr->num_phi = 0; - ptr->phi_stmt = NULL; + ptr->stmt = stmt; + ptr->flags = flags; } /* Initialize iterator PTR to the use operands in STMT based on FLAGS. Return @@ -839,9 +887,10 @@ op_iter_init_phiuse (ssa_op_iter *ptr, gimple phi, int flags) return NULL_USE_OPERAND_P; } - ptr->phi_stmt = phi; - ptr->num_phi = gimple_phi_num_args (phi); + ptr->stmt = phi; + ptr->numops = gimple_phi_num_args (phi); ptr->iter_type = ssa_op_iter_use; + ptr->flags = flags; return op_iter_next_use (ptr); } |