diff options
author | amacleod <amacleod@138bc75d-0d04-0410-961f-82ee72b054a4> | 2004-08-25 21:21:19 +0000 |
---|---|---|
committer | amacleod <amacleod@138bc75d-0d04-0410-961f-82ee72b054a4> | 2004-08-25 21:21:19 +0000 |
commit | 43daa21e7c3b20f510ed5e16e2aef1b806d69d2b (patch) | |
tree | 22414e194e2c3d5262c72554997d72332edaa89c /gcc/tree-flow-inline.h | |
parent | dc5fda0ed00721c5c3c4d23e13ba4be8897c4c20 (diff) | |
download | gcc-43daa21e7c3b20f510ed5e16e2aef1b806d69d2b.tar.gz |
2004-08-25 Andrew MacLeod <amacleod@redhat.com>
* tree-ssa-operands.h (struct ssa_operand_iterator_d): New. SSA operand
iterator controlling structure.
(SSA_OP_USE, SSA_OP_DEF, SSA_OP_VUSE, SSA_OP_VMAYUSE, SSA_OP_VMAYDEF,
SSA_OP_VMUSTDEF, SSA_OP_VIRTUAL_USES, SSA_OP_VIRTUAL_DEFS,
SSA_OP_ALL_USES, SSA_OP_ALL_DEFS, SSA_OP_ALL_OPERANDS): New. Operand
iterator flags.
(FOR_EACH_SSA_TREE_OPERAND): New. Iterate over operands as trees.
(FOR_EACH_SSA_USE_OPERAND): New. Iterate over operands as uses.
(FOR_EACH_SSA_DEF_OPERAND): New. Iterate over operands as defs.
(FOR_EACH_SSA_MAYDEF_OPERAND): New. Iterate over V_MAY_DEFs.
* tree-ssa-operands.c (NULL_DEF_OPERAND_P, NULL_USE_OPERAND_P): New.
Empty operand pointers.
* tree-flow-inline.h (op_iter_done): New. Return true if finished.
(op_iter_next_use): New. Return next use_operand_p.
(op_iter_next_def): New. Return next def_operand_p.
(op_iter_next_tree): New. Return next operands as a tree.
(op_iter_init): New. Initialize an iterator structure.
(op_iter_init_use): New. Initialize structure and get the first use.
(op_iter_init_def): New. Initialize structure and get the first def.
(op_iter_init_tree): New. Initialize structure and get the first tree.
(op_iter_next_maydef): New. Return next V_MAY_DEF operands.
(op_iter_init_maydef): New. Initialize structure and get the first
V_MAY_DEF operands.
* tree-cfg.c (tree_duplicate_bb): Use new operand iterator.
* tree-dfa.c (compute_immediate_uses_for_stmt,
redirect_immediate_uses): Use new operand iterator.
(v_may_defs_disappeared_p, v_must_defs_disappeared_p): Delete.
(mark_new_vars_to_rename): Use new operand iterator. Count virtual
operands instead of using *_disappeared_p routines.
* tree-into-ssa.c (mark_def_sites, ssa_mark_def_sites, rewrite_stmt,
ssa_rewrite_stmt): Use new operand iterator.
* tree-outof-ssa.c (check_replaceable, find_replaceable_in_bb,
rewrite_trees): Use new operand iterator.
* tree-pretty-print.c (dump_vops): Use new operand iterator.
* tree-sra.c (mark_all_v_defs): Use new operand iterator.
* tree-ssa-alias.c (compute_points_to_and_addr_escape,
dump_points_to_info): Use new operand iterator.
* tree-ssa-ccp.c (cp_lattice_meet, visit_stmt, initialize,
replace_uses_in, replace_vuse_in, likely_value, set_rhs): Use new
operand iterator.
* tree-ssa-dce.c (mark_stmt_if_obviously_necessary,
propagate_necessity): Use new operand iterator.
* tree-ssa-dom.c (cprop_into_stmt, optimize_stmt): Use operand iterator.
(register_definitions_for_stmt): Use new operand iterator. Take stmt as
a parameter instead of a stmt_ann_t.
* tree-ssa-live.c (create_ssa_var_map, calculate_live_on_entry,
build_tree_conflict_graph): Use new operand iterator.
* tree-ssa-loop-im.c (determine_max_movement, single_reachable_address,
rewrite_mem_refs): Use new operand iterator.
* tree-ssa-loop-manip.c (find_uses_to_rename_stmt,
check_loop_closed_ssa_use): Use new operand iterator.
* tree-ssa.c (verify_ssa, replace_immediate_uses): Use operand iterator.
* tree-ssanames.c (release_defs): Use new operand iterator.
* tree-vectorizer.c (vect_create_data_ref): Use new operand iterator.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@86583 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/tree-flow-inline.h')
-rw-r--r-- | gcc/tree-flow-inline.h | 172 |
1 files changed, 172 insertions, 0 deletions
diff --git a/gcc/tree-flow-inline.h b/gcc/tree-flow-inline.h index a9cc21325e8..423088c9e51 100644 --- a/gcc/tree-flow-inline.h +++ b/gcc/tree-flow-inline.h @@ -673,4 +673,176 @@ get_tree_ann (tree t) return (ann) ? ann : create_tree_ann (t); } +/* ----------------------------------------------------------------------- */ + +/* The following set of routines are used to iterator over various type of + SSA operands. */ + +/* Return true if PTR is finished iterating. */ +static inline bool +op_iter_done (ssa_op_iter *ptr) +{ + return ptr->done; +} + +/* Get the next iterator use value for PTR. */ +static inline use_operand_p +op_iter_next_use (ssa_op_iter *ptr) +{ + if (ptr->use_i < ptr->num_use) + { + return USE_OP_PTR (ptr->ops->use_ops, (ptr->use_i)++); + } + if (ptr->vuse_i < ptr->num_vuse) + { + return VUSE_OP_PTR (ptr->ops->vuse_ops, (ptr->vuse_i)++); + } + if (ptr->v_mayu_i < ptr->num_v_mayu) + { + return V_MAY_DEF_OP_PTR (ptr->ops->v_may_def_ops, + (ptr->v_mayu_i)++); + } + ptr->done = true; + return NULL_USE_OPERAND_P; +} + +/* Get the next iterator def value for PTR. */ +static inline def_operand_p +op_iter_next_def (ssa_op_iter *ptr) +{ + if (ptr->def_i < ptr->num_def) + { + return DEF_OP_PTR (ptr->ops->def_ops, (ptr->def_i)++); + } + if (ptr->v_must_i < ptr->num_v_must) + { + return V_MUST_DEF_OP_PTR (ptr->ops->v_must_def_ops, + (ptr->v_must_i)++); + } + if (ptr->v_mayd_i < ptr->num_v_mayd) + { + return V_MAY_DEF_RESULT_PTR (ptr->ops->v_may_def_ops, + (ptr->v_mayd_i)++); + } + ptr->done = true; + return NULL_DEF_OPERAND_P; +} + +/* Get the next iterator tree value for PTR. */ +static inline tree +op_iter_next_tree (ssa_op_iter *ptr) +{ + if (ptr->use_i < ptr->num_use) + { + return USE_OP (ptr->ops->use_ops, (ptr->use_i)++); + } + if (ptr->vuse_i < ptr->num_vuse) + { + return VUSE_OP (ptr->ops->vuse_ops, (ptr->vuse_i)++); + } + if (ptr->v_mayu_i < ptr->num_v_mayu) + { + return V_MAY_DEF_OP (ptr->ops->v_may_def_ops, (ptr->v_mayu_i)++); + } + if (ptr->def_i < ptr->num_def) + { + return DEF_OP (ptr->ops->def_ops, (ptr->def_i)++); + } + if (ptr->v_must_i < ptr->num_v_must) + { + return V_MUST_DEF_OP (ptr->ops->v_must_def_ops, + (ptr->v_must_i)++); + } + if (ptr->v_mayd_i < ptr->num_v_mayd) + { + return V_MAY_DEF_RESULT (ptr->ops->v_may_def_ops, + (ptr->v_mayd_i)++); + } + ptr->done = true; + return NULL; +} + +/* Initialize the iterator PTR to the virtual defs in STMT. */ +static inline void +op_iter_init (ssa_op_iter *ptr, tree stmt, int flags) +{ + stmt_operands_p ops; + stmt_ann_t ann = get_stmt_ann (stmt); + + ops = &(ann->operands); + ptr->done = false; + ptr->ops = ops; + ptr->num_def = (flags & SSA_OP_DEF) ? NUM_DEFS (ops->def_ops) : 0; + ptr->num_use = (flags & SSA_OP_USE) ? NUM_USES (ops->use_ops) : 0; + ptr->num_vuse = (flags & SSA_OP_VUSE) ? NUM_VUSES (ops->vuse_ops) : 0; + ptr->num_v_mayu = (flags & SSA_OP_VMAYUSE) + ? NUM_V_MAY_DEFS (ops->v_may_def_ops) : 0; + ptr->num_v_mayd = (flags & SSA_OP_VMAYDEF) + ? NUM_V_MAY_DEFS (ops->v_may_def_ops) : 0; + ptr->num_v_must = (flags & SSA_OP_VMUSTDEF) + ? NUM_V_MUST_DEFS (ops->v_must_def_ops) : 0; + ptr->def_i = 0; + ptr->use_i = 0; + ptr->vuse_i = 0; + ptr->v_mayu_i = 0; + ptr->v_mayd_i = 0; + ptr->v_must_i = 0; +} + +/* Initialize iterator PTR to the use operands in STMT based on FLAGS. Return + the first use. */ +static inline use_operand_p +op_iter_init_use (ssa_op_iter *ptr, tree stmt, int flags) +{ + op_iter_init (ptr, stmt, flags); + return op_iter_next_use (ptr); +} + +/* Initialize iterator PTR to the def operands in STMT based on FLAGS. Return + the first def. */ +static inline def_operand_p +op_iter_init_def (ssa_op_iter *ptr, tree stmt, int flags) +{ + op_iter_init (ptr, stmt, flags); + return op_iter_next_def (ptr); +} + +/* Initialize iterator PTR to the operands in STMT based on FLAGS. Return + the first operand as a tree. */ +static inline tree +op_iter_init_tree (ssa_op_iter *ptr, tree stmt, int flags) +{ + op_iter_init (ptr, stmt, flags); + return op_iter_next_tree (ptr); +} + +/* Get the next iterator maydef value for PTR, returning the maydef values in + USE and DEF. */ +static inline void +op_iter_next_maydef (use_operand_p *use, def_operand_p *def, ssa_op_iter *ptr) +{ + if (ptr->v_mayu_i < ptr->num_v_mayu) + { + *def = V_MAY_DEF_RESULT_PTR (ptr->ops->v_may_def_ops, ptr->v_mayu_i); + *use = V_MAY_DEF_OP_PTR (ptr->ops->v_may_def_ops, (ptr->v_mayu_i)++); + return; + } + else + { + *def = NULL_DEF_OPERAND_P; + *use = NULL_USE_OPERAND_P; + } + ptr->done = true; + return; +} + +/* Initialize iterator PTR to the operands in STMT. Return the first operands + in USE and DEF. */ +static inline void +op_iter_init_maydef (ssa_op_iter *ptr, tree stmt, use_operand_p *use, + def_operand_p *def) +{ + op_iter_init (ptr, stmt, SSA_OP_VMAYUSE); + op_iter_next_maydef (use, def, ptr); +} #endif /* _TREE_FLOW_INLINE_H */ |