diff options
author | Daniel Berlin <dberlin@dberlin.org> | 2004-10-27 17:45:21 +0000 |
---|---|---|
committer | Daniel Berlin <dberlin@gcc.gnu.org> | 2004-10-27 17:45:21 +0000 |
commit | 52328bf6c8b1a5021ae5cae29b8317123d2a58f5 (patch) | |
tree | 36b6b5291cd04acd1807e64b366402dc565251b6 /gcc/tree-flow-inline.h | |
parent | 47a3c2dcc616e8eace211fac58278055b0ebb3ba (diff) | |
download | gcc-52328bf6c8b1a5021ae5cae29b8317123d2a58f5.zip gcc-52328bf6c8b1a5021ae5cae29b8317123d2a58f5.tar.gz gcc-52328bf6c8b1a5021ae5cae29b8317123d2a58f5.tar.bz2 |
re PR tree-optimization/17133 (wrong code with -ftree-lim)
2004-10-27 Daniel Berlin <dberlin@dberlin.org>
Fix PR tree-optimization/17133
* tree-cfg.c (rewrite_to_new_ssa_names_bb): Also rewrite must
def kill operand.
* tree-flow-inline.h: V_MUST_DEF_OP became V_MUST_DEF_RESULT.
(get_v_must_def_result_ptr): Modify for new structure of
v_must_defs array.
(get_v_must_def_kill_ptr): New.
(op_iter_next_use): Add support for the kill that occurs in V_MUST_DEFs.
(op_iter_next_tree): Ditto. Also V_MAY_DEF_OP became V_MAY_DEF_RESULT.
(op_iter_next_def): V_MAY_DEF_OP became V_MAY_DEF_RESULT.
(op_iter_init): Initialize new mustu members.
(op_iter_next_mustdef): New function.
(op_iter_init_mustdef): Ditto.
* tree-flow.h (rewrite_def_def_chains): New function.
* tree-into-ssa.c (mark_def_sites): Handle mustdefkill operands.
(ssa_mark_def_sites): Ditto.
(rewrite_stmt): Ditto.
(ssa_rewrite_stmt): Ditto.
(rewrite_blocks): Factor out from rewrite_into_ssa.
(mark_def_block_sites): Ditto.
(rewrite_def_def_chains): New function, just rewrites def-def
chains without phi node insertion.
* tree-pass.h (TODO_fix_def_def_chains): New todo flag.
* tree-optimize.c (execute_todo): Handle TODO_fix_def_def_chains.
* tree-pretty-print.c (dump_vops): Print out MUST_DEF's so that
they include the rhs now.
* tree-ssa-ccp.c (visit_assignment): V_MUST_DEF_OP became
V_MUST_DEF_RESULT.
* tree-ssa-dce.c (mark_operand_necessary): Add phionly argument.
Update callers.
(mark_really_necessary_kill_operand_phis): New function.
(perform_tree_ssa_dce): Call it.
(pass_dce): Add TODO_fix_def_def_chains.
(pass_cd_dce): Ditto.
* tree-ssa-loop-im.c (determine_max_movement): Look at kills as
well.
(rewrite_mem_refs): Ditto.
* tree-ssa-loop-manip.c (find_uses_to_rename_stmt): Look at kills
as well.
* tree-ssa-operands.c (allocate_v_may_def_optype):
v_may_def_operand_type_t became v_def_use_operand_type_t.
(allocate_v_must_def_optype) Ditto.
(finalize_ssa_v_must_defs): Update for new operand type, as well
as setting the use portion as well.
(copy_virtual_operands): Copy the kill operand as well.
(create_ssa_artficial_load_stmt): V_MUST_DEF_OP became
V_MUST_DEF_RESULT.
* tree-ssa-operands.h (v_may_def_operand_type): Renamed to
v_def_use_operand_type.
(v_must_def_optype_d): Use v_def_use_operand_type.
(V_MUST_DEF_OP_*): Renamed to V_MUST_DEF_RESULT_*
(V_MUST_DEF_KILL_*): New macros.
(struct ssa_operand_iterator_d): Add num_v_mustu and v_mustu_i
members.
Rename existing must_i and num_v_must members to mustd_i and
num_v_mustd.
(SSA_OP_VMUSTDEFKILL): New flag.
(SSA_OP_VIRTUAL_KILLS): New flag.
(SSA_OP_ALL_OPERANDS): Add in SSA_OP_ALL_KILLS.
(SSA_OP_ALL_KILLS): New flag.
(FOR_EACH_SSA_MUSTDEF_OPERAND): New macro.
* tree-ssa.c (verify_ssa): Verify virtual kills as well.
* tree-vectorizer.c (vect_create_data_ref_ptr): V_MUST_DEF_OP
became V_MUST_DEF_RESULT.
(rename_variables_in_bb): Rename kill pointer as well.
* tree-dfa.c (compute_immediate_uses_for_stmt): Add kills into the
immediate uses.
From-SVN: r89695
Diffstat (limited to 'gcc/tree-flow-inline.h')
-rw-r--r-- | gcc/tree-flow-inline.h | 76 |
1 files changed, 64 insertions, 12 deletions
diff --git a/gcc/tree-flow-inline.h b/gcc/tree-flow-inline.h index 0507921..e3c955e 100644 --- a/gcc/tree-flow-inline.h +++ b/gcc/tree-flow-inline.h @@ -267,14 +267,25 @@ get_vuse_op_ptr(vuse_optype vuses, unsigned int index) return op; } -/* Return a def_operand_p that is the V_MUST_DEF_OP for the +/* Return a def_operand_p that is the V_MUST_DEF_RESULT for the V_MUST_DEF at INDEX in the V_MUST_DEFS array. */ static inline def_operand_p -get_v_must_def_op_ptr (v_must_def_optype v_must_defs, unsigned int index) +get_v_must_def_result_ptr (v_must_def_optype v_must_defs, unsigned int index) { def_operand_p op; gcc_assert (index < v_must_defs->num_v_must_defs); - op.def = &(v_must_defs->v_must_defs[index]); + op.def = &(v_must_defs->v_must_defs[index].def); + return op; +} + +/* Return a use_operand_p that is the V_MUST_DEF_KILL for the + V_MUST_DEF at INDEX in the V_MUST_DEFS array. */ +static inline use_operand_p +get_v_must_def_kill_ptr (v_must_def_optype v_must_defs, unsigned int index) +{ + use_operand_p op; + gcc_assert (index < v_must_defs->num_v_must_defs); + op.use = &(v_must_defs->v_must_defs[index].use); return op; } @@ -670,7 +681,12 @@ op_iter_next_use (ssa_op_iter *ptr) 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->v_mayu_i)++); + } + if (ptr->v_mustu_i < ptr->num_v_mustu) + { + return V_MUST_DEF_KILL_PTR (ptr->ops->v_must_def_ops, + (ptr->v_mustu_i)++); } ptr->done = true; return NULL_USE_OPERAND_P; @@ -684,10 +700,10 @@ op_iter_next_def (ssa_op_iter *ptr) { return DEF_OP_PTR (ptr->ops->def_ops, (ptr->def_i)++); } - if (ptr->v_must_i < ptr->num_v_must) + if (ptr->v_mustd_i < ptr->num_v_mustd) { - return V_MUST_DEF_OP_PTR (ptr->ops->v_must_def_ops, - (ptr->v_must_i)++); + return V_MUST_DEF_RESULT_PTR (ptr->ops->v_must_def_ops, + (ptr->v_mustd_i)++); } if (ptr->v_mayd_i < ptr->num_v_mayd) { @@ -714,14 +730,18 @@ op_iter_next_tree (ssa_op_iter *ptr) { return V_MAY_DEF_OP (ptr->ops->v_may_def_ops, (ptr->v_mayu_i)++); } + if (ptr->v_mustu_i < ptr->num_v_mustu) + { + return V_MUST_DEF_KILL (ptr->ops->v_must_def_ops, (ptr->v_mustu_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) + if (ptr->v_mustd_i < ptr->num_v_mustd) { - return V_MUST_DEF_OP (ptr->ops->v_must_def_ops, - (ptr->v_must_i)++); + return V_MUST_DEF_RESULT (ptr->ops->v_must_def_ops, + (ptr->v_mustd_i)++); } if (ptr->v_mayd_i < ptr->num_v_mayd) { @@ -749,14 +769,17 @@ op_iter_init (ssa_op_iter *ptr, tree stmt, int flags) ? 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) + ptr->num_v_mustu = (flags & SSA_OP_VMUSTDEFKILL) + ? NUM_V_MUST_DEFS (ops->v_must_def_ops) : 0; + ptr->num_v_mustd = (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; + ptr->v_mustu_i = 0; + ptr->v_mustd_i = 0; } /* Initialize iterator PTR to the use operands in STMT based on FLAGS. Return @@ -786,6 +809,25 @@ op_iter_init_tree (ssa_op_iter *ptr, tree stmt, int flags) return op_iter_next_tree (ptr); } +/* Get the next iterator mustdef value for PTR, returning the mustdef values in + KILL and DEF. */ +static inline void +op_iter_next_mustdef (use_operand_p *kill, def_operand_p *def, ssa_op_iter *ptr) +{ + if (ptr->v_mustu_i < ptr->num_v_mustu) + { + *def = V_MUST_DEF_RESULT_PTR (ptr->ops->v_must_def_ops, ptr->v_mustu_i); + *kill = V_MUST_DEF_KILL_PTR (ptr->ops->v_must_def_ops, (ptr->v_mustu_i)++); + return; + } + else + { + *def = NULL_DEF_OPERAND_P; + *kill = NULL_USE_OPERAND_P; + } + ptr->done = true; + return; +} /* Get the next iterator maydef value for PTR, returning the maydef values in USE and DEF. */ static inline void @@ -815,4 +857,14 @@ op_iter_init_maydef (ssa_op_iter *ptr, tree stmt, use_operand_p *use, op_iter_init (ptr, stmt, SSA_OP_VMAYUSE); op_iter_next_maydef (use, def, ptr); } + +/* Initialize iterator PTR to the operands in STMT. Return the first operands + in KILL and DEF. */ +static inline void +op_iter_init_mustdef (ssa_op_iter *ptr, tree stmt, use_operand_p *kill, + def_operand_p *def) +{ + op_iter_init (ptr, stmt, SSA_OP_VMUSTDEFKILL); + op_iter_next_mustdef (kill, def, ptr); +} #endif /* _TREE_FLOW_INLINE_H */ |