* [gimple-classes, committed 19/92] Introduce gimple_return
2014-10-27 20:35 [gimple-classes, committed 00/92] Initial slew of commits David Malcolm
` (6 preceding siblings ...)
2014-10-27 20:35 ` [gimple-classes, committed 22/92] Introduce gimple_transaction David Malcolm
@ 2014-10-27 20:35 ` David Malcolm
2014-10-27 20:35 ` [gimple-classes, committed 38/92] tree-cfg.c: Make verify_gimple_call require a gimple_call David Malcolm
` (83 subsequent siblings)
91 siblings, 0 replies; 93+ messages in thread
From: David Malcolm @ 2014-10-27 20:35 UTC (permalink / raw)
To: gcc-patches; +Cc: David Malcolm
This corresponds to:
[PATCH 21/89] Introduce gimple_return
https://gcc.gnu.org/ml/gcc-patches/2014-04/msg01180.html
from the original 89-patch kit
That earlier patch was approved by Jeff:
> OK after fixing up the naming/const stuff as discussed for prior
> patches.
> That applies to 22-30. Make sure to take care of
> the pretty printers per Trevor's comments as well. He indicated those
> were missing in a couple of those patches.
in https://gcc.gnu.org/ml/gcc-patches/2014-05/msg00628.html
gcc/
* coretypes.h (gimple_return): New typedef.
(const_gimple_return): New typedef.
* gimple.h (gimple_statement_return): New subclass of
gimple_statement_with_memory_ops, adding the invariant that
stmt->code == GIMPLE_RETURN.
(is_a_helper <gimple_statement_return>::test): New.
(gimple_build_return): Return a gimple_return rather
than a plain gimple.
* gimple.c (gimple_build_return): Return a gimple_return rather
than a plain gimple.
* cgraphunit.c (expand_thunk): Convert local from a gimple to
a gimple_return.
* gimple-low.c (struct return_statements_t): Convert field "stmt"
from a gimple to a gimple_return.
(lower_gimple_return): Convert local from a gimple to a
gimple_return.
* gimple-pretty-print.c (dump_gimple_return): Require a
gimple_return rather than a plain gimple.
(pp_gimple_stmt_1): Add a checked cast to gimple_return within
case GIMPLE_RETURN of switch statement.
* gimplify.c (gimplify_return_expr): Convert locals from
gimple to gimple_return.
* ipa-split.c (split_function): Likewise.
* tree-cfg.c (verify_gimple_assign): Require a gimple_return
rather than a plain gimple.
(verify_gimple_stmt): Add checked cast to gimple_return within
case GIMPLE_RETURN of switch statement.
* tree-tailcall.c (adjust_return_value): Convert local from
gimple to gimple_return.
---
gcc/ChangeLog.gimple-classes | 43 +++++++++++++++++++++++++++++++++++++++++++
gcc/cgraphunit.c | 2 +-
gcc/coretypes.h | 4 ++++
gcc/gimple-low.c | 4 ++--
gcc/gimple-pretty-print.c | 4 ++--
gcc/gimple.c | 6 ++++--
gcc/gimple.h | 24 +++++++++++++++++++++---
gcc/gimplify.c | 4 ++--
gcc/ipa-split.c | 2 +-
gcc/omp-low.c | 3 ++-
gcc/tree-cfg.c | 4 ++--
gcc/tree-tailcall.c | 3 ++-
12 files changed, 86 insertions(+), 17 deletions(-)
diff --git a/gcc/ChangeLog.gimple-classes b/gcc/ChangeLog.gimple-classes
index ba0bde6..5508788 100644
--- a/gcc/ChangeLog.gimple-classes
+++ b/gcc/ChangeLog.gimple-classes
@@ -1,5 +1,48 @@
2014-10-24 David Malcolm <dmalcolm@redhat.com>
+ Introduce gimple_return
+
+ * coretypes.h (gimple_return): New typedef.
+ (const_gimple_return): New typedef.
+
+ * gimple.h (gimple_statement_return): New subclass of
+ gimple_statement_with_memory_ops, adding the invariant that
+ stmt->code == GIMPLE_RETURN.
+ (is_a_helper <gimple_statement_return>::test): New.
+ (gimple_build_return): Return a gimple_return rather
+ than a plain gimple.
+
+ * gimple.c (gimple_build_return): Return a gimple_return rather
+ than a plain gimple.
+
+ * cgraphunit.c (expand_thunk): Convert local from a gimple to
+ a gimple_return.
+
+ * gimple-low.c (struct return_statements_t): Convert field "stmt"
+ from a gimple to a gimple_return.
+ (lower_gimple_return): Convert local from a gimple to a
+ gimple_return.
+
+ * gimple-pretty-print.c (dump_gimple_return): Require a
+ gimple_return rather than a plain gimple.
+ (pp_gimple_stmt_1): Add a checked cast to gimple_return within
+ case GIMPLE_RETURN of switch statement.
+
+ * gimplify.c (gimplify_return_expr): Convert locals from
+ gimple to gimple_return.
+
+ * ipa-split.c (split_function): Likewise.
+
+ * tree-cfg.c (verify_gimple_assign): Require a gimple_return
+ rather than a plain gimple.
+ (verify_gimple_stmt): Add checked cast to gimple_return within
+ case GIMPLE_RETURN of switch statement.
+
+ * tree-tailcall.c (adjust_return_value): Convert local from
+ gimple to gimple_return.
+
+2014-10-24 David Malcolm <dmalcolm@redhat.com>
+
Introduce gimple_call
* coretypes.h (gimple_call): New typedef.
diff --git a/gcc/cgraphunit.c b/gcc/cgraphunit.c
index 723ec5e..98d34be 100644
--- a/gcc/cgraphunit.c
+++ b/gcc/cgraphunit.c
@@ -1496,7 +1496,7 @@ cgraph_node::expand_thunk (bool output_asm_thunks, bool force_gimple_thunk)
tree restmp = NULL;
gimple_call call;
- gimple ret;
+ gimple_return ret;
if (in_lto_p)
get_body ();
diff --git a/gcc/coretypes.h b/gcc/coretypes.h
index 4981e7c..f726053 100644
--- a/gcc/coretypes.h
+++ b/gcc/coretypes.h
@@ -114,6 +114,10 @@ struct gimple_statement_call;
typedef struct gimple_statement_call *gimple_call;
typedef const struct gimple_statement_call *const_gimple_call;
+struct gimple_statement_return;
+typedef struct gimple_statement_return *gimple_return;
+typedef const struct gimple_statement_return *const_gimple_return;
+
struct gimple_statement_bind;
typedef struct gimple_statement_bind *gimple_bind;
typedef const struct gimple_statement_bind *const_gimple_bind;
diff --git a/gcc/gimple-low.c b/gcc/gimple-low.c
index ef84c28..04f87e2 100644
--- a/gcc/gimple-low.c
+++ b/gcc/gimple-low.c
@@ -60,7 +60,7 @@ along with GCC; see the file COPYING3. If not see
struct return_statements_t
{
tree label;
- gimple stmt;
+ gimple_return stmt;
};
typedef struct return_statements_t return_statements_t;
@@ -619,7 +619,7 @@ gimple_seq_may_fallthru (gimple_seq seq)
static void
lower_gimple_return (gimple_stmt_iterator *gsi, struct lower_data *data)
{
- gimple stmt = gsi_stmt (*gsi);
+ gimple_return stmt = as_a <gimple_return> (gsi_stmt (*gsi));
gimple t;
int i;
return_statements_t tmp_rs;
diff --git a/gcc/gimple-pretty-print.c b/gcc/gimple-pretty-print.c
index a1e1f1f..cfc111c 100644
--- a/gcc/gimple-pretty-print.c
+++ b/gcc/gimple-pretty-print.c
@@ -555,7 +555,7 @@ dump_gimple_assign (pretty_printer *buffer, gimple_assign gs, int spc, int flags
pp_gimple_stmt_1. */
static void
-dump_gimple_return (pretty_printer *buffer, gimple gs, int spc, int flags)
+dump_gimple_return (pretty_printer *buffer, gimple_return gs, int spc, int flags)
{
tree t;
@@ -2117,7 +2117,7 @@ pp_gimple_stmt_1 (pretty_printer *buffer, gimple gs, int spc, int flags)
break;
case GIMPLE_RETURN:
- dump_gimple_return (buffer, gs, spc, flags);
+ dump_gimple_return (buffer, as_a <gimple_return> (gs), spc, flags);
break;
case GIMPLE_SWITCH:
diff --git a/gcc/gimple.c b/gcc/gimple.c
index 5f5b33f..e8c0a62 100644
--- a/gcc/gimple.c
+++ b/gcc/gimple.c
@@ -177,10 +177,12 @@ gimple_build_with_ops_stat (enum gimple_code code, unsigned subcode,
/* Build a GIMPLE_RETURN statement returning RETVAL. */
-gimple
+gimple_return
gimple_build_return (tree retval)
{
- gimple s = gimple_build_with_ops (GIMPLE_RETURN, ERROR_MARK, 1);
+ gimple_return s =
+ as_a <gimple_return> (gimple_build_with_ops (GIMPLE_RETURN, ERROR_MARK,
+ 1));
if (retval)
gimple_return_set_retval (s, retval);
return s;
diff --git a/gcc/gimple.h b/gcc/gimple.h
index e68cc44..559d281 100644
--- a/gcc/gimple.h
+++ b/gcc/gimple.h
@@ -823,6 +823,16 @@ struct GTY((tag("GSS_WITH_MEM_OPS")))
/* no additional fields; this uses the layout for GSS_WITH_MEM_OPS. */
};
+/* A statement with the invariant that
+ stmt->code == GIMPLE_RETURN
+ i.e. a return statement. */
+
+struct GTY((tag("GSS_WITH_MEM_OPS")))
+ gimple_statement_return : public gimple_statement_with_memory_ops
+{
+ /* no additional fields; this uses the layout for GSS_WITH_MEM_OPS. */
+};
+
template <>
template <>
inline bool
@@ -1042,9 +1052,9 @@ is_a_helper <gimple_statement_phi *>::test (gimple gs)
template <>
template <>
inline bool
-is_a_helper <gimple_statement_transaction *>::test (gimple gs)
+is_a_helper <gimple_statement_return *>::test (gimple gs)
{
- return gs->code == GIMPLE_TRANSACTION;
+ return gs->code == GIMPLE_RETURN;
}
template <>
@@ -1058,6 +1068,14 @@ is_a_helper <gimple_statement_switch *>::test (gimple gs)
template <>
template <>
inline bool
+is_a_helper <gimple_statement_transaction *>::test (gimple gs)
+{
+ return gs->code == GIMPLE_TRANSACTION;
+}
+
+template <>
+template <>
+inline bool
is_a_helper <gimple_statement_try *>::test (gimple gs)
{
return gs->code == GIMPLE_TRY;
@@ -1260,7 +1278,7 @@ extern gimple currently_expanding_gimple_stmt;
#define gimple_alloc(c, n) gimple_alloc_stat (c, n MEM_STAT_INFO)
gimple gimple_alloc_stat (enum gimple_code, unsigned MEM_STAT_DECL);
-gimple gimple_build_return (tree);
+gimple_return gimple_build_return (tree);
void gimple_call_reset_alias_info (gimple_call);
gimple_call gimple_build_call_vec (tree, vec<tree> );
gimple_call gimple_build_call (tree, unsigned, ...);
diff --git a/gcc/gimplify.c b/gcc/gimplify.c
index a20c59d..af64e45 100644
--- a/gcc/gimplify.c
+++ b/gcc/gimplify.c
@@ -1191,7 +1191,7 @@ gimplify_bind_expr (tree *expr_p, gimple_seq *pre_p)
static enum gimplify_status
gimplify_return_expr (tree stmt, gimple_seq *pre_p)
{
- gimple ret;
+ gimple_return ret;
tree ret_expr = TREE_OPERAND (stmt, 0);
tree result_decl, result;
@@ -1211,7 +1211,7 @@ gimplify_return_expr (tree stmt, gimple_seq *pre_p)
|| TREE_CODE (ret_expr) == RESULT_DECL
|| ret_expr == error_mark_node)
{
- gimple ret = gimple_build_return (ret_expr);
+ gimple_return ret = gimple_build_return (ret_expr);
gimple_set_no_warning (ret, TREE_NO_WARNING (stmt));
gimplify_seq_add_stmt (pre_p, ret);
return GS_ALL_DONE;
diff --git a/gcc/ipa-split.c b/gcc/ipa-split.c
index 572467c..9c02f96 100644
--- a/gcc/ipa-split.c
+++ b/gcc/ipa-split.c
@@ -1489,7 +1489,7 @@ split_function (struct split_point *split_point)
*/
else
{
- gimple ret;
+ gimple_return ret;
if (split_point->split_part_set_retval
&& !VOID_TYPE_P (TREE_TYPE (TREE_TYPE (current_function_decl))))
{
diff --git a/gcc/omp-low.c b/gcc/omp-low.c
index 0a4f572..58a958e 100644
--- a/gcc/omp-low.c
+++ b/gcc/omp-low.c
@@ -9911,7 +9911,8 @@ lower_omp_taskreg (gimple_stmt_iterator *gsi_p, omp_context *ctx)
location_t loc = gimple_location (stmt);
clauses = gimple_omp_taskreg_clauses (stmt);
- par_bind = gimple_seq_first_stmt_as_a_bind (gimple_omp_body (stmt));
+ par_bind =
+ as_a <gimple_bind> (gimple_seq_first_stmt (gimple_omp_body (stmt)));
par_body = gimple_bind_body (par_bind);
child_fn = ctx->cb.dst_fn;
if (gimple_code (stmt) == GIMPLE_OMP_PARALLEL
diff --git a/gcc/tree-cfg.c b/gcc/tree-cfg.c
index c852d7a..ea5bc73 100644
--- a/gcc/tree-cfg.c
+++ b/gcc/tree-cfg.c
@@ -4262,7 +4262,7 @@ verify_gimple_assign (gimple_assign stmt)
is a problem, otherwise false. */
static bool
-verify_gimple_return (gimple stmt)
+verify_gimple_return (gimple_return stmt)
{
tree op = gimple_return_retval (stmt);
tree restype = TREE_TYPE (TREE_TYPE (cfun->decl));
@@ -4510,7 +4510,7 @@ verify_gimple_stmt (gimple stmt)
return verify_gimple_switch (as_a <gimple_switch> (stmt));
case GIMPLE_RETURN:
- return verify_gimple_return (stmt);
+ return verify_gimple_return (as_a <gimple_return> (stmt));
case GIMPLE_ASM:
return false;
diff --git a/gcc/tree-tailcall.c b/gcc/tree-tailcall.c
index 361f2ea..ff8236d 100644
--- a/gcc/tree-tailcall.c
+++ b/gcc/tree-tailcall.c
@@ -747,7 +747,8 @@ static void
adjust_return_value (basic_block bb, tree m, tree a)
{
tree retval;
- gimple ret_stmt = gimple_seq_last_stmt (bb_seq (bb));
+ gimple_return ret_stmt =
+ as_a <gimple_return> (gimple_seq_last_stmt (bb_seq (bb)));
gimple_stmt_iterator gsi = gsi_last_bb (bb);
gcc_assert (gimple_code (ret_stmt) == GIMPLE_RETURN);
--
1.8.5.3
^ permalink raw reply [flat|nested] 93+ messages in thread
* [gimple-classes, committed 03/92] Introduce gimple_cond and use it in various places
2014-10-27 20:35 [gimple-classes, committed 00/92] Initial slew of commits David Malcolm
` (8 preceding siblings ...)
2014-10-27 20:35 ` [gimple-classes, committed 38/92] tree-cfg.c: Make verify_gimple_call require a gimple_call David Malcolm
@ 2014-10-27 20:35 ` David Malcolm
2014-10-27 20:36 ` [gimple-classes, committed 40/92] Introduce gimple_omp_single David Malcolm
` (81 subsequent siblings)
91 siblings, 0 replies; 93+ messages in thread
From: David Malcolm @ 2014-10-27 20:35 UTC (permalink / raw)
To: gcc-patches; +Cc: David Malcolm
This corresponds to:
[PATCH 04/89] Introduce gimple_cond and use it in various places
https://gcc.gnu.org/ml/gcc-patches/2014-04/msg01153.html
from the original 89-patch kit
That earlier patch was approved by Jeff:
> This is generally fine. It needs minor tweaks due to the change in how
> we're handling const stuff, but otherwise it looks ready to go.
> So, once you've flushed the queue of dependencies and reworked
> this to fit into the new world order, it's OK for the trunk. Please
> post the final version for archival purposes.
in https://gcc.gnu.org/ml/gcc-patches/2014-05/msg00595.html
gcc/
* coretypes.h (gimple_cond): New typedef.
(const_gimple_cond): Likewise.
* gimple.h (struct gimple_statement_cond): New subclass of
gimple_statement_with_ops, adding the invariant that
stmt->code == GIMPLE_COND.
(is_a_helper <gimple_statement_cond>::test): New.
(gimple_build_cond): Return a gimple_cond, rather than just
a gimple.
(gimple_build_cond_from_tree): Likewise.
* gdbhooks.py (build_pretty_printer): Add gimple_cond and its
variants, using the gimple printer.
* cfgexpand.c (expand_gimple_cond): Require a gimple_cond rather
than just a gimple.
* gimple.h (gimple_cond_set_condition_from_tree): Likewise.
(gimple_cond_true_p): Likewise.
(gimple_cond_false_p): Likewise.
(gimple_cond_set_condition): Likewise.
* gimple.c (gimple_cond_set_condition_from_tree): Likewise.
* gimple-fold.c (fold_gimple_cond): Likewise.
* gimple-pretty-print.c (dump_gimple_cond): Likewise.
* tree-ssa-dom.c (canonicalize_comparison): Likewise.
* tree-ssa-forwprop.c (forward_propagate_into_gimple_cond): Likewise.
* tree-ssa-ifcombine.c (recognize_single_bit_test): Likewise.
(recognize_bits_test): Likewise.
* tree-ssa-threadedge.c (simplify_control_stmt_condition): Likewise.
(thread_around_empty_blocks): Likewise.
(thread_through_normal_block): Likewise.
(thread_across_edge): Likewise.
* tree-ssa-threadedge.h (thread_across_edge): Likewise.
* tree-vrp.c (range_fits_type_p): Likewise.
* cfgexpand.c (expand_gimple_basic_block): Add checked cast to
gimple_cond in regions where a stmt is known to have code GIMPLE_COND.
* gimple-fold.c (fold_stmt_1): Likewise.
* gimple-pretty-print.c (pp_gimple_stmt_1): Likewise.
* tree-ssa-dom.c (optimize_stmt): Likewise.
* tree-ssa-forwprop.c (ssa_forward_propagate_and_combine): Likewise.
* tree-ssa-loop-unswitch.c (tree_unswitch_single_loop): Likewise.
* tree-ssa-pre.c (eliminate_dom_walker::before_dom_children):
Likewise.
* tree-vrp.c (simplify_stmt_using_ranges): Likewise.
* cfgloopmanip.c (create_empty_loop_on_edge): Update local to be a
gimple_cond.
* tree-vrp.c (identify_jump_threads): Likewise.
* gimple.c (gimple_build_cond): Return a gimple_cond, rather than
just a gimple.
(gimple_build_cond_from_tree): Likewise.
* tree-ssa-dom.c (class dom_opt_dom_walker): Strengthen type of
field "m_dummy_cond" from a plain gimple to a gimple_cond.
* tree-ssa-ifcombine.c (ifcombine_ifandif): Introduce locals
inner_stmt and outer_stmt so that inner_cond and outer_cond can be
of type gimple_cond once we know that we have code == GIMPLE_COND.
* tree-ssa-loop-unswitch.c (tree_may_unswitch_on): Introduce local
"last" so that stmt can be of type gimple_cond.
---
gcc/ChangeLog.gimple-classes | 66 ++++++++++++++++++++++++++++++++++++++++++++
gcc/cfgexpand.c | 4 +--
gcc/cfgloopmanip.c | 2 +-
gcc/coretypes.h | 4 +++
gcc/gdbhooks.py | 2 ++
gcc/gimple-fold.c | 4 +--
gcc/gimple-pretty-print.c | 4 +--
gcc/gimple.c | 10 +++----
gcc/gimple.h | 31 +++++++++++++++++----
gcc/tree-ssa-dom.c | 6 ++--
gcc/tree-ssa-forwprop.c | 5 ++--
gcc/tree-ssa-ifcombine.c | 21 ++++++++------
gcc/tree-ssa-loop-unswitch.c | 19 ++++++++-----
gcc/tree-ssa-pre.c | 4 +--
gcc/tree-ssa-threadedge.c | 8 +++---
gcc/tree-ssa-threadedge.h | 2 +-
gcc/tree-vrp.c | 6 ++--
17 files changed, 149 insertions(+), 49 deletions(-)
diff --git a/gcc/ChangeLog.gimple-classes b/gcc/ChangeLog.gimple-classes
index dc1edc86..a7d756e 100644
--- a/gcc/ChangeLog.gimple-classes
+++ b/gcc/ChangeLog.gimple-classes
@@ -1,5 +1,71 @@
2014-10-24 David Malcolm <dmalcolm@redhat.com>
+ Introduce gimple_cond and use it in various places
+
+ * coretypes.h (gimple_cond): New typedef.
+ (const_gimple_cond): Likewise.
+
+ * gimple.h (struct gimple_statement_cond): New subclass of
+ gimple_statement_with_ops, adding the invariant that
+ stmt->code == GIMPLE_COND.
+ (is_a_helper <gimple_statement_cond>::test): New.
+ (gimple_build_cond): Return a gimple_cond, rather than just
+ a gimple.
+ (gimple_build_cond_from_tree): Likewise.
+
+ * gdbhooks.py (build_pretty_printer): Add gimple_cond and its
+ variants, using the gimple printer.
+
+ * cfgexpand.c (expand_gimple_cond): Require a gimple_cond rather
+ than just a gimple.
+ * gimple.h (gimple_cond_set_condition_from_tree): Likewise.
+ (gimple_cond_true_p): Likewise.
+ (gimple_cond_false_p): Likewise.
+ (gimple_cond_set_condition): Likewise.
+ * gimple.c (gimple_cond_set_condition_from_tree): Likewise.
+ * gimple-fold.c (fold_gimple_cond): Likewise.
+ * gimple-pretty-print.c (dump_gimple_cond): Likewise.
+ * tree-ssa-dom.c (canonicalize_comparison): Likewise.
+ * tree-ssa-forwprop.c (forward_propagate_into_gimple_cond): Likewise.
+ * tree-ssa-ifcombine.c (recognize_single_bit_test): Likewise.
+ (recognize_bits_test): Likewise.
+ * tree-ssa-threadedge.c (simplify_control_stmt_condition): Likewise.
+ (thread_around_empty_blocks): Likewise.
+ (thread_through_normal_block): Likewise.
+ (thread_across_edge): Likewise.
+ * tree-ssa-threadedge.h (thread_across_edge): Likewise.
+ * tree-vrp.c (range_fits_type_p): Likewise.
+
+ * cfgexpand.c (expand_gimple_basic_block): Add checked cast to
+ gimple_cond in regions where a stmt is known to have code GIMPLE_COND.
+ * gimple-fold.c (fold_stmt_1): Likewise.
+ * gimple-pretty-print.c (pp_gimple_stmt_1): Likewise.
+ * tree-ssa-dom.c (optimize_stmt): Likewise.
+ * tree-ssa-forwprop.c (ssa_forward_propagate_and_combine): Likewise.
+ * tree-ssa-loop-unswitch.c (tree_unswitch_single_loop): Likewise.
+ * tree-ssa-pre.c (eliminate_dom_walker::before_dom_children):
+ Likewise.
+ * tree-vrp.c (simplify_stmt_using_ranges): Likewise.
+
+ * cfgloopmanip.c (create_empty_loop_on_edge): Update local to be a
+ gimple_cond.
+ * tree-vrp.c (identify_jump_threads): Likewise.
+
+ * gimple.c (gimple_build_cond): Return a gimple_cond, rather than
+ just a gimple.
+ (gimple_build_cond_from_tree): Likewise.
+
+ * tree-ssa-dom.c (class dom_opt_dom_walker): Strengthen type of
+ field "m_dummy_cond" from a plain gimple to a gimple_cond.
+
+ * tree-ssa-ifcombine.c (ifcombine_ifandif): Introduce locals
+ inner_stmt and outer_stmt so that inner_cond and outer_cond can be
+ of type gimple_cond once we know that we have code == GIMPLE_COND.
+ * tree-ssa-loop-unswitch.c (tree_may_unswitch_on): Introduce local
+ "last" so that stmt can be of type gimple_cond.
+
+2014-10-24 David Malcolm <dmalcolm@redhat.com>
+
Introduce gimple_bind and use it for accessors.
* coretypes.h (gimple_bind): New typedef.
diff --git a/gcc/cfgexpand.c b/gcc/cfgexpand.c
index b32dc15..200cda6 100644
--- a/gcc/cfgexpand.c
+++ b/gcc/cfgexpand.c
@@ -2070,7 +2070,7 @@ maybe_cleanup_end_of_block (edge e, rtx_insn *last)
block and created a new one. */
static basic_block
-expand_gimple_cond (basic_block bb, gimple stmt)
+expand_gimple_cond (basic_block bb, gimple_cond stmt)
{
basic_block new_bb, dest;
edge new_edge;
@@ -5071,7 +5071,7 @@ expand_gimple_basic_block (basic_block bb, bool disable_tail_calls)
fixup the CFG accordingly. */
if (gimple_code (stmt) == GIMPLE_COND)
{
- new_bb = expand_gimple_cond (bb, stmt);
+ new_bb = expand_gimple_cond (bb, as_a <gimple_cond> (stmt));
if (new_bb)
return new_bb;
}
diff --git a/gcc/cfgloopmanip.c b/gcc/cfgloopmanip.c
index 83a0d51..3fa2535 100644
--- a/gcc/cfgloopmanip.c
+++ b/gcc/cfgloopmanip.c
@@ -776,7 +776,7 @@ create_empty_loop_on_edge (edge entry_edge,
struct loop *loop;
gimple_stmt_iterator gsi;
gimple_seq stmts;
- gimple cond_expr;
+ gimple_cond cond_expr;
tree exit_test;
edge exit_e;
int prob;
diff --git a/gcc/coretypes.h b/gcc/coretypes.h
index 9beb07c..ae60592 100644
--- a/gcc/coretypes.h
+++ b/gcc/coretypes.h
@@ -90,6 +90,10 @@ struct gimple_stmt_iterator;
/* Typedefs for leaf gimple subclasses (for individual gimple codes).
Keep this in the same order as the corresponding codes in gimple.def. */
+struct gimple_statement_cond;
+typedef struct gimple_statement_cond *gimple_cond;
+typedef const struct gimple_statement_cond *const_gimple_cond;
+
struct gimple_statement_switch;
typedef struct gimple_statement_switch *gimple_switch;
typedef const struct gimple_statement_switch *const_gimple_switch;
diff --git a/gcc/gdbhooks.py b/gcc/gdbhooks.py
index 48a0658..9be0ab2 100644
--- a/gcc/gdbhooks.py
+++ b/gcc/gdbhooks.py
@@ -458,6 +458,8 @@ def build_pretty_printer():
pp.add_printer_for_types(['gimple', 'gimple_statement_base *',
# Keep this in the same order as gimple.def:
+ 'gimple_cond', 'const_gimple_cond',
+ 'gimple_statement_cond *',
'gimple_switch', 'const_gimple_switch',
'gimple_statement_switch *',
'gimple_bind', 'const_gimple_bind',
diff --git a/gcc/gimple-fold.c b/gcc/gimple-fold.c
index a0ce0db..34dd32b 100644
--- a/gcc/gimple-fold.c
+++ b/gcc/gimple-fold.c
@@ -547,7 +547,7 @@ fold_gimple_assign (gimple_stmt_iterator *si)
assumed that the operands have been previously folded. */
static bool
-fold_gimple_cond (gimple stmt)
+fold_gimple_cond (gimple_cond stmt)
{
tree result = fold_binary_loc (gimple_location (stmt),
gimple_cond_code (stmt),
@@ -2925,7 +2925,7 @@ fold_stmt_1 (gimple_stmt_iterator *gsi, bool inplace)
}
case GIMPLE_COND:
- changed |= fold_gimple_cond (stmt);
+ changed |= fold_gimple_cond (as_a <gimple_cond> (stmt));
break;
case GIMPLE_CALL:
diff --git a/gcc/gimple-pretty-print.c b/gcc/gimple-pretty-print.c
index d47236f..9995c87 100644
--- a/gcc/gimple-pretty-print.c
+++ b/gcc/gimple-pretty-print.c
@@ -819,7 +819,7 @@ dump_gimple_switch (pretty_printer *buffer, gimple_switch gs, int spc,
pp_gimple_stmt_1. */
static void
-dump_gimple_cond (pretty_printer *buffer, gimple gs, int spc, int flags)
+dump_gimple_cond (pretty_printer *buffer, gimple_cond gs, int spc, int flags)
{
if (flags & TDF_RAW)
dump_gimple_fmt (buffer, spc, flags, "%G <%s, %T, %T, %T, %T>", gs,
@@ -2101,7 +2101,7 @@ pp_gimple_stmt_1 (pretty_printer *buffer, gimple gs, int spc, int flags)
break;
case GIMPLE_COND:
- dump_gimple_cond (buffer, gs, spc, flags);
+ dump_gimple_cond (buffer, as_a <gimple_cond> (gs), spc, flags);
break;
case GIMPLE_LABEL:
diff --git a/gcc/gimple.c b/gcc/gimple.c
index 64201f0..a75479a 100644
--- a/gcc/gimple.c
+++ b/gcc/gimple.c
@@ -438,14 +438,14 @@ gimple_build_assign_with_ops (enum tree_code subcode, tree lhs, tree op1,
T_LABEL is the label to jump to if the condition is true.
F_LABEL is the label to jump to otherwise. */
-gimple
+gimple_cond
gimple_build_cond (enum tree_code pred_code, tree lhs, tree rhs,
tree t_label, tree f_label)
{
- gimple p;
+ gimple_cond p;
gcc_assert (TREE_CODE_CLASS (pred_code) == tcc_comparison);
- p = gimple_build_with_ops (GIMPLE_COND, pred_code, 4);
+ p = as_a <gimple_cond> (gimple_build_with_ops (GIMPLE_COND, pred_code, 4));
gimple_cond_set_lhs (p, lhs);
gimple_cond_set_rhs (p, rhs);
gimple_cond_set_true_label (p, t_label);
@@ -456,7 +456,7 @@ gimple_build_cond (enum tree_code pred_code, tree lhs, tree rhs,
/* Build a GIMPLE_COND statement from the conditional expression tree
COND. T_LABEL and F_LABEL are as in gimple_build_cond. */
-gimple
+gimple_cond
gimple_build_cond_from_tree (tree cond, tree t_label, tree f_label)
{
enum tree_code code;
@@ -470,7 +470,7 @@ gimple_build_cond_from_tree (tree cond, tree t_label, tree f_label)
boolean expression tree COND. */
void
-gimple_cond_set_condition_from_tree (gimple stmt, tree cond)
+gimple_cond_set_condition_from_tree (gimple_cond stmt, tree cond)
{
enum tree_code code;
tree lhs, rhs;
diff --git a/gcc/gimple.h b/gcc/gimple.h
index 812fc2a..9683bc2 100644
--- a/gcc/gimple.h
+++ b/gcc/gimple.h
@@ -770,6 +770,16 @@ enum gimple_statement_structure_enum {
#undef DEFGSSTRUCT
/* A statement with the invariant that
+ stmt->code == GIMPLE_COND
+ i.e. a conditional jump statement. */
+
+struct GTY((tag("GSS_WITH_OPS")))
+ gimple_statement_cond : public gimple_statement_with_ops
+{
+ /* no additional fields; this uses the layout for GSS_WITH_OPS. */
+};
+
+/* A statement with the invariant that
stmt->code == GIMPLE_SWITCH
i.e. a switch statement. */
@@ -814,6 +824,14 @@ is_a_helper <gimple_statement_catch *>::test (gimple gs)
template <>
template <>
inline bool
+is_a_helper <gimple_statement_cond *>::test (gimple gs)
+{
+ return gs->code == GIMPLE_COND;
+}
+
+template <>
+template <>
+inline bool
is_a_helper <gimple_statement_resx *>::test (gimple gs)
{
return gs->code == GIMPLE_RESX;
@@ -1198,9 +1216,9 @@ gimple gimple_build_assign_with_ops (enum tree_code, tree,
tree, tree, tree CXX_MEM_STAT_INFO);
gimple gimple_build_assign_with_ops (enum tree_code, tree,
tree, tree CXX_MEM_STAT_INFO);
-gimple gimple_build_cond (enum tree_code, tree, tree, tree, tree);
-gimple gimple_build_cond_from_tree (tree, tree, tree);
-void gimple_cond_set_condition_from_tree (gimple, tree);
+gimple_cond gimple_build_cond (enum tree_code, tree, tree, tree, tree);
+gimple_cond gimple_build_cond_from_tree (tree, tree, tree);
+void gimple_cond_set_condition_from_tree (gimple_cond, tree);
gimple gimple_build_label (tree label);
gimple gimple_build_goto (tree dest);
gimple gimple_build_nop (void);
@@ -3041,7 +3059,7 @@ gimple_cond_make_true (gimple gs)
'if (0 == 0)', 'if (1 != 0)' or 'if (0 != 1)' */
static inline bool
-gimple_cond_true_p (const_gimple gs)
+gimple_cond_true_p (const_gimple_cond gs)
{
tree lhs = gimple_cond_lhs (gs);
tree rhs = gimple_cond_rhs (gs);
@@ -3066,7 +3084,7 @@ gimple_cond_true_p (const_gimple gs)
'if (0 != 0)', 'if (1 == 0)' or 'if (0 == 1)' */
static inline bool
-gimple_cond_false_p (const_gimple gs)
+gimple_cond_false_p (const_gimple_cond gs)
{
tree lhs = gimple_cond_lhs (gs);
tree rhs = gimple_cond_rhs (gs);
@@ -3090,7 +3108,8 @@ gimple_cond_false_p (const_gimple gs)
/* Set the code, LHS and RHS of GIMPLE_COND STMT from CODE, LHS and RHS. */
static inline void
-gimple_cond_set_condition (gimple stmt, enum tree_code code, tree lhs, tree rhs)
+gimple_cond_set_condition (gimple_cond stmt, enum tree_code code, tree lhs,
+ tree rhs)
{
gimple_cond_set_code (stmt, code);
gimple_cond_set_lhs (stmt, lhs);
diff --git a/gcc/tree-ssa-dom.c b/gcc/tree-ssa-dom.c
index 9f51a4d..d26596b 100644
--- a/gcc/tree-ssa-dom.c
+++ b/gcc/tree-ssa-dom.c
@@ -831,7 +831,7 @@ public:
private:
void thread_across_edge (edge);
- gimple m_dummy_cond;
+ gimple_cond m_dummy_cond;
};
/* Jump threading, redundancy elimination and const/copy propagation.
@@ -1003,7 +1003,7 @@ make_pass_dominator (gcc::context *ctxt)
condition to a canonical form. */
static void
-canonicalize_comparison (gimple condstmt)
+canonicalize_comparison (gimple_cond condstmt)
{
tree op0;
tree op1;
@@ -2326,7 +2326,7 @@ optimize_stmt (basic_block bb, gimple_stmt_iterator si)
}
if (gimple_code (stmt) == GIMPLE_COND)
- canonicalize_comparison (stmt);
+ canonicalize_comparison (as_a <gimple_cond> (stmt));
update_stmt_if_modified (stmt);
opt_stats.num_stmts++;
diff --git a/gcc/tree-ssa-forwprop.c b/gcc/tree-ssa-forwprop.c
index d491bde..5d17f7b 100644
--- a/gcc/tree-ssa-forwprop.c
+++ b/gcc/tree-ssa-forwprop.c
@@ -503,7 +503,7 @@ forward_propagate_into_comparison (gimple_stmt_iterator *gsi)
This must be kept in sync with forward_propagate_into_cond. */
static int
-forward_propagate_into_gimple_cond (gimple stmt)
+forward_propagate_into_gimple_cond (gimple_cond stmt)
{
tree tmp;
enum tree_code code = gimple_cond_code (stmt);
@@ -3836,7 +3836,8 @@ pass_forwprop::execute (function *fun)
case GIMPLE_COND:
{
int did_something;
- did_something = forward_propagate_into_gimple_cond (stmt);
+ did_something =
+ forward_propagate_into_gimple_cond (as_a <gimple_cond> (stmt));
if (did_something == 2)
cfg_changed = true;
changed = did_something != 0;
diff --git a/gcc/tree-ssa-ifcombine.c b/gcc/tree-ssa-ifcombine.c
index 118e99c..43fd50b 100644
--- a/gcc/tree-ssa-ifcombine.c
+++ b/gcc/tree-ssa-ifcombine.c
@@ -202,7 +202,7 @@ get_name_for_bit_test (tree candidate)
Returns true if the pattern matched, false otherwise. */
static bool
-recognize_single_bit_test (gimple cond, tree *name, tree *bit, bool inv)
+recognize_single_bit_test (gimple_cond cond, tree *name, tree *bit, bool inv)
{
gimple stmt;
@@ -311,7 +311,7 @@ recognize_single_bit_test (gimple cond, tree *name, tree *bit, bool inv)
Returns true if the pattern matched, false otherwise. */
static bool
-recognize_bits_test (gimple cond, tree *name, tree *bits, bool inv)
+recognize_bits_test (gimple_cond cond, tree *name, tree *bits, bool inv)
{
gimple stmt;
@@ -342,18 +342,21 @@ ifcombine_ifandif (basic_block inner_cond_bb, bool inner_inv,
basic_block outer_cond_bb, bool outer_inv, bool result_inv)
{
gimple_stmt_iterator gsi;
- gimple inner_cond, outer_cond;
+ gimple inner_stmt, outer_stmt;
+ gimple_cond inner_cond, outer_cond;
tree name1, name2, bit1, bit2, bits1, bits2;
- inner_cond = last_stmt (inner_cond_bb);
- if (!inner_cond
- || gimple_code (inner_cond) != GIMPLE_COND)
+ inner_stmt = last_stmt (inner_cond_bb);
+ if (!inner_stmt
+ || gimple_code (inner_stmt) != GIMPLE_COND)
return false;
+ inner_cond = as_a <gimple_cond> (inner_stmt);
- outer_cond = last_stmt (outer_cond_bb);
- if (!outer_cond
- || gimple_code (outer_cond) != GIMPLE_COND)
+ outer_stmt = last_stmt (outer_cond_bb);
+ if (!outer_stmt
+ || gimple_code (outer_stmt) != GIMPLE_COND)
return false;
+ outer_cond = as_a <gimple_cond> (outer_stmt);
/* See if we test a single bit of the same name in both tests. In
that case remove the outer test, merging both else edges,
diff --git a/gcc/tree-ssa-loop-unswitch.c b/gcc/tree-ssa-loop-unswitch.c
index 06f4a12..49631f6 100644
--- a/gcc/tree-ssa-loop-unswitch.c
+++ b/gcc/tree-ssa-loop-unswitch.c
@@ -138,15 +138,17 @@ tree_ssa_unswitch_loops (void)
static tree
tree_may_unswitch_on (basic_block bb, struct loop *loop)
{
- gimple stmt, def;
+ gimple last, def;
+ gimple_cond stmt;
tree cond, use;
basic_block def_bb;
ssa_op_iter iter;
/* BB must end in a simple conditional jump. */
- stmt = last_stmt (bb);
- if (!stmt || gimple_code (stmt) != GIMPLE_COND)
+ last = last_stmt (bb);
+ if (!last || gimple_code (last) != GIMPLE_COND)
return NULL_TREE;
+ stmt = as_a <gimple_cond> (last);
/* To keep the things simple, we do not directly remove the conditions,
but just replace tests with 0 != 0 resp. 1 != 0. Prevent the infinite
@@ -248,13 +250,15 @@ tree_unswitch_single_loop (struct loop *loop, int num)
if (integer_nonzerop (cond))
{
/* Remove false path. */
- gimple_cond_set_condition_from_tree (stmt, boolean_true_node);
+ gimple_cond_set_condition_from_tree (as_a <gimple_cond> (stmt),
+ boolean_true_node);
changed = true;
}
else if (integer_zerop (cond))
{
/* Remove true path. */
- gimple_cond_set_condition_from_tree (stmt, boolean_false_node);
+ gimple_cond_set_condition_from_tree (as_a <gimple_cond> (stmt),
+ boolean_false_node);
changed = true;
}
/* Do not unswitch too much. */
@@ -316,9 +320,10 @@ tree_unswitch_single_loop (struct loop *loop, int num)
if (stmt
&& gimple_code (stmt) == GIMPLE_COND)
{
- if (gimple_cond_true_p (stmt))
+ gimple_cond cond_stmt = as_a <gimple_cond> (stmt);
+ if (gimple_cond_true_p (cond_stmt))
flags = EDGE_FALSE_VALUE;
- else if (gimple_cond_false_p (stmt))
+ else if (gimple_cond_false_p (cond_stmt))
flags = EDGE_TRUE_VALUE;
}
}
diff --git a/gcc/tree-ssa-pre.c b/gcc/tree-ssa-pre.c
index 60ff70f..9deaa5e 100644
--- a/gcc/tree-ssa-pre.c
+++ b/gcc/tree-ssa-pre.c
@@ -4365,8 +4365,8 @@ eliminate_dom_walker::before_dom_children (basic_block b)
fold_stmt (&gsi);
stmt = gsi_stmt (gsi);
if ((gimple_code (stmt) == GIMPLE_COND
- && (gimple_cond_true_p (stmt)
- || gimple_cond_false_p (stmt)))
+ && (gimple_cond_true_p (as_a <gimple_cond> (stmt))
+ || gimple_cond_false_p (as_a <gimple_cond> (stmt))))
|| (gimple_code (stmt) == GIMPLE_SWITCH
&& TREE_CODE (gimple_switch_index (stmt)) == INTEGER_CST))
el_todo |= TODO_cleanup_cfg;
diff --git a/gcc/tree-ssa-threadedge.c b/gcc/tree-ssa-threadedge.c
index 3dee5ba..0a04787 100644
--- a/gcc/tree-ssa-threadedge.c
+++ b/gcc/tree-ssa-threadedge.c
@@ -521,7 +521,7 @@ dummy_simplify (gimple stmt1 ATTRIBUTE_UNUSED, gimple stmt2 ATTRIBUTE_UNUSED)
static tree
simplify_control_stmt_condition (edge e,
gimple stmt,
- gimple dummy_cond,
+ gimple_cond dummy_cond,
tree (*simplify) (gimple, gimple),
bool handle_dominating_asserts)
{
@@ -802,7 +802,7 @@ propagate_threaded_block_debug_into (basic_block dest, basic_block src)
try and simplify the condition at the end of TAKEN_EDGE->dest. */
static bool
thread_around_empty_blocks (edge taken_edge,
- gimple dummy_cond,
+ gimple_cond dummy_cond,
bool handle_dominating_asserts,
tree (*simplify) (gimple, gimple),
bitmap visited,
@@ -950,7 +950,7 @@ thread_around_empty_blocks (edge taken_edge,
static int
thread_through_normal_block (edge e,
- gimple dummy_cond,
+ gimple_cond dummy_cond,
bool handle_dominating_asserts,
vec<tree> *stack,
tree (*simplify) (gimple, gimple),
@@ -1078,7 +1078,7 @@ thread_through_normal_block (edge e,
SIMPLIFY is a pass-specific function used to simplify statements. */
void
-thread_across_edge (gimple dummy_cond,
+thread_across_edge (gimple_cond dummy_cond,
edge e,
bool handle_dominating_asserts,
vec<tree> *stack,
diff --git a/gcc/tree-ssa-threadedge.h b/gcc/tree-ssa-threadedge.h
index f005607..7ad5691 100644
--- a/gcc/tree-ssa-threadedge.h
+++ b/gcc/tree-ssa-threadedge.h
@@ -30,7 +30,7 @@ extern void threadedge_initialize_values (void);
extern void threadedge_finalize_values (void);
extern bool potentially_threadable_block (basic_block);
extern void propagate_threaded_block_debug_into (basic_block, basic_block);
-extern void thread_across_edge (gimple, edge, bool,
+extern void thread_across_edge (gimple_cond, edge, bool,
vec<tree> *, tree (*) (gimple, gimple));
#endif /* GCC_TREE_SSA_THREADEDGE_H */
diff --git a/gcc/tree-vrp.c b/gcc/tree-vrp.c
index a014f21..3248ceb 100644
--- a/gcc/tree-vrp.c
+++ b/gcc/tree-vrp.c
@@ -9073,7 +9073,7 @@ range_fits_type_p (value_range_t *vr, unsigned dest_precision, signop dest_sgn)
the original conditional. */
static bool
-simplify_cond_using_ranges (gimple stmt)
+simplify_cond_using_ranges (gimple_cond stmt)
{
tree op0 = gimple_cond_lhs (stmt);
tree op1 = gimple_cond_rhs (stmt);
@@ -9613,7 +9613,7 @@ simplify_stmt_using_ranges (gimple_stmt_iterator *gsi)
}
}
else if (gimple_code (stmt) == GIMPLE_COND)
- return simplify_cond_using_ranges (stmt);
+ return simplify_cond_using_ranges (as_a <gimple_cond> (stmt));
else if (gimple_code (stmt) == GIMPLE_SWITCH)
return simplify_switch_using_ranges (as_a <gimple_switch> (stmt));
else if (is_gimple_call (stmt)
@@ -9757,7 +9757,7 @@ static void
identify_jump_threads (void)
{
basic_block bb;
- gimple dummy;
+ gimple_cond dummy;
int i;
edge e;
--
1.8.5.3
^ permalink raw reply [flat|nested] 93+ messages in thread
* [gimple-classes, committed 33/92] Introduce gimple_omp_atomic_store
2014-10-27 20:35 [gimple-classes, committed 00/92] Initial slew of commits David Malcolm
2014-10-27 20:35 ` [gimple-classes, committed 45/92] omp-low.c: Use more concrete types of gimple statement for various locals David Malcolm
@ 2014-10-27 20:35 ` David Malcolm
2014-10-27 20:35 ` [gimple-classes, committed 06/92] Introduce gimple_debug and use it in a few places David Malcolm
` (89 subsequent siblings)
91 siblings, 0 replies; 93+ messages in thread
From: David Malcolm @ 2014-10-27 20:35 UTC (permalink / raw)
To: gcc-patches; +Cc: David Malcolm
This corresponds to:
[PATCH 35/89] Introduce gimple_omp_atomic_store
https://gcc.gnu.org/ml/gcc-patches/2014-04/msg01227.html
from the original 89-patch kit
That earlier patch was approved by Jeff:
> OK with expected changes due to renaming/updates to const handling.
> Please repost the final patch for archival purposes.
in https://gcc.gnu.org/ml/gcc-patches/2014-05/msg00804.html
gcc/
* coretypes.h (gimple_omp_atomic_store): New typedef.
(const_gimple_omp_atomic_store): New typedef.
* gimple-pretty-print.c (dump_gimple_omp_atomic_store): Require
a gimple_omp_atomic_store rather than a plain gimple.
(pp_gimple_stmt_1): Add checked cast to gimple_omp_atomic_store
within GIMPLE_OMP_ATOMIC_STORE case of switch statement.
* gimple-walk.c (walk_gimple_op): Likewise.
* gimple.c (gimple_build_omp_atomic_store): Return a
gimple_omp_atomic_store rather than a plain gimple.
* gimple.h (gimple_build_omp_atomic_store): Return a
gimple_omp_atomic_store rather than a plain gimple.
(gimple_omp_atomic_store_set_val): Require a gimple_omp_atomic_store
rather than a plain gimple.
(gimple_omp_atomic_store_val_ptr): Likewise.
(gimple_omp_atomic_store_val): Require a
const_gimple_omp_atomic_store rather than a plain const_gimple.
* gimplify.c (gimplify_omp_atomic): Strengthen locals "loadstmt" and
"storestmt" from gimple to gimple_omp_atomic_load loadstmt and
gimple_omp_atomic_store storestmt respectively.
* omp-low.c (expand_omp_atomic): Strengthen local "store" from
gimple to gimple_omp_atomic_store.
---
gcc/ChangeLog.gimple-classes | 31 +++++++++++++++++++++++++++++++
gcc/coretypes.h | 5 +++++
gcc/gimple-pretty-print.c | 8 +++++---
gcc/gimple-walk.c | 5 +++--
gcc/gimple.c | 5 +++--
gcc/gimple.h | 20 +++++++-------------
gcc/gimplify.c | 3 ++-
gcc/omp-low.c | 3 ++-
8 files changed, 58 insertions(+), 22 deletions(-)
diff --git a/gcc/ChangeLog.gimple-classes b/gcc/ChangeLog.gimple-classes
index 3026787..0073b05 100644
--- a/gcc/ChangeLog.gimple-classes
+++ b/gcc/ChangeLog.gimple-classes
@@ -1,5 +1,36 @@
2014-10-24 David Malcolm <dmalcolm@redhat.com>
+ Introduce gimple_omp_atomic_store
+
+ * coretypes.h (gimple_omp_atomic_store): New typedef.
+ (const_gimple_omp_atomic_store): New typedef.
+
+ * gimple-pretty-print.c (dump_gimple_omp_atomic_store): Require
+ a gimple_omp_atomic_store rather than a plain gimple.
+ (pp_gimple_stmt_1): Add checked cast to gimple_omp_atomic_store
+ within GIMPLE_OMP_ATOMIC_STORE case of switch statement.
+ * gimple-walk.c (walk_gimple_op): Likewise.
+
+ * gimple.c (gimple_build_omp_atomic_store): Return a
+ gimple_omp_atomic_store rather than a plain gimple.
+
+ * gimple.h (gimple_build_omp_atomic_store): Return a
+ gimple_omp_atomic_store rather than a plain gimple.
+ (gimple_omp_atomic_store_set_val): Require a gimple_omp_atomic_store
+ rather than a plain gimple.
+ (gimple_omp_atomic_store_val_ptr): Likewise.
+ (gimple_omp_atomic_store_val): Require a
+ const_gimple_omp_atomic_store rather than a plain const_gimple.
+
+ * gimplify.c (gimplify_omp_atomic): Strengthen locals "loadstmt" and
+ "storestmt" from gimple to gimple_omp_atomic_load loadstmt and
+ gimple_omp_atomic_store storestmt respectively.
+
+ * omp-low.c (expand_omp_atomic): Strengthen local "store" from
+ gimple to gimple_omp_atomic_store.
+
+2014-10-24 David Malcolm <dmalcolm@redhat.com>
+
Introduce gimple_omp_atomic_load
* coretypes.h (gimple_omp_atomic_load): New typedef.
diff --git a/gcc/coretypes.h b/gcc/coretypes.h
index 06b3be8..78647b2 100644
--- a/gcc/coretypes.h
+++ b/gcc/coretypes.h
@@ -171,6 +171,11 @@ typedef struct gimple_statement_omp_atomic_load *gimple_omp_atomic_load;
typedef const struct gimple_statement_omp_atomic_load *
const_gimple_omp_atomic_load;
+struct gimple_statement_omp_atomic_store;
+typedef struct gimple_statement_omp_atomic_store *gimple_omp_atomic_store;
+typedef const struct gimple_statement_omp_atomic_store *
+ const_gimple_omp_atomic_store;
+
union section;
typedef union section section;
struct gcc_options;
diff --git a/gcc/gimple-pretty-print.c b/gcc/gimple-pretty-print.c
index eafb6cd..62e4bf8 100644
--- a/gcc/gimple-pretty-print.c
+++ b/gcc/gimple-pretty-print.c
@@ -2000,8 +2000,8 @@ dump_gimple_omp_atomic_load (pretty_printer *buffer, gimple_omp_atomic_load gs,
in dumpfile.h). */
static void
-dump_gimple_omp_atomic_store (pretty_printer *buffer, gimple gs, int spc,
- int flags)
+dump_gimple_omp_atomic_store (pretty_printer *buffer,
+ gimple_omp_atomic_store gs, int spc, int flags)
{
if (flags & TDF_RAW)
{
@@ -2149,7 +2149,9 @@ pp_gimple_stmt_1 (pretty_printer *buffer, gimple gs, int spc, int flags)
break;
case GIMPLE_OMP_ATOMIC_STORE:
- dump_gimple_omp_atomic_store (buffer, gs, spc, flags);
+ dump_gimple_omp_atomic_store (buffer,
+ as_a <gimple_omp_atomic_store> (gs),
+ spc, flags);
break;
case GIMPLE_OMP_FOR:
diff --git a/gcc/gimple-walk.c b/gcc/gimple-walk.c
index af67218..987b856 100644
--- a/gcc/gimple-walk.c
+++ b/gcc/gimple-walk.c
@@ -434,8 +434,9 @@ walk_gimple_op (gimple stmt, walk_tree_fn callback_op,
break;
case GIMPLE_OMP_ATOMIC_STORE:
- ret = walk_tree (gimple_omp_atomic_store_val_ptr (stmt), callback_op,
- wi, pset);
+ ret = walk_tree (gimple_omp_atomic_store_val_ptr (
+ as_a <gimple_omp_atomic_store> (stmt)),
+ callback_op, wi, pset);
if (ret)
return ret;
break;
diff --git a/gcc/gimple.c b/gcc/gimple.c
index 8672b83..1bc176c 100644
--- a/gcc/gimple.c
+++ b/gcc/gimple.c
@@ -1094,10 +1094,11 @@ gimple_build_omp_atomic_load (tree lhs, tree rhs)
VAL is the value we are storing. */
-gimple
+gimple_omp_atomic_store
gimple_build_omp_atomic_store (tree val)
{
- gimple p = gimple_alloc (GIMPLE_OMP_ATOMIC_STORE, 0);
+ gimple_omp_atomic_store p =
+ as_a <gimple_omp_atomic_store> (gimple_alloc (GIMPLE_OMP_ATOMIC_STORE, 0));
gimple_omp_atomic_store_set_val (p, val);
return p;
}
diff --git a/gcc/gimple.h b/gcc/gimple.h
index a302529..4513fcb 100644
--- a/gcc/gimple.h
+++ b/gcc/gimple.h
@@ -1358,7 +1358,7 @@ gimple gimple_build_omp_single (gimple_seq, tree);
gimple gimple_build_omp_target (gimple_seq, int, tree);
gimple gimple_build_omp_teams (gimple_seq, tree);
gimple_omp_atomic_load gimple_build_omp_atomic_load (tree, tree);
-gimple gimple_build_omp_atomic_store (tree);
+gimple_omp_atomic_store gimple_build_omp_atomic_store (tree);
gimple_transaction gimple_build_transaction (gimple_seq, tree);
gimple gimple_build_predict (enum br_predictor, enum prediction);
extern void gimple_seq_add_stmt (gimple_seq *, gimple);
@@ -5367,33 +5367,27 @@ gimple_omp_for_cond (const_gimple gs, size_t i)
/* Set the value being stored in an atomic store. */
static inline void
-gimple_omp_atomic_store_set_val (gimple g, tree val)
+gimple_omp_atomic_store_set_val (gimple_omp_atomic_store store_stmt, tree val)
{
- gimple_statement_omp_atomic_store *omp_atomic_store_stmt =
- as_a <gimple_statement_omp_atomic_store *> (g);
- omp_atomic_store_stmt->val = val;
+ store_stmt->val = val;
}
/* Return the value being stored in an atomic store. */
static inline tree
-gimple_omp_atomic_store_val (const_gimple g)
+gimple_omp_atomic_store_val (const_gimple_omp_atomic_store store_stmt)
{
- const gimple_statement_omp_atomic_store *omp_atomic_store_stmt =
- as_a <const gimple_statement_omp_atomic_store *> (g);
- return omp_atomic_store_stmt->val;
+ return store_stmt->val;
}
/* Return a pointer to the value being stored in an atomic store. */
static inline tree *
-gimple_omp_atomic_store_val_ptr (gimple g)
+gimple_omp_atomic_store_val_ptr (gimple_omp_atomic_store store_stmt)
{
- gimple_statement_omp_atomic_store *omp_atomic_store_stmt =
- as_a <gimple_statement_omp_atomic_store *> (g);
- return &omp_atomic_store_stmt->val;
+ return &store_stmt->val;
}
diff --git a/gcc/gimplify.c b/gcc/gimplify.c
index 26cc2d0..a969233 100644
--- a/gcc/gimplify.c
+++ b/gcc/gimplify.c
@@ -7308,7 +7308,8 @@ gimplify_omp_atomic (tree *expr_p, gimple_seq *pre_p)
? NULL : TREE_OPERAND (*expr_p, 1);
tree type = TYPE_MAIN_VARIANT (TREE_TYPE (TREE_TYPE (addr)));
tree tmp_load;
- gimple loadstmt, storestmt;
+ gimple_omp_atomic_load loadstmt;
+ gimple_omp_atomic_store storestmt;
tmp_load = create_tmp_reg (type, NULL);
if (rhs && goa_stabilize_expr (&rhs, pre_p, addr, tmp_load) < 0)
diff --git a/gcc/omp-low.c b/gcc/omp-low.c
index 40cba5c..78ec43f 100644
--- a/gcc/omp-low.c
+++ b/gcc/omp-low.c
@@ -8188,7 +8188,8 @@ expand_omp_atomic (struct omp_region *region)
basic_block load_bb = region->entry, store_bb = region->exit;
gimple_omp_atomic_load load =
as_a <gimple_omp_atomic_load> (last_stmt (load_bb));
- gimple store = last_stmt (store_bb);
+ gimple_omp_atomic_store store =
+ as_a <gimple_omp_atomic_store> (last_stmt (store_bb));
tree loaded_val = gimple_omp_atomic_load_lhs (load);
tree addr = gimple_omp_atomic_load_rhs (load);
tree stored_val = gimple_omp_atomic_store_val (store);
--
1.8.5.3
^ permalink raw reply [flat|nested] 93+ messages in thread
* [gimple-classes, committed 00/92] Initial slew of commits
@ 2014-10-27 20:35 David Malcolm
2014-10-27 20:35 ` [gimple-classes, committed 45/92] omp-low.c: Use more concrete types of gimple statement for various locals David Malcolm
` (91 more replies)
0 siblings, 92 replies; 93+ messages in thread
From: David Malcolm @ 2014-10-27 20:35 UTC (permalink / raw)
To: gcc-patches; +Cc: David Malcolm
These patches move the type-checking of gimple statement accessors
from run-time to compile-time, for about half of the accessors.
I've pushed them to the git branch "dmalcolm/gimple-classes", which
can be seen at:
https://gcc.gnu.org/git/?p=gcc.git;a=shortlog;h=refs/heads/dmalcolm/gimple-classes
Patches 01-87:
These correspond to patches 02-89 from the patch kit I posted in
April, and approved by Jeff (with various caveats), rebased against trunk,
and eliminating the as_a_gimple_foo and dyn_cast_gimple_foo *methods* in
favor of direct use of as_a <>/dyn_cast <> from is-a.h
I used a script [1] to add references to the initial patch kit and Jeff's
reviews to the commit messages.
They introduce various new gimple subclasses, along with typedefs for the
const/non-const variants. Richi didn't want these typedefs, so I
immediately undo this part, renaming them in followups... (doing it this
way was the least error-prone way):
Patch 88: "Preparatory work before subclass renaming":
Various variables have names that confuse my subclass renaming
script. Rename them now to simplify the mass-renaming.
Patches 89 and 90 only make sense together; the former is handwritten, the
latter autogenerated:
Patch 89: "Eliminate subclass typedefs from coretypes.h"
This patch eliminates the const/non-const typedefs for the gimple
subclasses.
Patch 90: "Automated renaming of gimple subclasses"
This patch renames the gimple subclasses based on the pattern from
https://gcc.gnu.org/ml/gcc-patches/2014-05/msg00346.html
e.g.
"gimple_switch" becomes "gswitch *".
"const_gimple_bind" becomes "const gbind *".
i.e. pointers to all gimple *subclasses* now must be explicitly referred
to with "*". "gimple" is still implicitly a pointer, to minimize noise
when diffing against trunk.
The renaming script was:
https://github.com/davidmalcolm/gcc-refactoring-scripts/blob/master/rename_gimple_subclasses.py
Patch 91: "Remove out-of-date references to typedefs":
Fix some now-bogus comments.
Patch 92: "Update gimple.texi class hierarchy diagram"
I've successfully bootstrapped and regrtested patches 01-90 on
x86_64-unknown-linux-gnu (Fedora 20) - same results relative to
an unpatched control bootstrap of the branchpoint (r216157).
For reference, here's what the class hierarchy diagram from
gimple.texi looks like after these patches, with the new subclass
names (e.g. "gassign" and "gphi"):
gimple_statement_base
| layout: GSS_BASE
| used for 4 codes: GIMPLE_ERROR_MARK
| GIMPLE_NOP
| GIMPLE_OMP_SECTIONS_SWITCH
| GIMPLE_PREDICT
|
+ gimple_statement_with_ops_base
| | (no GSS layout)
| |
| + gimple_statement_with_ops
| | | layout: GSS_WITH_OPS
| | |
| | + gcond
| | | code: GIMPLE_COND
| | |
| | + gdebug
| | | code: GIMPLE_DEBUG
| | |
| | + ggoto
| | | code: GIMPLE_GOTO
| | |
| | + glabel
| | | code: GIMPLE_LABEL
| | |
| | + gswitch
| | code: GIMPLE_SWITCH
| |
| + gimple_statement_with_memory_ops_base
| | layout: GSS_WITH_MEM_OPS_BASE
| |
| + gimple_statement_with_memory_ops
| | | layout: GSS_WITH_MEM_OPS
| | |
| | + gassign
| | | code GIMPLE_ASSIGN
| | |
| | + greturn
| | code GIMPLE_RETURN
| |
| + gcall
| | layout: GSS_CALL, code: GIMPLE_CALL
| |
| + gasm
| | layout: GSS_ASM, code: GIMPLE_ASM
| |
| + gtransaction
| layout: GSS_TRANSACTION, code: GIMPLE_TRANSACTION
|
+ gimple_statement_omp
| | layout: GSS_OMP. Used for code GIMPLE_OMP_SECTION
| |
| + gomp_critical
| | layout: GSS_OMP_CRITICAL, code: GIMPLE_OMP_CRITICAL
| |
| + gomp_for
| | layout: GSS_OMP_FOR, code: GIMPLE_OMP_FOR
| |
| + gomp_parallel_layout
| | | layout: GSS_OMP_PARALLEL_LAYOUT
| | |
| | + gimple_statement_omp_taskreg
| | | |
| | | + gomp_parallel
| | | | code: GIMPLE_OMP_PARALLEL
| | | |
| | | + gomp_task
| | | code: GIMPLE_OMP_TASK
| | |
| | + gimple_statement_omp_target
| | code: GIMPLE_OMP_TARGET
| |
| + gomp_sections
| | layout: GSS_OMP_SECTIONS, code: GIMPLE_OMP_SECTIONS
| |
| + gimple_statement_omp_single_layout
| | layout: GSS_OMP_SINGLE_LAYOUT
| |
| + gomp_single
| | code: GIMPLE_OMP_SINGLE
| |
| + gomp_teams
| code: GIMPLE_OMP_TEAMS
|
+ gbind
| layout: GSS_BIND, code: GIMPLE_BIND
|
+ gcatch
| layout: GSS_CATCH, code: GIMPLE_CATCH
|
+ geh_filter
| layout: GSS_EH_FILTER, code: GIMPLE_EH_FILTER
|
+ geh_else
| layout: GSS_EH_ELSE, code: GIMPLE_EH_ELSE
|
+ geh_mnt
| layout: GSS_EH_MNT, code: GIMPLE_EH_MUST_NOT_THROW
|
+ gphi
| layout: GSS_PHI, code: GIMPLE_PHI
|
+ gimple_statement_eh_ctrl
| | layout: GSS_EH_CTRL
| |
| + gresx
| | code: GIMPLE_RESX
| |
| + geh_dispatch
| code: GIMPLE_EH_DISPATCH
|
+ gtry
| layout: GSS_TRY, code: GIMPLE_TRY
|
+ gimple_statement_wce
| layout: GSS_WCE, code: GIMPLE_WITH_CLEANUP_EXPR
|
+ gomp_continue
| layout: GSS_OMP_CONTINUE, code: GIMPLE_OMP_CONTINUE
|
+ gomp_atomic_load
| layout: GSS_OMP_ATOMIC_LOAD, code: GIMPLE_OMP_ATOMIC_LOAD
|
+ gimple_statement_omp_atomic_store_layout
| layout: GSS_OMP_ATOMIC_STORE_LAYOUT,
| code: GIMPLE_OMP_ATOMIC_STORE
|
+ gomp_atomic_store
| code: GIMPLE_OMP_ATOMIC_STORE
|
+ gomp_return
code: GIMPLE_OMP_RETURN
Dave
[1] https://github.com/davidmalcolm/gcc-refactoring-scripts/blob/master/refactor_gimple_patches.py
and https://github.com/davidmalcolm/gcc-refactoring-scripts/blob/master/gimple_approvals.py
David Malcolm (92):
Introduce gimple_switch and use it in various places
Introduce gimple_bind and use it for accessors.
Introduce gimple_cond and use it in various places
Introduce gimple_assign and use it in various places
Introduce gimple_label and use it in a few places
Introduce gimple_debug and use it in a few places
Introduce gimple_phi and use it in various places
Introduce gimple_phi_iterator
Update ssa_prop_visit_phi_fn callbacks to take a gimple_phi
tree-parloops.c: use gimple_phi in various places
tree-predcom.c: use gimple_phi in various places
tree-ssa-phiprop.c: use gimple_phi
tree-ssa-loop-niter.c: use gimple_phi in a few places
tree-ssa-loop-manip.c: use gimple_phi in three places
tree-ssa-loop-ivopts.c: use gimple_phi in a few places
Update various expressions within tree-scalar-evolution.c to be
gimple_phi
Concretize get_loop_exit_condition et al to working on gimple_cond
Introduce gimple_call
Introduce gimple_return
Introduce gimple_goto
Introduce gimple_asm
Introduce gimple_transaction
Introduce gimple_catch
Introduce gimple_eh_filter
Introduce gimple_eh_must_not_throw
Introduce gimple_eh_else
Introduce gimple_resx
Introduce gimple_eh_dispatch
Use subclasses of gimple in various places
Introduce gimple_try
Use more concrete types for various gimple statements
Introduce gimple_omp_atomic_load
Introduce gimple_omp_atomic_store
Introduce gimple_omp_continue
Introduce gimple_omp_critical
Introduce gimple_omp_for
Introduce gimple_omp_parallel
tree-cfg.c: Make verify_gimple_call require a gimple_call
Introduce gimple_omp_task
Introduce gimple_omp_single
Introduce gimple_omp_target
Introduce gimple_omp_teams
Introduce gimple_omp_sections
tree-parloops.c: Use gimple_phi in various places
omp-low.c: Use more concrete types of gimple statement for various
locals
Make gimple_phi_arg_def_ptr and gimple_phi_arg_has_location require a
gimple_phi
Make add_phi_arg require a gimple_phi
Make gimple_phi_arg_set_location require a gimple_phi
Update GRAPHITE to use more concrete gimple statement classes
Make gimple_phi_arg_edge require a gimple_phi
More gimple_phi
Make gimple_call_return_slot_opt_p require a gimple_call.
Use gimple_call for callgraph edges
Various gimple to gimple_call conversions in IPA
Concretize parameter to gimple_call_copy_skip_args
Make gimple_label_set_label require a gimple_label
Make gimple_goto_set_dest require a gimple_goto
Concretize gimple_catch_types
Concretize gimple_call_use_set and gimple_call_clobber_set
Concretize gimple_label_label
Concretize gimple_eh_filter_set_types and gimple_eh_filter_set_failure
Concretize gimple_try_set_catch_is_cleanup
Concretize three gimple_try_set_ accessors
Make gimple_phi_arg_location_from_edge require a gimple_phi
Make gimple_phi_arg_location require a gimple_phi.
Concretize three gimple_return_ accessors
Make gimple_cond_set_{true|false}_label require gimple_cond.
Concretize locals within expand_omp_for_init_counts
Concretize gimple_cond_make_{false|true}
Concretize gimple_switch_index and gimple_switch_index_ptr
Concretize gimple_cond_{true|false}_label
Concretize gimple_cond_set_code
Concretize gimple_cond_set_{lhs|rhs}
Concretize gimple_cond_{lhs|rhs}_ptr
Concretize various expressions from gimple to gimple_cond
Concretize gimple_call_set_nothrow
Concretize gimple_call_nothrow_p
Tweak to gimplify_modify_expr
Concretize gimple_call_set_fn
Concretize gimple_call_set_fntype
Concretize gimple_call_set_tail and gimple_call_tail_p
Concretize gimple_call_arg_flags
Concretize gimple_assign_nontemporal_move_p
Concretize gimple_call_copy_flags and ipa_modify_call_arguments
Use gimple_call in some places within tree-ssa-dom.c
Use gimple_phi in many more places.
Convert various gimple to gimple_phi within ssa-iterators.h
Preparatory work before subclass renaming
Eliminate subclass typedefs from coretypes.h
Automated renaming of gimple subclasses
Remove out-of-date references to typedefs
Update gimple.texi class hierarchy diagram
gcc/ChangeLog.gimple-classes | 4483 +++++++++++++++++++++++++++++++++
gcc/asan.c | 20 +-
gcc/builtins.c | 4 +-
gcc/builtins.h | 4 +-
gcc/c-family/ChangeLog.gimple-classes | 20 +
gcc/c-family/c-gimplify.c | 4 +-
gcc/cfgexpand.c | 58 +-
gcc/cfgloop.c | 6 +-
gcc/cfgloopmanip.c | 4 +-
gcc/cgraph.c | 21 +-
gcc/cgraph.h | 16 +-
gcc/cgraphbuild.c | 30 +-
gcc/cgraphclones.c | 7 +-
gcc/cgraphunit.c | 6 +-
gcc/coretypes.h | 35 +
gcc/doc/gimple.texi | 79 +-
gcc/expr.h | 2 +-
gcc/gdbhooks.py | 19 +-
gcc/gimple-builder.c | 16 +-
gcc/gimple-builder.h | 16 +-
gcc/gimple-fold.c | 40 +-
gcc/gimple-iterator.c | 12 +-
gcc/gimple-iterator.h | 11 +-
gcc/gimple-low.c | 39 +-
gcc/gimple-pretty-print.c | 181 +-
gcc/gimple-ssa-isolate-paths.c | 22 +-
gcc/gimple-ssa-strength-reduction.c | 38 +-
gcc/gimple-streamer-in.c | 34 +-
gcc/gimple-streamer-out.c | 46 +-
gcc/gimple-walk.c | 169 +-
gcc/gimple.c | 352 +--
gcc/gimple.h | 1400 +++++-----
gcc/gimplify-me.c | 29 +-
gcc/gimplify.c | 143 +-
gcc/gimplify.h | 6 +-
gcc/graphite-scop-detection.c | 22 +-
gcc/graphite-sese-to-poly.c | 141 +-
gcc/gsstruct.def | 34 +-
gcc/internal-fn.c | 48 +-
gcc/internal-fn.def | 2 +-
gcc/internal-fn.h | 2 +-
gcc/ipa-inline-analysis.c | 18 +-
gcc/ipa-prop.c | 37 +-
gcc/ipa-prop.h | 2 +-
gcc/ipa-pure-const.c | 10 +-
gcc/ipa-split.c | 111 +-
gcc/java/ChangeLog.gimple-classes | 20 +
gcc/java/java-gimplify.c | 2 +-
gcc/lto-streamer-in.c | 4 +-
gcc/lto-streamer-out.c | 15 +-
gcc/omp-low.c | 469 ++--
gcc/predict.c | 56 +-
gcc/sese.c | 13 +-
gcc/ssa-iterators.h | 20 +-
gcc/stmt.c | 4 +-
gcc/trans-mem.c | 132 +-
gcc/tree-call-cdce.c | 29 +-
gcc/tree-cfg.c | 409 +--
gcc/tree-cfg.h | 4 +-
gcc/tree-cfgcleanup.c | 44 +-
gcc/tree-complex.c | 39 +-
gcc/tree-data-ref.c | 3 +-
gcc/tree-dfa.c | 12 +-
gcc/tree-eh.c | 279 +-
gcc/tree-eh.h | 6 +-
gcc/tree-emutls.c | 13 +-
gcc/tree-if-conv.c | 15 +-
gcc/tree-inline.c | 214 +-
gcc/tree-inline.h | 4 +-
gcc/tree-into-ssa.c | 59 +-
gcc/tree-into-ssa.h | 2 +-
gcc/tree-loop-distribution.c | 55 +-
gcc/tree-nested.c | 52 +-
gcc/tree-nrv.c | 11 +-
gcc/tree-object-size.c | 20 +-
gcc/tree-outof-ssa.c | 23 +-
gcc/tree-parloops.c | 101 +-
gcc/tree-phinodes.c | 52 +-
gcc/tree-phinodes.h | 8 +-
gcc/tree-predcom.c | 30 +-
gcc/tree-profile.c | 19 +-
gcc/tree-scalar-evolution.c | 87 +-
gcc/tree-scalar-evolution.h | 2 +-
gcc/tree-sra.c | 125 +-
gcc/tree-ssa-alias.c | 16 +-
gcc/tree-ssa-alias.h | 4 +-
gcc/tree-ssa-ccp.c | 30 +-
gcc/tree-ssa-coalesce.c | 29 +-
gcc/tree-ssa-copy.c | 12 +-
gcc/tree-ssa-copyrename.c | 12 +-
gcc/tree-ssa-dce.c | 37 +-
gcc/tree-ssa-dom.c | 76 +-
gcc/tree-ssa-forwprop.c | 23 +-
gcc/tree-ssa-ifcombine.c | 27 +-
gcc/tree-ssa-live.c | 16 +-
gcc/tree-ssa-loop-im.c | 65 +-
gcc/tree-ssa-loop-ivcanon.c | 41 +-
gcc/tree-ssa-loop-ivopts.c | 44 +-
gcc/tree-ssa-loop-manip.c | 64 +-
gcc/tree-ssa-loop-niter.c | 25 +-
gcc/tree-ssa-loop-prefetch.c | 4 +-
gcc/tree-ssa-loop-unswitch.c | 19 +-
gcc/tree-ssa-math-opts.c | 38 +-
gcc/tree-ssa-operands.c | 8 +-
gcc/tree-ssa-phiopt.c | 38 +-
gcc/tree-ssa-phiprop.c | 12 +-
gcc/tree-ssa-pre.c | 62 +-
gcc/tree-ssa-propagate.c | 36 +-
gcc/tree-ssa-propagate.h | 2 +-
gcc/tree-ssa-reassoc.c | 39 +-
gcc/tree-ssa-sccvn.c | 29 +-
gcc/tree-ssa-sccvn.h | 2 +-
gcc/tree-ssa-sink.c | 8 +-
gcc/tree-ssa-strlen.c | 13 +-
gcc/tree-ssa-structalias.c | 86 +-
gcc/tree-ssa-tail-merge.c | 33 +-
gcc/tree-ssa-ter.c | 4 +-
gcc/tree-ssa-threadedge.c | 19 +-
gcc/tree-ssa-threadedge.h | 2 +-
gcc/tree-ssa-threadupdate.c | 22 +-
gcc/tree-ssa-uncprop.c | 7 +-
gcc/tree-ssa-uninit.c | 74 +-
gcc/tree-ssa.c | 56 +-
gcc/tree-stdarg.c | 19 +-
gcc/tree-switch-conversion.c | 57 +-
gcc/tree-tailcall.c | 46 +-
gcc/tree-vect-data-refs.c | 7 +-
gcc/tree-vect-generic.c | 13 +-
gcc/tree-vect-loop-manip.c | 74 +-
gcc/tree-vect-loop.c | 61 +-
gcc/tree-vect-patterns.c | 2 +-
gcc/tree-vect-slp.c | 15 +-
gcc/tree-vect-stmts.c | 22 +-
gcc/tree-vectorizer.h | 2 +-
gcc/tree-vrp.c | 100 +-
gcc/tree.c | 5 +-
gcc/ubsan.c | 4 +-
gcc/value-prof.c | 91 +-
gcc/value-prof.h | 3 +-
gcc/vtable-verify.c | 2 +-
140 files changed, 8532 insertions(+), 3376 deletions(-)
create mode 100644 gcc/ChangeLog.gimple-classes
create mode 100644 gcc/c-family/ChangeLog.gimple-classes
create mode 100644 gcc/java/ChangeLog.gimple-classes
--
1.8.5.3
^ permalink raw reply [flat|nested] 93+ messages in thread
* [gimple-classes, committed 22/92] Introduce gimple_transaction
2014-10-27 20:35 [gimple-classes, committed 00/92] Initial slew of commits David Malcolm
` (5 preceding siblings ...)
2014-10-27 20:35 ` [gimple-classes, committed 27/92] Introduce gimple_resx David Malcolm
@ 2014-10-27 20:35 ` David Malcolm
2014-10-27 20:35 ` [gimple-classes, committed 19/92] Introduce gimple_return David Malcolm
` (84 subsequent siblings)
91 siblings, 0 replies; 93+ messages in thread
From: David Malcolm @ 2014-10-27 20:35 UTC (permalink / raw)
To: gcc-patches; +Cc: David Malcolm
This corresponds to:
[PATCH 24/89] Introduce gimple_transaction
https://gcc.gnu.org/ml/gcc-patches/2014-04/msg01207.html
from the original 89-patch kit
That earlier patch was approved by Jeff:
> OK after fixing up the naming/const stuff as discussed for prior
> patches.
> That applies to 22-30. Make sure to take care of
> the pretty printers per Trevor's comments as well. He indicated those
> were missing in a couple of those patches.
in https://gcc.gnu.org/ml/gcc-patches/2014-05/msg00628.html
gcc/
* coretypes.h (gimple_transaction): New typedef.
(const_gimple_transaction): New typedef.
* gimple.h (gimple_build_transaction): Return a gimple_transaction
rather than a plain gimple.
(gimple_transaction_body_ptr): Require a gimple_transaction rather
than a plain gimple.
(gimple_transaction_body): Likewise.
(gimple_transaction_label_ptr): Likewise.
(gimple_transaction_set_body): Likewise.
(gimple_transaction_set_label): Likewise.
(gimple_transaction_set_subcode): Likewise.
(gimple_transaction_label): Require a const_gimple_transaction
rather than a plain const_gimple.
(gimple_transaction_subcode): Likewise.
* gimple-low.c (lower_stmt): Add checked cast to
gimple_transaction within GIMPLE_TRANSACTION case of switch
statement.
* gimple-pretty-print.c (dump_gimple_transaction): Require a
gimple_transaction rather than a plain gimple.
(pp_gimple_stmt_1): Add checked cast to gimple_transaction within
GIMPLE_TRANSACTION case of switch statement.
* gimple-streamer-in.c (input_gimple_stmt): Likewise.
* gimple-streamer-out.c (output_gimple_stmt): Likewise.
* gimple-walk.c (walk_gimple_op): Likewise.
(walk_gimple_stmt): Likewise.
* gimple.c (gimple_build_transaction): Return a gimple_transaction
rather than a plain gimple.
(gimple_copy): Add checked casts to gimple_transaction within
GIMPLE_TRANSACTION case of switch statement.
* gimplify.c (gimplify_transaction): Split local "g" into
"body_stmt" and "trans_stmt", strengthening the type of the latter
from gimple to gimple_transaction.
* omp-low.c (lower_omp_1): Add checked cast to gimple_transaction
within GIMPLE_TRANSACTION case of switch statement.
* trans-mem.c (diagnose_tm_1): Add checked cast within
GIMPLE_TRANSACTION case of switch statement, introducing a new
local "trans_stmt". Use it in place of "stmt".
(examine_call_tm): Convert local from gimple to gimple_transaction.
(tm_region::get_transaction_stmt): New method.
(tm_region::transaction_stmt): Add clarification of type to the
comment.
(tm_region_init_0): Require a gimple_transaction rather than a
plain gimple.
(tm_region_init): Convert a check against GIMPLE_TRANSACTION to a
dyn_cast<gimple_transaction> and new local.
(transaction_subcode_ior): Add a new local, using the new
get_transaction_stmt method to perform a checked cast.
(propagate_tm_flags_out): Likewise.
(expand_transaction): Add a checked cast using the new
get_transaction_stmt method.
(generate_tm_state): Likewise.
(execute_tm_mark): Likewise.
(ipa_tm_diagnose_transaction): Likewise.
* tree-cfg.c (verify_gimple_transaction): Require a
gimple_transaction rather than a plain gimple.
(make_edges): Add checked cast within GIMPLE_TRANSACTION case of
switch statement
(cleanup_dead_labels): Likewise.
(verify_gimple_stmt): Likewise.
(verify_gimple_in_seq_2): Likewise.
(verify_gimple_in_seq_2): Likewise.
(gimple_redirect_edge_and_branch): Add checked cast.
* tree-inline.c (remap_gimple_stmt): Add checked cast within
GIMPLE_TRANSACTION case of switch statement, introducing a new
local "old_trans_stmt". Use it in place of "stmt". Add new
local "new_trans_stmt", using it to initialize "copy", and for
type-safe operations as a transaction.
(estimate_num_insns): Add checked cast within GIMPLE_TRANSACTION
case of switch statement.
---
gcc/ChangeLog.gimple-classes | 83 ++++++++++++++++++++++++++++++++++++++++++++
gcc/coretypes.h | 4 +++
gcc/gimple-low.c | 4 ++-
gcc/gimple-pretty-print.c | 6 ++--
gcc/gimple-streamer-in.c | 3 +-
gcc/gimple-streamer-out.c | 7 ++--
gcc/gimple-walk.c | 8 +++--
gcc/gimple.c | 11 +++---
gcc/gimple.h | 46 ++++++++++--------------
gcc/gimplify.c | 13 +++----
gcc/omp-low.c | 4 ++-
gcc/trans-mem.c | 66 ++++++++++++++++++++++++-----------
gcc/tree-cfg.c | 19 +++++-----
gcc/tree-inline.c | 19 +++++++---
14 files changed, 214 insertions(+), 79 deletions(-)
diff --git a/gcc/ChangeLog.gimple-classes b/gcc/ChangeLog.gimple-classes
index bd88371..b3a475e 100644
--- a/gcc/ChangeLog.gimple-classes
+++ b/gcc/ChangeLog.gimple-classes
@@ -1,5 +1,88 @@
2014-10-24 David Malcolm <dmalcolm@redhat.com>
+ Introduce gimple_transaction
+
+ * coretypes.h (gimple_transaction): New typedef.
+ (const_gimple_transaction): New typedef.
+
+ * gimple.h (gimple_build_transaction): Return a gimple_transaction
+ rather than a plain gimple.
+ (gimple_transaction_body_ptr): Require a gimple_transaction rather
+ than a plain gimple.
+ (gimple_transaction_body): Likewise.
+ (gimple_transaction_label_ptr): Likewise.
+ (gimple_transaction_set_body): Likewise.
+ (gimple_transaction_set_label): Likewise.
+ (gimple_transaction_set_subcode): Likewise.
+ (gimple_transaction_label): Require a const_gimple_transaction
+ rather than a plain const_gimple.
+ (gimple_transaction_subcode): Likewise.
+
+ * gimple-low.c (lower_stmt): Add checked cast to
+ gimple_transaction within GIMPLE_TRANSACTION case of switch
+ statement.
+
+ * gimple-pretty-print.c (dump_gimple_transaction): Require a
+ gimple_transaction rather than a plain gimple.
+ (pp_gimple_stmt_1): Add checked cast to gimple_transaction within
+ GIMPLE_TRANSACTION case of switch statement.
+ * gimple-streamer-in.c (input_gimple_stmt): Likewise.
+ * gimple-streamer-out.c (output_gimple_stmt): Likewise.
+ * gimple-walk.c (walk_gimple_op): Likewise.
+ (walk_gimple_stmt): Likewise.
+
+ * gimple.c (gimple_build_transaction): Return a gimple_transaction
+ rather than a plain gimple.
+ (gimple_copy): Add checked casts to gimple_transaction within
+ GIMPLE_TRANSACTION case of switch statement.
+
+ * gimplify.c (gimplify_transaction): Split local "g" into
+ "body_stmt" and "trans_stmt", strengthening the type of the latter
+ from gimple to gimple_transaction.
+
+ * omp-low.c (lower_omp_1): Add checked cast to gimple_transaction
+ within GIMPLE_TRANSACTION case of switch statement.
+
+ * trans-mem.c (diagnose_tm_1): Add checked cast within
+ GIMPLE_TRANSACTION case of switch statement, introducing a new
+ local "trans_stmt". Use it in place of "stmt".
+ (examine_call_tm): Convert local from gimple to gimple_transaction.
+ (tm_region::get_transaction_stmt): New method.
+ (tm_region::transaction_stmt): Add clarification of type to the
+ comment.
+ (tm_region_init_0): Require a gimple_transaction rather than a
+ plain gimple.
+ (tm_region_init): Convert a check against GIMPLE_TRANSACTION to a
+ dyn_cast<gimple_transaction> and new local.
+ (transaction_subcode_ior): Add a new local, using the new
+ get_transaction_stmt method to perform a checked cast.
+ (propagate_tm_flags_out): Likewise.
+ (expand_transaction): Add a checked cast using the new
+ get_transaction_stmt method.
+ (generate_tm_state): Likewise.
+ (execute_tm_mark): Likewise.
+ (ipa_tm_diagnose_transaction): Likewise.
+
+ * tree-cfg.c (verify_gimple_transaction): Require a
+ gimple_transaction rather than a plain gimple.
+ (make_edges): Add checked cast within GIMPLE_TRANSACTION case of
+ switch statement
+ (cleanup_dead_labels): Likewise.
+ (verify_gimple_stmt): Likewise.
+ (verify_gimple_in_seq_2): Likewise.
+ (verify_gimple_in_seq_2): Likewise.
+ (gimple_redirect_edge_and_branch): Add checked cast.
+
+ * tree-inline.c (remap_gimple_stmt): Add checked cast within
+ GIMPLE_TRANSACTION case of switch statement, introducing a new
+ local "old_trans_stmt". Use it in place of "stmt". Add new
+ local "new_trans_stmt", using it to initialize "copy", and for
+ type-safe operations as a transaction.
+ (estimate_num_insns): Add checked cast within GIMPLE_TRANSACTION
+ case of switch statement.
+
+2014-10-24 David Malcolm <dmalcolm@redhat.com>
+
Introduce gimple_asm
* coretypes.h (gimple_asm): New typedef.
diff --git a/gcc/coretypes.h b/gcc/coretypes.h
index 98636bb..a38d7bd 100644
--- a/gcc/coretypes.h
+++ b/gcc/coretypes.h
@@ -122,6 +122,10 @@ struct gimple_statement_call;
typedef struct gimple_statement_call *gimple_call;
typedef const struct gimple_statement_call *const_gimple_call;
+struct gimple_statement_transaction;
+typedef struct gimple_statement_transaction *gimple_transaction;
+typedef const struct gimple_statement_transaction *const_gimple_transaction;
+
struct gimple_statement_return;
typedef struct gimple_statement_return *gimple_return;
typedef const struct gimple_statement_return *const_gimple_return;
diff --git a/gcc/gimple-low.c b/gcc/gimple-low.c
index 04f87e2..4a4ad8a 100644
--- a/gcc/gimple-low.c
+++ b/gcc/gimple-low.c
@@ -361,7 +361,9 @@ lower_stmt (gimple_stmt_iterator *gsi, struct lower_data *data)
return;
case GIMPLE_TRANSACTION:
- lower_sequence (gimple_transaction_body_ptr (stmt), data);
+ lower_sequence (gimple_transaction_body_ptr (
+ as_a <gimple_transaction> (stmt)),
+ data);
break;
default:
diff --git a/gcc/gimple-pretty-print.c b/gcc/gimple-pretty-print.c
index d8d7703..a188759 100644
--- a/gcc/gimple-pretty-print.c
+++ b/gcc/gimple-pretty-print.c
@@ -1519,7 +1519,8 @@ dump_gimple_omp_return (pretty_printer *buffer, gimple gs, int spc, int flags)
/* Dump a GIMPLE_TRANSACTION tuple on the pretty_printer BUFFER. */
static void
-dump_gimple_transaction (pretty_printer *buffer, gimple gs, int spc, int flags)
+dump_gimple_transaction (pretty_printer *buffer, gimple_transaction gs,
+ int spc, int flags)
{
unsigned subcode = gimple_transaction_subcode (gs);
@@ -2231,7 +2232,8 @@ pp_gimple_stmt_1 (pretty_printer *buffer, gimple gs, int spc, int flags)
break;
case GIMPLE_TRANSACTION:
- dump_gimple_transaction (buffer, gs, spc, flags);
+ dump_gimple_transaction (buffer, as_a <gimple_transaction> (gs), spc,
+ flags);
break;
default:
diff --git a/gcc/gimple-streamer-in.c b/gcc/gimple-streamer-in.c
index c297ec3..a4130a5 100644
--- a/gcc/gimple-streamer-in.c
+++ b/gcc/gimple-streamer-in.c
@@ -200,7 +200,8 @@ input_gimple_stmt (struct lto_input_block *ib, struct data_in *data_in,
break;
case GIMPLE_TRANSACTION:
- gimple_transaction_set_label (stmt, stream_read_tree (ib, data_in));
+ gimple_transaction_set_label (as_a <gimple_transaction> (stmt),
+ stream_read_tree (ib, data_in));
break;
default:
diff --git a/gcc/gimple-streamer-out.c b/gcc/gimple-streamer-out.c
index 77fc3fa..cc87e88 100644
--- a/gcc/gimple-streamer-out.c
+++ b/gcc/gimple-streamer-out.c
@@ -177,8 +177,11 @@ output_gimple_stmt (struct output_block *ob, gimple stmt)
break;
case GIMPLE_TRANSACTION:
- gcc_assert (gimple_transaction_body (stmt) == NULL);
- stream_write_tree (ob, gimple_transaction_label (stmt), true);
+ {
+ gimple_transaction trans_stmt = as_a <gimple_transaction> (stmt);
+ gcc_assert (gimple_transaction_body (trans_stmt) == NULL);
+ stream_write_tree (ob, gimple_transaction_label (trans_stmt), true);
+ }
break;
default:
diff --git a/gcc/gimple-walk.c b/gcc/gimple-walk.c
index 40d2145..e41a9a5 100644
--- a/gcc/gimple-walk.c
+++ b/gcc/gimple-walk.c
@@ -438,8 +438,9 @@ walk_gimple_op (gimple stmt, walk_tree_fn callback_op,
break;
case GIMPLE_TRANSACTION:
- ret = walk_tree (gimple_transaction_label_ptr (stmt), callback_op,
- wi, pset);
+ ret = walk_tree (gimple_transaction_label_ptr (
+ as_a <gimple_transaction> (stmt)),
+ callback_op, wi, pset);
if (ret)
return ret;
break;
@@ -618,7 +619,8 @@ walk_gimple_stmt (gimple_stmt_iterator *gsi, walk_stmt_fn callback_stmt,
break;
case GIMPLE_TRANSACTION:
- ret = walk_gimple_seq_mod (gimple_transaction_body_ptr (stmt),
+ ret = walk_gimple_seq_mod (gimple_transaction_body_ptr (
+ as_a <gimple_transaction> (stmt)),
callback_stmt, callback_op, wi);
if (ret)
return wi->callback_result;
diff --git a/gcc/gimple.c b/gcc/gimple.c
index 2d86191..68ede1f 100644
--- a/gcc/gimple.c
+++ b/gcc/gimple.c
@@ -1101,10 +1101,11 @@ gimple_build_omp_atomic_store (tree val)
/* Build a GIMPLE_TRANSACTION statement. */
-gimple
+gimple_transaction
gimple_build_transaction (gimple_seq body, tree label)
{
- gimple p = gimple_alloc (GIMPLE_TRANSACTION, 0);
+ gimple_transaction p =
+ as_a <gimple_transaction> (gimple_alloc (GIMPLE_TRANSACTION, 0));
gimple_transaction_set_body (p, body);
gimple_transaction_set_label (p, label);
return p;
@@ -1765,8 +1766,10 @@ gimple_copy (gimple stmt)
break;
case GIMPLE_TRANSACTION:
- new_seq = gimple_seq_copy (gimple_transaction_body (stmt));
- gimple_transaction_set_body (copy, new_seq);
+ new_seq = gimple_seq_copy (gimple_transaction_body (
+ as_a <gimple_transaction> (stmt)));
+ gimple_transaction_set_body (as_a <gimple_transaction> (copy),
+ new_seq);
break;
case GIMPLE_WITH_CLEANUP_EXPR:
diff --git a/gcc/gimple.h b/gcc/gimple.h
index d2dc7ce..4ddcb24 100644
--- a/gcc/gimple.h
+++ b/gcc/gimple.h
@@ -1359,7 +1359,7 @@ gimple gimple_build_omp_target (gimple_seq, int, tree);
gimple gimple_build_omp_teams (gimple_seq, tree);
gimple gimple_build_omp_atomic_load (tree, tree);
gimple gimple_build_omp_atomic_store (tree);
-gimple gimple_build_transaction (gimple_seq, tree);
+gimple_transaction gimple_build_transaction (gimple_seq, tree);
gimple gimple_build_predict (enum br_predictor, enum prediction);
extern void gimple_seq_add_stmt (gimple_seq *, gimple);
extern void gimple_seq_add_stmt_without_update (gimple_seq *, gimple);
@@ -5545,78 +5545,70 @@ gimple_omp_continue_set_control_use (gimple g, tree use)
omp_continue_stmt->control_use = use;
}
-/* Return a pointer to the body for the GIMPLE_TRANSACTION statement GS. */
+/* Return a pointer to the body for the GIMPLE_TRANSACTION statement
+ TRANSACTION_STMT. */
static inline gimple_seq *
-gimple_transaction_body_ptr (gimple gs)
+gimple_transaction_body_ptr (gimple_transaction transaction_stmt)
{
- gimple_statement_transaction *transaction_stmt =
- as_a <gimple_statement_transaction *> (gs);
return &transaction_stmt->body;
}
-/* Return the body for the GIMPLE_TRANSACTION statement GS. */
+/* Return the body for the GIMPLE_TRANSACTION statement TRANSACTION_STMT. */
static inline gimple_seq
-gimple_transaction_body (gimple gs)
+gimple_transaction_body (gimple_transaction transaction_stmt)
{
- return *gimple_transaction_body_ptr (gs);
+ return *gimple_transaction_body_ptr (transaction_stmt);
}
/* Return the label associated with a GIMPLE_TRANSACTION. */
static inline tree
-gimple_transaction_label (const_gimple gs)
+gimple_transaction_label (const_gimple_transaction transaction_stmt)
{
- const gimple_statement_transaction *transaction_stmt =
- as_a <const gimple_statement_transaction *> (gs);
return transaction_stmt->label;
}
static inline tree *
-gimple_transaction_label_ptr (gimple gs)
+gimple_transaction_label_ptr (gimple_transaction transaction_stmt)
{
- gimple_statement_transaction *transaction_stmt =
- as_a <gimple_statement_transaction *> (gs);
return &transaction_stmt->label;
}
/* Return the subcode associated with a GIMPLE_TRANSACTION. */
static inline unsigned int
-gimple_transaction_subcode (const_gimple gs)
+gimple_transaction_subcode (const_gimple_transaction transaction_stmt)
{
- GIMPLE_CHECK (gs, GIMPLE_TRANSACTION);
- return gs->subcode;
+ return transaction_stmt->subcode;
}
-/* Set BODY to be the body for the GIMPLE_TRANSACTION statement GS. */
+/* Set BODY to be the body for the GIMPLE_TRANSACTION statement
+ TRANSACTION_STMT. */
static inline void
-gimple_transaction_set_body (gimple gs, gimple_seq body)
+gimple_transaction_set_body (gimple_transaction transaction_stmt,
+ gimple_seq body)
{
- gimple_statement_transaction *transaction_stmt =
- as_a <gimple_statement_transaction *> (gs);
transaction_stmt->body = body;
}
/* Set the label associated with a GIMPLE_TRANSACTION. */
static inline void
-gimple_transaction_set_label (gimple gs, tree label)
+gimple_transaction_set_label (gimple_transaction transaction_stmt, tree label)
{
- gimple_statement_transaction *transaction_stmt =
- as_a <gimple_statement_transaction *> (gs);
transaction_stmt->label = label;
}
/* Set the subcode associated with a GIMPLE_TRANSACTION. */
static inline void
-gimple_transaction_set_subcode (gimple gs, unsigned int subcode)
+gimple_transaction_set_subcode (gimple_transaction transaction_stmt,
+ unsigned int subcode)
{
- GIMPLE_CHECK (gs, GIMPLE_TRANSACTION);
- gs->subcode = subcode;
+ transaction_stmt->subcode = subcode;
}
diff --git a/gcc/gimplify.c b/gcc/gimplify.c
index bed3606..e233da8 100644
--- a/gcc/gimplify.c
+++ b/gcc/gimplify.c
@@ -7359,7 +7359,8 @@ static enum gimplify_status
gimplify_transaction (tree *expr_p, gimple_seq *pre_p)
{
tree expr = *expr_p, temp, tbody = TRANSACTION_EXPR_BODY (expr);
- gimple g;
+ gimple body_stmt;
+ gimple_transaction trans_stmt;
gimple_seq body = NULL;
int subcode = 0;
@@ -7376,17 +7377,17 @@ gimplify_transaction (tree *expr_p, gimple_seq *pre_p)
push_gimplify_context ();
temp = voidify_wrapper_expr (*expr_p, NULL);
- g = gimplify_and_return_first (TRANSACTION_EXPR_BODY (expr), &body);
- pop_gimplify_context (g);
+ body_stmt = gimplify_and_return_first (TRANSACTION_EXPR_BODY (expr), &body);
+ pop_gimplify_context (body_stmt);
- g = gimple_build_transaction (body, NULL);
+ trans_stmt = gimple_build_transaction (body, NULL);
if (TRANSACTION_EXPR_OUTER (expr))
subcode = GTMA_IS_OUTER;
else if (TRANSACTION_EXPR_RELAXED (expr))
subcode = GTMA_IS_RELAXED;
- gimple_transaction_set_subcode (g, subcode);
+ gimple_transaction_set_subcode (trans_stmt, subcode);
- gimplify_seq_add_stmt (pre_p, g);
+ gimplify_seq_add_stmt (pre_p, trans_stmt);
if (temp)
{
diff --git a/gcc/omp-low.c b/gcc/omp-low.c
index 58a958e..b8a131b 100644
--- a/gcc/omp-low.c
+++ b/gcc/omp-low.c
@@ -10468,7 +10468,9 @@ lower_omp_1 (gimple_stmt_iterator *gsi_p, omp_context *ctx)
lower_omp (gimple_try_cleanup_ptr (stmt), ctx);
break;
case GIMPLE_TRANSACTION:
- lower_omp (gimple_transaction_body_ptr (stmt), ctx);
+ lower_omp (gimple_transaction_body_ptr (
+ as_a <gimple_transaction> (stmt)),
+ ctx);
break;
case GIMPLE_BIND:
lower_omp (gimple_bind_body_ptr (as_a <gimple_bind> (stmt)), ctx);
diff --git a/gcc/trans-mem.c b/gcc/trans-mem.c
index fe8be6c..82f93b9 100644
--- a/gcc/trans-mem.c
+++ b/gcc/trans-mem.c
@@ -755,9 +755,10 @@ diagnose_tm_1 (gimple_stmt_iterator *gsi, bool *handled_ops_p,
case GIMPLE_TRANSACTION:
{
+ gimple_transaction trans_stmt = as_a <gimple_transaction> (stmt);
unsigned char inner_flags = DIAG_TM_SAFE;
- if (gimple_transaction_subcode (stmt) & GTMA_IS_RELAXED)
+ if (gimple_transaction_subcode (trans_stmt) & GTMA_IS_RELAXED)
{
if (d->block_flags & DIAG_TM_SAFE)
error_at (gimple_location (stmt),
@@ -767,7 +768,7 @@ diagnose_tm_1 (gimple_stmt_iterator *gsi, bool *handled_ops_p,
"relaxed transaction in %<transaction_safe%> function");
inner_flags = DIAG_TM_RELAXED;
}
- else if (gimple_transaction_subcode (stmt) & GTMA_IS_OUTER)
+ else if (gimple_transaction_subcode (trans_stmt) & GTMA_IS_OUTER)
{
if (d->block_flags)
error_at (gimple_location (stmt),
@@ -783,7 +784,7 @@ diagnose_tm_1 (gimple_stmt_iterator *gsi, bool *handled_ops_p,
}
*handled_ops_p = true;
- if (gimple_transaction_body (stmt))
+ if (gimple_transaction_body (trans_stmt))
{
struct walk_stmt_info wi_inner;
struct diagnose_tm d_inner;
@@ -796,7 +797,7 @@ diagnose_tm_1 (gimple_stmt_iterator *gsi, bool *handled_ops_p,
memset (&wi_inner, 0, sizeof (wi_inner));
wi_inner.info = &d_inner;
- walk_gimple_seq (gimple_transaction_body (stmt),
+ walk_gimple_seq (gimple_transaction_body (trans_stmt),
diagnose_tm_1, diagnose_tm_1_op, &wi_inner);
}
}
@@ -1598,7 +1599,8 @@ examine_call_tm (unsigned *state, gimple_stmt_iterator *gsi)
static void
lower_transaction (gimple_stmt_iterator *gsi, struct walk_stmt_info *wi)
{
- gimple g, stmt = gsi_stmt (*gsi);
+ gimple g;
+ gimple_transaction stmt = as_a <gimple_transaction> (gsi_stmt (*gsi));
unsigned int *outer_state = (unsigned int *) wi->info;
unsigned int this_state = 0;
struct walk_stmt_info this_wi;
@@ -1794,6 +1796,22 @@ make_pass_lower_tm (gcc::context *ctxt)
struct tm_region
{
+public:
+
+ /* The field "transaction_stmt" is initially a gimple_transaction,
+ but eventually gets lowered to a gimple_call (to BUILT_IN_TM_START).
+
+ Helper method to get it as a gimple_transaction, with code-checking
+ in a checked-build. */
+
+ gimple_transaction
+ get_transaction_stmt () const
+ {
+ return as_a <gimple_transaction> (transaction_stmt);
+ }
+
+public:
+
/* Link to the next unnested transaction. */
struct tm_region *next;
@@ -1805,7 +1823,8 @@ struct tm_region
/* The GIMPLE_TRANSACTION statement beginning this transaction.
After TM_MARK, this gets replaced by a call to
- BUILT_IN_TM_START. */
+ BUILT_IN_TM_START.
+ Hence this will be either a gimple_transaction or a gimple_call. */
gimple transaction_stmt;
/* After TM_MARK expands the GIMPLE_TRANSACTION into a call to
@@ -1848,7 +1867,8 @@ static bitmap_obstack tm_obstack;
GIMPLE_TRANSACTION statement in a tree of tm_region elements. */
static struct tm_region *
-tm_region_init_0 (struct tm_region *outer, basic_block bb, gimple stmt)
+tm_region_init_0 (struct tm_region *outer, basic_block bb,
+ gimple_transaction stmt)
{
struct tm_region *region;
@@ -1963,8 +1983,9 @@ tm_region_init (struct tm_region *region)
/* Check for the last statement in the block beginning a new region. */
g = last_stmt (bb);
old_region = region;
- if (g && gimple_code (g) == GIMPLE_TRANSACTION)
- region = tm_region_init_0 (region, bb, g);
+ if (g)
+ if (gimple_transaction trans_stmt = dyn_cast <gimple_transaction> (g))
+ region = tm_region_init_0 (region, bb, trans_stmt);
/* Process subsequent blocks. */
FOR_EACH_EDGE (e, ei, bb->succs)
@@ -2073,8 +2094,9 @@ transaction_subcode_ior (struct tm_region *region, unsigned flags)
{
if (region && region->transaction_stmt)
{
- flags |= gimple_transaction_subcode (region->transaction_stmt);
- gimple_transaction_set_subcode (region->transaction_stmt, flags);
+ gimple_transaction transaction_stmt = region->get_transaction_stmt ();
+ flags |= gimple_transaction_subcode (transaction_stmt);
+ gimple_transaction_set_subcode (transaction_stmt, flags);
}
}
@@ -2698,7 +2720,7 @@ expand_transaction (struct tm_region *region, void *data ATTRIBUTE_UNUSED)
/* ??? There are plenty of bits here we're not computing. */
{
- int subcode = gimple_transaction_subcode (region->transaction_stmt);
+ int subcode = gimple_transaction_subcode (region->get_transaction_stmt ());
int flags = 0;
if (subcode & GTMA_DOES_GO_IRREVOCABLE)
flags |= PR_DOESGOIRREVOCABLE;
@@ -2903,8 +2925,8 @@ generate_tm_state (struct tm_region *region, void *data ATTRIBUTE_UNUSED)
// again as we process blocks.
if (region->exit_blocks)
{
- unsigned int subcode
- = gimple_transaction_subcode (region->transaction_stmt);
+ gimple_transaction transaction_stmt = region->get_transaction_stmt ();
+ unsigned int subcode = gimple_transaction_subcode (transaction_stmt);
if (subcode & GTMA_DOES_GO_IRREVOCABLE)
subcode &= (GTMA_DECLARATION_MASK | GTMA_DOES_GO_IRREVOCABLE
@@ -2912,7 +2934,7 @@ generate_tm_state (struct tm_region *region, void *data ATTRIBUTE_UNUSED)
| GTMA_HAS_NO_INSTRUMENTATION);
else
subcode &= GTMA_DECLARATION_MASK;
- gimple_transaction_set_subcode (region->transaction_stmt, subcode);
+ gimple_transaction_set_subcode (transaction_stmt, subcode);
}
return NULL;
@@ -2928,11 +2950,13 @@ propagate_tm_flags_out (struct tm_region *region)
if (region->outer && region->outer->transaction_stmt)
{
- unsigned s = gimple_transaction_subcode (region->transaction_stmt);
+ unsigned s =
+ gimple_transaction_subcode (region->get_transaction_stmt ());
s &= (GTMA_HAVE_ABORT | GTMA_HAVE_LOAD | GTMA_HAVE_STORE
| GTMA_MAY_ENTER_IRREVOCABLE);
- s |= gimple_transaction_subcode (region->outer->transaction_stmt);
- gimple_transaction_set_subcode (region->outer->transaction_stmt, s);
+ s |= gimple_transaction_subcode (region->outer->get_transaction_stmt ());
+ gimple_transaction_set_subcode (region->outer->get_transaction_stmt (),
+ s);
}
propagate_tm_flags_out (region->next);
@@ -2967,7 +2991,8 @@ execute_tm_mark (void)
{
if (r->transaction_stmt)
{
- unsigned sub = gimple_transaction_subcode (r->transaction_stmt);
+ unsigned sub =
+ gimple_transaction_subcode (r->get_transaction_stmt ());
/* If we're sure to go irrevocable, there won't be
anything to expand, since the run-time will go
@@ -4664,7 +4689,8 @@ ipa_tm_diagnose_transaction (struct cgraph_node *node,
struct tm_region *r;
for (r = all_tm_regions; r ; r = r->next)
- if (gimple_transaction_subcode (r->transaction_stmt) & GTMA_IS_RELAXED)
+ if (gimple_transaction_subcode (r->get_transaction_stmt ())
+ & GTMA_IS_RELAXED)
{
/* Atomic transactions can be nested inside relaxed. */
if (r->inner)
diff --git a/gcc/tree-cfg.c b/gcc/tree-cfg.c
index 8e9262f..1662d49 100644
--- a/gcc/tree-cfg.c
+++ b/gcc/tree-cfg.c
@@ -163,7 +163,7 @@ static inline bool stmt_starts_bb_p (gimple, gimple);
static int gimple_verify_flow_info (void);
static void gimple_make_forwarder_block (edge);
static gimple first_non_label_stmt (basic_block);
-static bool verify_gimple_transaction (gimple);
+static bool verify_gimple_transaction (gimple_transaction);
static bool call_can_make_abnormal_goto (gimple);
/* Flowgraph optimization and cleanup. */
@@ -859,7 +859,8 @@ make_edges (void)
case GIMPLE_TRANSACTION:
{
- tree abort_label = gimple_transaction_label (last);
+ tree abort_label =
+ gimple_transaction_label (as_a <gimple_transaction> (last));
if (abort_label)
make_edge (bb, label_to_block (abort_label), EDGE_TM_ABORT);
fallthru = true;
@@ -1473,12 +1474,13 @@ cleanup_dead_labels (void)
case GIMPLE_TRANSACTION:
{
- tree label = gimple_transaction_label (stmt);
+ gimple_transaction trans_stmt = as_a <gimple_transaction> (stmt);
+ tree label = gimple_transaction_label (trans_stmt);
if (label)
{
tree new_label = main_block_label (label);
if (new_label != label)
- gimple_transaction_set_label (stmt, new_label);
+ gimple_transaction_set_label (trans_stmt, new_label);
}
}
break;
@@ -4517,7 +4519,7 @@ verify_gimple_stmt (gimple stmt)
return false;
case GIMPLE_TRANSACTION:
- return verify_gimple_transaction (stmt);
+ return verify_gimple_transaction (as_a <gimple_transaction> (stmt));
/* Tuples that do not have tree operands. */
case GIMPLE_NOP:
@@ -4646,7 +4648,7 @@ verify_gimple_in_seq_2 (gimple_seq stmts)
break;
case GIMPLE_TRANSACTION:
- err |= verify_gimple_transaction (stmt);
+ err |= verify_gimple_transaction (as_a <gimple_transaction> (stmt));
break;
default:
@@ -4666,7 +4668,7 @@ verify_gimple_in_seq_2 (gimple_seq stmts)
is a problem, otherwise false. */
static bool
-verify_gimple_transaction (gimple stmt)
+verify_gimple_transaction (gimple_transaction stmt)
{
tree lab = gimple_transaction_label (stmt);
if (lab != NULL && TREE_CODE (lab) != LABEL_DECL)
@@ -5579,7 +5581,8 @@ gimple_redirect_edge_and_branch (edge e, basic_block dest)
/* The ABORT edge has a stored label associated with it, otherwise
the edges are simply redirectable. */
if (e->flags == 0)
- gimple_transaction_set_label (stmt, gimple_block_label (dest));
+ gimple_transaction_set_label (as_a <gimple_transaction> (stmt),
+ gimple_block_label (dest));
break;
default:
diff --git a/gcc/tree-inline.c b/gcc/tree-inline.c
index 2c7d6b7..44a2ba0 100644
--- a/gcc/tree-inline.c
+++ b/gcc/tree-inline.c
@@ -1455,9 +1455,19 @@ remap_gimple_stmt (gimple stmt, copy_body_data *id)
break;
case GIMPLE_TRANSACTION:
- s1 = remap_gimple_seq (gimple_transaction_body (stmt), id);
- copy = gimple_build_transaction (s1, gimple_transaction_label (stmt));
- gimple_transaction_set_subcode (copy, gimple_transaction_subcode (stmt));
+ {
+ gimple_transaction old_trans_stmt =
+ as_a <gimple_transaction> (stmt);
+ gimple_transaction new_trans_stmt;
+ s1 = remap_gimple_seq (gimple_transaction_body (old_trans_stmt),
+ id);
+ copy = new_trans_stmt =
+ gimple_build_transaction (s1,
+ gimple_transaction_label (old_trans_stmt));
+ gimple_transaction_set_subcode (
+ new_trans_stmt,
+ gimple_transaction_subcode (old_trans_stmt));
+ }
break;
default:
@@ -4012,7 +4022,8 @@ estimate_num_insns (gimple stmt, eni_weights *weights)
case GIMPLE_TRANSACTION:
return (weights->tm_cost
- + estimate_num_insns_seq (gimple_transaction_body (stmt),
+ + estimate_num_insns_seq (gimple_transaction_body (
+ as_a <gimple_transaction> (stmt)),
weights));
default:
--
1.8.5.3
^ permalink raw reply [flat|nested] 93+ messages in thread
* [gimple-classes, committed 27/92] Introduce gimple_resx
2014-10-27 20:35 [gimple-classes, committed 00/92] Initial slew of commits David Malcolm
` (4 preceding siblings ...)
2014-10-27 20:35 ` [gimple-classes, committed 14/92] tree-ssa-loop-manip.c: use gimple_phi in three places David Malcolm
@ 2014-10-27 20:35 ` David Malcolm
2014-10-27 20:35 ` [gimple-classes, committed 22/92] Introduce gimple_transaction David Malcolm
` (85 subsequent siblings)
91 siblings, 0 replies; 93+ messages in thread
From: David Malcolm @ 2014-10-27 20:35 UTC (permalink / raw)
To: gcc-patches; +Cc: David Malcolm
This corresponds to:
[PATCH 29/89] Introduce gimple_resx
https://gcc.gnu.org/ml/gcc-patches/2014-04/msg01161.html
from the original 89-patch kit
That earlier patch was approved by Jeff:
> OK after fixing up the naming/const stuff as discussed for prior
> patches.
> That applies to 22-30. Make sure to take care of
> the pretty printers per Trevor's comments as well. He indicated those
> were missing in a couple of those patches.
in https://gcc.gnu.org/ml/gcc-patches/2014-05/msg00628.html
gcc/
* coretypes.h (gimple_resx): New typedef.
(const_gimple_resx): New typedef.
* gimple.h (gimple_build_resx): Return a gimple_resx rather than a
plain gimple.
(gimple_resx_region): Require a const_gimple_resx rather than a
plain const_gimple.
(gimple_resx_set_region): Require a gimple_resx rather than a
plain gimple.
* gimple-pretty-print.c (dump_gimple_resx): Require a gimple_resx
rather than a plain gimple.
(pp_gimple_stmt_1): Add a checked cast to gimple_resx within
GIMPLE_RESX case of switch statement.
* gimple-streamer-in.c (input_gimple_stmt): Likewise.
* gimple-streamer-out.c (output_gimple_stmt): Likewise.
* gimple.c (gimple_build_resx): Return a gimple_resx rather than
a plain gimple.
* tree-cfg.c (move_stmt_r): Add a checked cast to gimple_resx
within GIMPLE_RESX case of switch statement, adding a new local.
* tree-eh.c (emit_resx): Convert local "x" from gimple to
gimple_resx.
(lower_resx): Require a gimple_resx rather than a plain gimple.
(pass_lower_resx::execute): Add a checked cast to gimple_resx.
(mark_reachable_handlers): Likewise.
* tree-inline.c (remap_gimple_stmt): Add a checked cast to
gimple_resx within GIMPLE_RESX case of switch statement, adding
a new local.
---
gcc/ChangeLog.gimple-classes | 39 +++++++++++++++++++++++++++++++++++++++
gcc/coretypes.h | 4 ++++
gcc/gimple-pretty-print.c | 4 ++--
gcc/gimple-streamer-in.c | 3 ++-
gcc/gimple-streamer-out.c | 2 +-
gcc/gimple.c | 7 +++----
gcc/gimple.h | 13 +++++--------
gcc/tree-cfg.c | 5 +++--
gcc/tree-eh.c | 11 +++++++----
gcc/tree-inline.c | 5 +++--
10 files changed, 69 insertions(+), 24 deletions(-)
diff --git a/gcc/ChangeLog.gimple-classes b/gcc/ChangeLog.gimple-classes
index fe3008a..6e2d2f5 100644
--- a/gcc/ChangeLog.gimple-classes
+++ b/gcc/ChangeLog.gimple-classes
@@ -1,5 +1,44 @@
2014-10-24 David Malcolm <dmalcolm@redhat.com>
+ Introduce gimple_resx
+
+ * coretypes.h (gimple_resx): New typedef.
+ (const_gimple_resx): New typedef.
+
+ * gimple.h (gimple_build_resx): Return a gimple_resx rather than a
+ plain gimple.
+ (gimple_resx_region): Require a const_gimple_resx rather than a
+ plain const_gimple.
+ (gimple_resx_set_region): Require a gimple_resx rather than a
+ plain gimple.
+
+ * gimple-pretty-print.c (dump_gimple_resx): Require a gimple_resx
+ rather than a plain gimple.
+ (pp_gimple_stmt_1): Add a checked cast to gimple_resx within
+ GIMPLE_RESX case of switch statement.
+
+ * gimple-streamer-in.c (input_gimple_stmt): Likewise.
+
+ * gimple-streamer-out.c (output_gimple_stmt): Likewise.
+
+ * gimple.c (gimple_build_resx): Return a gimple_resx rather than
+ a plain gimple.
+
+ * tree-cfg.c (move_stmt_r): Add a checked cast to gimple_resx
+ within GIMPLE_RESX case of switch statement, adding a new local.
+
+ * tree-eh.c (emit_resx): Convert local "x" from gimple to
+ gimple_resx.
+ (lower_resx): Require a gimple_resx rather than a plain gimple.
+ (pass_lower_resx::execute): Add a checked cast to gimple_resx.
+ (mark_reachable_handlers): Likewise.
+
+ * tree-inline.c (remap_gimple_stmt): Add a checked cast to
+ gimple_resx within GIMPLE_RESX case of switch statement, adding
+ a new local.
+
+2014-10-24 David Malcolm <dmalcolm@redhat.com>
+
Introduce gimple_eh_else
* coretypes.h (gimple_eh_else): New typedef.
diff --git a/gcc/coretypes.h b/gcc/coretypes.h
index ba076ec..fc2dbf3 100644
--- a/gcc/coretypes.h
+++ b/gcc/coretypes.h
@@ -150,6 +150,10 @@ struct gimple_statement_eh_else;
typedef struct gimple_statement_eh_else *gimple_eh_else;
typedef const struct gimple_statement_eh_else *const_gimple_eh_else;
+struct gimple_statement_resx;
+typedef struct gimple_statement_resx *gimple_resx;
+typedef const struct gimple_statement_resx *const_gimple_resx;
+
struct gimple_statement_phi;
typedef struct gimple_statement_phi *gimple_phi;
typedef const struct gimple_statement_phi *const_gimple_phi;
diff --git a/gcc/gimple-pretty-print.c b/gcc/gimple-pretty-print.c
index a82049f..81f1a35 100644
--- a/gcc/gimple-pretty-print.c
+++ b/gcc/gimple-pretty-print.c
@@ -1057,7 +1057,7 @@ dump_gimple_eh_else (pretty_printer *buffer, gimple_eh_else gs, int spc,
dumpfile.h). */
static void
-dump_gimple_resx (pretty_printer *buffer, gimple gs, int spc, int flags)
+dump_gimple_resx (pretty_printer *buffer, gimple_resx gs, int spc, int flags)
{
if (flags & TDF_RAW)
dump_gimple_fmt (buffer, spc, flags, "%G <%d>", gs,
@@ -2214,7 +2214,7 @@ pp_gimple_stmt_1 (pretty_printer *buffer, gimple gs, int spc, int flags)
break;
case GIMPLE_RESX:
- dump_gimple_resx (buffer, gs, spc, flags);
+ dump_gimple_resx (buffer, as_a <gimple_resx> (gs), spc, flags);
break;
case GIMPLE_EH_DISPATCH:
diff --git a/gcc/gimple-streamer-in.c b/gcc/gimple-streamer-in.c
index 1d1ad27..55f939c 100644
--- a/gcc/gimple-streamer-in.c
+++ b/gcc/gimple-streamer-in.c
@@ -123,7 +123,8 @@ input_gimple_stmt (struct lto_input_block *ib, struct data_in *data_in,
switch (code)
{
case GIMPLE_RESX:
- gimple_resx_set_region (stmt, streamer_read_hwi (ib));
+ gimple_resx_set_region (as_a <gimple_resx> (stmt),
+ streamer_read_hwi (ib));
break;
case GIMPLE_EH_MUST_NOT_THROW:
diff --git a/gcc/gimple-streamer-out.c b/gcc/gimple-streamer-out.c
index 41a4dc4..b23dfb7 100644
--- a/gcc/gimple-streamer-out.c
+++ b/gcc/gimple-streamer-out.c
@@ -97,7 +97,7 @@ output_gimple_stmt (struct output_block *ob, gimple stmt)
switch (gimple_code (stmt))
{
case GIMPLE_RESX:
- streamer_write_hwi (ob, gimple_resx_region (stmt));
+ streamer_write_hwi (ob, gimple_resx_region (as_a <gimple_resx> (stmt)));
break;
case GIMPLE_EH_MUST_NOT_THROW:
diff --git a/gcc/gimple.c b/gcc/gimple.c
index b3c663c..c94611a 100644
--- a/gcc/gimple.c
+++ b/gcc/gimple.c
@@ -710,12 +710,11 @@ gimple_build_wce (gimple_seq cleanup)
/* Build a GIMPLE_RESX statement. */
-gimple
+gimple_resx
gimple_build_resx (int region)
{
- gimple_statement_resx *p =
- as_a <gimple_statement_resx *> (
- gimple_build_with_ops (GIMPLE_RESX, ERROR_MARK, 0));
+ gimple_resx p =
+ as_a <gimple_resx> (gimple_build_with_ops (GIMPLE_RESX, ERROR_MARK, 0));
p->region = region;
return p;
}
diff --git a/gcc/gimple.h b/gcc/gimple.h
index 9b73e00..f15693b 100644
--- a/gcc/gimple.h
+++ b/gcc/gimple.h
@@ -1332,7 +1332,7 @@ gimple_eh_else gimple_build_eh_else (gimple_seq, gimple_seq);
gimple_statement_try *gimple_build_try (gimple_seq, gimple_seq,
enum gimple_try_flags);
gimple gimple_build_wce (gimple_seq);
-gimple gimple_build_resx (int);
+gimple_resx gimple_build_resx (int);
gimple_switch gimple_build_switch_nlabels (unsigned, tree, tree);
gimple_switch gimple_build_switch (tree, tree, vec<tree> );
gimple gimple_build_eh_dispatch (int);
@@ -4019,22 +4019,19 @@ gimple_phi_arg_has_location (gimple gs, size_t i)
}
-/* Return the region number for GIMPLE_RESX GS. */
+/* Return the region number for GIMPLE_RESX RESX_STMT. */
static inline int
-gimple_resx_region (const_gimple gs)
+gimple_resx_region (const_gimple_resx resx_stmt)
{
- const gimple_statement_resx *resx_stmt =
- as_a <const gimple_statement_resx *> (gs);
return resx_stmt->region;
}
-/* Set REGION to be the region number for GIMPLE_RESX GS. */
+/* Set REGION to be the region number for GIMPLE_RESX RESX_STMT. */
static inline void
-gimple_resx_set_region (gimple gs, int region)
+gimple_resx_set_region (gimple_resx resx_stmt, int region)
{
- gimple_statement_resx *resx_stmt = as_a <gimple_statement_resx *> (gs);
resx_stmt->region = region;
}
diff --git a/gcc/tree-cfg.c b/gcc/tree-cfg.c
index 10422c6..3ac05cb 100644
--- a/gcc/tree-cfg.c
+++ b/gcc/tree-cfg.c
@@ -6524,9 +6524,10 @@ move_stmt_r (gimple_stmt_iterator *gsi_p, bool *handled_ops_p,
case GIMPLE_RESX:
{
- int r = gimple_resx_region (stmt);
+ gimple_resx resx_stmt = as_a <gimple_resx> (stmt);
+ int r = gimple_resx_region (resx_stmt);
r = move_stmt_eh_region_nr (r, p);
- gimple_resx_set_region (stmt, r);
+ gimple_resx_set_region (resx_stmt, r);
}
break;
diff --git a/gcc/tree-eh.c b/gcc/tree-eh.c
index fbb40e5..f58e518 100644
--- a/gcc/tree-eh.c
+++ b/gcc/tree-eh.c
@@ -805,7 +805,7 @@ emit_post_landing_pad (gimple_seq *seq, eh_region region)
static void
emit_resx (gimple_seq *seq, eh_region region)
{
- gimple x = gimple_build_resx (region->index);
+ gimple_resx x = gimple_build_resx (region->index);
gimple_seq_add_stmt (seq, x);
if (region->outer)
record_stmt_eh_region (region->outer, x);
@@ -3145,7 +3145,8 @@ make_pass_refactor_eh (gcc::context *ctxt)
/* At the end of gimple optimization, we can lower RESX. */
static bool
-lower_resx (basic_block bb, gimple stmt, hash_map<eh_region, tree> *mnt_map)
+lower_resx (basic_block bb, gimple_resx stmt,
+ hash_map<eh_region, tree> *mnt_map)
{
int lp_nr;
eh_region src_r, dst_r;
@@ -3333,7 +3334,8 @@ pass_lower_resx::execute (function *fun)
gimple last = last_stmt (bb);
if (last && is_gimple_resx (last))
{
- dominance_invalidated |= lower_resx (bb, last, &mnt_map);
+ dominance_invalidated |=
+ lower_resx (bb, as_a <gimple_resx> (last), &mnt_map);
any_rewritten = true;
}
}
@@ -3818,7 +3820,8 @@ mark_reachable_handlers (sbitmap *r_reachablep, sbitmap *lp_reachablep)
switch (gimple_code (stmt))
{
case GIMPLE_RESX:
- bitmap_set_bit (r_reachable, gimple_resx_region (stmt));
+ bitmap_set_bit (r_reachable,
+ gimple_resx_region (as_a <gimple_resx> (stmt)));
break;
case GIMPLE_EH_DISPATCH:
bitmap_set_bit (r_reachable, gimple_eh_dispatch_region (stmt));
diff --git a/gcc/tree-inline.c b/gcc/tree-inline.c
index b6f2a5c..60f501d 100644
--- a/gcc/tree-inline.c
+++ b/gcc/tree-inline.c
@@ -1584,9 +1584,10 @@ remap_gimple_stmt (gimple stmt, copy_body_data *id)
case GIMPLE_RESX:
{
- int r = gimple_resx_region (copy);
+ gimple_resx resx_stmt = as_a <gimple_resx> (copy);
+ int r = gimple_resx_region (resx_stmt);
r = remap_eh_region_nr (r, id);
- gimple_resx_set_region (copy, r);
+ gimple_resx_set_region (resx_stmt, r);
}
break;
--
1.8.5.3
^ permalink raw reply [flat|nested] 93+ messages in thread
* [gimple-classes, committed 20/92] Introduce gimple_goto
2014-10-27 20:35 [gimple-classes, committed 00/92] Initial slew of commits David Malcolm
` (2 preceding siblings ...)
2014-10-27 20:35 ` [gimple-classes, committed 06/92] Introduce gimple_debug and use it in a few places David Malcolm
@ 2014-10-27 20:35 ` David Malcolm
2014-10-27 20:35 ` [gimple-classes, committed 14/92] tree-ssa-loop-manip.c: use gimple_phi in three places David Malcolm
` (87 subsequent siblings)
91 siblings, 0 replies; 93+ messages in thread
From: David Malcolm @ 2014-10-27 20:35 UTC (permalink / raw)
To: gcc-patches; +Cc: David Malcolm
This corresponds to:
[PATCH 22/89] Introduce gimple_goto
https://gcc.gnu.org/ml/gcc-patches/2014-04/msg01174.html
from the original 89-patch kit
That earlier patch was approved by Jeff:
> OK after fixing up the naming/const stuff as discussed for prior
> patches.
> That applies to 22-30. Make sure to take care of
> the pretty printers per Trevor's comments as well. He indicated those
> were missing in a couple of those patches.
in https://gcc.gnu.org/ml/gcc-patches/2014-05/msg00628.html
gcc/
* coretypes.h (gimple_goto): New typedef.
(const_gimple_goto): New typedef.
* gimple.h (gimple_statement_goto): New subclass of
gimple_statement_with_ops, adding the invariant that
stmt->code == GIMPLE_GOTO.
(is_a_helper <gimple_statement_goto>::test): New.
(gimple_build_goto): Return a gimple_goto rather than a
plain gimple.
* gimple-pretty-print.c (dump_gimple_goto): Require a gimple_goto
rather than a plain gimple.
(pp_gimple_stmt_1): Add a checked cast to gimple_goto within
GIMPLE_GOTO case of switch statement.
* gimple.c (gimple_build_goto): Return a gimple_goto rather than a
plain gimple.
* tree-cfg.c (verify_gimple_goto): Require a gimple_goto rather
than a plain gimple.
(verify_gimple_stmt): Add a checked cast to gimple_goto within
GIMPLE_GOTO case of switch statement.
---
gcc/ChangeLog.gimple-classes | 27 +++++++++++++++++++++++++++
gcc/coretypes.h | 4 ++++
gcc/gimple-pretty-print.c | 4 ++--
gcc/gimple.c | 5 +++--
gcc/gimple.h | 24 +++++++++++++++++++++++-
gcc/tree-cfg.c | 4 ++--
6 files changed, 61 insertions(+), 7 deletions(-)
diff --git a/gcc/ChangeLog.gimple-classes b/gcc/ChangeLog.gimple-classes
index 5508788..bba6c7d 100644
--- a/gcc/ChangeLog.gimple-classes
+++ b/gcc/ChangeLog.gimple-classes
@@ -1,5 +1,32 @@
2014-10-24 David Malcolm <dmalcolm@redhat.com>
+ Introduce gimple_goto
+
+ * coretypes.h (gimple_goto): New typedef.
+ (const_gimple_goto): New typedef.
+
+ * gimple.h (gimple_statement_goto): New subclass of
+ gimple_statement_with_ops, adding the invariant that
+ stmt->code == GIMPLE_GOTO.
+ (is_a_helper <gimple_statement_goto>::test): New.
+ (gimple_build_goto): Return a gimple_goto rather than a
+ plain gimple.
+
+ * gimple-pretty-print.c (dump_gimple_goto): Require a gimple_goto
+ rather than a plain gimple.
+ (pp_gimple_stmt_1): Add a checked cast to gimple_goto within
+ GIMPLE_GOTO case of switch statement.
+
+ * gimple.c (gimple_build_goto): Return a gimple_goto rather than a
+ plain gimple.
+
+ * tree-cfg.c (verify_gimple_goto): Require a gimple_goto rather
+ than a plain gimple.
+ (verify_gimple_stmt): Add a checked cast to gimple_goto within
+ GIMPLE_GOTO case of switch statement.
+
+2014-10-24 David Malcolm <dmalcolm@redhat.com>
+
Introduce gimple_return
* coretypes.h (gimple_return): New typedef.
diff --git a/gcc/coretypes.h b/gcc/coretypes.h
index f726053..653343a 100644
--- a/gcc/coretypes.h
+++ b/gcc/coretypes.h
@@ -98,6 +98,10 @@ struct gimple_statement_debug;
typedef struct gimple_statement_debug *gimple_debug;
typedef const struct gimple_statement_debug *const_gimple_debug;
+struct gimple_statement_goto;
+typedef struct gimple_statement_goto *gimple_goto;
+typedef const struct gimple_statement_goto *const_gimple_goto;
+
struct gimple_statement_label;
typedef struct gimple_statement_label *gimple_label;
typedef const struct gimple_statement_label *const_gimple_label;
diff --git a/gcc/gimple-pretty-print.c b/gcc/gimple-pretty-print.c
index cfc111c..47772d6 100644
--- a/gcc/gimple-pretty-print.c
+++ b/gcc/gimple-pretty-print.c
@@ -884,7 +884,7 @@ dump_gimple_label (pretty_printer *buffer, gimple_label gs, int spc, int flags)
TDF_* in dumpfile.h). */
static void
-dump_gimple_goto (pretty_printer *buffer, gimple gs, int spc, int flags)
+dump_gimple_goto (pretty_printer *buffer, gimple_goto gs, int spc, int flags)
{
tree label = gimple_goto_dest (gs);
if (flags & TDF_RAW)
@@ -2109,7 +2109,7 @@ pp_gimple_stmt_1 (pretty_printer *buffer, gimple gs, int spc, int flags)
break;
case GIMPLE_GOTO:
- dump_gimple_goto (buffer, gs, spc, flags);
+ dump_gimple_goto (buffer, as_a <gimple_goto> (gs), spc, flags);
break;
case GIMPLE_NOP:
diff --git a/gcc/gimple.c b/gcc/gimple.c
index e8c0a62..0e5e473 100644
--- a/gcc/gimple.c
+++ b/gcc/gimple.c
@@ -499,10 +499,11 @@ gimple_build_label (tree label)
/* Build a GIMPLE_GOTO statement to label DEST. */
-gimple
+gimple_goto
gimple_build_goto (tree dest)
{
- gimple p = gimple_build_with_ops (GIMPLE_GOTO, ERROR_MARK, 1);
+ gimple_goto p =
+ as_a <gimple_goto> (gimple_build_with_ops (GIMPLE_GOTO, ERROR_MARK, 1));
gimple_goto_set_dest (p, dest);
return p;
}
diff --git a/gcc/gimple.h b/gcc/gimple.h
index 559d281..128baf5 100644
--- a/gcc/gimple.h
+++ b/gcc/gimple.h
@@ -790,6 +790,20 @@ struct GTY((tag("GSS_WITH_OPS")))
};
/* A statement with the invariant that
+ stmt->code == GIMPLE_GOTO
+ i.e. a goto statement.
+
+ This type will normally be accessed via the gimple_goto and
+ const_gimple_goto typedefs (in coretypes.h), which are pointers to
+ this type. */
+
+struct GTY((tag("GSS_WITH_OPS")))
+ gimple_statement_goto : public gimple_statement_with_ops
+{
+ /* no additional fields; this uses the layout for GSS_WITH_OPS. */
+};
+
+/* A statement with the invariant that
stmt->code == GIMPLE_LABEL
i.e. a label statement.
@@ -892,6 +906,14 @@ is_a_helper <gimple_statement_debug *>::test (gimple gs)
template <>
template <>
inline bool
+is_a_helper <gimple_statement_goto *>::test (gimple gs)
+{
+ return gs->code == GIMPLE_GOTO;
+}
+
+template <>
+template <>
+inline bool
is_a_helper <gimple_statement_label *>::test (gimple gs)
{
return gs->code == GIMPLE_LABEL;
@@ -1297,7 +1319,7 @@ gimple_cond gimple_build_cond (enum tree_code, tree, tree, tree, tree);
gimple_cond gimple_build_cond_from_tree (tree, tree, tree);
void gimple_cond_set_condition_from_tree (gimple_cond, tree);
gimple_label gimple_build_label (tree label);
-gimple gimple_build_goto (tree dest);
+gimple_goto gimple_build_goto (tree dest);
gimple gimple_build_nop (void);
gimple_bind gimple_build_bind (tree, gimple_seq, tree);
gimple gimple_build_asm_vec (const char *, vec<tree, va_gc> *,
diff --git a/gcc/tree-cfg.c b/gcc/tree-cfg.c
index ea5bc73..1652075 100644
--- a/gcc/tree-cfg.c
+++ b/gcc/tree-cfg.c
@@ -4304,7 +4304,7 @@ verify_gimple_return (gimple_return stmt)
is a problem, otherwise false. */
static bool
-verify_gimple_goto (gimple stmt)
+verify_gimple_goto (gimple_goto stmt)
{
tree dest = gimple_goto_dest (stmt);
@@ -4504,7 +4504,7 @@ verify_gimple_stmt (gimple stmt)
gimple_cond_rhs (stmt));
case GIMPLE_GOTO:
- return verify_gimple_goto (stmt);
+ return verify_gimple_goto (as_a <gimple_goto> (stmt));
case GIMPLE_SWITCH:
return verify_gimple_switch (as_a <gimple_switch> (stmt));
--
1.8.5.3
^ permalink raw reply [flat|nested] 93+ messages in thread
* [gimple-classes, committed 14/92] tree-ssa-loop-manip.c: use gimple_phi in three places
2014-10-27 20:35 [gimple-classes, committed 00/92] Initial slew of commits David Malcolm
` (3 preceding siblings ...)
2014-10-27 20:35 ` [gimple-classes, committed 20/92] Introduce gimple_goto David Malcolm
@ 2014-10-27 20:35 ` David Malcolm
2014-10-27 20:35 ` [gimple-classes, committed 27/92] Introduce gimple_resx David Malcolm
` (86 subsequent siblings)
91 siblings, 0 replies; 93+ messages in thread
From: David Malcolm @ 2014-10-27 20:35 UTC (permalink / raw)
To: gcc-patches; +Cc: David Malcolm
This corresponds to:
[PATCH 15/89] tree-ssa-loop-manip.c: use gimple_phi in three places
https://gcc.gnu.org/ml/gcc-patches/2014-04/msg01217.html
from the original 89-patch kit
That earlier patch was approved by Jeff:
> OK when prerequisites have gone in.
in https://gcc.gnu.org/ml/gcc-patches/2014-05/msg00625.html
gcc/
* tree-ssa-loop-manip.c (add_exit_phi): Convert local "phi" to be a
gimple_phi.
(split_loop_exit_edge): Likewise for "phi" and "new_phi".
---
gcc/ChangeLog.gimple-classes | 8 ++++++++
gcc/tree-ssa-loop-manip.c | 4 ++--
2 files changed, 10 insertions(+), 2 deletions(-)
diff --git a/gcc/ChangeLog.gimple-classes b/gcc/ChangeLog.gimple-classes
index 533002f..1e636be 100644
--- a/gcc/ChangeLog.gimple-classes
+++ b/gcc/ChangeLog.gimple-classes
@@ -1,5 +1,13 @@
2014-10-24 David Malcolm <dmalcolm@redhat.com>
+ tree-ssa-loop-manip.c: use gimple_phi in three places
+
+ * tree-ssa-loop-manip.c (add_exit_phi): Convert local "phi" to be a
+ gimple_phi.
+ (split_loop_exit_edge): Likewise for "phi" and "new_phi".
+
+2014-10-24 David Malcolm <dmalcolm@redhat.com>
+
tree-ssa-loop-niter.c: use gimple_phi in a few places
* tree-ssa-loop-niter.c (chain_of_csts_start): Return a gimple_phi
diff --git a/gcc/tree-ssa-loop-manip.c b/gcc/tree-ssa-loop-manip.c
index 3acf7fb..edc913d 100644
--- a/gcc/tree-ssa-loop-manip.c
+++ b/gcc/tree-ssa-loop-manip.c
@@ -276,7 +276,7 @@ compute_live_loop_exits (bitmap live_exits, bitmap use_blocks,
static void
add_exit_phi (basic_block exit, tree var)
{
- gimple phi;
+ gimple_phi phi;
edge e;
edge_iterator ei;
@@ -627,7 +627,7 @@ split_loop_exit_edge (edge exit)
{
basic_block dest = exit->dest;
basic_block bb = split_edge (exit);
- gimple phi, new_phi;
+ gimple_phi phi, new_phi;
tree new_name, name;
use_operand_p op_p;
gimple_phi_iterator psi;
--
1.8.5.3
^ permalink raw reply [flat|nested] 93+ messages in thread
* [gimple-classes, committed 38/92] tree-cfg.c: Make verify_gimple_call require a gimple_call
2014-10-27 20:35 [gimple-classes, committed 00/92] Initial slew of commits David Malcolm
` (7 preceding siblings ...)
2014-10-27 20:35 ` [gimple-classes, committed 19/92] Introduce gimple_return David Malcolm
@ 2014-10-27 20:35 ` David Malcolm
2014-10-27 20:35 ` [gimple-classes, committed 03/92] Introduce gimple_cond and use it in various places David Malcolm
` (82 subsequent siblings)
91 siblings, 0 replies; 93+ messages in thread
From: David Malcolm @ 2014-10-27 20:35 UTC (permalink / raw)
To: gcc-patches; +Cc: David Malcolm
This corresponds to:
[PATCH 40/89] tree-cfg.c: Make verify_gimple_call require a gimple_call
https://gcc.gnu.org/ml/gcc-patches/2014-04/msg01232.html
from the original 89-patch kit
That earlier patch was approved by Jeff:
> OK when prerequisites have gone in.
in https://gcc.gnu.org/ml/gcc-patches/2014-05/msg00805.html
gcc/
* tree-cfg.c (verify_gimple_call): Require a gimple_call rather
than a plain gimple.
(verify_gimple_stmt): Add checked cast to gimple_call within
GIMPLE_CALL case of switch statement.
---
gcc/ChangeLog.gimple-classes | 9 +++++++++
gcc/tree-cfg.c | 4 ++--
2 files changed, 11 insertions(+), 2 deletions(-)
diff --git a/gcc/ChangeLog.gimple-classes b/gcc/ChangeLog.gimple-classes
index b0ddcd3..b030d20 100644
--- a/gcc/ChangeLog.gimple-classes
+++ b/gcc/ChangeLog.gimple-classes
@@ -1,5 +1,14 @@
2014-10-24 David Malcolm <dmalcolm@redhat.com>
+ tree-cfg.c: Make verify_gimple_call require a gimple_call
+
+ * tree-cfg.c (verify_gimple_call): Require a gimple_call rather
+ than a plain gimple.
+ (verify_gimple_stmt): Add checked cast to gimple_call within
+ GIMPLE_CALL case of switch statement.
+
+2014-10-24 David Malcolm <dmalcolm@redhat.com>
+
Introduce gimple_omp_parallel
* coretypes.h (gimple_omp_parallel): New typedef.
diff --git a/gcc/tree-cfg.c b/gcc/tree-cfg.c
index feeefea..9db1ffd 100644
--- a/gcc/tree-cfg.c
+++ b/gcc/tree-cfg.c
@@ -3208,7 +3208,7 @@ valid_fixed_convert_types_p (tree type1, tree type2)
is a problem, otherwise false. */
static bool
-verify_gimple_call (gimple stmt)
+verify_gimple_call (gimple_call stmt)
{
tree fn = gimple_call_fn (stmt);
tree fntype, fndecl;
@@ -4486,7 +4486,7 @@ verify_gimple_stmt (gimple stmt)
return verify_gimple_label (as_a <gimple_label> (stmt));
case GIMPLE_CALL:
- return verify_gimple_call (stmt);
+ return verify_gimple_call (as_a <gimple_call> (stmt));
case GIMPLE_COND:
if (TREE_CODE_CLASS (gimple_cond_code (stmt)) != tcc_comparison)
--
1.8.5.3
^ permalink raw reply [flat|nested] 93+ messages in thread
* [gimple-classes, committed 45/92] omp-low.c: Use more concrete types of gimple statement for various locals
2014-10-27 20:35 [gimple-classes, committed 00/92] Initial slew of commits David Malcolm
@ 2014-10-27 20:35 ` David Malcolm
2014-10-27 20:35 ` [gimple-classes, committed 33/92] Introduce gimple_omp_atomic_store David Malcolm
` (90 subsequent siblings)
91 siblings, 0 replies; 93+ messages in thread
From: David Malcolm @ 2014-10-27 20:35 UTC (permalink / raw)
To: gcc-patches; +Cc: David Malcolm
This corresponds to:
[PATCH 47/89] omp-low.c: Use more concrete types of gimple statement for various locals
https://gcc.gnu.org/ml/gcc-patches/2014-04/msg01203.html
from the original 89-patch kit
That earlier patch was approved by Jeff:
> OK once prerequisites have gone in.
in https://gcc.gnu.org/ml/gcc-patches/2014-05/msg00810.html
gcc/
* omp-low.c (finalize_task_copyfn): Strengthen local "bind" from
plain gimple to gimple_bind.
(lower_rec_input_clauses): Strengthen local "g" from
plain gimple to gimple_assign.
(lower_lastprivate_clauses): Likewise for "stmt" to gimple_cond
and "g" to gimple_call.
(expand_omp_for_init_vars): Likewise, for two decls of "stmt" to
gimple_assign.
(expand_omp_atomic_pipeline): Likewise for one decl of "stmt".
(expand_omp_atomic_mutex): Likewise.
(lower_omp_master): Likewise for "x" to gimple_call.
(lower_omp_ordered): Likewise.
---
gcc/ChangeLog.gimple-classes | 17 +++++++++++++++++
gcc/omp-low.c | 22 ++++++++++++----------
2 files changed, 29 insertions(+), 10 deletions(-)
diff --git a/gcc/ChangeLog.gimple-classes b/gcc/ChangeLog.gimple-classes
index b8d2f38..b0391f3 100644
--- a/gcc/ChangeLog.gimple-classes
+++ b/gcc/ChangeLog.gimple-classes
@@ -1,5 +1,22 @@
2014-10-24 David Malcolm <dmalcolm@redhat.com>
+ omp-low.c: Use more concrete types of gimple statement for various locals
+
+ * omp-low.c (finalize_task_copyfn): Strengthen local "bind" from
+ plain gimple to gimple_bind.
+ (lower_rec_input_clauses): Strengthen local "g" from
+ plain gimple to gimple_assign.
+ (lower_lastprivate_clauses): Likewise for "stmt" to gimple_cond
+ and "g" to gimple_call.
+ (expand_omp_for_init_vars): Likewise, for two decls of "stmt" to
+ gimple_assign.
+ (expand_omp_atomic_pipeline): Likewise for one decl of "stmt".
+ (expand_omp_atomic_mutex): Likewise.
+ (lower_omp_master): Likewise for "x" to gimple_call.
+ (lower_omp_ordered): Likewise.
+
+2014-10-24 David Malcolm <dmalcolm@redhat.com>
+
tree-parloops.c: Use gimple_phi in various places
* tree-parloops.c (reduction_info::keep_res): Strengthen field
diff --git a/gcc/omp-low.c b/gcc/omp-low.c
index 1edc943..9946f3f 100644
--- a/gcc/omp-low.c
+++ b/gcc/omp-low.c
@@ -1377,7 +1377,7 @@ finalize_task_copyfn (gimple_omp_task task_stmt)
struct function *child_cfun;
tree child_fn;
gimple_seq seq = NULL, new_seq;
- gimple bind;
+ gimple_bind bind;
child_fn = gimple_omp_task_copy_fn (task_stmt);
if (child_fn == NULL_TREE)
@@ -3603,7 +3603,7 @@ lower_rec_input_clauses (tree clauses, gimple_seq *ilist, gimple_seq *dlist,
gimplify_and_add (x, ilist);
gimple_stmt_iterator gsi
= gsi_start_1 (gimple_omp_body_ptr (ctx->stmt));
- gimple g
+ gimple_assign g
= gimple_build_assign (unshare_expr (lvar), iv);
gsi_insert_before_without_update (&gsi, g,
GSI_SAME_STMT);
@@ -3940,7 +3940,7 @@ lower_lastprivate_clauses (tree clauses, tree predicate, gimple_seq *stmt_list,
if (predicate)
{
- gimple stmt;
+ gimple_cond stmt;
tree label_true, arm1, arm2;
label = create_artificial_label (UNKNOWN_LOCATION);
@@ -3987,7 +3987,7 @@ lower_lastprivate_clauses (tree clauses, tree predicate, gimple_seq *stmt_list,
if (lastlane == NULL)
{
lastlane = create_tmp_var (unsigned_type_node, NULL);
- gimple g
+ gimple_call g
= gimple_build_call_internal (IFN_GOMP_SIMD_LAST_LANE,
2, simduid,
TREE_OPERAND (val, 1));
@@ -5360,7 +5360,7 @@ expand_omp_for_init_vars (struct omp_for_data *fd, gimple_stmt_iterator *gsi,
tree t = fold_convert (TREE_TYPE (tem), counts[i]);
t = force_gimple_operand_gsi (gsi, t, false, NULL_TREE,
false, GSI_CONTINUE_LINKING);
- gimple stmt = gimple_build_assign (tem, t);
+ gimple_assign stmt = gimple_build_assign (tem, t);
gsi_insert_after (gsi, stmt, GSI_CONTINUE_LINKING);
}
}
@@ -5369,7 +5369,7 @@ expand_omp_for_init_vars (struct omp_for_data *fd, gimple_stmt_iterator *gsi,
tree type = TREE_TYPE (fd->loop.v);
tree tem = create_tmp_reg (type, ".tem");
- gimple stmt = gimple_build_assign (tem, startvar);
+ gimple_assign stmt = gimple_build_assign (tem, startvar);
gsi_insert_after (gsi, stmt, GSI_CONTINUE_LINKING);
for (i = fd->collapse - 1; i >= 0; i--)
@@ -8044,7 +8044,7 @@ expand_omp_atomic_pipeline (basic_block load_bb, basic_block store_bb,
gsi2 = gsi_start_bb (loop_header);
if (gimple_in_ssa_p (cfun))
{
- gimple stmt;
+ gimple_assign stmt;
x = force_gimple_operand_gsi (&gsi2, x, true, NULL_TREE,
true, GSI_SAME_STMT);
stmt = gimple_build_assign (loaded_val, x);
@@ -8157,7 +8157,7 @@ expand_omp_atomic_mutex (basic_block load_bb, basic_block store_bb,
tree addr, tree loaded_val, tree stored_val)
{
gimple_stmt_iterator si;
- gimple stmt;
+ gimple_assign stmt;
tree t;
si = gsi_last_bb (load_bb);
@@ -9190,7 +9190,8 @@ lower_omp_master (gimple_stmt_iterator *gsi_p, omp_context *ctx)
static void
lower_omp_taskgroup (gimple_stmt_iterator *gsi_p, omp_context *ctx)
{
- gimple stmt = gsi_stmt (*gsi_p), x;
+ gimple stmt = gsi_stmt (*gsi_p);
+ gimple_call x;
gimple_bind bind;
tree block = make_node (BLOCK);
@@ -9219,7 +9220,8 @@ static void
lower_omp_ordered (gimple_stmt_iterator *gsi_p, omp_context *ctx)
{
tree block;
- gimple stmt = gsi_stmt (*gsi_p), x;
+ gimple stmt = gsi_stmt (*gsi_p);
+ gimple_call x;
gimple_bind bind;
push_gimplify_context ();
--
1.8.5.3
^ permalink raw reply [flat|nested] 93+ messages in thread
* [gimple-classes, committed 06/92] Introduce gimple_debug and use it in a few places
2014-10-27 20:35 [gimple-classes, committed 00/92] Initial slew of commits David Malcolm
2014-10-27 20:35 ` [gimple-classes, committed 45/92] omp-low.c: Use more concrete types of gimple statement for various locals David Malcolm
2014-10-27 20:35 ` [gimple-classes, committed 33/92] Introduce gimple_omp_atomic_store David Malcolm
@ 2014-10-27 20:35 ` David Malcolm
2014-10-27 20:35 ` [gimple-classes, committed 20/92] Introduce gimple_goto David Malcolm
` (88 subsequent siblings)
91 siblings, 0 replies; 93+ messages in thread
From: David Malcolm @ 2014-10-27 20:35 UTC (permalink / raw)
To: gcc-patches; +Cc: David Malcolm
This corresponds to:
[PATCH 07/89] Introduce gimple_debug and use it in a few places
https://gcc.gnu.org/ml/gcc-patches/2014-04/msg01192.html
from the original 89-patch kit
That earlier patch was approved by Jeff:
> Same as prior patches.
in https://gcc.gnu.org/ml/gcc-patches/2014-05/msg00598.html
gcc/
* coretypes.h (gimple_debug): New typedef.
(const_gimple_debug): New typedef.
* gimple.h (struct gimple_statement_debug): New subclass of
gimple_statement_with_ops, adding the invariant that
stmt->code == GIMPLE_DEBUG.
(is_a_helper <gimple_statement_debug>::test): New.
* gdbhooks.py (build_pretty_printer): Add gimple_debug and its
variants, using the gimple printer.
* gimple-pretty-print.c (dump_gimple_debug): Require a gimple_debug
rather than just a gimple.
* tree-inline.c (copy_debug_stmt): Likewise.
* tree-inline.h (struct copy_body_data): Strengthen field
"debug_stmts" from a vec<gimple> to a vec<gimple_debug>.
* gimple.c (gimple_build_debug_bind_stat): Return a gimple_debug
rather than just a gimple.
(gimple_build_debug_source_bind_stat): Likewise.
* gimple.h (gimple_build_debug_bind_stat): Likewise.
(gimple_build_debug_source_bind_stat): Likewise.
* tree-inline.c (remap_gimple_stmt): Update locals to be a
gimple_debug.
(maybe_move_debug_stmts_to_successors): Likewise.
(copy_debug_stmts): Likewise.
* gimple-pretty-print.c (pp_gimple_stmt_1): Add checked cast to
gimple_debug in regions where a stmt is known to have code
GIMPLE_DEBUG.
---
gcc/ChangeLog.gimple-classes | 37 +++++++++++++++++++++++++++++++++++++
gcc/coretypes.h | 4 ++++
gcc/gdbhooks.py | 2 ++
gcc/gimple-pretty-print.c | 4 ++--
gcc/gimple.c | 20 +++++++++++---------
gcc/gimple.h | 26 ++++++++++++++++++++++++--
gcc/tree-inline.c | 16 +++++++++-------
gcc/tree-inline.h | 2 +-
8 files changed, 90 insertions(+), 21 deletions(-)
diff --git a/gcc/ChangeLog.gimple-classes b/gcc/ChangeLog.gimple-classes
index 68eb669..ec16551 100644
--- a/gcc/ChangeLog.gimple-classes
+++ b/gcc/ChangeLog.gimple-classes
@@ -1,5 +1,42 @@
2014-10-24 David Malcolm <dmalcolm@redhat.com>
+ Introduce gimple_debug and use it in a few places
+
+ * coretypes.h (gimple_debug): New typedef.
+ (const_gimple_debug): New typedef.
+
+ * gimple.h (struct gimple_statement_debug): New subclass of
+ gimple_statement_with_ops, adding the invariant that
+ stmt->code == GIMPLE_DEBUG.
+ (is_a_helper <gimple_statement_debug>::test): New.
+
+ * gdbhooks.py (build_pretty_printer): Add gimple_debug and its
+ variants, using the gimple printer.
+
+ * gimple-pretty-print.c (dump_gimple_debug): Require a gimple_debug
+ rather than just a gimple.
+ * tree-inline.c (copy_debug_stmt): Likewise.
+
+ * tree-inline.h (struct copy_body_data): Strengthen field
+ "debug_stmts" from a vec<gimple> to a vec<gimple_debug>.
+
+ * gimple.c (gimple_build_debug_bind_stat): Return a gimple_debug
+ rather than just a gimple.
+ (gimple_build_debug_source_bind_stat): Likewise.
+ * gimple.h (gimple_build_debug_bind_stat): Likewise.
+ (gimple_build_debug_source_bind_stat): Likewise.
+
+ * tree-inline.c (remap_gimple_stmt): Update locals to be a
+ gimple_debug.
+ (maybe_move_debug_stmts_to_successors): Likewise.
+ (copy_debug_stmts): Likewise.
+
+ * gimple-pretty-print.c (pp_gimple_stmt_1): Add checked cast to
+ gimple_debug in regions where a stmt is known to have code
+ GIMPLE_DEBUG.
+
+2014-10-24 David Malcolm <dmalcolm@redhat.com>
+
Introduce gimple_label and use it in a few places
* coretypes.h (gimple_label): New typedef.
diff --git a/gcc/coretypes.h b/gcc/coretypes.h
index 24c6352..a338599 100644
--- a/gcc/coretypes.h
+++ b/gcc/coretypes.h
@@ -94,6 +94,10 @@ struct gimple_statement_cond;
typedef struct gimple_statement_cond *gimple_cond;
typedef const struct gimple_statement_cond *const_gimple_cond;
+struct gimple_statement_debug;
+typedef struct gimple_statement_debug *gimple_debug;
+typedef const struct gimple_statement_debug *const_gimple_debug;
+
struct gimple_statement_label;
typedef struct gimple_statement_label *gimple_label;
typedef const struct gimple_statement_label *const_gimple_label;
diff --git a/gcc/gdbhooks.py b/gcc/gdbhooks.py
index 7514e45..455fa5c 100644
--- a/gcc/gdbhooks.py
+++ b/gcc/gdbhooks.py
@@ -460,6 +460,8 @@ def build_pretty_printer():
# Keep this in the same order as gimple.def:
'gimple_cond', 'const_gimple_cond',
'gimple_statement_cond *',
+ 'gimple_debug', 'const_gimple_debug',
+ 'gimple_statement_debug *',
'gimple_label', 'const_gimple_label',
'gimple_statement_label *',
'gimple_switch', 'const_gimple_switch',
diff --git a/gcc/gimple-pretty-print.c b/gcc/gimple-pretty-print.c
index 9766d57..4ab8673 100644
--- a/gcc/gimple-pretty-print.c
+++ b/gcc/gimple-pretty-print.c
@@ -1082,7 +1082,7 @@ dump_gimple_eh_dispatch (pretty_printer *buffer, gimple gs, int spc, int flags)
in dumpfile.h). */
static void
-dump_gimple_debug (pretty_printer *buffer, gimple gs, int spc, int flags)
+dump_gimple_debug (pretty_printer *buffer, gimple_debug gs, int spc, int flags)
{
switch (gs->subcode)
{
@@ -2217,7 +2217,7 @@ pp_gimple_stmt_1 (pretty_printer *buffer, gimple gs, int spc, int flags)
break;
case GIMPLE_DEBUG:
- dump_gimple_debug (buffer, gs, spc, flags);
+ dump_gimple_debug (buffer, as_a <gimple_debug> (gs), spc, flags);
break;
case GIMPLE_PREDICT:
diff --git a/gcc/gimple.c b/gcc/gimple.c
index 7eff0b6..b99e0d4 100644
--- a/gcc/gimple.c
+++ b/gcc/gimple.c
@@ -765,13 +765,13 @@ gimple_build_eh_dispatch (int region)
VAR is bound to VALUE; block and location are taken from STMT. */
-gimple
+gimple_debug
gimple_build_debug_bind_stat (tree var, tree value, gimple stmt MEM_STAT_DECL)
{
- gimple p = gimple_build_with_ops_stat (GIMPLE_DEBUG,
- (unsigned)GIMPLE_DEBUG_BIND, 2
- PASS_MEM_STAT);
-
+ gimple_debug p =
+ as_a <gimple_debug> (gimple_build_with_ops_stat (GIMPLE_DEBUG,
+ (unsigned)GIMPLE_DEBUG_BIND, 2
+ PASS_MEM_STAT));
gimple_debug_bind_set_var (p, var);
gimple_debug_bind_set_value (p, value);
if (stmt)
@@ -785,13 +785,15 @@ gimple_build_debug_bind_stat (tree var, tree value, gimple stmt MEM_STAT_DECL)
VAR is bound to VALUE; block and location are taken from STMT. */
-gimple
+gimple_debug
gimple_build_debug_source_bind_stat (tree var, tree value,
gimple stmt MEM_STAT_DECL)
{
- gimple p = gimple_build_with_ops_stat (GIMPLE_DEBUG,
- (unsigned)GIMPLE_DEBUG_SOURCE_BIND, 2
- PASS_MEM_STAT);
+ gimple_debug p =
+ as_a <gimple_debug> (
+ gimple_build_with_ops_stat (GIMPLE_DEBUG,
+ (unsigned)GIMPLE_DEBUG_SOURCE_BIND, 2
+ PASS_MEM_STAT));
gimple_debug_source_bind_set_var (p, var);
gimple_debug_source_bind_set_value (p, value);
diff --git a/gcc/gimple.h b/gcc/gimple.h
index 0e34c67..8e5b42a 100644
--- a/gcc/gimple.h
+++ b/gcc/gimple.h
@@ -780,6 +780,20 @@ struct GTY((tag("GSS_WITH_OPS")))
};
/* A statement with the invariant that
+ stmt->code == GIMPLE_DEBUG
+ i.e. a debug statement.
+
+ This type will normally be accessed via the gimple_debug and
+ const_gimple_debug typedefs (in coretypes.h), which are pointers to
+ this type. */
+
+struct GTY((tag("GSS_WITH_OPS")))
+ gimple_statement_debug : public gimple_statement_with_ops
+{
+ /* no additional fields; this uses the layout for GSS_WITH_OPS. */
+};
+
+/* A statement with the invariant that
stmt->code == GIMPLE_LABEL
i.e. a label statement.
@@ -864,6 +878,14 @@ is_a_helper <gimple_statement_cond *>::test (gimple gs)
template <>
template <>
inline bool
+is_a_helper <gimple_statement_debug *>::test (gimple gs)
+{
+ return gs->code == GIMPLE_DEBUG;
+}
+
+template <>
+template <>
+inline bool
is_a_helper <gimple_statement_label *>::test (gimple gs)
{
return gs->code == GIMPLE_LABEL;
@@ -1278,10 +1300,10 @@ gimple gimple_build_resx (int);
gimple_switch gimple_build_switch_nlabels (unsigned, tree, tree);
gimple_switch gimple_build_switch (tree, tree, vec<tree> );
gimple gimple_build_eh_dispatch (int);
-gimple gimple_build_debug_bind_stat (tree, tree, gimple MEM_STAT_DECL);
+gimple_debug gimple_build_debug_bind_stat (tree, tree, gimple MEM_STAT_DECL);
#define gimple_build_debug_bind(var,val,stmt) \
gimple_build_debug_bind_stat ((var), (val), (stmt) MEM_STAT_INFO)
-gimple gimple_build_debug_source_bind_stat (tree, tree, gimple MEM_STAT_DECL);
+gimple_debug gimple_build_debug_source_bind_stat (tree, tree, gimple MEM_STAT_DECL);
#define gimple_build_debug_source_bind(var,val,stmt) \
gimple_build_debug_source_bind_stat ((var), (val), (stmt) MEM_STAT_INFO)
gimple gimple_build_omp_critical (gimple_seq, tree);
diff --git a/gcc/tree-inline.c b/gcc/tree-inline.c
index 5b7cdea..96bd561 100644
--- a/gcc/tree-inline.c
+++ b/gcc/tree-inline.c
@@ -1509,15 +1509,16 @@ remap_gimple_stmt (gimple stmt, copy_body_data *id)
if (gimple_debug_bind_p (stmt))
{
- copy = gimple_build_debug_bind (gimple_debug_bind_get_var (stmt),
- gimple_debug_bind_get_value (stmt),
- stmt);
+ gimple_debug copy =
+ gimple_build_debug_bind (gimple_debug_bind_get_var (stmt),
+ gimple_debug_bind_get_value (stmt),
+ stmt);
id->debug_stmts.safe_push (copy);
return copy;
}
if (gimple_debug_source_bind_p (stmt))
{
- copy = gimple_build_debug_source_bind
+ gimple_debug copy = gimple_build_debug_source_bind
(gimple_debug_source_bind_get_var (stmt),
gimple_debug_source_bind_get_value (stmt), stmt);
id->debug_stmts.safe_push (copy);
@@ -2317,7 +2318,8 @@ maybe_move_debug_stmts_to_successors (copy_body_data *id, basic_block new_bb)
gimple_stmt_iterator dsi = gsi_after_labels (e->dest);
while (is_gimple_debug (gsi_stmt (ssi)))
{
- gimple stmt = gsi_stmt (ssi), new_stmt;
+ gimple stmt = gsi_stmt (ssi);
+ gimple_debug new_stmt;
tree var;
tree value;
@@ -2645,7 +2647,7 @@ copy_cfg_body (copy_body_data * id, gcov_type count, int frequency_scale,
this arises, we drop the VALUE expression altogether. */
static void
-copy_debug_stmt (gimple stmt, copy_body_data *id)
+copy_debug_stmt (gimple_debug stmt, copy_body_data *id)
{
tree t, *n;
struct walk_stmt_info wi;
@@ -2737,7 +2739,7 @@ static void
copy_debug_stmts (copy_body_data *id)
{
size_t i;
- gimple stmt;
+ gimple_debug stmt;
if (!id->debug_stmts.exists ())
return;
diff --git a/gcc/tree-inline.h b/gcc/tree-inline.h
index 53059da..87351b1 100644
--- a/gcc/tree-inline.h
+++ b/gcc/tree-inline.h
@@ -127,7 +127,7 @@ struct copy_body_data
bitmap blocks_to_copy;
/* Debug statements that need processing. */
- vec<gimple> debug_stmts;
+ vec<gimple_debug> debug_stmts;
/* A map from local declarations in the inlined function to
equivalents in the function into which it is being inlined, where
--
1.8.5.3
^ permalink raw reply [flat|nested] 93+ messages in thread
* [gimple-classes, committed 70/92] Concretize gimple_switch_index and gimple_switch_index_ptr
2014-10-27 20:35 [gimple-classes, committed 00/92] Initial slew of commits David Malcolm
` (24 preceding siblings ...)
2014-10-27 20:36 ` [gimple-classes, committed 87/92] Convert various gimple to gimple_phi within ssa-iterators.h David Malcolm
@ 2014-10-27 20:36 ` David Malcolm
2014-10-27 20:36 ` [gimple-classes, committed 25/92] Introduce gimple_eh_must_not_throw David Malcolm
` (65 subsequent siblings)
91 siblings, 0 replies; 93+ messages in thread
From: David Malcolm @ 2014-10-27 20:36 UTC (permalink / raw)
To: gcc-patches; +Cc: David Malcolm
This corresponds to:
[PATCH 72/89] Concretize gimple_switch_index and gimple_switch_index_ptr
https://gcc.gnu.org/ml/gcc-patches/2014-04/msg01185.html
from the original 89-patch kit
That earlier patch was approved by Jeff:
> OK once prereqs go in and will obviously need updating for const
> changes as well.
in https://gcc.gnu.org/ml/gcc-patches/2014-05/msg00860.html
gcc/
* gimple.h (gimple_switch_index): Require a const_gimple_switch rather
than a plain const_gimple.
(gimple_switch_index_ptr): Likewise.
* gimplify-me.c (gimple_regimplify_operands): Add checked cast to
gimple_switch within "case GIMPLE_SWITCH".
* tree-cfgcleanup.c (cleanup_control_expr_graph): Likewise.
* tree-ssa-ccp.c (ccp_fold): Likewise.
* tree-ssa-dom.c (optimize_stmt): Likewise.
* tree-ssa-ccp.c (evaluate_stmt): Add checked cast to
gimple_switch within region guarded by check for GIMPLE_SWITCH.
* tree-ssa-dom.c (record_edge_info): Likewise.
(eliminate_redundant_computations): Likewise.
* tree-ssa-loop-ivcanon.c (tree_estimate_loop_size): Likewise.
* tree-ssa-threadedge.c (simplify_control_stmt_condition): Likewise.
* tree-ssa-dom.c (initialize_hash_element): Replace check for
code GIMPLE_SWITCH with a dyn_cast<gimple_switch>.
(propagate_rhs_into_lhs): Likewise.
* tree-ssa-propagate.c (may_propagate_copy_into_stmt): Likewise.
(propagate_tree_value_into_stmt): Likewise.
---
gcc/ChangeLog.gimple-classes | 27 +++++++++++++++++++++++++++
gcc/gimple.h | 6 ++----
gcc/gimplify-me.c | 4 ++--
gcc/tree-cfgcleanup.c | 2 +-
gcc/tree-ssa-ccp.c | 4 ++--
gcc/tree-ssa-dom.c | 22 +++++++++++-----------
gcc/tree-ssa-loop-ivcanon.c | 8 ++++++--
gcc/tree-ssa-pre.c | 4 +++-
gcc/tree-ssa-propagate.c | 8 ++++----
gcc/tree-ssa-sccvn.c | 2 +-
gcc/tree-ssa-threadedge.c | 2 +-
11 files changed, 60 insertions(+), 29 deletions(-)
diff --git a/gcc/ChangeLog.gimple-classes b/gcc/ChangeLog.gimple-classes
index 7b03dad..aa83c24 100644
--- a/gcc/ChangeLog.gimple-classes
+++ b/gcc/ChangeLog.gimple-classes
@@ -1,5 +1,32 @@
2014-10-24 David Malcolm <dmalcolm@redhat.com>
+ Concretize gimple_switch_index and gimple_switch_index_ptr
+
+ * gimple.h (gimple_switch_index): Require a const_gimple_switch rather
+ than a plain const_gimple.
+ (gimple_switch_index_ptr): Likewise.
+
+ * gimplify-me.c (gimple_regimplify_operands): Add checked cast to
+ gimple_switch within "case GIMPLE_SWITCH".
+ * tree-cfgcleanup.c (cleanup_control_expr_graph): Likewise.
+ * tree-ssa-ccp.c (ccp_fold): Likewise.
+ * tree-ssa-dom.c (optimize_stmt): Likewise.
+
+ * tree-ssa-ccp.c (evaluate_stmt): Add checked cast to
+ gimple_switch within region guarded by check for GIMPLE_SWITCH.
+ * tree-ssa-dom.c (record_edge_info): Likewise.
+ (eliminate_redundant_computations): Likewise.
+ * tree-ssa-loop-ivcanon.c (tree_estimate_loop_size): Likewise.
+ * tree-ssa-threadedge.c (simplify_control_stmt_condition): Likewise.
+
+ * tree-ssa-dom.c (initialize_hash_element): Replace check for
+ code GIMPLE_SWITCH with a dyn_cast<gimple_switch>.
+ (propagate_rhs_into_lhs): Likewise.
+ * tree-ssa-propagate.c (may_propagate_copy_into_stmt): Likewise.
+ (propagate_tree_value_into_stmt): Likewise.
+
+2014-10-24 David Malcolm <dmalcolm@redhat.com>
+
Concretize gimple_cond_make_{false|true}
* gimple.h (gimple_cond_make_false): Require a gimple_cond.
diff --git a/gcc/gimple.h b/gcc/gimple.h
index de1ad22..dc080de 100644
--- a/gcc/gimple.h
+++ b/gcc/gimple.h
@@ -4062,9 +4062,8 @@ gimple_switch_set_num_labels (gimple_switch g, unsigned nlabels)
/* Return the index variable used by the switch statement GS. */
static inline tree
-gimple_switch_index (const_gimple gs)
+gimple_switch_index (const_gimple_switch gs)
{
- GIMPLE_CHECK (gs, GIMPLE_SWITCH);
return gimple_op (gs, 0);
}
@@ -4072,9 +4071,8 @@ gimple_switch_index (const_gimple gs)
/* Return a pointer to the index variable for the switch statement GS. */
static inline tree *
-gimple_switch_index_ptr (const_gimple gs)
+gimple_switch_index_ptr (const_gimple_switch gs)
{
- GIMPLE_CHECK (gs, GIMPLE_SWITCH);
return gimple_op_ptr (gs, 0);
}
diff --git a/gcc/gimplify-me.c b/gcc/gimplify-me.c
index 67d71fc..5ecd169 100644
--- a/gcc/gimplify-me.c
+++ b/gcc/gimplify-me.c
@@ -174,8 +174,8 @@ gimple_regimplify_operands (gimple stmt, gimple_stmt_iterator *gsi_p)
is_gimple_val, fb_rvalue);
break;
case GIMPLE_SWITCH:
- gimplify_expr (gimple_switch_index_ptr (stmt), &pre, NULL,
- is_gimple_val, fb_rvalue);
+ gimplify_expr (gimple_switch_index_ptr (as_a <gimple_switch> (stmt)),
+ &pre, NULL, is_gimple_val, fb_rvalue);
break;
case GIMPLE_OMP_ATOMIC_LOAD:
gimplify_expr (gimple_omp_atomic_load_rhs_ptr (
diff --git a/gcc/tree-cfgcleanup.c b/gcc/tree-cfgcleanup.c
index 7ec9145..da96036 100644
--- a/gcc/tree-cfgcleanup.c
+++ b/gcc/tree-cfgcleanup.c
@@ -113,7 +113,7 @@ cleanup_control_expr_graph (basic_block bb, gimple_stmt_iterator gsi)
break;
case GIMPLE_SWITCH:
- val = gimple_switch_index (stmt);
+ val = gimple_switch_index (as_a <gimple_switch> (stmt));
break;
default:
diff --git a/gcc/tree-ssa-ccp.c b/gcc/tree-ssa-ccp.c
index 9be5b73..33fa392 100644
--- a/gcc/tree-ssa-ccp.c
+++ b/gcc/tree-ssa-ccp.c
@@ -1143,7 +1143,7 @@ ccp_fold (gimple stmt)
case GIMPLE_SWITCH:
{
/* Return the constant switch index. */
- return valueize_op (gimple_switch_index (stmt));
+ return valueize_op (gimple_switch_index (as_a <gimple_switch> (stmt)));
}
case GIMPLE_ASSIGN:
@@ -1692,7 +1692,7 @@ evaluate_stmt (gimple stmt)
simplified = gimple_assign_rhs1 (stmt);
}
else if (code == GIMPLE_SWITCH)
- simplified = gimple_switch_index (stmt);
+ simplified = gimple_switch_index (as_a <gimple_switch> (stmt));
else
/* These cannot satisfy is_gimple_min_invariant without folding. */
gcc_assert (code == GIMPLE_CALL || code == GIMPLE_COND);
diff --git a/gcc/tree-ssa-dom.c b/gcc/tree-ssa-dom.c
index 26240eb..47e45da 100644
--- a/gcc/tree-ssa-dom.c
+++ b/gcc/tree-ssa-dom.c
@@ -346,11 +346,11 @@ initialize_hash_element (gimple stmt, tree lhs,
for (i = 0; i < nargs; i++)
expr->ops.call.args[i] = gimple_call_arg (stmt, i);
}
- else if (code == GIMPLE_SWITCH)
+ else if (gimple_switch swtch_stmt = dyn_cast <gimple_switch> (stmt))
{
- expr->type = TREE_TYPE (gimple_switch_index (stmt));
+ expr->type = TREE_TYPE (gimple_switch_index (swtch_stmt));
expr->kind = EXPR_SINGLE;
- expr->ops.single.rhs = gimple_switch_index (stmt);
+ expr->ops.single.rhs = gimple_switch_index (swtch_stmt);
}
else if (code == GIMPLE_GOTO)
{
@@ -1796,7 +1796,7 @@ record_edge_info (basic_block bb)
if (gimple_code (stmt) == GIMPLE_SWITCH)
{
gimple_switch switch_stmt = as_a <gimple_switch> (stmt);
- tree index = gimple_switch_index (stmt);
+ tree index = gimple_switch_index (switch_stmt);
if (TREE_CODE (index) == SSA_NAME)
{
@@ -2081,8 +2081,8 @@ eliminate_redundant_computations (gimple_stmt_iterator* gsi)
expr_type = TREE_TYPE (gimple_call_lhs (stmt));
assigns_var_p = true;
}
- else if (gimple_code (stmt) == GIMPLE_SWITCH)
- expr_type = TREE_TYPE (gimple_switch_index (stmt));
+ else if (gimple_switch swtch_stmt = dyn_cast <gimple_switch> (stmt))
+ expr_type = TREE_TYPE (gimple_switch_index (swtch_stmt));
else if (gimple_code (stmt) == GIMPLE_PHI)
/* We can't propagate into a phi, so the logic below doesn't apply.
Instead record an equivalence between the cached LHS and the
@@ -2359,9 +2359,9 @@ optimize_stmt (basic_block bb, gimple_stmt_iterator si)
rhs = gimple_assign_rhs1 (stmt);
else if (gimple_code (stmt) == GIMPLE_GOTO)
rhs = gimple_goto_dest (stmt);
- else if (gimple_code (stmt) == GIMPLE_SWITCH)
+ else if (gimple_switch swtch_stmt = dyn_cast <gimple_switch> (stmt))
/* This should never be an ADDR_EXPR. */
- rhs = gimple_switch_index (stmt);
+ rhs = gimple_switch_index (swtch_stmt);
if (rhs && TREE_CODE (rhs) == ADDR_EXPR)
recompute_tree_invariant_for_addr_expr (rhs);
@@ -2483,8 +2483,8 @@ optimize_stmt (basic_block bb, gimple_stmt_iterator si)
val = fold_binary_loc (gimple_location (stmt),
gimple_cond_code (stmt), boolean_type_node,
gimple_cond_lhs (stmt), gimple_cond_rhs (stmt));
- else if (gimple_code (stmt) == GIMPLE_SWITCH)
- val = gimple_switch_index (stmt);
+ else if (gimple_switch swtch_stmt = dyn_cast <gimple_switch> (stmt))
+ val = gimple_switch_index (swtch_stmt);
if (val && TREE_CODE (val) == INTEGER_CST && find_taken_edge (bb, val))
cfg_altered = true;
@@ -2836,7 +2836,7 @@ propagate_rhs_into_lhs (gimple stmt, tree lhs, tree rhs, bitmap interesting_name
gimple_cond_lhs (use_stmt),
gimple_cond_rhs (use_stmt));
else if (gimple_code (use_stmt) == GIMPLE_SWITCH)
- val = gimple_switch_index (use_stmt);
+ val = gimple_switch_index (as_a <gimple_switch> (use_stmt));
else
val = gimple_goto_dest (use_stmt);
diff --git a/gcc/tree-ssa-loop-ivcanon.c b/gcc/tree-ssa-loop-ivcanon.c
index b70f118..6715caa 100644
--- a/gcc/tree-ssa-loop-ivcanon.c
+++ b/gcc/tree-ssa-loop-ivcanon.c
@@ -306,7 +306,9 @@ tree_estimate_loop_size (struct loop *loop, edge exit, edge edge_to_cancel, stru
&& constant_after_peeling (gimple_cond_lhs (stmt), stmt, loop)
&& constant_after_peeling (gimple_cond_rhs (stmt), stmt, loop))
|| (gimple_code (stmt) == GIMPLE_SWITCH
- && constant_after_peeling (gimple_switch_index (stmt), stmt, loop)))
+ && constant_after_peeling (gimple_switch_index (
+ as_a <gimple_switch> (stmt)),
+ stmt, loop)))
{
if (dump_file && (dump_flags & TDF_DETAILS))
fprintf (dump_file, " Constant conditional.\n");
@@ -358,7 +360,9 @@ tree_estimate_loop_size (struct loop *loop, edge exit, edge edge_to_cancel, stru
&& (!constant_after_peeling (gimple_cond_lhs (stmt), stmt, loop)
|| constant_after_peeling (gimple_cond_rhs (stmt), stmt, loop)))
|| (gimple_code (stmt) == GIMPLE_SWITCH
- && !constant_after_peeling (gimple_switch_index (stmt), stmt, loop)))
+ && !constant_after_peeling (gimple_switch_index (
+ as_a <gimple_switch> (stmt)),
+ stmt, loop)))
&& (!exit || bb != exit->src))
size->num_branches_on_hot_path++;
}
diff --git a/gcc/tree-ssa-pre.c b/gcc/tree-ssa-pre.c
index 189363a..c5e1f85 100644
--- a/gcc/tree-ssa-pre.c
+++ b/gcc/tree-ssa-pre.c
@@ -4372,7 +4372,9 @@ eliminate_dom_walker::before_dom_children (basic_block b)
&& (gimple_cond_true_p (as_a <gimple_cond> (stmt))
|| gimple_cond_false_p (as_a <gimple_cond> (stmt))))
|| (gimple_code (stmt) == GIMPLE_SWITCH
- && TREE_CODE (gimple_switch_index (stmt)) == INTEGER_CST))
+ && TREE_CODE (gimple_switch_index (
+ as_a <gimple_switch> (stmt)))
+ == INTEGER_CST))
el_todo |= TODO_cleanup_cfg;
}
/* If we removed EH side-effects from the statement, clean
diff --git a/gcc/tree-ssa-propagate.c b/gcc/tree-ssa-propagate.c
index 986829f..08482fd 100644
--- a/gcc/tree-ssa-propagate.c
+++ b/gcc/tree-ssa-propagate.c
@@ -1316,8 +1316,8 @@ may_propagate_copy_into_stmt (gimple dest, tree orig)
if (gimple_assign_single_p (dest))
return may_propagate_copy (gimple_assign_rhs1 (dest), orig);
- else if (gimple_code (dest) == GIMPLE_SWITCH)
- return may_propagate_copy (gimple_switch_index (dest), orig);
+ else if (gimple_switch dest_swtch = dyn_cast <gimple_switch> (dest))
+ return may_propagate_copy (gimple_switch_index (dest_swtch), orig);
/* In other cases, the expression is not materialized, so there
is no destination to pass to may_propagate_copy. On the other
@@ -1463,8 +1463,8 @@ propagate_tree_value_into_stmt (gimple_stmt_iterator *gsi, tree val)
res = update_call_from_tree (gsi, expr);
gcc_assert (res);
}
- else if (gimple_code (stmt) == GIMPLE_SWITCH)
- propagate_tree_value (gimple_switch_index_ptr (stmt), val);
+ else if (gimple_switch swtch_stmt = dyn_cast <gimple_switch> (stmt))
+ propagate_tree_value (gimple_switch_index_ptr (swtch_stmt), val);
else
gcc_unreachable ();
}
diff --git a/gcc/tree-ssa-sccvn.c b/gcc/tree-ssa-sccvn.c
index 4f0ab06..48fb2dd 100644
--- a/gcc/tree-ssa-sccvn.c
+++ b/gcc/tree-ssa-sccvn.c
@@ -4257,7 +4257,7 @@ cond_dom_walker::before_dom_children (basic_block bb)
break;
}
case GIMPLE_SWITCH:
- val = gimple_switch_index (stmt);
+ val = gimple_switch_index (as_a <gimple_switch> (stmt));
break;
case GIMPLE_GOTO:
val = gimple_goto_dest (stmt);
diff --git a/gcc/tree-ssa-threadedge.c b/gcc/tree-ssa-threadedge.c
index 50cc729..4b7bee5 100644
--- a/gcc/tree-ssa-threadedge.c
+++ b/gcc/tree-ssa-threadedge.c
@@ -619,7 +619,7 @@ simplify_control_stmt_condition (edge e,
}
if (code == GIMPLE_SWITCH)
- cond = gimple_switch_index (stmt);
+ cond = gimple_switch_index (as_a <gimple_switch> (stmt));
else if (code == GIMPLE_GOTO)
cond = gimple_goto_dest (stmt);
else
--
1.8.5.3
^ permalink raw reply [flat|nested] 93+ messages in thread
* [gimple-classes, committed 71/92] Concretize gimple_cond_{true|false}_label
2014-10-27 20:35 [gimple-classes, committed 00/92] Initial slew of commits David Malcolm
` (16 preceding siblings ...)
2014-10-27 20:36 ` [gimple-classes, committed 43/92] Introduce gimple_omp_sections David Malcolm
@ 2014-10-27 20:36 ` David Malcolm
2014-10-27 20:36 ` [gimple-classes, committed 61/92] Concretize gimple_eh_filter_set_types and gimple_eh_filter_set_failure David Malcolm
` (73 subsequent siblings)
91 siblings, 0 replies; 93+ messages in thread
From: David Malcolm @ 2014-10-27 20:36 UTC (permalink / raw)
To: gcc-patches; +Cc: David Malcolm
This corresponds to:
[PATCH 73/89] Concretize gimple_cond_{true|false}_label
https://gcc.gnu.org/ml/gcc-patches/2014-04/msg01169.html
from the original 89-patch kit
That earlier patch was approved by Jeff:
> OK once prerequisites have gone in.
in https://gcc.gnu.org/ml/gcc-patches/2014-05/msg00845.html
gcc/
* gimple.h (gimple_cond_true_label): Require a const_gimple_cond
rather than just a const_gimple.
(gimple_cond_false_label): Likewise.
* omp-low.c (diagnose_sb_2): Add checked cast to gimple_cond within
case GIMPLE_COND.
* tree-eh.c (maybe_record_in_goto_queue): Likewise.
* tree-cfg.c (verify_gimple_stmt): Add a checked cast to gimple_cond
within "case GIMPLE_COND", splitting it out into...
(verify_gimple_label): New.
---
gcc/ChangeLog.gimple-classes | 16 ++++++++++++++++
gcc/gimple.h | 7 +++----
gcc/omp-low.c | 5 +++--
gcc/tree-cfg.c | 43 ++++++++++++++++++++++++++-----------------
gcc/tree-eh.c | 17 +++++++++++------
5 files changed, 59 insertions(+), 29 deletions(-)
diff --git a/gcc/ChangeLog.gimple-classes b/gcc/ChangeLog.gimple-classes
index aa83c24..2bff31c 100644
--- a/gcc/ChangeLog.gimple-classes
+++ b/gcc/ChangeLog.gimple-classes
@@ -1,5 +1,21 @@
2014-10-24 David Malcolm <dmalcolm@redhat.com>
+ Concretize gimple_cond_{true|false}_label
+
+ * gimple.h (gimple_cond_true_label): Require a const_gimple_cond
+ rather than just a const_gimple.
+ (gimple_cond_false_label): Likewise.
+
+ * omp-low.c (diagnose_sb_2): Add checked cast to gimple_cond within
+ case GIMPLE_COND.
+ * tree-eh.c (maybe_record_in_goto_queue): Likewise.
+
+ * tree-cfg.c (verify_gimple_stmt): Add a checked cast to gimple_cond
+ within "case GIMPLE_COND", splitting it out into...
+ (verify_gimple_label): New.
+
+2014-10-24 David Malcolm <dmalcolm@redhat.com>
+
Concretize gimple_switch_index and gimple_switch_index_ptr
* gimple.h (gimple_switch_index): Require a const_gimple_switch rather
diff --git a/gcc/gimple.h b/gcc/gimple.h
index dc080de..94f3416 100644
--- a/gcc/gimple.h
+++ b/gcc/gimple.h
@@ -3080,9 +3080,8 @@ gimple_cond_set_rhs (gimple gs, tree rhs)
predicate evaluates to true. */
static inline tree
-gimple_cond_true_label (const_gimple gs)
+gimple_cond_true_label (const_gimple_cond gs)
{
- GIMPLE_CHECK (gs, GIMPLE_COND);
return gimple_op (gs, 2);
}
@@ -3111,9 +3110,9 @@ gimple_cond_set_false_label (gimple_cond gs, tree label)
predicate evaluates to false. */
static inline tree
-gimple_cond_false_label (const_gimple gs)
+gimple_cond_false_label (const_gimple_cond gs)
{
- GIMPLE_CHECK (gs, GIMPLE_COND);
+
return gimple_op (gs, 3);
}
diff --git a/gcc/omp-low.c b/gcc/omp-low.c
index be4037b..2ab49c3 100644
--- a/gcc/omp-low.c
+++ b/gcc/omp-low.c
@@ -10919,7 +10919,8 @@ diagnose_sb_2 (gimple_stmt_iterator *gsi_p, bool *handled_ops_p,
case GIMPLE_COND:
{
- tree lab = gimple_cond_true_label (stmt);
+ gimple_cond cond_stmt = as_a <gimple_cond> (stmt);
+ tree lab = gimple_cond_true_label (cond_stmt);
if (lab)
{
n = splay_tree_lookup (all_labels,
@@ -10927,7 +10928,7 @@ diagnose_sb_2 (gimple_stmt_iterator *gsi_p, bool *handled_ops_p,
diagnose_sb_0 (gsi_p, context,
n ? (gimple) n->value : NULL);
}
- lab = gimple_cond_false_label (stmt);
+ lab = gimple_cond_false_label (cond_stmt);
if (lab)
{
n = splay_tree_lookup (all_labels,
diff --git a/gcc/tree-cfg.c b/gcc/tree-cfg.c
index f17b342..ad530f3 100644
--- a/gcc/tree-cfg.c
+++ b/gcc/tree-cfg.c
@@ -4482,6 +4482,31 @@ verify_gimple_label (gimple_label stmt)
return err;
}
+/* Verify a gimple cond statement STMT.
+ Returns true if anything is wrong. */
+
+static bool
+verify_gimple_cond (gimple_cond stmt)
+{
+ if (TREE_CODE_CLASS (gimple_cond_code (stmt)) != tcc_comparison)
+ {
+ error ("invalid comparison code in gimple cond");
+ return true;
+ }
+ if (!(!gimple_cond_true_label (stmt)
+ || TREE_CODE (gimple_cond_true_label (stmt)) == LABEL_DECL)
+ || !(!gimple_cond_false_label (stmt)
+ || TREE_CODE (gimple_cond_false_label (stmt)) == LABEL_DECL))
+ {
+ error ("invalid labels in gimple cond");
+ return true;
+ }
+
+ return verify_gimple_comparison (boolean_type_node,
+ gimple_cond_lhs (stmt),
+ gimple_cond_rhs (stmt));
+}
+
/* Verify the GIMPLE statement STMT. Returns true if there is an
error, otherwise false. */
@@ -4500,23 +4525,7 @@ verify_gimple_stmt (gimple stmt)
return verify_gimple_call (as_a <gimple_call> (stmt));
case GIMPLE_COND:
- if (TREE_CODE_CLASS (gimple_cond_code (stmt)) != tcc_comparison)
- {
- error ("invalid comparison code in gimple cond");
- return true;
- }
- if (!(!gimple_cond_true_label (stmt)
- || TREE_CODE (gimple_cond_true_label (stmt)) == LABEL_DECL)
- || !(!gimple_cond_false_label (stmt)
- || TREE_CODE (gimple_cond_false_label (stmt)) == LABEL_DECL))
- {
- error ("invalid labels in gimple cond");
- return true;
- }
-
- return verify_gimple_comparison (boolean_type_node,
- gimple_cond_lhs (stmt),
- gimple_cond_rhs (stmt));
+ return verify_gimple_cond (as_a <gimple_cond> (stmt));
case GIMPLE_GOTO:
return verify_gimple_goto (as_a <gimple_goto> (stmt));
diff --git a/gcc/tree-eh.c b/gcc/tree-eh.c
index da54772..2ef68c9 100644
--- a/gcc/tree-eh.c
+++ b/gcc/tree-eh.c
@@ -671,12 +671,17 @@ maybe_record_in_goto_queue (struct leh_state *state, gimple stmt)
switch (gimple_code (stmt))
{
case GIMPLE_COND:
- new_stmt.tp = gimple_op_ptr (stmt, 2);
- record_in_goto_queue_label (tf, new_stmt, gimple_cond_true_label (stmt),
- EXPR_LOCATION (*new_stmt.tp));
- new_stmt.tp = gimple_op_ptr (stmt, 3);
- record_in_goto_queue_label (tf, new_stmt, gimple_cond_false_label (stmt),
- EXPR_LOCATION (*new_stmt.tp));
+ {
+ gimple_cond cond_stmt = as_a <gimple_cond> (stmt);
+ new_stmt.tp = gimple_op_ptr (cond_stmt, 2);
+ record_in_goto_queue_label (tf, new_stmt,
+ gimple_cond_true_label (cond_stmt),
+ EXPR_LOCATION (*new_stmt.tp));
+ new_stmt.tp = gimple_op_ptr (cond_stmt, 3);
+ record_in_goto_queue_label (tf, new_stmt,
+ gimple_cond_false_label (cond_stmt),
+ EXPR_LOCATION (*new_stmt.tp));
+ }
break;
case GIMPLE_GOTO:
new_stmt.g = stmt;
--
1.8.5.3
^ permalink raw reply [flat|nested] 93+ messages in thread
* [gimple-classes, committed 69/92] Concretize gimple_cond_make_{false|true}
2014-10-27 20:35 [gimple-classes, committed 00/92] Initial slew of commits David Malcolm
` (12 preceding siblings ...)
2014-10-27 20:36 ` [gimple-classes, committed 39/92] Introduce gimple_omp_task David Malcolm
@ 2014-10-27 20:36 ` David Malcolm
2014-10-27 20:36 ` [gimple-classes, committed 82/92] Concretize gimple_call_arg_flags David Malcolm
` (77 subsequent siblings)
91 siblings, 0 replies; 93+ messages in thread
From: David Malcolm @ 2014-10-27 20:36 UTC (permalink / raw)
To: gcc-patches; +Cc: David Malcolm
This corresponds to:
[PATCH 71/89] Concretize gimple_cond_make_{false|true}
https://gcc.gnu.org/ml/gcc-patches/2014-04/msg01208.html
from the original 89-patch kit
That earlier patch was approved by Jeff:
> OK once prerequisites go in.
in https://gcc.gnu.org/ml/gcc-patches/2014-05/msg00863.html
gcc/
* gimple.h (gimple_cond_make_false): Require a gimple_cond.
(gimple_cond_make_true): Likewise.
* tree-cfg.c (fold_cond_expr_cond): Add a checked cast to
gimple_cond within region guarded by check for GIMPLE_COND.
* tree-ssa-ccp.c (ccp_fold_stmt): Likewise.
* tree-loop-distribution.c (generate_loops_for_partition): Replace
a check for GIMPLE_COND with a dyn_cast<gimple_cond>.
* tree-ssa-ccp.c (optimize_unreachable): Likewise.
* tree-ssa-loop-niter.c (number_of_iterations_exit): Likewise.
* tree-ssa-pre.c (eliminate_dom_walker::before_dom_children):
Likewise.
* tree-vrp.c (fold_predicate_in): Add a checked cast to
gimple_cond. We must be dealing with a GIMPLE_COND since logic
at top of the function ensures we only act on GIMPLE_ASSIGN and
GIMPLE_COND statements, and we're now within a "not a GIMPLE_ASSIGN"
clause.
* tree-ssa-loop-ivcanon.c (remove_exits_and_undefined_stmts): Add
checked cast of elt->stmt to gimple_cond. The existing code requires
this to be a GIMPLE_COND, though it's not clear to me how this
requirement is enforced.
(remove_redundant_iv_tests): Likewise.
(try_unroll_loop_completely): Likewise, for the last_stmt of the
preceding bb along edge_to_cancel.
* tree-ssa-reassoc.c (maybe_optimize_range_tests): Likewise, for the
last_stmt of bb.
---
gcc/ChangeLog.gimple-classes | 34 ++++++++++++++++++++++++++++++++++
gcc/gimple.h | 4 ++--
gcc/tree-cfg.c | 11 +++++++----
gcc/tree-loop-distribution.c | 4 ++--
gcc/tree-ssa-ccp.c | 13 +++++++------
gcc/tree-ssa-loop-ivcanon.c | 17 +++++++++--------
gcc/tree-ssa-loop-niter.c | 10 +++++++---
gcc/tree-ssa-reassoc.c | 15 ++++++++-------
gcc/tree-vrp.c | 5 +++--
9 files changed, 79 insertions(+), 34 deletions(-)
diff --git a/gcc/ChangeLog.gimple-classes b/gcc/ChangeLog.gimple-classes
index a046f12..7b03dad 100644
--- a/gcc/ChangeLog.gimple-classes
+++ b/gcc/ChangeLog.gimple-classes
@@ -1,5 +1,39 @@
2014-10-24 David Malcolm <dmalcolm@redhat.com>
+ Concretize gimple_cond_make_{false|true}
+
+ * gimple.h (gimple_cond_make_false): Require a gimple_cond.
+ (gimple_cond_make_true): Likewise.
+
+ * tree-cfg.c (fold_cond_expr_cond): Add a checked cast to
+ gimple_cond within region guarded by check for GIMPLE_COND.
+ * tree-ssa-ccp.c (ccp_fold_stmt): Likewise.
+
+ * tree-loop-distribution.c (generate_loops_for_partition): Replace
+ a check for GIMPLE_COND with a dyn_cast<gimple_cond>.
+ * tree-ssa-ccp.c (optimize_unreachable): Likewise.
+ * tree-ssa-loop-niter.c (number_of_iterations_exit): Likewise.
+ * tree-ssa-pre.c (eliminate_dom_walker::before_dom_children):
+ Likewise.
+
+ * tree-vrp.c (fold_predicate_in): Add a checked cast to
+ gimple_cond. We must be dealing with a GIMPLE_COND since logic
+ at top of the function ensures we only act on GIMPLE_ASSIGN and
+ GIMPLE_COND statements, and we're now within a "not a GIMPLE_ASSIGN"
+ clause.
+
+ * tree-ssa-loop-ivcanon.c (remove_exits_and_undefined_stmts): Add
+ checked cast of elt->stmt to gimple_cond. The existing code requires
+ this to be a GIMPLE_COND, though it's not clear to me how this
+ requirement is enforced.
+ (remove_redundant_iv_tests): Likewise.
+ (try_unroll_loop_completely): Likewise, for the last_stmt of the
+ preceding bb along edge_to_cancel.
+ * tree-ssa-reassoc.c (maybe_optimize_range_tests): Likewise, for the
+ last_stmt of bb.
+
+2014-10-24 David Malcolm <dmalcolm@redhat.com>
+
Concretize locals within expand_omp_for_init_counts
* omp-low.c (expand_omp_for_init_counts): Eliminate local "stmt"
diff --git a/gcc/gimple.h b/gcc/gimple.h
index 6a09975..de1ad22 100644
--- a/gcc/gimple.h
+++ b/gcc/gimple.h
@@ -3121,7 +3121,7 @@ gimple_cond_false_label (const_gimple gs)
/* Set the conditional COND_STMT to be of the form 'if (1 == 0)'. */
static inline void
-gimple_cond_make_false (gimple gs)
+gimple_cond_make_false (gimple_cond gs)
{
gimple_cond_set_lhs (gs, boolean_true_node);
gimple_cond_set_rhs (gs, boolean_false_node);
@@ -3132,7 +3132,7 @@ gimple_cond_make_false (gimple gs)
/* Set the conditional COND_STMT to be of the form 'if (1 == 1)'. */
static inline void
-gimple_cond_make_true (gimple gs)
+gimple_cond_make_true (gimple_cond gs)
{
gimple_cond_set_lhs (gs, boolean_true_node);
gimple_cond_set_rhs (gs, boolean_true_node);
diff --git a/gcc/tree-cfg.c b/gcc/tree-cfg.c
index 4de42a8..f17b342 100644
--- a/gcc/tree-cfg.c
+++ b/gcc/tree-cfg.c
@@ -591,13 +591,16 @@ fold_cond_expr_cond (void)
if (stmt && gimple_code (stmt) == GIMPLE_COND)
{
+ gimple_cond cond_stmt = as_a <gimple_cond> (stmt);
location_t loc = gimple_location (stmt);
tree cond;
bool zerop, onep;
fold_defer_overflow_warnings ();
- cond = fold_binary_loc (loc, gimple_cond_code (stmt), boolean_type_node,
- gimple_cond_lhs (stmt), gimple_cond_rhs (stmt));
+ cond = fold_binary_loc (loc, gimple_cond_code (cond_stmt),
+ boolean_type_node,
+ gimple_cond_lhs (cond_stmt),
+ gimple_cond_rhs (cond_stmt));
if (cond)
{
zerop = integer_zerop (cond);
@@ -610,9 +613,9 @@ fold_cond_expr_cond (void)
stmt,
WARN_STRICT_OVERFLOW_CONDITIONAL);
if (zerop)
- gimple_cond_make_false (stmt);
+ gimple_cond_make_false (cond_stmt);
else if (onep)
- gimple_cond_make_true (stmt);
+ gimple_cond_make_true (cond_stmt);
}
}
}
diff --git a/gcc/tree-loop-distribution.c b/gcc/tree-loop-distribution.c
index bed8bf1..a6cd30f 100644
--- a/gcc/tree-loop-distribution.c
+++ b/gcc/tree-loop-distribution.c
@@ -680,9 +680,9 @@ generate_loops_for_partition (struct loop *loop, partition_t partition,
{
/* Choose an arbitrary path through the empty CFG part
that this unnecessary control stmt controls. */
- if (gimple_code (stmt) == GIMPLE_COND)
+ if (gimple_cond cond_stmt = dyn_cast <gimple_cond> (stmt))
{
- gimple_cond_make_false (stmt);
+ gimple_cond_make_false (cond_stmt);
update_stmt (stmt);
}
else if (gimple_code (stmt) == GIMPLE_SWITCH)
diff --git a/gcc/tree-ssa-ccp.c b/gcc/tree-ssa-ccp.c
index 3a5632f..9be5b73 100644
--- a/gcc/tree-ssa-ccp.c
+++ b/gcc/tree-ssa-ccp.c
@@ -2061,6 +2061,7 @@ ccp_fold_stmt (gimple_stmt_iterator *gsi)
{
case GIMPLE_COND:
{
+ gimple_cond cond_stmt = as_a <gimple_cond> (stmt);
ccp_prop_value_t val;
/* Statement evaluation will handle type mismatches in constants
more gracefully than the final propagation. This allows us to
@@ -2080,9 +2081,9 @@ ccp_fold_stmt (gimple_stmt_iterator *gsi)
}
if (integer_zerop (val.value))
- gimple_cond_make_false (stmt);
+ gimple_cond_make_false (cond_stmt);
else
- gimple_cond_make_true (stmt);
+ gimple_cond_make_true (cond_stmt);
return true;
}
@@ -2588,15 +2589,15 @@ optimize_unreachable (gimple_stmt_iterator i)
continue;
stmt = gsi_stmt (gsi);
- if (gimple_code (stmt) == GIMPLE_COND)
+ if (gimple_cond cond_stmt = dyn_cast <gimple_cond> (stmt))
{
if (e->flags & EDGE_TRUE_VALUE)
- gimple_cond_make_false (stmt);
+ gimple_cond_make_false (cond_stmt);
else if (e->flags & EDGE_FALSE_VALUE)
- gimple_cond_make_true (stmt);
+ gimple_cond_make_true (cond_stmt);
else
gcc_unreachable ();
- update_stmt (stmt);
+ update_stmt (cond_stmt);
}
else
{
diff --git a/gcc/tree-ssa-loop-ivcanon.c b/gcc/tree-ssa-loop-ivcanon.c
index 00cbf8f..b70f118 100644
--- a/gcc/tree-ssa-loop-ivcanon.c
+++ b/gcc/tree-ssa-loop-ivcanon.c
@@ -521,11 +521,12 @@ remove_exits_and_undefined_stmts (struct loop *loop, unsigned int npeeled)
if (!loop_exit_edge_p (loop, exit_edge))
exit_edge = EDGE_SUCC (bb, 1);
gcc_checking_assert (loop_exit_edge_p (loop, exit_edge));
+ gimple_cond cond_stmt = as_a <gimple_cond> (elt->stmt);
if (exit_edge->flags & EDGE_TRUE_VALUE)
- gimple_cond_make_true (elt->stmt);
+ gimple_cond_make_true (cond_stmt);
else
- gimple_cond_make_false (elt->stmt);
- update_stmt (elt->stmt);
+ gimple_cond_make_false (cond_stmt);
+ update_stmt (cond_stmt);
changed = true;
}
}
@@ -574,11 +575,12 @@ remove_redundant_iv_tests (struct loop *loop)
fprintf (dump_file, "Removed pointless exit: ");
print_gimple_stmt (dump_file, elt->stmt, 0, 0);
}
+ gimple_cond cond_stmt = as_a <gimple_cond> (elt->stmt);
if (exit_edge->flags & EDGE_TRUE_VALUE)
- gimple_cond_make_false (elt->stmt);
+ gimple_cond_make_false (cond_stmt);
else
- gimple_cond_make_true (elt->stmt);
- update_stmt (elt->stmt);
+ gimple_cond_make_true (cond_stmt);
+ update_stmt (cond_stmt);
changed = true;
}
}
@@ -658,7 +660,6 @@ try_unroll_loop_completely (struct loop *loop,
location_t locus)
{
unsigned HOST_WIDE_INT n_unroll, ninsns, max_unroll, unr_insns;
- gimple cond;
struct loop_size size;
bool n_unroll_found = false;
edge edge_to_cancel = NULL;
@@ -855,7 +856,7 @@ try_unroll_loop_completely (struct loop *loop,
/* Remove the conditional from the last copy of the loop. */
if (edge_to_cancel)
{
- cond = last_stmt (edge_to_cancel->src);
+ gimple_cond cond = as_a <gimple_cond> (last_stmt (edge_to_cancel->src));
if (edge_to_cancel->flags & EDGE_TRUE_VALUE)
gimple_cond_make_false (cond);
else
diff --git a/gcc/tree-ssa-loop-niter.c b/gcc/tree-ssa-loop-niter.c
index 025c1f9..2179462 100644
--- a/gcc/tree-ssa-loop-niter.c
+++ b/gcc/tree-ssa-loop-niter.c
@@ -1922,7 +1922,8 @@ number_of_iterations_exit (struct loop *loop, edge exit,
struct tree_niter_desc *niter,
bool warn, bool every_iteration)
{
- gimple stmt;
+ gimple last;
+ gimple_cond stmt;
tree type;
tree op0, op1;
enum tree_code code;
@@ -1935,8 +1936,11 @@ number_of_iterations_exit (struct loop *loop, edge exit,
return false;
niter->assumptions = boolean_false_node;
- stmt = last_stmt (exit->src);
- if (!stmt || gimple_code (stmt) != GIMPLE_COND)
+ last = last_stmt (exit->src);
+ if (!last)
+ return false;
+ stmt = dyn_cast <gimple_cond> (last);
+ if (!stmt)
return false;
/* We want the condition for staying inside loop. */
diff --git a/gcc/tree-ssa-reassoc.c b/gcc/tree-ssa-reassoc.c
index 5b951d7..2512e91 100644
--- a/gcc/tree-ssa-reassoc.c
+++ b/gcc/tree-ssa-reassoc.c
@@ -3040,18 +3040,19 @@ maybe_optimize_range_tests (gimple stmt)
&& bbinfo[idx].op == NULL_TREE
&& ops[bbinfo[idx].first_idx]->op != NULL_TREE)
{
- stmt = last_stmt (bb);
+ gimple_cond cond_stmt = as_a <gimple_cond> (last_stmt (bb));
if (integer_zerop (ops[bbinfo[idx].first_idx]->op))
- gimple_cond_make_false (stmt);
+ gimple_cond_make_false (cond_stmt);
else if (integer_onep (ops[bbinfo[idx].first_idx]->op))
- gimple_cond_make_true (stmt);
+ gimple_cond_make_true (cond_stmt);
else
{
- gimple_cond_set_code (stmt, NE_EXPR);
- gimple_cond_set_lhs (stmt, ops[bbinfo[idx].first_idx]->op);
- gimple_cond_set_rhs (stmt, boolean_false_node);
+ gimple_cond_set_code (cond_stmt, NE_EXPR);
+ gimple_cond_set_lhs (cond_stmt,
+ ops[bbinfo[idx].first_idx]->op);
+ gimple_cond_set_rhs (cond_stmt, boolean_false_node);
}
- update_stmt (stmt);
+ update_stmt (cond_stmt);
}
if (bb == first_bb)
break;
diff --git a/gcc/tree-vrp.c b/gcc/tree-vrp.c
index bd4fff6..afd54bf 100644
--- a/gcc/tree-vrp.c
+++ b/gcc/tree-vrp.c
@@ -9671,10 +9671,11 @@ fold_predicate_in (gimple_stmt_iterator *si)
else
{
gcc_assert (gimple_code (stmt) == GIMPLE_COND);
+ gimple_cond cond_stmt = as_a <gimple_cond> (stmt);
if (integer_zerop (val))
- gimple_cond_make_false (stmt);
+ gimple_cond_make_false (cond_stmt);
else if (integer_onep (val))
- gimple_cond_make_true (stmt);
+ gimple_cond_make_true (cond_stmt);
else
gcc_unreachable ();
}
--
1.8.5.3
^ permalink raw reply [flat|nested] 93+ messages in thread
* [gimple-classes, committed 92/92] Update gimple.texi class hierarchy diagram
2014-10-27 20:35 [gimple-classes, committed 00/92] Initial slew of commits David Malcolm
` (20 preceding siblings ...)
2014-10-27 20:36 ` [gimple-classes, committed 66/92] Concretize three gimple_return_ accessors David Malcolm
@ 2014-10-27 20:36 ` David Malcolm
2014-10-27 20:36 ` [gimple-classes, committed 01/92] Introduce gimple_switch and use it in various places David Malcolm
` (69 subsequent siblings)
91 siblings, 0 replies; 93+ messages in thread
From: David Malcolm @ 2014-10-27 20:36 UTC (permalink / raw)
To: gcc-patches; +Cc: David Malcolm
gcc/ChangeLog.gimple-classes:
* doc/gimple.texi (Class hierarchy of GIMPLE statements): Update
to reflect the new gimple subclasses and the renamings of existing
classes.
---
gcc/ChangeLog.gimple-classes | 6 ++++
gcc/doc/gimple.texi | 79 ++++++++++++++++++++++++++------------------
2 files changed, 53 insertions(+), 32 deletions(-)
diff --git a/gcc/ChangeLog.gimple-classes b/gcc/ChangeLog.gimple-classes
index b0c61d1..aec5065 100644
--- a/gcc/ChangeLog.gimple-classes
+++ b/gcc/ChangeLog.gimple-classes
@@ -1,5 +1,11 @@
2014-10-27 David Malcolm <dmalcolm@redhat.com>
+ * doc/gimple.texi (Class hierarchy of GIMPLE statements): Update
+ to reflect the new gimple subclasses and the renamings of existing
+ classes.
+
+2014-10-27 David Malcolm <dmalcolm@redhat.com>
+
* gimple.h (struct gdebug): Remove out-of-date references to
typedefs.
(struct ggoto): Likewise.
diff --git a/gcc/doc/gimple.texi b/gcc/doc/gimple.texi
index 1e5473d..621c860 100644
--- a/gcc/doc/gimple.texi
+++ b/gcc/doc/gimple.texi
@@ -311,111 +311,126 @@ kinds, along with their relationships to @code{GSS_} values (layouts) and
| | (no GSS layout)
| |
| + gimple_statement_with_ops
- | | layout: GSS_WITH_OPS
- | | Used for 5 codes: GIMPLE_COND
- | | GIMPLE_DEBUG
- | | GIMPLE_GOTO
- | | GIMPLE_LABEL
- | | GIMPLE_SWITCH
+ | | | layout: GSS_WITH_OPS
+ | | |
+ | | + gcond
+ | | | code: GIMPLE_COND
+ | | |
+ | | + gdebug
+ | | | code: GIMPLE_DEBUG
+ | | |
+ | | + ggoto
+ | | | code: GIMPLE_GOTO
+ | | |
+ | | + glabel
+ | | | code: GIMPLE_LABEL
+ | | |
+ | | + gswitch
+ | | code: GIMPLE_SWITCH
| |
| + gimple_statement_with_memory_ops_base
| | layout: GSS_WITH_MEM_OPS_BASE
| |
| + gimple_statement_with_memory_ops
- | | layout: GSS_WITH_MEM_OPS.
- | | used for codes GIMPLE_ASSIGN and GIMPLE_RETURN.
+ | | | layout: GSS_WITH_MEM_OPS
+ | | |
+ | | + gassign
+ | | | code GIMPLE_ASSIGN
+ | | |
+ | | + greturn
+ | | code GIMPLE_RETURN
| |
- | + gimple_statement_call
+ | + gcall
| | layout: GSS_CALL, code: GIMPLE_CALL
| |
- | + gimple_statement_asm
+ | + gasm
| | layout: GSS_ASM, code: GIMPLE_ASM
| |
- | + gimple_statement_transaction
+ | + gtransaction
| layout: GSS_TRANSACTION, code: GIMPLE_TRANSACTION
|
+ gimple_statement_omp
| | layout: GSS_OMP. Used for code GIMPLE_OMP_SECTION
| |
- | + gimple_statement_omp_critical
+ | + gomp_critical
| | layout: GSS_OMP_CRITICAL, code: GIMPLE_OMP_CRITICAL
| |
- | + gimple_statement_omp_for
+ | + gomp_for
| | layout: GSS_OMP_FOR, code: GIMPLE_OMP_FOR
| |
- | + gimple_statement_omp_parallel_layout
+ | + gomp_parallel_layout
| | | layout: GSS_OMP_PARALLEL_LAYOUT
| | |
| | + gimple_statement_omp_taskreg
| | | |
- | | | + gimple_statement_omp_parallel
+ | | | + gomp_parallel
| | | | code: GIMPLE_OMP_PARALLEL
| | | |
- | | | + gimple_statement_omp_task
+ | | | + gomp_task
| | | code: GIMPLE_OMP_TASK
| | |
| | + gimple_statement_omp_target
| | code: GIMPLE_OMP_TARGET
| |
- | + gimple_statement_omp_sections
+ | + gomp_sections
| | layout: GSS_OMP_SECTIONS, code: GIMPLE_OMP_SECTIONS
| |
| + gimple_statement_omp_single_layout
| | layout: GSS_OMP_SINGLE_LAYOUT
| |
- | + gimple_statement_omp_single
+ | + gomp_single
| | code: GIMPLE_OMP_SINGLE
| |
- | + gimple_statement_omp_teams
+ | + gomp_teams
| code: GIMPLE_OMP_TEAMS
|
- + gimple_statement_bind
+ + gbind
| layout: GSS_BIND, code: GIMPLE_BIND
|
- + gimple_statement_catch
+ + gcatch
| layout: GSS_CATCH, code: GIMPLE_CATCH
|
- + gimple_statement_eh_filter
+ + geh_filter
| layout: GSS_EH_FILTER, code: GIMPLE_EH_FILTER
|
- + gimple_statement_eh_else
+ + geh_else
| layout: GSS_EH_ELSE, code: GIMPLE_EH_ELSE
|
- + gimple_statement_eh_mnt
+ + geh_mnt
| layout: GSS_EH_MNT, code: GIMPLE_EH_MUST_NOT_THROW
|
- + gimple_statement_phi
+ + gphi
| layout: GSS_PHI, code: GIMPLE_PHI
|
+ gimple_statement_eh_ctrl
| | layout: GSS_EH_CTRL
| |
- | + gimple_statement_resx
+ | + gresx
| | code: GIMPLE_RESX
| |
- | + gimple_statement_eh_dispatch
+ | + geh_dispatch
| code: GIMPLE_EH_DISPATCH
|
- + gimple_statement_try
+ + gtry
| layout: GSS_TRY, code: GIMPLE_TRY
|
+ gimple_statement_wce
| layout: GSS_WCE, code: GIMPLE_WITH_CLEANUP_EXPR
|
- + gimple_statement_omp_continue
+ + gomp_continue
| layout: GSS_OMP_CONTINUE, code: GIMPLE_OMP_CONTINUE
|
- + gimple_statement_omp_atomic_load
+ + gomp_atomic_load
| layout: GSS_OMP_ATOMIC_LOAD, code: GIMPLE_OMP_ATOMIC_LOAD
|
+ gimple_statement_omp_atomic_store_layout
| layout: GSS_OMP_ATOMIC_STORE_LAYOUT,
| code: GIMPLE_OMP_ATOMIC_STORE
|
- + gimple_statement_omp_atomic_store
+ + gomp_atomic_store
| code: GIMPLE_OMP_ATOMIC_STORE
|
- + gimple_statement_omp_return
+ + gomp_return
code: GIMPLE_OMP_RETURN
@end smallexample
--
1.8.5.3
^ permalink raw reply [flat|nested] 93+ messages in thread
* [gimple-classes, committed 82/92] Concretize gimple_call_arg_flags
2014-10-27 20:35 [gimple-classes, committed 00/92] Initial slew of commits David Malcolm
` (13 preceding siblings ...)
2014-10-27 20:36 ` [gimple-classes, committed 69/92] Concretize gimple_cond_make_{false|true} David Malcolm
@ 2014-10-27 20:36 ` David Malcolm
2014-10-27 20:36 ` [gimple-classes, committed 51/92] More gimple_phi David Malcolm
` (76 subsequent siblings)
91 siblings, 0 replies; 93+ messages in thread
From: David Malcolm @ 2014-10-27 20:36 UTC (permalink / raw)
To: gcc-patches; +Cc: David Malcolm
This corresponds to:
[PATCH 84/89] Concretize gimple_call_arg_flags
https://gcc.gnu.org/ml/gcc-patches/2014-04/msg01186.html
from the original 89-patch kit
That earlier patch was approved by Jeff:
> This is fine, but will need tweaking once the const changes go in. The
> final form is approved given its triviality, but please post for
> archival purposes.
in https://gcc.gnu.org/ml/gcc-patches/2014-05/msg00838.html
gcc/
* gimple.h (gimple_call_arg_flags): Require a const_gimple_call
rather than a const_gimple.
* gimple.c (gimple_call_fnspec): Likewise.
(gimple_call_arg_flags): Likewise.
* tree-inline.c (remap_gimple_stmt): Use a dyn_cast rather than a
is_gimple_call and repeated checked casts.
---
gcc/ChangeLog.gimple-classes | 13 +++++++++++++
gcc/gimple.c | 4 ++--
gcc/gimple.h | 2 +-
gcc/tree-inline.c | 6 +++---
4 files changed, 19 insertions(+), 6 deletions(-)
diff --git a/gcc/ChangeLog.gimple-classes b/gcc/ChangeLog.gimple-classes
index 56fe40d..e064bcf 100644
--- a/gcc/ChangeLog.gimple-classes
+++ b/gcc/ChangeLog.gimple-classes
@@ -1,5 +1,18 @@
2014-10-24 David Malcolm <dmalcolm@redhat.com>
+ Concretize gimple_call_arg_flags
+
+ * gimple.h (gimple_call_arg_flags): Require a const_gimple_call
+ rather than a const_gimple.
+
+ * gimple.c (gimple_call_fnspec): Likewise.
+ (gimple_call_arg_flags): Likewise.
+
+ * tree-inline.c (remap_gimple_stmt): Use a dyn_cast rather than a
+ is_gimple_call and repeated checked casts.
+
+2014-10-24 David Malcolm <dmalcolm@redhat.com>
+
Concretize gimple_call_set_tail and gimple_call_tail_p
* gimple.h (gimple_call_set_tail): Require a gimple_call.
diff --git a/gcc/gimple.c b/gcc/gimple.c
index a244617..73aa6c1 100644
--- a/gcc/gimple.c
+++ b/gcc/gimple.c
@@ -1367,7 +1367,7 @@ gimple_call_flags (const_gimple stmt)
/* Return the "fn spec" string for call STMT. */
static const_tree
-gimple_call_fnspec (const_gimple stmt)
+gimple_call_fnspec (const_gimple_call stmt)
{
tree type, attr;
@@ -1388,7 +1388,7 @@ gimple_call_fnspec (const_gimple stmt)
/* Detects argument flags for argument number ARG on call STMT. */
int
-gimple_call_arg_flags (const_gimple stmt, unsigned arg)
+gimple_call_arg_flags (const_gimple_call stmt, unsigned arg)
{
const_tree attr = gimple_call_fnspec (stmt);
diff --git a/gcc/gimple.h b/gcc/gimple.h
index 9d09804..a396ec3 100644
--- a/gcc/gimple.h
+++ b/gcc/gimple.h
@@ -1373,7 +1373,7 @@ bool empty_body_p (gimple_seq);
gimple_seq gimple_seq_copy (gimple_seq);
bool gimple_call_same_target_p (const_gimple, const_gimple);
int gimple_call_flags (const_gimple);
-int gimple_call_arg_flags (const_gimple, unsigned);
+int gimple_call_arg_flags (const_gimple_call, unsigned);
int gimple_call_return_flags (const_gimple_call);
bool gimple_assign_copy_p (gimple);
bool gimple_assign_ssa_name_copy_p (gimple);
diff --git a/gcc/tree-inline.c b/gcc/tree-inline.c
index 84dfea8..a0a299b 100644
--- a/gcc/tree-inline.c
+++ b/gcc/tree-inline.c
@@ -1548,9 +1548,9 @@ remap_gimple_stmt (gimple stmt, copy_body_data *id)
copy = gimple_copy (stmt);
/* Clear flags that need revisiting. */
- if (is_gimple_call (copy)
- && gimple_call_tail_p (as_a <gimple_call> (copy)))
- gimple_call_set_tail (as_a <gimple_call> (copy), false);
+ if (gimple_call call_stmt = dyn_cast <gimple_call> (copy))
+ if (gimple_call_tail_p (call_stmt))
+ gimple_call_set_tail (call_stmt, false);
/* Remap the region numbers for __builtin_eh_{pointer,filter},
RESX and EH_DISPATCH. */
--
1.8.5.3
^ permalink raw reply [flat|nested] 93+ messages in thread
* [gimple-classes, committed 04/92] Introduce gimple_assign and use it in various places
2014-10-27 20:35 [gimple-classes, committed 00/92] Initial slew of commits David Malcolm
` (22 preceding siblings ...)
2014-10-27 20:36 ` [gimple-classes, committed 01/92] Introduce gimple_switch and use it in various places David Malcolm
@ 2014-10-27 20:36 ` David Malcolm
2014-10-27 20:36 ` [gimple-classes, committed 87/92] Convert various gimple to gimple_phi within ssa-iterators.h David Malcolm
` (67 subsequent siblings)
91 siblings, 0 replies; 93+ messages in thread
From: David Malcolm @ 2014-10-27 20:36 UTC (permalink / raw)
To: gcc-patches; +Cc: David Malcolm
This corresponds to:
[PATCH 05/89] Introduce gimple_assign and use it in various places
https://gcc.gnu.org/ml/gcc-patches/2014-04/msg01151.html
from the original 89-patch kit
That earlier patch was approved by Jeff:
> Similar to the gimple_cond patch. Update for the changes in the
> prerequisites and it's good to go. Please post final version for
> archival purposes.
in https://gcc.gnu.org/ml/gcc-patches/2014-05/msg00596.html
gcc/
* coretypes.h (gimple_assign): New typedef.
(const_gimple_assign): New typedef.
* gimple.h (struct gimple_statement_assign): New subclass of
gimple_statement_with_memory_ops, adding the invariant that
stmt->code == GIMPLE_ASSIGN.
(is_a_helper <gimple_statement_assign>::test): New.
* gdbhooks.py (build_pretty_printer): Add gimple_assign and its
variants, using the gimple printer.
* gimple-builder.c (build_assign): Return a gimple_assign rather
than just a gimple from each of the overloaded variants.
(build_type_cast): Likewise.
* gimple-builder.h (build_assign): Likewise.
(build_type_cast): Likewise.
* gimple.c (gimple_build_assign_stat): Likewise.
(gimple_build_assign_with_ops): Likewise.
* gimple.h (gimple_build_assign_stat): Likewise.
(gimple_build_assign_with_ops): Likewise.
* asan.c (get_mem_ref_of_assignment): Require a const_gimple_assign
rather than just a "const gimple" (the latter is not a
"const_gimple").
* gimple-pretty-print.c (dump_unary_rhs): Require a gimple_assign
rather than just a gimple.
(dump_binary_rhs): Likewise.
(dump_ternary_rhs): Likewise.
* tree-cfg.c (verify_gimple_assign_unary): Likewise.
(verify_gimple_assign_binary): Likewise.
(verify_gimple_assign_ternary): Likewise.
(verify_gimple_assign_single): Likewise.
(verify_gimple_assign): Likewise.
* tree-ssa-sccvn.c (simplify_unary_expression): Likewise.
(try_to_simplify): Likewise.
* tree-tailcall.c (process_assignment): Likewise.
* tree-vect-generic.c (expand_vector_operation): Likewise.
* tree-vrp.c (extract_range_from_cond_expr): Likewise.
(extract_range_from_assignment): Likewise.
* asan.c (has_stmt_been_instrumented_p): Add checked cast to
gimple_assign in regions where a stmt is known to have code
GIMPLE_ASSIGN.
* gimple-pretty-print.c (pp_gimple_stmt_1): Likewise.
* tree-cfg.c (verify_gimple_stmt): Likewise.
* tree-ssa-sccvn.c (visit_use): Likewise.
* tree-tailcall.c (find_tail_calls): Likewise.
* tree-vrp.c (vrp_visit_assignment_or_call): Likewise.
* tree-vrp.c (simplify_stmt_for_jump_threading): Replace a check
against GIMPLE_ASSIGN with a dyn_cast<gimple_assign>, introducing
a gimple_assign local.
* tree-vect-generic.c (expand_vector_condition): Convert local to a
gimple_assign, adding a checked cast when extracting from gsi, since
this is only called when underlying stmt has code GIMPLE_ASSIGN.
(optimize_vector_constructor): Likewise.
(lower_vec_perm): Likewise.
(expand_vector_operations_1): Convert local to a gimple_assign,
introducing a dyn_cast.
---
gcc/ChangeLog.gimple-classes | 65 ++++++++++++++++++++++++++++++++++++++++++++
gcc/asan.c | 5 ++--
gcc/coretypes.h | 4 +++
gcc/gdbhooks.py | 2 ++
gcc/gimple-builder.c | 16 +++++------
gcc/gimple-builder.h | 16 +++++------
gcc/gimple-pretty-print.c | 10 +++----
gcc/gimple.c | 13 +++++----
gcc/gimple.h | 29 ++++++++++++++++----
gcc/tree-cfg.c | 12 ++++----
gcc/tree-ssa-sccvn.c | 6 ++--
gcc/tree-tailcall.c | 5 ++--
gcc/tree-vect-generic.c | 13 +++++----
gcc/tree-vrp.c | 12 ++++----
14 files changed, 151 insertions(+), 57 deletions(-)
diff --git a/gcc/ChangeLog.gimple-classes b/gcc/ChangeLog.gimple-classes
index a7d756e..f737e3c 100644
--- a/gcc/ChangeLog.gimple-classes
+++ b/gcc/ChangeLog.gimple-classes
@@ -1,5 +1,70 @@
2014-10-24 David Malcolm <dmalcolm@redhat.com>
+ Introduce gimple_assign and use it in various places
+
+ * coretypes.h (gimple_assign): New typedef.
+ (const_gimple_assign): New typedef.
+
+ * gimple.h (struct gimple_statement_assign): New subclass of
+ gimple_statement_with_memory_ops, adding the invariant that
+ stmt->code == GIMPLE_ASSIGN.
+ (is_a_helper <gimple_statement_assign>::test): New.
+
+ * gdbhooks.py (build_pretty_printer): Add gimple_assign and its
+ variants, using the gimple printer.
+
+ * gimple-builder.c (build_assign): Return a gimple_assign rather
+ than just a gimple from each of the overloaded variants.
+ (build_type_cast): Likewise.
+ * gimple-builder.h (build_assign): Likewise.
+ (build_type_cast): Likewise.
+ * gimple.c (gimple_build_assign_stat): Likewise.
+ (gimple_build_assign_with_ops): Likewise.
+ * gimple.h (gimple_build_assign_stat): Likewise.
+ (gimple_build_assign_with_ops): Likewise.
+
+ * asan.c (get_mem_ref_of_assignment): Require a const_gimple_assign
+ rather than just a "const gimple" (the latter is not a
+ "const_gimple").
+ * gimple-pretty-print.c (dump_unary_rhs): Require a gimple_assign
+ rather than just a gimple.
+ (dump_binary_rhs): Likewise.
+ (dump_ternary_rhs): Likewise.
+ * tree-cfg.c (verify_gimple_assign_unary): Likewise.
+ (verify_gimple_assign_binary): Likewise.
+ (verify_gimple_assign_ternary): Likewise.
+ (verify_gimple_assign_single): Likewise.
+ (verify_gimple_assign): Likewise.
+ * tree-ssa-sccvn.c (simplify_unary_expression): Likewise.
+ (try_to_simplify): Likewise.
+ * tree-tailcall.c (process_assignment): Likewise.
+ * tree-vect-generic.c (expand_vector_operation): Likewise.
+ * tree-vrp.c (extract_range_from_cond_expr): Likewise.
+ (extract_range_from_assignment): Likewise.
+
+ * asan.c (has_stmt_been_instrumented_p): Add checked cast to
+ gimple_assign in regions where a stmt is known to have code
+ GIMPLE_ASSIGN.
+ * gimple-pretty-print.c (pp_gimple_stmt_1): Likewise.
+ * tree-cfg.c (verify_gimple_stmt): Likewise.
+ * tree-ssa-sccvn.c (visit_use): Likewise.
+ * tree-tailcall.c (find_tail_calls): Likewise.
+ * tree-vrp.c (vrp_visit_assignment_or_call): Likewise.
+
+ * tree-vrp.c (simplify_stmt_for_jump_threading): Replace a check
+ against GIMPLE_ASSIGN with a dyn_cast<gimple_assign>, introducing
+ a gimple_assign local.
+
+ * tree-vect-generic.c (expand_vector_condition): Convert local to a
+ gimple_assign, adding a checked cast when extracting from gsi, since
+ this is only called when underlying stmt has code GIMPLE_ASSIGN.
+ (optimize_vector_constructor): Likewise.
+ (lower_vec_perm): Likewise.
+ (expand_vector_operations_1): Convert local to a gimple_assign,
+ introducing a dyn_cast.
+
+2014-10-24 David Malcolm <dmalcolm@redhat.com>
+
Introduce gimple_cond and use it in various places
* coretypes.h (gimple_cond): New typedef.
diff --git a/gcc/asan.c b/gcc/asan.c
index 2a61a82..ccf487b 100644
--- a/gcc/asan.c
+++ b/gcc/asan.c
@@ -454,7 +454,7 @@ has_mem_ref_been_instrumented (const asan_mem_ref *ref, tree len)
otherwise. */
static bool
-get_mem_ref_of_assignment (const gimple assignment,
+get_mem_ref_of_assignment (const_gimple_assign assignment,
asan_mem_ref *ref,
bool *ref_is_store)
{
@@ -822,7 +822,8 @@ has_stmt_been_instrumented_p (gimple stmt)
asan_mem_ref r;
asan_mem_ref_init (&r, NULL, 1);
- if (get_mem_ref_of_assignment (stmt, &r, &r_is_store))
+ if (get_mem_ref_of_assignment (as_a <gimple_assign> (stmt), &r,
+ &r_is_store))
return has_mem_ref_been_instrumented (&r);
}
else if (gimple_call_builtin_p (stmt, BUILT_IN_NORMAL))
diff --git a/gcc/coretypes.h b/gcc/coretypes.h
index ae60592..f8aeb94 100644
--- a/gcc/coretypes.h
+++ b/gcc/coretypes.h
@@ -98,6 +98,10 @@ struct gimple_statement_switch;
typedef struct gimple_statement_switch *gimple_switch;
typedef const struct gimple_statement_switch *const_gimple_switch;
+struct gimple_statement_assign;
+typedef struct gimple_statement_assign *gimple_assign;
+typedef const struct gimple_statement_assign *const_gimple_assign;
+
struct gimple_statement_bind;
typedef struct gimple_statement_bind *gimple_bind;
typedef const struct gimple_statement_bind *const_gimple_bind;
diff --git a/gcc/gdbhooks.py b/gcc/gdbhooks.py
index 9be0ab2..d5162de 100644
--- a/gcc/gdbhooks.py
+++ b/gcc/gdbhooks.py
@@ -462,6 +462,8 @@ def build_pretty_printer():
'gimple_statement_cond *',
'gimple_switch', 'const_gimple_switch',
'gimple_statement_switch *',
+ 'gimple_assign', 'const_gimple_assign',
+ 'gimple_statement_assign *',
'gimple_bind', 'const_gimple_bind',
'gimple_statement_bind *'],
diff --git a/gcc/gimple-builder.c b/gcc/gimple-builder.c
index ba4be26..b6f439c 100644
--- a/gcc/gimple-builder.c
+++ b/gcc/gimple-builder.c
@@ -51,7 +51,7 @@ get_expr_type (enum tree_code code, tree op)
the expression code for the RHS. OP1 is the first operand and VAL
is an integer value to be used as the second operand. */
-gimple
+gimple_assign
build_assign (enum tree_code code, tree op1, int val, tree lhs)
{
tree op2 = build_int_cst (TREE_TYPE (op1), val);
@@ -60,7 +60,7 @@ build_assign (enum tree_code code, tree op1, int val, tree lhs)
return gimple_build_assign_with_ops (code, lhs, op1, op2);
}
-gimple
+gimple_assign
build_assign (enum tree_code code, gimple g, int val, tree lhs )
{
return build_assign (code, gimple_assign_lhs (g), val, lhs);
@@ -75,7 +75,7 @@ build_assign (enum tree_code code, gimple g, int val, tree lhs )
in normal form depending on the type of builder invoking this
function. */
-gimple
+gimple_assign
build_assign (enum tree_code code, tree op1, tree op2, tree lhs)
{
if (lhs == NULL_TREE)
@@ -83,19 +83,19 @@ build_assign (enum tree_code code, tree op1, tree op2, tree lhs)
return gimple_build_assign_with_ops (code, lhs, op1, op2);
}
-gimple
+gimple_assign
build_assign (enum tree_code code, gimple op1, tree op2, tree lhs)
{
return build_assign (code, gimple_assign_lhs (op1), op2, lhs);
}
-gimple
+gimple_assign
build_assign (enum tree_code code, tree op1, gimple op2, tree lhs)
{
return build_assign (code, op1, gimple_assign_lhs (op2), lhs);
}
-gimple
+gimple_assign
build_assign (enum tree_code code, gimple op1, gimple op2, tree lhs)
{
return build_assign (code, gimple_assign_lhs (op1), gimple_assign_lhs (op2),
@@ -106,7 +106,7 @@ build_assign (enum tree_code code, gimple op1, gimple op2, tree lhs)
/* Create and return a type cast assignment. This creates a NOP_EXPR
that converts OP to TO_TYPE. */
-gimple
+gimple_assign
build_type_cast (tree to_type, tree op, tree lhs)
{
if (lhs == NULL_TREE)
@@ -114,7 +114,7 @@ build_type_cast (tree to_type, tree op, tree lhs)
return gimple_build_assign_with_ops (NOP_EXPR, lhs, op, NULL_TREE);
}
-gimple
+gimple_assign
build_type_cast (tree to_type, gimple op, tree lhs)
{
return build_type_cast (to_type, gimple_assign_lhs (op), lhs);
diff --git a/gcc/gimple-builder.h b/gcc/gimple-builder.h
index 1b5afdc..9f9ad21 100644
--- a/gcc/gimple-builder.h
+++ b/gcc/gimple-builder.h
@@ -21,13 +21,13 @@ along with GCC; see the file COPYING3. If not see
#ifndef GCC_GIMPLE_BUILDER_H
#define GCC_GIMPLE_BUILDER_H
-gimple build_assign (enum tree_code, tree, int, tree lhs = NULL_TREE);
-gimple build_assign (enum tree_code, gimple, int, tree lhs = NULL_TREE);
-gimple build_assign (enum tree_code, tree, tree, tree lhs = NULL_TREE);
-gimple build_assign (enum tree_code, gimple, tree, tree lhs = NULL_TREE);
-gimple build_assign (enum tree_code, tree, gimple, tree lhs = NULL_TREE);
-gimple build_assign (enum tree_code, gimple, gimple, tree lhs = NULL_TREE);
-gimple build_type_cast (tree, tree, tree lhs = NULL_TREE);
-gimple build_type_cast (tree, gimple, tree lhs = NULL_TREE);
+gimple_assign build_assign (enum tree_code, tree, int, tree lhs = NULL_TREE);
+gimple_assign build_assign (enum tree_code, gimple, int, tree lhs = NULL_TREE);
+gimple_assign build_assign (enum tree_code, tree, tree, tree lhs = NULL_TREE);
+gimple_assign build_assign (enum tree_code, gimple, tree, tree lhs = NULL_TREE);
+gimple_assign build_assign (enum tree_code, tree, gimple, tree lhs = NULL_TREE);
+gimple_assign build_assign (enum tree_code, gimple, gimple, tree lhs = NULL_TREE);
+gimple_assign build_type_cast (tree, tree, tree lhs = NULL_TREE);
+gimple_assign build_type_cast (tree, gimple, tree lhs = NULL_TREE);
#endif /* GCC_GIMPLE_BUILDER_H */
diff --git a/gcc/gimple-pretty-print.c b/gcc/gimple-pretty-print.c
index 9995c87..482fb1f 100644
--- a/gcc/gimple-pretty-print.c
+++ b/gcc/gimple-pretty-print.c
@@ -261,7 +261,7 @@ dump_gimple_fmt (pretty_printer *buffer, int spc, int flags,
assignment GS. BUFFER, SPC and FLAGS are as in pp_gimple_stmt_1. */
static void
-dump_unary_rhs (pretty_printer *buffer, gimple gs, int spc, int flags)
+dump_unary_rhs (pretty_printer *buffer, gimple_assign gs, int spc, int flags)
{
enum tree_code rhs_code = gimple_assign_rhs_code (gs);
tree lhs = gimple_assign_lhs (gs);
@@ -345,7 +345,7 @@ dump_unary_rhs (pretty_printer *buffer, gimple gs, int spc, int flags)
assignment GS. BUFFER, SPC and FLAGS are as in pp_gimple_stmt_1. */
static void
-dump_binary_rhs (pretty_printer *buffer, gimple gs, int spc, int flags)
+dump_binary_rhs (pretty_printer *buffer, gimple_assign gs, int spc, int flags)
{
const char *p;
enum tree_code code = gimple_assign_rhs_code (gs);
@@ -401,7 +401,7 @@ dump_binary_rhs (pretty_printer *buffer, gimple gs, int spc, int flags)
assignment GS. BUFFER, SPC and FLAGS are as in pp_gimple_stmt_1. */
static void
-dump_ternary_rhs (pretty_printer *buffer, gimple gs, int spc, int flags)
+dump_ternary_rhs (pretty_printer *buffer, gimple_assign gs, int spc, int flags)
{
const char *p;
enum tree_code code = gimple_assign_rhs_code (gs);
@@ -496,7 +496,7 @@ dump_ternary_rhs (pretty_printer *buffer, gimple gs, int spc, int flags)
pp_gimple_stmt_1. */
static void
-dump_gimple_assign (pretty_printer *buffer, gimple gs, int spc, int flags)
+dump_gimple_assign (pretty_printer *buffer, gimple_assign gs, int spc, int flags)
{
if (flags & TDF_RAW)
{
@@ -2089,7 +2089,7 @@ pp_gimple_stmt_1 (pretty_printer *buffer, gimple gs, int spc, int flags)
break;
case GIMPLE_ASSIGN:
- dump_gimple_assign (buffer, gs, spc, flags);
+ dump_gimple_assign (buffer, as_a <gimple_assign> (gs), spc, flags);
break;
case GIMPLE_BIND:
diff --git a/gcc/gimple.c b/gcc/gimple.c
index a75479a..5ffa357 100644
--- a/gcc/gimple.c
+++ b/gcc/gimple.c
@@ -377,7 +377,7 @@ gimple_build_call_from_tree (tree t)
LHS of the assignment.
RHS of the assignment which can be unary or binary. */
-gimple
+gimple_assign
gimple_build_assign_stat (tree lhs, tree rhs MEM_STAT_DECL)
{
enum tree_code subcode;
@@ -393,19 +393,20 @@ gimple_build_assign_stat (tree lhs, tree rhs MEM_STAT_DECL)
OP1 and OP2. If OP2 is NULL then SUBCODE must be of class
GIMPLE_UNARY_RHS or GIMPLE_SINGLE_RHS. */
-gimple
+gimple_assign
gimple_build_assign_with_ops (enum tree_code subcode, tree lhs, tree op1,
tree op2, tree op3 MEM_STAT_DECL)
{
unsigned num_ops;
- gimple p;
+ gimple_assign p;
/* Need 1 operand for LHS and 1 or 2 for the RHS (depending on the
code). */
num_ops = get_gimple_rhs_num_ops (subcode) + 1;
- p = gimple_build_with_ops_stat (GIMPLE_ASSIGN, (unsigned)subcode, num_ops
- PASS_MEM_STAT);
+ p = as_a <gimple_assign> (
+ gimple_build_with_ops_stat (GIMPLE_ASSIGN, (unsigned)subcode, num_ops
+ PASS_MEM_STAT));
gimple_assign_set_lhs (p, lhs);
gimple_assign_set_rhs1 (p, op1);
if (op2)
@@ -423,7 +424,7 @@ gimple_build_assign_with_ops (enum tree_code subcode, tree lhs, tree op1,
return p;
}
-gimple
+gimple_assign
gimple_build_assign_with_ops (enum tree_code subcode, tree lhs, tree op1,
tree op2 MEM_STAT_DECL)
{
diff --git a/gcc/gimple.h b/gcc/gimple.h
index 9683bc2..285b1f2 100644
--- a/gcc/gimple.h
+++ b/gcc/gimple.h
@@ -789,6 +789,16 @@ struct GTY((tag("GSS_WITH_OPS")))
/* no additional fields; this uses the layout for GSS_WITH_OPS. */
};
+/* A statement with the invariant that
+ stmt->code == GIMPLE_ASSIGN
+ i.e. an assignment statement. */
+
+struct GTY((tag("GSS_WITH_MEM_OPS")))
+ gimple_statement_assign : public gimple_statement_with_memory_ops
+{
+ /* no additional fields; this uses the layout for GSS_WITH_MEM_OPS. */
+};
+
template <>
template <>
inline bool
@@ -800,6 +810,14 @@ is_a_helper <gimple_statement_asm *>::test (gimple gs)
template <>
template <>
inline bool
+is_a_helper <gimple_statement_assign *>::test (gimple gs)
+{
+ return gs->code == GIMPLE_ASSIGN;
+}
+
+template <>
+template <>
+inline bool
is_a_helper <gimple_statement_bind *>::test (gimple gs)
{
return gs->code == GIMPLE_BIND;
@@ -1210,12 +1228,13 @@ gimple gimple_build_call_valist (tree, unsigned, va_list);
gimple gimple_build_call_internal (enum internal_fn, unsigned, ...);
gimple gimple_build_call_internal_vec (enum internal_fn, vec<tree> );
gimple gimple_build_call_from_tree (tree);
-gimple gimple_build_assign_stat (tree, tree MEM_STAT_DECL);
+gimple_assign gimple_build_assign_stat (tree, tree MEM_STAT_DECL);
#define gimple_build_assign(l,r) gimple_build_assign_stat (l, r MEM_STAT_INFO)
-gimple gimple_build_assign_with_ops (enum tree_code, tree,
- tree, tree, tree CXX_MEM_STAT_INFO);
-gimple gimple_build_assign_with_ops (enum tree_code, tree,
- tree, tree CXX_MEM_STAT_INFO);
+gimple_assign gimple_build_assign_with_ops (enum tree_code, tree,
+ tree, tree,
+ tree CXX_MEM_STAT_INFO);
+gimple_assign gimple_build_assign_with_ops (enum tree_code, tree,
+ tree, tree CXX_MEM_STAT_INFO);
gimple_cond gimple_build_cond (enum tree_code, tree, tree, tree, tree);
gimple_cond gimple_build_cond_from_tree (tree, tree, tree);
void gimple_cond_set_condition_from_tree (gimple_cond, tree);
diff --git a/gcc/tree-cfg.c b/gcc/tree-cfg.c
index 20d9c5e..6aef279 100644
--- a/gcc/tree-cfg.c
+++ b/gcc/tree-cfg.c
@@ -3423,7 +3423,7 @@ verify_gimple_comparison (tree type, tree op0, tree op1)
Returns true if anything is wrong. */
static bool
-verify_gimple_assign_unary (gimple stmt)
+verify_gimple_assign_unary (gimple_assign stmt)
{
enum tree_code rhs_code = gimple_assign_rhs_code (stmt);
tree lhs = gimple_assign_lhs (stmt);
@@ -3576,7 +3576,7 @@ verify_gimple_assign_unary (gimple stmt)
Returns true if anything is wrong. */
static bool
-verify_gimple_assign_binary (gimple stmt)
+verify_gimple_assign_binary (gimple_assign stmt)
{
enum tree_code rhs_code = gimple_assign_rhs_code (stmt);
tree lhs = gimple_assign_lhs (stmt);
@@ -3850,7 +3850,7 @@ verify_gimple_assign_binary (gimple stmt)
Returns true if anything is wrong. */
static bool
-verify_gimple_assign_ternary (gimple stmt)
+verify_gimple_assign_ternary (gimple_assign stmt)
{
enum tree_code rhs_code = gimple_assign_rhs_code (stmt);
tree lhs = gimple_assign_lhs (stmt);
@@ -4023,7 +4023,7 @@ verify_gimple_assign_ternary (gimple stmt)
Returns true if anything is wrong. */
static bool
-verify_gimple_assign_single (gimple stmt)
+verify_gimple_assign_single (gimple_assign stmt)
{
enum tree_code rhs_code = gimple_assign_rhs_code (stmt);
tree lhs = gimple_assign_lhs (stmt);
@@ -4237,7 +4237,7 @@ verify_gimple_assign_single (gimple stmt)
is a problem, otherwise false. */
static bool
-verify_gimple_assign (gimple stmt)
+verify_gimple_assign (gimple_assign stmt)
{
switch (gimple_assign_rhs_class (stmt))
{
@@ -4476,7 +4476,7 @@ verify_gimple_stmt (gimple stmt)
switch (gimple_code (stmt))
{
case GIMPLE_ASSIGN:
- return verify_gimple_assign (stmt);
+ return verify_gimple_assign (as_a <gimple_assign> (stmt));
case GIMPLE_LABEL:
return verify_gimple_label (stmt);
diff --git a/gcc/tree-ssa-sccvn.c b/gcc/tree-ssa-sccvn.c
index 44656ea..f1fd0f5 100644
--- a/gcc/tree-ssa-sccvn.c
+++ b/gcc/tree-ssa-sccvn.c
@@ -3298,7 +3298,7 @@ simplify_binary_expression (gimple stmt)
simplified. */
static tree
-simplify_unary_expression (gimple stmt)
+simplify_unary_expression (gimple_assign stmt)
{
tree result = NULL_TREE;
tree orig_op0, op0 = gimple_assign_rhs1 (stmt);
@@ -3362,7 +3362,7 @@ simplify_unary_expression (gimple stmt)
/* Try to simplify RHS using equivalences and constant folding. */
static tree
-try_to_simplify (gimple stmt)
+try_to_simplify (gimple_assign stmt)
{
enum tree_code code = gimple_assign_rhs_code (stmt);
tree tem;
@@ -3450,7 +3450,7 @@ visit_use (tree use)
changed = visit_copy (lhs, rhs1);
goto done;
}
- simplified = try_to_simplify (stmt);
+ simplified = try_to_simplify (as_a <gimple_assign> (stmt));
if (simplified)
{
if (dump_file && (dump_flags & TDF_DETAILS))
diff --git a/gcc/tree-tailcall.c b/gcc/tree-tailcall.c
index 9e98968..b5bd635 100644
--- a/gcc/tree-tailcall.c
+++ b/gcc/tree-tailcall.c
@@ -267,7 +267,7 @@ independent_of_stmt_p (tree expr, gimple at, gimple_stmt_iterator gsi)
additive factor for the real return value. */
static bool
-process_assignment (gimple stmt, gimple_stmt_iterator call, tree *m,
+process_assignment (gimple_assign stmt, gimple_stmt_iterator call, tree *m,
tree *a, tree *ass_var)
{
tree op0, op1 = NULL_TREE, non_ass_var = NULL_TREE;
@@ -559,7 +559,8 @@ find_tail_calls (basic_block bb, struct tailcall **ret)
return;
/* This is a gimple assign. */
- if (! process_assignment (stmt, gsi, &tmp_m, &tmp_a, &ass_var))
+ if (! process_assignment (as_a <gimple_assign> (stmt), gsi, &tmp_m,
+ &tmp_a, &ass_var))
return;
if (tmp_a)
diff --git a/gcc/tree-vect-generic.c b/gcc/tree-vect-generic.c
index f631c99..44de77e 100644
--- a/gcc/tree-vect-generic.c
+++ b/gcc/tree-vect-generic.c
@@ -835,7 +835,7 @@ expand_vector_divmod (gimple_stmt_iterator *gsi, tree type, tree op0,
static void
expand_vector_condition (gimple_stmt_iterator *gsi)
{
- gimple stmt = gsi_stmt (*gsi);
+ gimple_assign stmt = as_a <gimple_assign> (gsi_stmt (*gsi));
tree type = gimple_expr_type (stmt);
tree a = gimple_assign_rhs1 (stmt);
tree a1 = a;
@@ -898,7 +898,7 @@ expand_vector_condition (gimple_stmt_iterator *gsi)
static tree
expand_vector_operation (gimple_stmt_iterator *gsi, tree type, tree compute_type,
- gimple assign, enum tree_code code)
+ gimple_assign assign, enum tree_code code)
{
enum machine_mode compute_mode = TYPE_MODE (compute_type);
@@ -1004,7 +1004,7 @@ expand_vector_operation (gimple_stmt_iterator *gsi, tree type, tree compute_type
static void
optimize_vector_constructor (gimple_stmt_iterator *gsi)
{
- gimple stmt = gsi_stmt (*gsi);
+ gimple_assign stmt = as_a <gimple_assign> (gsi_stmt (*gsi));
tree lhs = gimple_assign_lhs (stmt);
tree rhs = gimple_assign_rhs1 (stmt);
tree type = TREE_TYPE (rhs);
@@ -1219,7 +1219,7 @@ vector_element (gimple_stmt_iterator *gsi, tree vect, tree idx, tree *ptmpvec)
static void
lower_vec_perm (gimple_stmt_iterator *gsi)
{
- gimple stmt = gsi_stmt (*gsi);
+ gimple_assign stmt = as_a <gimple_assign> (gsi_stmt (*gsi));
tree mask = gimple_assign_rhs3 (stmt);
tree vec0 = gimple_assign_rhs1 (stmt);
tree vec1 = gimple_assign_rhs2 (stmt);
@@ -1392,14 +1392,15 @@ count_type_subparts (tree type)
static void
expand_vector_operations_1 (gimple_stmt_iterator *gsi)
{
- gimple stmt = gsi_stmt (*gsi);
tree lhs, rhs1, rhs2 = NULL, type, compute_type = NULL_TREE;
enum tree_code code;
optab op = unknown_optab;
enum gimple_rhs_class rhs_class;
tree new_rhs;
- if (gimple_code (stmt) != GIMPLE_ASSIGN)
+ /* Only consider code == GIMPLE_ASSIGN. */
+ gimple_assign stmt = dyn_cast <gimple_assign> (gsi_stmt (*gsi));
+ if (!stmt)
return;
code = gimple_assign_rhs_code (stmt);
diff --git a/gcc/tree-vrp.c b/gcc/tree-vrp.c
index 3248ceb..b75ac9c 100644
--- a/gcc/tree-vrp.c
+++ b/gcc/tree-vrp.c
@@ -3678,7 +3678,7 @@ extract_range_from_unary_expr (value_range_t *vr, enum tree_code code,
the ranges of each of its operands and the expression code. */
static void
-extract_range_from_cond_expr (value_range_t *vr, gimple stmt)
+extract_range_from_cond_expr (value_range_t *vr, gimple_assign stmt)
{
tree op0, op1;
value_range_t vr0 = VR_INITIALIZER;
@@ -3988,7 +3988,7 @@ extract_range_basic (value_range_t *vr, gimple stmt)
in *VR. */
static void
-extract_range_from_assignment (value_range_t *vr, gimple stmt)
+extract_range_from_assignment (value_range_t *vr, gimple_assign stmt)
{
enum tree_code code = gimple_assign_rhs_code (stmt);
@@ -6917,7 +6917,7 @@ vrp_visit_assignment_or_call (gimple stmt, tree *output_p)
else if (code == GIMPLE_CALL)
extract_range_basic (&new_vr, stmt);
else
- extract_range_from_assignment (&new_vr, stmt);
+ extract_range_from_assignment (&new_vr, as_a <gimple_assign> (stmt));
if (update_value_range (lhs, &new_vr))
{
@@ -9715,16 +9715,16 @@ simplify_stmt_for_jump_threading (gimple stmt, gimple within_stmt)
gimple_cond_lhs (stmt),
gimple_cond_rhs (stmt), within_stmt);
- if (gimple_code (stmt) == GIMPLE_ASSIGN)
+ if (gimple_assign assign_stmt = dyn_cast <gimple_assign> (stmt))
{
value_range_t new_vr = VR_INITIALIZER;
- tree lhs = gimple_assign_lhs (stmt);
+ tree lhs = gimple_assign_lhs (assign_stmt);
if (TREE_CODE (lhs) == SSA_NAME
&& (INTEGRAL_TYPE_P (TREE_TYPE (lhs))
|| POINTER_TYPE_P (TREE_TYPE (lhs))))
{
- extract_range_from_assignment (&new_vr, stmt);
+ extract_range_from_assignment (&new_vr, assign_stmt);
if (range_int_cst_singleton_p (&new_vr))
return new_vr.min;
}
--
1.8.5.3
^ permalink raw reply [flat|nested] 93+ messages in thread
* [gimple-classes, committed 43/92] Introduce gimple_omp_sections
2014-10-27 20:35 [gimple-classes, committed 00/92] Initial slew of commits David Malcolm
` (15 preceding siblings ...)
2014-10-27 20:36 ` [gimple-classes, committed 51/92] More gimple_phi David Malcolm
@ 2014-10-27 20:36 ` David Malcolm
2014-10-27 20:36 ` [gimple-classes, committed 71/92] Concretize gimple_cond_{true|false}_label David Malcolm
` (74 subsequent siblings)
91 siblings, 0 replies; 93+ messages in thread
From: David Malcolm @ 2014-10-27 20:36 UTC (permalink / raw)
To: gcc-patches; +Cc: David Malcolm
This corresponds to:
[PATCH 45/89] Introduce gimple_omp_sections
https://gcc.gnu.org/ml/gcc-patches/2014-04/msg01188.html
from the original 89-patch kit
That earlier patch was approved by Jeff:
> OK with expected changes due to renaming/updates to const handling.
> Please repost the final patch for archival purposes.
in https://gcc.gnu.org/ml/gcc-patches/2014-05/msg00821.html
gcc/
* coretypes.h (gimple_omp_sections): New typedef.
(const_gimple_omp_sections): New typedef.
* gimple-pretty-print.c (dump_gimple_omp_sections): Require a
gimple_omp_sections rather than a plain gimple.
(pp_gimple_stmt_1): Add checked cast to gimple_omp_sections within
GIMPLE_OMP_SECTIONS case of switch statement.
* gimple.c (gimple_build_omp_sections): Return a
gimple_omp_sections rather than a plain gimple.
* gimple.h (gimple_build_omp_sections): Return a
gimple_omp_sections rather than a plain gimple.
* omp-low.c (scan_omp_sections): Require a gimple_omp_sections
rather than a plain gimple.
(scan_omp_1_stmt): Add checked cast to gimple_omp_sections within
GIMPLE_OMP_SECTIONS case of switch statement.
(expand_omp_sections): Strengthen local "sections_stmt" from gimple
to gimple_omp_sections.
(lower_omp_sections): Likewise for "stmt".
---
gcc/ChangeLog.gimple-classes | 26 ++++++++++++++++++++++++++
gcc/coretypes.h | 4 ++++
gcc/gimple-pretty-print.c | 7 ++++---
gcc/gimple.c | 5 +++--
gcc/gimple.h | 2 +-
gcc/omp-low.c | 14 ++++++++------
6 files changed, 46 insertions(+), 12 deletions(-)
diff --git a/gcc/ChangeLog.gimple-classes b/gcc/ChangeLog.gimple-classes
index 65c7986..b0a8465 100644
--- a/gcc/ChangeLog.gimple-classes
+++ b/gcc/ChangeLog.gimple-classes
@@ -1,5 +1,31 @@
2014-10-24 David Malcolm <dmalcolm@redhat.com>
+ Introduce gimple_omp_sections
+
+ * coretypes.h (gimple_omp_sections): New typedef.
+ (const_gimple_omp_sections): New typedef.
+
+ * gimple-pretty-print.c (dump_gimple_omp_sections): Require a
+ gimple_omp_sections rather than a plain gimple.
+ (pp_gimple_stmt_1): Add checked cast to gimple_omp_sections within
+ GIMPLE_OMP_SECTIONS case of switch statement.
+
+ * gimple.c (gimple_build_omp_sections): Return a
+ gimple_omp_sections rather than a plain gimple.
+
+ * gimple.h (gimple_build_omp_sections): Return a
+ gimple_omp_sections rather than a plain gimple.
+
+ * omp-low.c (scan_omp_sections): Require a gimple_omp_sections
+ rather than a plain gimple.
+ (scan_omp_1_stmt): Add checked cast to gimple_omp_sections within
+ GIMPLE_OMP_SECTIONS case of switch statement.
+ (expand_omp_sections): Strengthen local "sections_stmt" from gimple
+ to gimple_omp_sections.
+ (lower_omp_sections): Likewise for "stmt".
+
+2014-10-24 David Malcolm <dmalcolm@redhat.com>
+
Introduce gimple_omp_teams
* coretypes.h (gimple_omp_teams): New typedef.
diff --git a/gcc/coretypes.h b/gcc/coretypes.h
index 2cd33e5..b8417bc 100644
--- a/gcc/coretypes.h
+++ b/gcc/coretypes.h
@@ -196,6 +196,10 @@ struct gimple_statement_omp_task;
typedef struct gimple_statement_omp_task *gimple_omp_task;
typedef const struct gimple_statement_omp_task *const_gimple_omp_task;
+struct gimple_statement_omp_sections;
+typedef struct gimple_statement_omp_sections *gimple_omp_sections;
+typedef const struct gimple_statement_omp_sections *const_gimple_omp_sections;
+
struct gimple_statement_omp_single;
typedef struct gimple_statement_omp_single *gimple_omp_single;
typedef const struct gimple_statement_omp_single *const_gimple_omp_single;
diff --git a/gcc/gimple-pretty-print.c b/gcc/gimple-pretty-print.c
index d5e3639..a90d2ef 100644
--- a/gcc/gimple-pretty-print.c
+++ b/gcc/gimple-pretty-print.c
@@ -1388,8 +1388,8 @@ dump_gimple_omp_teams (pretty_printer *buffer, gimple_omp_teams gs, int spc,
/* Dump a GIMPLE_OMP_SECTIONS tuple on the pretty_printer BUFFER. */
static void
-dump_gimple_omp_sections (pretty_printer *buffer, gimple gs, int spc,
- int flags)
+dump_gimple_omp_sections (pretty_printer *buffer, gimple_omp_sections gs,
+ int spc, int flags)
{
if (flags & TDF_RAW)
{
@@ -2188,7 +2188,8 @@ pp_gimple_stmt_1 (pretty_printer *buffer, gimple gs, int spc, int flags)
break;
case GIMPLE_OMP_SECTIONS:
- dump_gimple_omp_sections (buffer, gs, spc, flags);
+ dump_gimple_omp_sections (buffer, as_a <gimple_omp_sections> (gs),
+ spc, flags);
break;
case GIMPLE_OMP_SECTIONS_SWITCH:
diff --git a/gcc/gimple.c b/gcc/gimple.c
index b4b76f3..c2b4588 100644
--- a/gcc/gimple.c
+++ b/gcc/gimple.c
@@ -1007,10 +1007,11 @@ gimple_build_omp_return (bool wait_p)
CLAUSES are any of the OMP sections contsruct's clauses: private,
firstprivate, lastprivate, reduction, and nowait. */
-gimple
+gimple_omp_sections
gimple_build_omp_sections (gimple_seq body, tree clauses)
{
- gimple p = gimple_alloc (GIMPLE_OMP_SECTIONS, 0);
+ gimple_omp_sections p =
+ as_a <gimple_omp_sections> (gimple_alloc (GIMPLE_OMP_SECTIONS, 0));
if (body)
gimple_omp_set_body (p, body);
gimple_omp_sections_set_clauses (p, clauses);
diff --git a/gcc/gimple.h b/gcc/gimple.h
index 462495e..4e59777 100644
--- a/gcc/gimple.h
+++ b/gcc/gimple.h
@@ -1353,7 +1353,7 @@ gimple gimple_build_omp_taskgroup (gimple_seq);
gimple_omp_continue gimple_build_omp_continue (tree, tree);
gimple gimple_build_omp_ordered (gimple_seq);
gimple gimple_build_omp_return (bool);
-gimple gimple_build_omp_sections (gimple_seq, tree);
+gimple_omp_sections gimple_build_omp_sections (gimple_seq, tree);
gimple gimple_build_omp_sections_switch (void);
gimple_omp_single gimple_build_omp_single (gimple_seq, tree);
gimple_omp_target gimple_build_omp_target (gimple_seq, int, tree);
diff --git a/gcc/omp-low.c b/gcc/omp-low.c
index ce71618..1edc943 100644
--- a/gcc/omp-low.c
+++ b/gcc/omp-low.c
@@ -2295,7 +2295,7 @@ scan_omp_for (gimple_omp_for stmt, omp_context *outer_ctx)
/* Scan an OpenMP sections directive. */
static void
-scan_omp_sections (gimple stmt, omp_context *outer_ctx)
+scan_omp_sections (gimple_omp_sections stmt, omp_context *outer_ctx)
{
omp_context *ctx;
@@ -2814,7 +2814,7 @@ scan_omp_1_stmt (gimple_stmt_iterator *gsi, bool *handled_ops_p,
break;
case GIMPLE_OMP_SECTIONS:
- scan_omp_sections (stmt, ctx);
+ scan_omp_sections (as_a <gimple_omp_sections> (stmt), ctx);
break;
case GIMPLE_OMP_SINGLE:
@@ -7423,7 +7423,8 @@ expand_omp_sections (struct omp_region *region)
unsigned len;
basic_block entry_bb, l0_bb, l1_bb, l2_bb, default_bb;
gimple_stmt_iterator si, switch_si;
- gimple sections_stmt, stmt;
+ gimple_omp_sections sections_stmt;
+ gimple stmt;
gimple_omp_continue cont;
edge_iterator ei;
edge e;
@@ -7478,7 +7479,7 @@ expand_omp_sections (struct omp_region *region)
/* The call to GOMP_sections_start goes in ENTRY_BB, replacing the
GIMPLE_OMP_SECTIONS statement. */
si = gsi_last_bb (entry_bb);
- sections_stmt = gsi_stmt (si);
+ sections_stmt = as_a <gimple_omp_sections> (gsi_stmt (si));
gcc_assert (gimple_code (sections_stmt) == GIMPLE_OMP_SECTIONS);
vin = gimple_omp_sections_control (sections_stmt);
if (!is_combined_parallel (region))
@@ -8876,11 +8877,12 @@ lower_omp_sections (gimple_stmt_iterator *gsi_p, omp_context *ctx)
{
tree block, control;
gimple_stmt_iterator tgsi;
- gimple stmt, t;
+ gimple_omp_sections stmt;
+ gimple t;
gimple_bind new_stmt, bind;
gimple_seq ilist, dlist, olist, new_body;
- stmt = gsi_stmt (*gsi_p);
+ stmt = as_a <gimple_omp_sections> (gsi_stmt (*gsi_p));
push_gimplify_context ();
--
1.8.5.3
^ permalink raw reply [flat|nested] 93+ messages in thread
* [gimple-classes, committed 61/92] Concretize gimple_eh_filter_set_types and gimple_eh_filter_set_failure
2014-10-27 20:35 [gimple-classes, committed 00/92] Initial slew of commits David Malcolm
` (17 preceding siblings ...)
2014-10-27 20:36 ` [gimple-classes, committed 71/92] Concretize gimple_cond_{true|false}_label David Malcolm
@ 2014-10-27 20:36 ` David Malcolm
2014-10-27 20:36 ` [gimple-classes, committed 57/92] Make gimple_goto_set_dest require a gimple_goto David Malcolm
` (72 subsequent siblings)
91 siblings, 0 replies; 93+ messages in thread
From: David Malcolm @ 2014-10-27 20:36 UTC (permalink / raw)
To: gcc-patches; +Cc: David Malcolm
This corresponds to:
[PATCH 63/89] Concretize gimple_eh_filter_set_types and gimple_eh_filter_set_failure
https://gcc.gnu.org/ml/gcc-patches/2014-04/msg01166.html
from the original 89-patch kit
That earlier patch was approved by Jeff:
> OK once prerequisites have gone in.
in https://gcc.gnu.org/ml/gcc-patches/2014-05/msg00830.html
gcc/
* gimple.h (gimple_eh_filter_set_types): Require a gimple_eh_filter.
(gimple_eh_filter_set_failure): Likewise.
* gimple.c (gimple_copy): Add checked casts to gimple_eh_filter
within GIMPLE_EH_FILTER case.
---
gcc/ChangeLog.gimple-classes | 9 +++++++++
gcc/gimple.c | 13 +++++++++----
gcc/gimple.h | 14 ++++++--------
3 files changed, 24 insertions(+), 12 deletions(-)
diff --git a/gcc/ChangeLog.gimple-classes b/gcc/ChangeLog.gimple-classes
index 20deecf..ba0f5c1 100644
--- a/gcc/ChangeLog.gimple-classes
+++ b/gcc/ChangeLog.gimple-classes
@@ -1,5 +1,14 @@
2014-10-24 David Malcolm <dmalcolm@redhat.com>
+ Concretize gimple_eh_filter_set_types and gimple_eh_filter_set_failure
+
+ * gimple.h (gimple_eh_filter_set_types): Require a gimple_eh_filter.
+ (gimple_eh_filter_set_failure): Likewise.
+ * gimple.c (gimple_copy): Add checked casts to gimple_eh_filter
+ within GIMPLE_EH_FILTER case.
+
+2014-10-24 David Malcolm <dmalcolm@redhat.com>
+
Concretize gimple_label_label
* gimple.h (gimple_label_label): Require a const_gimple_label
diff --git a/gcc/gimple.c b/gcc/gimple.c
index 8721316..0775477 100644
--- a/gcc/gimple.c
+++ b/gcc/gimple.c
@@ -1686,10 +1686,15 @@ gimple_copy (gimple stmt)
break;
case GIMPLE_EH_FILTER:
- new_seq = gimple_seq_copy (gimple_eh_filter_failure (stmt));
- gimple_eh_filter_set_failure (copy, new_seq);
- t = unshare_expr (gimple_eh_filter_types (stmt));
- gimple_eh_filter_set_types (copy, t);
+ {
+ gimple_eh_filter eh_filter_stmt = as_a <gimple_eh_filter> (stmt);
+ gimple_eh_filter eh_filter_copy = as_a <gimple_eh_filter> (copy);
+ new_seq =
+ gimple_seq_copy (gimple_eh_filter_failure (eh_filter_stmt));
+ gimple_eh_filter_set_failure (eh_filter_copy, new_seq);
+ t = unshare_expr (gimple_eh_filter_types (eh_filter_stmt));
+ gimple_eh_filter_set_types (eh_filter_copy, t);
+ }
break;
case GIMPLE_EH_ELSE:
diff --git a/gcc/gimple.h b/gcc/gimple.h
index 1a017ca..79ee8ba 100644
--- a/gcc/gimple.h
+++ b/gcc/gimple.h
@@ -3620,25 +3620,23 @@ gimple_eh_filter_failure (gimple gs)
}
-/* Set TYPES to be the set of types handled by GIMPLE_EH_FILTER GS. */
+/* Set TYPES to be the set of types handled by GIMPLE_EH_FILTER
+ EH_FILTER_STMT. */
static inline void
-gimple_eh_filter_set_types (gimple gs, tree types)
+gimple_eh_filter_set_types (gimple_eh_filter eh_filter_stmt, tree types)
{
- gimple_statement_eh_filter *eh_filter_stmt =
- as_a <gimple_statement_eh_filter *> (gs);
eh_filter_stmt->types = types;
}
/* Set FAILURE to be the sequence of statements to execute on failure
- for GIMPLE_EH_FILTER GS. */
+ for GIMPLE_EH_FILTER EH_FILTER_STMT. */
static inline void
-gimple_eh_filter_set_failure (gimple gs, gimple_seq failure)
+gimple_eh_filter_set_failure (gimple_eh_filter eh_filter_stmt,
+ gimple_seq failure)
{
- gimple_statement_eh_filter *eh_filter_stmt =
- as_a <gimple_statement_eh_filter *> (gs);
eh_filter_stmt->failure = failure;
}
--
1.8.5.3
^ permalink raw reply [flat|nested] 93+ messages in thread
* [gimple-classes, committed 25/92] Introduce gimple_eh_must_not_throw
2014-10-27 20:35 [gimple-classes, committed 00/92] Initial slew of commits David Malcolm
` (25 preceding siblings ...)
2014-10-27 20:36 ` [gimple-classes, committed 70/92] Concretize gimple_switch_index and gimple_switch_index_ptr David Malcolm
@ 2014-10-27 20:36 ` David Malcolm
2014-10-27 20:37 ` [gimple-classes, committed 83/92] Concretize gimple_assign_nontemporal_move_p David Malcolm
` (64 subsequent siblings)
91 siblings, 0 replies; 93+ messages in thread
From: David Malcolm @ 2014-10-27 20:36 UTC (permalink / raw)
To: gcc-patches; +Cc: David Malcolm
This corresponds to:
[PATCH 27/89] Introduce gimple_eh_must_not_throw
https://gcc.gnu.org/ml/gcc-patches/2014-04/msg01218.html
from the original 89-patch kit
That earlier patch was approved by Jeff:
> OK after fixing up the naming/const stuff as discussed for prior
> patches.
> That applies to 22-30. Make sure to take care of
> the pretty printers per Trevor's comments as well. He indicated those
> were missing in a couple of those patches.
in https://gcc.gnu.org/ml/gcc-patches/2014-05/msg00628.html
gcc/
* coretypes.h (gimple_eh_must_not_throw): New typedef.
(const_gimple_eh_must_not_throw): New typedef.
* gimple-pretty-print.c (dump_gimple_eh_must_not_throw): Require
a gimple_eh_must_not_throw rather than a plain gimple.
(pp_gimple_stmt_1): Add a checked cast to gimple_eh_must_not_throw
within GIMPLE_EH_MUST_NOT_THROW case of switch statement.
* gimple-streamer-in.c (input_gimple_stmt): Likewise.
* gimple-streamer-out.c (output_gimple_stmt): Likewise.
* gimple.c (gimple_build_eh_must_not_throw): Return a
gimple_eh_must_not_throw rather than a plain gimple.
* gimple.h (gimple_build_eh_must_not_throw): Return a
gimple_eh_must_not_throw rather than a plain gimple.
(gimple_eh_must_not_throw_fndecl): Require a
gimple_eh_must_not_throw rather than a plain gimple.
(gimple_eh_must_not_throw_set_fndecl): Likewise.
* tree-eh.c (lower_eh_must_not_throw): Add checked cast.
---
gcc/ChangeLog.gimple-classes | 27 +++++++++++++++++++++++++++
gcc/coretypes.h | 4 ++++
gcc/gimple-pretty-print.c | 8 +++++---
gcc/gimple-streamer-in.c | 4 +++-
gcc/gimple-streamer-out.c | 5 ++++-
gcc/gimple.c | 6 ++++--
gcc/gimple.h | 9 ++++-----
gcc/tree-eh.c | 3 ++-
8 files changed, 53 insertions(+), 13 deletions(-)
diff --git a/gcc/ChangeLog.gimple-classes b/gcc/ChangeLog.gimple-classes
index e91317c..dd39ce6 100644
--- a/gcc/ChangeLog.gimple-classes
+++ b/gcc/ChangeLog.gimple-classes
@@ -1,5 +1,32 @@
2014-10-24 David Malcolm <dmalcolm@redhat.com>
+ Introduce gimple_eh_must_not_throw
+
+ * coretypes.h (gimple_eh_must_not_throw): New typedef.
+ (const_gimple_eh_must_not_throw): New typedef.
+
+ * gimple-pretty-print.c (dump_gimple_eh_must_not_throw): Require
+ a gimple_eh_must_not_throw rather than a plain gimple.
+ (pp_gimple_stmt_1): Add a checked cast to gimple_eh_must_not_throw
+ within GIMPLE_EH_MUST_NOT_THROW case of switch statement.
+
+ * gimple-streamer-in.c (input_gimple_stmt): Likewise.
+
+ * gimple-streamer-out.c (output_gimple_stmt): Likewise.
+
+ * gimple.c (gimple_build_eh_must_not_throw): Return a
+ gimple_eh_must_not_throw rather than a plain gimple.
+
+ * gimple.h (gimple_build_eh_must_not_throw): Return a
+ gimple_eh_must_not_throw rather than a plain gimple.
+ (gimple_eh_must_not_throw_fndecl): Require a
+ gimple_eh_must_not_throw rather than a plain gimple.
+ (gimple_eh_must_not_throw_set_fndecl): Likewise.
+
+ * tree-eh.c (lower_eh_must_not_throw): Add checked cast.
+
+2014-10-24 David Malcolm <dmalcolm@redhat.com>
+
Introduce gimple_eh_filter
* coretypes.h (gimple_eh_filter): New typedef.
diff --git a/gcc/coretypes.h b/gcc/coretypes.h
index d2d19ec..51b73f6 100644
--- a/gcc/coretypes.h
+++ b/gcc/coretypes.h
@@ -142,6 +142,10 @@ struct gimple_statement_eh_filter;
typedef struct gimple_statement_eh_filter *gimple_eh_filter;
typedef const struct gimple_statement_eh_filter *const_gimple_eh_filter;
+struct gimple_statement_eh_mnt;
+typedef struct gimple_statement_eh_mnt *gimple_eh_must_not_throw;
+typedef const struct gimple_statement_eh_mnt *const_gimple_eh_must_not_throw;
+
struct gimple_statement_phi;
typedef struct gimple_statement_phi *gimple_phi;
typedef const struct gimple_statement_phi *const_gimple_phi;
diff --git a/gcc/gimple-pretty-print.c b/gcc/gimple-pretty-print.c
index 5876a0c..42f94a3 100644
--- a/gcc/gimple-pretty-print.c
+++ b/gcc/gimple-pretty-print.c
@@ -1021,8 +1021,8 @@ dump_gimple_eh_filter (pretty_printer *buffer, gimple_eh_filter gs, int spc,
/* Dump a GIMPLE_EH_MUST_NOT_THROW tuple. */
static void
-dump_gimple_eh_must_not_throw (pretty_printer *buffer, gimple gs,
- int spc, int flags)
+dump_gimple_eh_must_not_throw (pretty_printer *buffer,
+ gimple_eh_must_not_throw gs, int spc, int flags)
{
if (flags & TDF_RAW)
dump_gimple_fmt (buffer, spc, flags, "%G <%T>", gs,
@@ -2203,7 +2203,9 @@ pp_gimple_stmt_1 (pretty_printer *buffer, gimple gs, int spc, int flags)
break;
case GIMPLE_EH_MUST_NOT_THROW:
- dump_gimple_eh_must_not_throw (buffer, gs, spc, flags);
+ dump_gimple_eh_must_not_throw (buffer,
+ as_a <gimple_eh_must_not_throw> (gs),
+ spc, flags);
break;
case GIMPLE_EH_ELSE:
diff --git a/gcc/gimple-streamer-in.c b/gcc/gimple-streamer-in.c
index a4130a5..1d1ad27 100644
--- a/gcc/gimple-streamer-in.c
+++ b/gcc/gimple-streamer-in.c
@@ -127,7 +127,9 @@ input_gimple_stmt (struct lto_input_block *ib, struct data_in *data_in,
break;
case GIMPLE_EH_MUST_NOT_THROW:
- gimple_eh_must_not_throw_set_fndecl (stmt, stream_read_tree (ib, data_in));
+ gimple_eh_must_not_throw_set_fndecl (
+ as_a <gimple_eh_must_not_throw> (stmt),
+ stream_read_tree (ib, data_in));
break;
case GIMPLE_EH_DISPATCH:
diff --git a/gcc/gimple-streamer-out.c b/gcc/gimple-streamer-out.c
index cc87e88..41a4dc4 100644
--- a/gcc/gimple-streamer-out.c
+++ b/gcc/gimple-streamer-out.c
@@ -101,7 +101,10 @@ output_gimple_stmt (struct output_block *ob, gimple stmt)
break;
case GIMPLE_EH_MUST_NOT_THROW:
- stream_write_tree (ob, gimple_eh_must_not_throw_fndecl (stmt), true);
+ stream_write_tree (ob,
+ gimple_eh_must_not_throw_fndecl (
+ as_a <gimple_eh_must_not_throw> (stmt)),
+ true);
break;
case GIMPLE_EH_DISPATCH:
diff --git a/gcc/gimple.c b/gcc/gimple.c
index 3b1ff98..a52d989 100644
--- a/gcc/gimple.c
+++ b/gcc/gimple.c
@@ -644,10 +644,12 @@ gimple_build_eh_filter (tree types, gimple_seq failure)
/* Build a GIMPLE_EH_MUST_NOT_THROW statement. */
-gimple
+gimple_eh_must_not_throw
gimple_build_eh_must_not_throw (tree decl)
{
- gimple p = gimple_alloc (GIMPLE_EH_MUST_NOT_THROW, 0);
+ gimple_eh_must_not_throw p =
+ as_a <gimple_eh_must_not_throw> (
+ gimple_alloc (GIMPLE_EH_MUST_NOT_THROW, 0));
gcc_assert (TREE_CODE (decl) == FUNCTION_DECL);
gcc_assert (flags_from_decl_or_type (decl) & ECF_NORETURN);
diff --git a/gcc/gimple.h b/gcc/gimple.h
index 0d95035..445a1c0 100644
--- a/gcc/gimple.h
+++ b/gcc/gimple.h
@@ -1327,7 +1327,7 @@ gimple_asm gimple_build_asm_vec (const char *, vec<tree, va_gc> *,
vec<tree, va_gc> *);
gimple_catch gimple_build_catch (tree, gimple_seq);
gimple_eh_filter gimple_build_eh_filter (tree, gimple_seq);
-gimple gimple_build_eh_must_not_throw (tree);
+gimple_eh_must_not_throw gimple_build_eh_must_not_throw (tree);
gimple gimple_build_eh_else (gimple_seq, gimple_seq);
gimple_statement_try *gimple_build_try (gimple_seq, gimple_seq,
enum gimple_try_flags);
@@ -3652,18 +3652,17 @@ gimple_eh_filter_set_failure (gimple gs, gimple_seq failure)
/* Get the function decl to be called by the MUST_NOT_THROW region. */
static inline tree
-gimple_eh_must_not_throw_fndecl (gimple gs)
+gimple_eh_must_not_throw_fndecl (gimple_eh_must_not_throw eh_mnt_stmt)
{
- gimple_statement_eh_mnt *eh_mnt_stmt = as_a <gimple_statement_eh_mnt *> (gs);
return eh_mnt_stmt->fndecl;
}
/* Set the function decl to be called by GS to DECL. */
static inline void
-gimple_eh_must_not_throw_set_fndecl (gimple gs, tree decl)
+gimple_eh_must_not_throw_set_fndecl (gimple_eh_must_not_throw eh_mnt_stmt,
+ tree decl)
{
- gimple_statement_eh_mnt *eh_mnt_stmt = as_a <gimple_statement_eh_mnt *> (gs);
eh_mnt_stmt->fndecl = decl;
}
diff --git a/gcc/tree-eh.c b/gcc/tree-eh.c
index 15dcf51..d22eb45 100644
--- a/gcc/tree-eh.c
+++ b/gcc/tree-eh.c
@@ -1861,7 +1861,8 @@ lower_eh_must_not_throw (struct leh_state *state, gimple tp)
this_region = gen_eh_region_must_not_throw (state->cur_region);
this_region->u.must_not_throw.failure_decl
- = gimple_eh_must_not_throw_fndecl (inner);
+ = gimple_eh_must_not_throw_fndecl (
+ as_a <gimple_eh_must_not_throw> (inner));
this_region->u.must_not_throw.failure_loc
= LOCATION_LOCUS (gimple_location (tp));
--
1.8.5.3
^ permalink raw reply [flat|nested] 93+ messages in thread
* [gimple-classes, committed 05/92] Introduce gimple_label and use it in a few places
2014-10-27 20:35 [gimple-classes, committed 00/92] Initial slew of commits David Malcolm
` (10 preceding siblings ...)
2014-10-27 20:36 ` [gimple-classes, committed 40/92] Introduce gimple_omp_single David Malcolm
@ 2014-10-27 20:36 ` David Malcolm
2014-10-27 20:36 ` [gimple-classes, committed 39/92] Introduce gimple_omp_task David Malcolm
` (79 subsequent siblings)
91 siblings, 0 replies; 93+ messages in thread
From: David Malcolm @ 2014-10-27 20:36 UTC (permalink / raw)
To: gcc-patches; +Cc: David Malcolm
This corresponds to:
[PATCH 06/89] Introduce gimple_label and use it in a few places
https://gcc.gnu.org/ml/gcc-patches/2014-04/msg01152.html
from the original 89-patch kit
That earlier patch was approved by Jeff:
> Same as prior patches for gimple_cond and gimple_assign.
in https://gcc.gnu.org/ml/gcc-patches/2014-05/msg00597.html
gcc/
* coretypes.h (gimple_label): New typedef.
(const_gimple_label): New typedef.
* gimple.h (struct gimple_statement_label): New subclass of
gimple_statement_with_ops, adding the invariant that
stmt->code == GIMPLE_LABEL.
(is_a_helper <gimple_statement_label>::test): New.
* gdbhooks.py (build_pretty_printer): Add gimple_label and its
variants, reusing the gimple printer.
* gimple-pretty-print.c (dump_gimple_label): Require a gimple_label
rather than just a gimple.
* tree-cfg.c (verify_gimple_label): Likewise.
* gimple.c (gimple_build_label): Return a gimple_label rather than
just a gimple.
* gimple.h (gimple_build_label): Likewise.
* gimplify.c (gimplify_case_label_expr): Update local to be a
gimple_label.
* tree-switch-conversion.c (gen_inbound_check): Likewise.
* gimple-pretty-print.c (pp_gimple_stmt_1): Add checked cast to
gimple_label in regions where a stmt is known to have code
GIMPLE_LABEL.
* tree-cfg.c (verify_gimple_stmt): Likewise.
---
gcc/ChangeLog.gimple-classes | 32 ++++++++++++++++++++++++++++++++
gcc/coretypes.h | 4 ++++
gcc/gdbhooks.py | 2 ++
gcc/gimple-pretty-print.c | 4 ++--
gcc/gimple.c | 5 +++--
gcc/gimple.h | 24 +++++++++++++++++++++++-
gcc/gimplify.c | 6 +++---
gcc/tree-cfg.c | 4 ++--
gcc/tree-switch-conversion.c | 2 +-
9 files changed, 72 insertions(+), 11 deletions(-)
diff --git a/gcc/ChangeLog.gimple-classes b/gcc/ChangeLog.gimple-classes
index f737e3c..68eb669 100644
--- a/gcc/ChangeLog.gimple-classes
+++ b/gcc/ChangeLog.gimple-classes
@@ -1,5 +1,37 @@
2014-10-24 David Malcolm <dmalcolm@redhat.com>
+ Introduce gimple_label and use it in a few places
+
+ * coretypes.h (gimple_label): New typedef.
+ (const_gimple_label): New typedef.
+
+ * gimple.h (struct gimple_statement_label): New subclass of
+ gimple_statement_with_ops, adding the invariant that
+ stmt->code == GIMPLE_LABEL.
+ (is_a_helper <gimple_statement_label>::test): New.
+
+ * gdbhooks.py (build_pretty_printer): Add gimple_label and its
+ variants, reusing the gimple printer.
+
+ * gimple-pretty-print.c (dump_gimple_label): Require a gimple_label
+ rather than just a gimple.
+ * tree-cfg.c (verify_gimple_label): Likewise.
+
+ * gimple.c (gimple_build_label): Return a gimple_label rather than
+ just a gimple.
+ * gimple.h (gimple_build_label): Likewise.
+
+ * gimplify.c (gimplify_case_label_expr): Update local to be a
+ gimple_label.
+ * tree-switch-conversion.c (gen_inbound_check): Likewise.
+
+ * gimple-pretty-print.c (pp_gimple_stmt_1): Add checked cast to
+ gimple_label in regions where a stmt is known to have code
+ GIMPLE_LABEL.
+ * tree-cfg.c (verify_gimple_stmt): Likewise.
+
+2014-10-24 David Malcolm <dmalcolm@redhat.com>
+
Introduce gimple_assign and use it in various places
* coretypes.h (gimple_assign): New typedef.
diff --git a/gcc/coretypes.h b/gcc/coretypes.h
index f8aeb94..24c6352 100644
--- a/gcc/coretypes.h
+++ b/gcc/coretypes.h
@@ -94,6 +94,10 @@ struct gimple_statement_cond;
typedef struct gimple_statement_cond *gimple_cond;
typedef const struct gimple_statement_cond *const_gimple_cond;
+struct gimple_statement_label;
+typedef struct gimple_statement_label *gimple_label;
+typedef const struct gimple_statement_label *const_gimple_label;
+
struct gimple_statement_switch;
typedef struct gimple_statement_switch *gimple_switch;
typedef const struct gimple_statement_switch *const_gimple_switch;
diff --git a/gcc/gdbhooks.py b/gcc/gdbhooks.py
index d5162de..7514e45 100644
--- a/gcc/gdbhooks.py
+++ b/gcc/gdbhooks.py
@@ -460,6 +460,8 @@ def build_pretty_printer():
# Keep this in the same order as gimple.def:
'gimple_cond', 'const_gimple_cond',
'gimple_statement_cond *',
+ 'gimple_label', 'const_gimple_label',
+ 'gimple_statement_label *',
'gimple_switch', 'const_gimple_switch',
'gimple_statement_switch *',
'gimple_assign', 'const_gimple_assign',
diff --git a/gcc/gimple-pretty-print.c b/gcc/gimple-pretty-print.c
index 482fb1f..9766d57 100644
--- a/gcc/gimple-pretty-print.c
+++ b/gcc/gimple-pretty-print.c
@@ -863,7 +863,7 @@ dump_gimple_cond (pretty_printer *buffer, gimple_cond gs, int spc, int flags)
TDF_* in dumpfils.h). */
static void
-dump_gimple_label (pretty_printer *buffer, gimple gs, int spc, int flags)
+dump_gimple_label (pretty_printer *buffer, gimple_label gs, int spc, int flags)
{
tree label = gimple_label_label (gs);
if (flags & TDF_RAW)
@@ -2105,7 +2105,7 @@ pp_gimple_stmt_1 (pretty_printer *buffer, gimple gs, int spc, int flags)
break;
case GIMPLE_LABEL:
- dump_gimple_label (buffer, gs, spc, flags);
+ dump_gimple_label (buffer, as_a <gimple_label> (gs), spc, flags);
break;
case GIMPLE_GOTO:
diff --git a/gcc/gimple.c b/gcc/gimple.c
index 5ffa357..7eff0b6 100644
--- a/gcc/gimple.c
+++ b/gcc/gimple.c
@@ -482,10 +482,11 @@ gimple_cond_set_condition_from_tree (gimple_cond stmt, tree cond)
/* Build a GIMPLE_LABEL statement for LABEL. */
-gimple
+gimple_label
gimple_build_label (tree label)
{
- gimple p = gimple_build_with_ops (GIMPLE_LABEL, ERROR_MARK, 1);
+ gimple_label p =
+ as_a <gimple_label> (gimple_build_with_ops (GIMPLE_LABEL, ERROR_MARK, 1));
gimple_label_set_label (p, label);
return p;
}
diff --git a/gcc/gimple.h b/gcc/gimple.h
index 285b1f2..0e34c67 100644
--- a/gcc/gimple.h
+++ b/gcc/gimple.h
@@ -780,6 +780,20 @@ struct GTY((tag("GSS_WITH_OPS")))
};
/* A statement with the invariant that
+ stmt->code == GIMPLE_LABEL
+ i.e. a label statement.
+
+ This type will normally be accessed via the gimple_label and
+ const_gimple_label typedefs (in coretypes.h), which are pointers to
+ this type. */
+
+struct GTY((tag("GSS_WITH_OPS")))
+ gimple_statement_label : public gimple_statement_with_ops
+{
+ /* no additional fields; this uses the layout for GSS_WITH_OPS. */
+};
+
+/* A statement with the invariant that
stmt->code == GIMPLE_SWITCH
i.e. a switch statement. */
@@ -850,6 +864,14 @@ is_a_helper <gimple_statement_cond *>::test (gimple gs)
template <>
template <>
inline bool
+is_a_helper <gimple_statement_label *>::test (gimple gs)
+{
+ return gs->code == GIMPLE_LABEL;
+}
+
+template <>
+template <>
+inline bool
is_a_helper <gimple_statement_resx *>::test (gimple gs)
{
return gs->code == GIMPLE_RESX;
@@ -1238,7 +1260,7 @@ gimple_assign gimple_build_assign_with_ops (enum tree_code, tree,
gimple_cond gimple_build_cond (enum tree_code, tree, tree, tree, tree);
gimple_cond gimple_build_cond_from_tree (tree, tree, tree);
void gimple_cond_set_condition_from_tree (gimple_cond, tree);
-gimple gimple_build_label (tree label);
+gimple_label gimple_build_label (tree label);
gimple gimple_build_goto (tree dest);
gimple gimple_build_nop (void);
gimple_bind gimple_build_bind (tree, gimple_seq, tree);
diff --git a/gcc/gimplify.c b/gcc/gimplify.c
index df4e085..f4cbe52 100644
--- a/gcc/gimplify.c
+++ b/gcc/gimplify.c
@@ -1531,7 +1531,7 @@ static enum gimplify_status
gimplify_case_label_expr (tree *expr_p, gimple_seq *pre_p)
{
struct gimplify_ctx *ctxp;
- gimple gimple_label;
+ gimple_label label_stmt;
/* Invalid OpenMP programs can play Duff's Device type games with
#pragma omp parallel. At least in the C front end, we don't
@@ -1540,9 +1540,9 @@ gimplify_case_label_expr (tree *expr_p, gimple_seq *pre_p)
if (ctxp->case_labels.exists ())
break;
- gimple_label = gimple_build_label (CASE_LABEL (*expr_p));
+ label_stmt = gimple_build_label (CASE_LABEL (*expr_p));
ctxp->case_labels.safe_push (*expr_p);
- gimplify_seq_add_stmt (pre_p, gimple_label);
+ gimplify_seq_add_stmt (pre_p, label_stmt);
return GS_ALL_DONE;
}
diff --git a/gcc/tree-cfg.c b/gcc/tree-cfg.c
index 6aef279..4652237 100644
--- a/gcc/tree-cfg.c
+++ b/gcc/tree-cfg.c
@@ -4429,7 +4429,7 @@ verify_gimple_debug (gimple stmt ATTRIBUTE_UNUSED)
Returns true if anything is wrong. */
static bool
-verify_gimple_label (gimple stmt)
+verify_gimple_label (gimple_label stmt)
{
tree decl = gimple_label_label (stmt);
int uid;
@@ -4479,7 +4479,7 @@ verify_gimple_stmt (gimple stmt)
return verify_gimple_assign (as_a <gimple_assign> (stmt));
case GIMPLE_LABEL:
- return verify_gimple_label (stmt);
+ return verify_gimple_label (as_a <gimple_label> (stmt));
case GIMPLE_CALL:
return verify_gimple_call (stmt);
diff --git a/gcc/tree-switch-conversion.c b/gcc/tree-switch-conversion.c
index 084eb1b..7691aeb 100644
--- a/gcc/tree-switch-conversion.c
+++ b/gcc/tree-switch-conversion.c
@@ -1243,7 +1243,7 @@ gen_inbound_check (gimple_switch swtch, struct switch_conv_info *info)
tree label_decl1 = create_artificial_label (UNKNOWN_LOCATION);
tree label_decl2 = create_artificial_label (UNKNOWN_LOCATION);
tree label_decl3 = create_artificial_label (UNKNOWN_LOCATION);
- gimple label1, label2, label3;
+ gimple_label label1, label2, label3;
tree utype, tidx;
tree bound;
--
1.8.5.3
^ permalink raw reply [flat|nested] 93+ messages in thread
* [gimple-classes, committed 39/92] Introduce gimple_omp_task
2014-10-27 20:35 [gimple-classes, committed 00/92] Initial slew of commits David Malcolm
` (11 preceding siblings ...)
2014-10-27 20:36 ` [gimple-classes, committed 05/92] Introduce gimple_label and use it in a few places David Malcolm
@ 2014-10-27 20:36 ` David Malcolm
2014-10-27 20:36 ` [gimple-classes, committed 69/92] Concretize gimple_cond_make_{false|true} David Malcolm
` (78 subsequent siblings)
91 siblings, 0 replies; 93+ messages in thread
From: David Malcolm @ 2014-10-27 20:36 UTC (permalink / raw)
To: gcc-patches; +Cc: David Malcolm
This corresponds to:
[PATCH 41/89] Introduce gimple_omp_task
https://gcc.gnu.org/ml/gcc-patches/2014-04/msg01160.html
from the original 89-patch kit
That earlier patch was approved by Jeff:
> OK with expected changes due to renaming/updates to const handling.
> Please repost the final patch for archival purposes.
in https://gcc.gnu.org/ml/gcc-patches/2014-05/msg00806.html
gcc/
* coretypes.h (gimple_omp_task): New typedef.
(const_gimple_omp_task): New typedef.
* gimple.h (gimple_build_omp_task): Return a gimple_omp_task
rather than a plain gimple.
* gimple-pretty-print.c (dump_gimple_omp_task): Require a
gimple_omp_task rather than a plain gimple.
(pp_gimple_stmt_1): Add checked cast to gimple_omp_task within
GIMPLE_OMP_TASK case of switch statement.
* gimple.c (gimple_build_omp_task): Return a gimple_omp_task
rather than a plain gimple.
* omp-low.c (finalize_task_copyfn): Require a gimple_omp_task
rather than a plain gimple.
(delete_omp_context): Add checked cast to gimple_omp_task.
(scan_omp_task): Strengthen local "stmt" from gimple to
gimple_omp_task.
(expand_task_call): Require a gimple_omp_task rather than a plain
gimple.
(expand_omp_taskreg): Add checked cast to gimple_omp_task.
(create_task_copyfn): Require a gimple_omp_task rather than a
plain gimple.
(lower_omp_taskreg): Add checked cast to gimple_omp_task.
---
gcc/ChangeLog.gimple-classes | 30 ++++++++++++++++++++++++++++++
gcc/coretypes.h | 4 ++++
gcc/gimple-pretty-print.c | 4 ++--
gcc/gimple.c | 5 +++--
gcc/gimple.h | 3 ++-
gcc/omp-low.c | 14 +++++++-------
6 files changed, 48 insertions(+), 12 deletions(-)
diff --git a/gcc/ChangeLog.gimple-classes b/gcc/ChangeLog.gimple-classes
index b030d20..5dfdc22 100644
--- a/gcc/ChangeLog.gimple-classes
+++ b/gcc/ChangeLog.gimple-classes
@@ -1,5 +1,35 @@
2014-10-24 David Malcolm <dmalcolm@redhat.com>
+ Introduce gimple_omp_task
+
+ * coretypes.h (gimple_omp_task): New typedef.
+ (const_gimple_omp_task): New typedef.
+
+ * gimple.h (gimple_build_omp_task): Return a gimple_omp_task
+ rather than a plain gimple.
+
+ * gimple-pretty-print.c (dump_gimple_omp_task): Require a
+ gimple_omp_task rather than a plain gimple.
+ (pp_gimple_stmt_1): Add checked cast to gimple_omp_task within
+ GIMPLE_OMP_TASK case of switch statement.
+
+ * gimple.c (gimple_build_omp_task): Return a gimple_omp_task
+ rather than a plain gimple.
+
+ * omp-low.c (finalize_task_copyfn): Require a gimple_omp_task
+ rather than a plain gimple.
+ (delete_omp_context): Add checked cast to gimple_omp_task.
+ (scan_omp_task): Strengthen local "stmt" from gimple to
+ gimple_omp_task.
+ (expand_task_call): Require a gimple_omp_task rather than a plain
+ gimple.
+ (expand_omp_taskreg): Add checked cast to gimple_omp_task.
+ (create_task_copyfn): Require a gimple_omp_task rather than a
+ plain gimple.
+ (lower_omp_taskreg): Add checked cast to gimple_omp_task.
+
+2014-10-24 David Malcolm <dmalcolm@redhat.com>
+
tree-cfg.c: Make verify_gimple_call require a gimple_call
* tree-cfg.c (verify_gimple_call): Require a gimple_call rather
diff --git a/gcc/coretypes.h b/gcc/coretypes.h
index 641658f..323e23c 100644
--- a/gcc/coretypes.h
+++ b/gcc/coretypes.h
@@ -192,6 +192,10 @@ struct gimple_statement_omp_parallel;
typedef struct gimple_statement_omp_parallel *gimple_omp_parallel;
typedef const struct gimple_statement_omp_parallel *const_gimple_omp_parallel;
+struct gimple_statement_omp_task;
+typedef struct gimple_statement_omp_task *gimple_omp_task;
+typedef const struct gimple_statement_omp_task *const_gimple_omp_task;
+
union section;
typedef union section section;
struct gcc_options;
diff --git a/gcc/gimple-pretty-print.c b/gcc/gimple-pretty-print.c
index ea788c2..2cb6fc8 100644
--- a/gcc/gimple-pretty-print.c
+++ b/gcc/gimple-pretty-print.c
@@ -1911,7 +1911,7 @@ dump_gimple_omp_parallel (pretty_printer *buffer, gimple_omp_parallel gs,
dumpfile.h). */
static void
-dump_gimple_omp_task (pretty_printer *buffer, gimple gs, int spc,
+dump_gimple_omp_task (pretty_printer *buffer, gimple_omp_task gs, int spc,
int flags)
{
if (flags & TDF_RAW)
@@ -2142,7 +2142,7 @@ pp_gimple_stmt_1 (pretty_printer *buffer, gimple gs, int spc, int flags)
break;
case GIMPLE_OMP_TASK:
- dump_gimple_omp_task (buffer, gs, spc, flags);
+ dump_gimple_omp_task (buffer, as_a <gimple_omp_task> (gs), spc, flags);
break;
case GIMPLE_OMP_ATOMIC_LOAD:
diff --git a/gcc/gimple.c b/gcc/gimple.c
index 26bd509..9510014 100644
--- a/gcc/gimple.c
+++ b/gcc/gimple.c
@@ -890,12 +890,13 @@ gimple_build_omp_parallel (gimple_seq body, tree clauses, tree child_fn,
COPY_FN is the optional function for firstprivate initialization.
ARG_SIZE and ARG_ALIGN are size and alignment of the data block. */
-gimple
+gimple_omp_task
gimple_build_omp_task (gimple_seq body, tree clauses, tree child_fn,
tree data_arg, tree copy_fn, tree arg_size,
tree arg_align)
{
- gimple p = gimple_alloc (GIMPLE_OMP_TASK, 0);
+ gimple_omp_task p =
+ as_a <gimple_omp_task> (gimple_alloc (GIMPLE_OMP_TASK, 0));
if (body)
gimple_omp_set_body (p, body);
gimple_omp_task_set_clauses (p, clauses);
diff --git a/gcc/gimple.h b/gcc/gimple.h
index cc460499..a9903de 100644
--- a/gcc/gimple.h
+++ b/gcc/gimple.h
@@ -1345,7 +1345,8 @@ gimple_debug gimple_build_debug_source_bind_stat (tree, tree, gimple MEM_STAT_DE
gimple_omp_critical gimple_build_omp_critical (gimple_seq, tree);
gimple_omp_for gimple_build_omp_for (gimple_seq, int, tree, size_t, gimple_seq);
gimple_omp_parallel gimple_build_omp_parallel (gimple_seq, tree, tree, tree);
-gimple gimple_build_omp_task (gimple_seq, tree, tree, tree, tree, tree, tree);
+gimple_omp_task gimple_build_omp_task (gimple_seq, tree, tree, tree, tree,
+ tree, tree);
gimple gimple_build_omp_section (gimple_seq);
gimple gimple_build_omp_master (gimple_seq);
gimple gimple_build_omp_taskgroup (gimple_seq);
diff --git a/gcc/omp-low.c b/gcc/omp-low.c
index 46155d6..c51e6da 100644
--- a/gcc/omp-low.c
+++ b/gcc/omp-low.c
@@ -1372,7 +1372,7 @@ static gimple_seq maybe_catch_exception (gimple_seq);
/* Finalize task copyfn. */
static void
-finalize_task_copyfn (gimple task_stmt)
+finalize_task_copyfn (gimple_omp_task task_stmt)
{
struct function *child_cfun;
tree child_fn;
@@ -1434,7 +1434,7 @@ delete_omp_context (splay_tree_value value)
}
if (is_task_ctx (ctx))
- finalize_task_copyfn (ctx->stmt);
+ finalize_task_copyfn (as_a <gimple_omp_task> (ctx->stmt));
XDELETE (ctx);
}
@@ -2126,7 +2126,7 @@ scan_omp_task (gimple_stmt_iterator *gsi, omp_context *outer_ctx)
{
omp_context *ctx;
tree name, t;
- gimple stmt = gsi_stmt (*gsi);
+ gimple_omp_task stmt = as_a <gimple_omp_task> (gsi_stmt (*gsi));
/* Ignore task directives with empty bodies. */
if (optimize > 0
@@ -4566,7 +4566,7 @@ expand_cilk_for_call (basic_block bb, gimple_omp_parallel entry_stmt,
generate the task operation. BB is the block where to insert the code. */
static void
-expand_task_call (basic_block bb, gimple entry_stmt)
+expand_task_call (basic_block bb, gimple_omp_task entry_stmt)
{
tree t, t1, t2, t3, flags, cond, c, c2, clauses, depend;
gimple_stmt_iterator gsi;
@@ -5127,7 +5127,7 @@ expand_omp_taskreg (struct omp_region *region)
expand_parallel_call (region, new_bb,
as_a <gimple_omp_parallel> (entry_stmt), ws_args);
else
- expand_task_call (new_bb, entry_stmt);
+ expand_task_call (new_bb, as_a <gimple_omp_task> (entry_stmt));
if (gimple_in_ssa_p (cfun))
update_ssa (TODO_update_ssa_only_virtuals);
}
@@ -9623,7 +9623,7 @@ task_copyfn_remap_type (struct omp_taskcopy_context *tcctx, tree orig_type)
/* Create task copyfn. */
static void
-create_task_copyfn (gimple task_stmt, omp_context *ctx)
+create_task_copyfn (gimple_omp_task task_stmt, omp_context *ctx)
{
struct function *child_cfun;
tree child_fn, t, c, src, dst, f, sf, arg, sarg, decl;
@@ -9954,7 +9954,7 @@ lower_omp_taskreg (gimple_stmt_iterator *gsi_p, omp_context *ctx)
}
if (ctx->srecord_type)
- create_task_copyfn (stmt, ctx);
+ create_task_copyfn (as_a <gimple_omp_task> (stmt), ctx);
push_gimplify_context ();
--
1.8.5.3
^ permalink raw reply [flat|nested] 93+ messages in thread
* [gimple-classes, committed 01/92] Introduce gimple_switch and use it in various places
2014-10-27 20:35 [gimple-classes, committed 00/92] Initial slew of commits David Malcolm
` (21 preceding siblings ...)
2014-10-27 20:36 ` [gimple-classes, committed 92/92] Update gimple.texi class hierarchy diagram David Malcolm
@ 2014-10-27 20:36 ` David Malcolm
2014-10-27 20:36 ` [gimple-classes, committed 04/92] Introduce gimple_assign " David Malcolm
` (68 subsequent siblings)
91 siblings, 0 replies; 93+ messages in thread
From: David Malcolm @ 2014-10-27 20:36 UTC (permalink / raw)
To: gcc-patches; +Cc: David Malcolm
This corresponds to:
[PATCH 02/89] Introduce gimple_switch and use it in various places
https://gcc.gnu.org/ml/gcc-patches/2014-04/msg01154.html
from the original 89-patch kit
That earlier patch was approved by Jeff:
> So it sounds like Richi really prefers the explicit casting rather
> than member functions. It seems like a minor issue to me, so let's go
> with explicit casting.
> OK for the trunk with that change. Per Richi's request, please
> hold off until 4.9.1 goes out the door (~2 months?)
in https://gcc.gnu.org/ml/gcc-patches/2014-04/msg01475.html
gcc/
* gimple.h (gimple_statement_switch): New subclass of
gimple_statement_with_ops, adding the invariant that
stmt->code == GIMPLE_SWITCH.
(is_a_helper <gimple_statement_switch>::test (gimple)): New.
* coretypes.h (gimple_switch): New typedef
(const_gimple_switch): Likewise.
* gdbhooks.py (build_pretty_printer): Add gimple_switch
and its variants, using the gimple printer.
* gimple.c (gimple_build_switch_nlabels): Return a gimple_switch
rather than just a gimple.
(gimple_build_switch): Likewise.
* gimple.h (gimple_build_switch_nlabels): Likewise.
(gimple_build_switch): Likewise.
* gimple.h (gimple_switch_num_labels): Update type-signature to
require a gimple_switch rather than just a gimple.
(gimple_switch_set_num_labels): Likewise.
(gimple_switch_set_index): Likewise.
(gimple_switch_label): Likewise.
(gimple_switch_set_label): Likewise.
(gimple_switch_default_label): Likewise.
(gimple_switch_set_default_label): Likewise.
* expr.h (expand_case): Likewise.
* gimple-pretty-print.c (dump_gimple_call): Likewise.
* stmt.c (compute_cases_per_edge): Likewise.
(expand_case): Likewise.
* tree-cfg.h (group_case_labels_stmt): Likewise.
* tree-cfg.c (make_gimple_switch_edges): Likewise.
(find_taken_edge_switch_expr) Likewise.
(find_case_label_for_value) Likewise.
(get_cases_for_edge): Likewise.
(group_case_labels_stmt): Likewise.
(verify_gimple_switch): Likewise.
* tree-eh.c (verify_norecord_switch_expr): Likewise.
* tree-eh.c (lower_eh_constructs_2): Likewise.
* tree-loop-distribution.c (generate_loops_for_partition): Likewise.
* tree-ssa-dom.c (record_edge_info): Likewise.
* tree-ssa-forwprop.c (simplify_gimple_switch_label_vec): Likewise.
(simplify_gimple_switch): Likewise.
* tree-switch-conversion.c (emit_case_bit_tests): Likewise.
(collect_switch_conv_info): Likewise.
(build_constructors): Likewise.
(array_value_type): Likewise.
(build_one_array): Likewise.
(build_arrays): Likewise.
(gen_inbound_check): Likewise.
* tree-vrp.c (find_switch_asserts): Likewise.
(find_case_label_range): Likewise.
(find_case_label_ranges): Likewise.
(vrp_visit_switch_stmt): Likewise.
(simplify_switch_using_ranges): Likewise.
* tree-vrp.c (switch_update): Strengthen field "stmt" from being
merely a gimple to being a gimple_switch.
* cfgexpand.c (expand_gimple_stmt_1): Add checked cast to
gimple_switch in regions where the stmt code has been tested as
GIMPLE_SWITCH.
* gimple-pretty-print.c (pp_gimple_stmt_1): Likewise.
* tree-cfg.c (make_edges): Likewise.
(end_recording_case_labels): Likewise.
(cleanup_dead_labels): Likewise.
(cleanup_dead_labels): Likewise.
(group_case_labels): Likewise.
(find_taken_edge): Likewise.
(find_case_label_for_value): Likewise.
(verify_gimple_stmt): Likewise.
(gimple_verify_flow_info): Likewise.
(gimple_redirect_edge_and_branch): Likewise.
* tree-inline.c (estimate_num_insns): Likewise.
* tree-ssa-forwprop.c (ssa_forward_propagate_and_combine): Likewise.
* tree-ssa-uncprop.c (associate_equivalences_with_edges): Likewise.
* tree-switch-conversion.c (do_switchconv): Likewise.
* tree-vrp.c (find_assert_locations_1): Likewise.
(vrp_visit_stmt): Likewise.
(simplify_stmt_using_ranges): Likewise.
* ipa-inline-analysis.c (set_switch_stmt_execution_predicate):
Introduce local "lastg" as a generic gimple, so that local "last"
can be of type gimple_switch once lastg's code has been verified.
* omp-low.c (diagnose_sb_2): Introduce switch_stmt local to handle
the GIMPLE_SWITCH case.
* tree-cfg.c (find_taken_edge_switch_expr): Add gimple_switch
argument, since the caller (find_taken_edge) has checked that
last_stmt is a switch.
Conflicts:
gcc/coretypes.h
gcc/tree-cfg.c
gcc/tree-ssa-dom.c
gcc/tree-ssa-uncprop.c
gcc/tree-vrp.c
---
gcc/ChangeLog.gimple-classes | 100 +++++++++++++++++++++++++++++++++++++++++++
gcc/cfgexpand.c | 2 +-
gcc/coretypes.h | 8 ++++
gcc/expr.h | 2 +-
gcc/gdbhooks.py | 7 ++-
gcc/gimple-pretty-print.c | 5 ++-
gcc/gimple.c | 11 ++---
gcc/gimple.h | 37 ++++++++++++----
gcc/ipa-inline-analysis.c | 7 +--
gcc/omp-low.c | 5 ++-
gcc/stmt.c | 4 +-
gcc/tree-cfg.c | 57 ++++++++++++------------
gcc/tree-cfg.h | 2 +-
gcc/tree-eh.c | 5 ++-
gcc/tree-inline.c | 21 +++++----
gcc/tree-loop-distribution.c | 3 +-
gcc/tree-ssa-dom.c | 5 ++-
gcc/tree-ssa-forwprop.c | 6 +--
gcc/tree-ssa-uncprop.c | 7 +--
gcc/tree-switch-conversion.c | 20 ++++-----
gcc/tree-vrp.c | 20 ++++-----
21 files changed, 239 insertions(+), 95 deletions(-)
create mode 100644 gcc/ChangeLog.gimple-classes
diff --git a/gcc/ChangeLog.gimple-classes b/gcc/ChangeLog.gimple-classes
new file mode 100644
index 0000000..08dbf95
--- /dev/null
+++ b/gcc/ChangeLog.gimple-classes
@@ -0,0 +1,100 @@
+2014-10-24 David Malcolm <dmalcolm@redhat.com>
+
+ Introduce gimple_switch and use it in various places
+
+ * gimple.h (gimple_statement_switch): New subclass of
+ gimple_statement_with_ops, adding the invariant that
+ stmt->code == GIMPLE_SWITCH.
+ (is_a_helper <gimple_statement_switch>::test (gimple)): New.
+
+ * coretypes.h (gimple_switch): New typedef
+ (const_gimple_switch): Likewise.
+
+ * gdbhooks.py (build_pretty_printer): Add gimple_switch
+ and its variants, using the gimple printer.
+
+ * gimple.c (gimple_build_switch_nlabels): Return a gimple_switch
+ rather than just a gimple.
+ (gimple_build_switch): Likewise.
+ * gimple.h (gimple_build_switch_nlabels): Likewise.
+ (gimple_build_switch): Likewise.
+
+ * gimple.h (gimple_switch_num_labels): Update type-signature to
+ require a gimple_switch rather than just a gimple.
+ (gimple_switch_set_num_labels): Likewise.
+ (gimple_switch_set_index): Likewise.
+ (gimple_switch_label): Likewise.
+ (gimple_switch_set_label): Likewise.
+ (gimple_switch_default_label): Likewise.
+ (gimple_switch_set_default_label): Likewise.
+ * expr.h (expand_case): Likewise.
+ * gimple-pretty-print.c (dump_gimple_call): Likewise.
+ * stmt.c (compute_cases_per_edge): Likewise.
+ (expand_case): Likewise.
+ * tree-cfg.h (group_case_labels_stmt): Likewise.
+ * tree-cfg.c (make_gimple_switch_edges): Likewise.
+ (find_taken_edge_switch_expr) Likewise.
+ (find_case_label_for_value) Likewise.
+ (get_cases_for_edge): Likewise.
+ (group_case_labels_stmt): Likewise.
+ (verify_gimple_switch): Likewise.
+ * tree-eh.c (verify_norecord_switch_expr): Likewise.
+ * tree-eh.c (lower_eh_constructs_2): Likewise.
+ * tree-loop-distribution.c (generate_loops_for_partition): Likewise.
+ * tree-ssa-dom.c (record_edge_info): Likewise.
+ * tree-ssa-forwprop.c (simplify_gimple_switch_label_vec): Likewise.
+ (simplify_gimple_switch): Likewise.
+ * tree-switch-conversion.c (emit_case_bit_tests): Likewise.
+ (collect_switch_conv_info): Likewise.
+ (build_constructors): Likewise.
+ (array_value_type): Likewise.
+ (build_one_array): Likewise.
+ (build_arrays): Likewise.
+ (gen_inbound_check): Likewise.
+ * tree-vrp.c (find_switch_asserts): Likewise.
+ (find_case_label_range): Likewise.
+ (find_case_label_ranges): Likewise.
+ (vrp_visit_switch_stmt): Likewise.
+ (simplify_switch_using_ranges): Likewise.
+
+ * tree-vrp.c (switch_update): Strengthen field "stmt" from being
+ merely a gimple to being a gimple_switch.
+
+ * cfgexpand.c (expand_gimple_stmt_1): Add checked cast to
+ gimple_switch in regions where the stmt code has been tested as
+ GIMPLE_SWITCH.
+ * gimple-pretty-print.c (pp_gimple_stmt_1): Likewise.
+ * tree-cfg.c (make_edges): Likewise.
+ (end_recording_case_labels): Likewise.
+ (cleanup_dead_labels): Likewise.
+ (cleanup_dead_labels): Likewise.
+ (group_case_labels): Likewise.
+ (find_taken_edge): Likewise.
+ (find_case_label_for_value): Likewise.
+ (verify_gimple_stmt): Likewise.
+ (gimple_verify_flow_info): Likewise.
+ (gimple_redirect_edge_and_branch): Likewise.
+ * tree-inline.c (estimate_num_insns): Likewise.
+ * tree-ssa-forwprop.c (ssa_forward_propagate_and_combine): Likewise.
+ * tree-ssa-uncprop.c (associate_equivalences_with_edges): Likewise.
+ * tree-switch-conversion.c (do_switchconv): Likewise.
+ * tree-vrp.c (find_assert_locations_1): Likewise.
+ (vrp_visit_stmt): Likewise.
+ (simplify_stmt_using_ranges): Likewise.
+
+ * ipa-inline-analysis.c (set_switch_stmt_execution_predicate):
+ Introduce local "lastg" as a generic gimple, so that local "last"
+ can be of type gimple_switch once lastg's code has been verified.
+
+ * omp-low.c (diagnose_sb_2): Introduce switch_stmt local to handle
+ the GIMPLE_SWITCH case.
+
+ * tree-cfg.c (find_taken_edge_switch_expr): Add gimple_switch
+ argument, since the caller (find_taken_edge) has checked that
+ last_stmt is a switch.
+
+Copyright (C) 2014 Free Software Foundation, Inc.
+
+Copying and distribution of this file, with or without modification,
+are permitted in any medium without royalty provided the copyright
+notice and this notice are preserved.
diff --git a/gcc/cfgexpand.c b/gcc/cfgexpand.c
index 5cb96df..b32dc15 100644
--- a/gcc/cfgexpand.c
+++ b/gcc/cfgexpand.c
@@ -3209,7 +3209,7 @@ expand_gimple_stmt_1 (gimple stmt)
case GIMPLE_PREDICT:
break;
case GIMPLE_SWITCH:
- expand_case (stmt);
+ expand_case (as_a <gimple_switch> (stmt));
break;
case GIMPLE_ASM:
expand_asm_stmt (stmt);
diff --git a/gcc/coretypes.h b/gcc/coretypes.h
index c850ff4..1f586c9 100644
--- a/gcc/coretypes.h
+++ b/gcc/coretypes.h
@@ -86,6 +86,14 @@ typedef struct gimple_statement_base *gimple;
typedef const struct gimple_statement_base *const_gimple;
typedef gimple gimple_seq;
struct gimple_stmt_iterator;
+
+/* Typedefs for leaf gimple subclasses (for individual gimple codes).
+ Keep this in the same order as the corresponding codes in gimple.def. */
+
+struct gimple_statement_switch;
+typedef struct gimple_statement_switch *gimple_switch;
+typedef const struct gimple_statement_switch *const_gimple_switch;
+
union section;
typedef union section section;
struct gcc_options;
diff --git a/gcc/expr.h b/gcc/expr.h
index 2e66329..f1458de 100644
--- a/gcc/expr.h
+++ b/gcc/expr.h
@@ -763,7 +763,7 @@ rtx get_personality_function (tree);
/* In stmt.c */
/* Expand a GIMPLE_SWITCH statement. */
-extern void expand_case (gimple);
+extern void expand_case (gimple_switch);
/* Like expand_case but special-case for SJLJ exception dispatching. */
extern void expand_sjlj_dispatch_table (rtx, vec<tree> );
diff --git a/gcc/gdbhooks.py b/gcc/gdbhooks.py
index 0af8ecd..94568f1 100644
--- a/gcc/gdbhooks.py
+++ b/gcc/gdbhooks.py
@@ -455,7 +455,12 @@ def build_pretty_printer():
'tree', TreePrinter)
pp.add_printer_for_types(['cgraph_node *'],
'cgraph_node', CGraphNodePrinter)
- pp.add_printer_for_types(['gimple', 'gimple_statement_base *'],
+ pp.add_printer_for_types(['gimple', 'gimple_statement_base *',
+
+ # Keep this in the same order as gimple.def:
+ 'gimple_switch', 'const_gimple_switch',
+ 'gimple_statement_switch *'],
+
'gimple',
GimplePrinter)
pp.add_printer_for_types(['basic_block', 'basic_block_def *'],
diff --git a/gcc/gimple-pretty-print.c b/gcc/gimple-pretty-print.c
index 4a42d27..9701f2d 100644
--- a/gcc/gimple-pretty-print.c
+++ b/gcc/gimple-pretty-print.c
@@ -785,7 +785,8 @@ dump_gimple_call (pretty_printer *buffer, gimple gs, int spc, int flags)
pp_gimple_stmt_1. */
static void
-dump_gimple_switch (pretty_printer *buffer, gimple gs, int spc, int flags)
+dump_gimple_switch (pretty_printer *buffer, gimple_switch gs, int spc,
+ int flags)
{
unsigned int i;
@@ -2120,7 +2121,7 @@ pp_gimple_stmt_1 (pretty_printer *buffer, gimple gs, int spc, int flags)
break;
case GIMPLE_SWITCH:
- dump_gimple_switch (buffer, gs, spc, flags);
+ dump_gimple_switch (buffer, as_a <gimple_switch> (gs), spc, flags);
break;
case GIMPLE_TRY:
diff --git a/gcc/gimple.c b/gcc/gimple.c
index db76174..a8bd72c 100644
--- a/gcc/gimple.c
+++ b/gcc/gimple.c
@@ -714,13 +714,14 @@ gimple_build_resx (int region)
NLABELS is the number of labels in the switch excluding the default.
DEFAULT_LABEL is the default label for the switch statement. */
-gimple
+gimple_switch
gimple_build_switch_nlabels (unsigned nlabels, tree index, tree default_label)
{
/* nlabels + 1 default label + 1 index. */
gcc_checking_assert (default_label);
- gimple p = gimple_build_with_ops (GIMPLE_SWITCH, ERROR_MARK,
- 1 + 1 + nlabels);
+ gimple_switch p =
+ as_a <gimple_switch> (gimple_build_with_ops (GIMPLE_SWITCH, ERROR_MARK,
+ 1 + 1 + nlabels));
gimple_switch_set_index (p, index);
gimple_switch_set_default_label (p, default_label);
return p;
@@ -732,12 +733,12 @@ gimple_build_switch_nlabels (unsigned nlabels, tree index, tree default_label)
DEFAULT_LABEL is the default label
ARGS is a vector of labels excluding the default. */
-gimple
+gimple_switch
gimple_build_switch (tree index, tree default_label, vec<tree> args)
{
unsigned i, nlabels = args.length ();
- gimple p = gimple_build_switch_nlabels (nlabels, index, default_label);
+ gimple_switch p = gimple_build_switch_nlabels (nlabels, index, default_label);
/* Copy the labels from the vector to the switch statement. */
for (i = 0; i < nlabels; i++)
diff --git a/gcc/gimple.h b/gcc/gimple.h
index ec41585..1b25e67 100644
--- a/gcc/gimple.h
+++ b/gcc/gimple.h
@@ -203,6 +203,7 @@ struct GTY((desc ("gimple_statement_structure (&%h)"), tag ("GSS_BASE"),
and the prev pointer being the last. */
gimple next;
gimple GTY((skip)) prev;
+
};
@@ -768,6 +769,16 @@ enum gimple_statement_structure_enum {
};
#undef DEFGSSTRUCT
+/* A statement with the invariant that
+ stmt->code == GIMPLE_SWITCH
+ i.e. a switch statement. */
+
+struct GTY((tag("GSS_WITH_OPS")))
+ gimple_statement_switch : public gimple_statement_with_ops
+{
+ /* no additional fields; this uses the layout for GSS_WITH_OPS. */
+};
+
template <>
template <>
inline bool
@@ -963,6 +974,14 @@ is_a_helper <gimple_statement_transaction *>::test (gimple gs)
template <>
template <>
inline bool
+is_a_helper <gimple_statement_switch *>::test (gimple gs)
+{
+ return gs->code == GIMPLE_SWITCH;
+}
+
+template <>
+template <>
+inline bool
is_a_helper <gimple_statement_try *>::test (gimple gs)
{
return gs->code == GIMPLE_TRY;
@@ -1197,8 +1216,8 @@ gimple_statement_try *gimple_build_try (gimple_seq, gimple_seq,
enum gimple_try_flags);
gimple gimple_build_wce (gimple_seq);
gimple gimple_build_resx (int);
-gimple gimple_build_switch_nlabels (unsigned, tree, tree);
-gimple gimple_build_switch (tree, tree, vec<tree> );
+gimple_switch gimple_build_switch_nlabels (unsigned, tree, tree);
+gimple_switch gimple_build_switch (tree, tree, vec<tree> );
gimple gimple_build_eh_dispatch (int);
gimple gimple_build_debug_bind_stat (tree, tree, gimple MEM_STAT_DECL);
#define gimple_build_debug_bind(var,val,stmt) \
@@ -3979,7 +3998,7 @@ gimple_eh_dispatch_set_region (gimple gs, int region)
/* Return the number of labels associated with the switch statement GS. */
static inline unsigned
-gimple_switch_num_labels (const_gimple gs)
+gimple_switch_num_labels (const_gimple_switch gs)
{
unsigned num_ops;
GIMPLE_CHECK (gs, GIMPLE_SWITCH);
@@ -3992,7 +4011,7 @@ gimple_switch_num_labels (const_gimple gs)
/* Set NLABELS to be the number of labels for the switch statement GS. */
static inline void
-gimple_switch_set_num_labels (gimple g, unsigned nlabels)
+gimple_switch_set_num_labels (gimple_switch g, unsigned nlabels)
{
GIMPLE_CHECK (g, GIMPLE_SWITCH);
gimple_set_num_ops (g, nlabels + 1);
@@ -4022,7 +4041,7 @@ gimple_switch_index_ptr (const_gimple gs)
/* Set INDEX to be the index variable for switch statement GS. */
static inline void
-gimple_switch_set_index (gimple gs, tree index)
+gimple_switch_set_index (gimple_switch gs, tree index)
{
GIMPLE_CHECK (gs, GIMPLE_SWITCH);
gcc_gimple_checking_assert (SSA_VAR_P (index) || CONSTANT_CLASS_P (index));
@@ -4034,7 +4053,7 @@ gimple_switch_set_index (gimple gs, tree index)
labels in a switch statement. */
static inline tree
-gimple_switch_label (const_gimple gs, unsigned index)
+gimple_switch_label (const_gimple_switch gs, unsigned index)
{
GIMPLE_CHECK (gs, GIMPLE_SWITCH);
gcc_gimple_checking_assert (gimple_num_ops (gs) > index + 1);
@@ -4044,7 +4063,7 @@ gimple_switch_label (const_gimple gs, unsigned index)
/* Set the label number INDEX to LABEL. 0 is always the default label. */
static inline void
-gimple_switch_set_label (gimple gs, unsigned index, tree label)
+gimple_switch_set_label (gimple_switch gs, unsigned index, tree label)
{
GIMPLE_CHECK (gs, GIMPLE_SWITCH);
gcc_gimple_checking_assert (gimple_num_ops (gs) > index + 1
@@ -4056,7 +4075,7 @@ gimple_switch_set_label (gimple gs, unsigned index, tree label)
/* Return the default label for a switch statement. */
static inline tree
-gimple_switch_default_label (const_gimple gs)
+gimple_switch_default_label (const_gimple_switch gs)
{
tree label = gimple_switch_label (gs, 0);
gcc_checking_assert (!CASE_LOW (label) && !CASE_HIGH (label));
@@ -4066,7 +4085,7 @@ gimple_switch_default_label (const_gimple gs)
/* Set the default label for a switch statement. */
static inline void
-gimple_switch_set_default_label (gimple gs, tree label)
+gimple_switch_set_default_label (gimple_switch gs, tree label)
{
gcc_checking_assert (!CASE_LOW (label) && !CASE_HIGH (label));
gimple_switch_set_label (gs, 0, label);
diff --git a/gcc/ipa-inline-analysis.c b/gcc/ipa-inline-analysis.c
index 38f56d2..1fb7ef3 100644
--- a/gcc/ipa-inline-analysis.c
+++ b/gcc/ipa-inline-analysis.c
@@ -1798,7 +1798,7 @@ set_switch_stmt_execution_predicate (struct ipa_node_params *info,
struct inline_summary *summary,
basic_block bb)
{
- gimple last;
+ gimple lastg;
tree op;
int index;
struct agg_position_info aggpos;
@@ -1807,9 +1807,10 @@ set_switch_stmt_execution_predicate (struct ipa_node_params *info,
size_t n;
size_t case_idx;
- last = last_stmt (bb);
- if (!last || gimple_code (last) != GIMPLE_SWITCH)
+ lastg = last_stmt (bb);
+ if (!lastg || gimple_code (lastg) != GIMPLE_SWITCH)
return;
+ gimple_switch last = as_a <gimple_switch> (lastg);
op = gimple_switch_index (last);
if (!unmodified_parm_or_parm_agg_item (info, last, op, &index, &aggpos))
return;
diff --git a/gcc/omp-low.c b/gcc/omp-low.c
index 06db877..0e50637 100644
--- a/gcc/omp-low.c
+++ b/gcc/omp-low.c
@@ -10912,10 +10912,11 @@ diagnose_sb_2 (gimple_stmt_iterator *gsi_p, bool *handled_ops_p,
case GIMPLE_SWITCH:
{
+ gimple_switch switch_stmt = as_a <gimple_switch> (stmt);
unsigned int i;
- for (i = 0; i < gimple_switch_num_labels (stmt); ++i)
+ for (i = 0; i < gimple_switch_num_labels (switch_stmt); ++i)
{
- tree lab = CASE_LABEL (gimple_switch_label (stmt, i));
+ tree lab = CASE_LABEL (gimple_switch_label (switch_stmt, i));
n = splay_tree_lookup (all_labels, (splay_tree_key) lab);
if (n && diagnose_sb_0 (gsi_p, context, (gimple) n->value))
break;
diff --git a/gcc/stmt.c b/gcc/stmt.c
index 6d4eed9..1c8e20e 100644
--- a/gcc/stmt.c
+++ b/gcc/stmt.c
@@ -1106,7 +1106,7 @@ reset_out_edges_aux (basic_block bb)
STMT. Record this information in the aux field of the edge. */
static inline void
-compute_cases_per_edge (gimple stmt)
+compute_cases_per_edge (gimple_switch stmt)
{
basic_block bb = gimple_bb (stmt);
reset_out_edges_aux (bb);
@@ -1128,7 +1128,7 @@ compute_cases_per_edge (gimple stmt)
Generate the code to test it and jump to the right place. */
void
-expand_case (gimple stmt)
+expand_case (gimple_switch stmt)
{
tree minval = NULL_TREE, maxval = NULL_TREE, range = NULL_TREE;
rtx default_label = NULL_RTX;
diff --git a/gcc/tree-cfg.c b/gcc/tree-cfg.c
index cdab639..ffbe8f7 100644
--- a/gcc/tree-cfg.c
+++ b/gcc/tree-cfg.c
@@ -152,7 +152,7 @@ static void make_blocks (gimple_seq);
static void make_edges (void);
static void assign_discriminators (void);
static void make_cond_expr_edges (basic_block);
-static void make_gimple_switch_edges (basic_block);
+static void make_gimple_switch_edges (gimple_switch, basic_block);
static bool make_goto_expr_edges (basic_block);
static void make_gimple_asm_edges (basic_block);
static edge gimple_redirect_edge_and_branch (edge, basic_block);
@@ -172,8 +172,8 @@ static bool gimple_can_merge_blocks_p (basic_block, basic_block);
static void remove_bb (basic_block);
static edge find_taken_edge_computed_goto (basic_block, tree);
static edge find_taken_edge_cond_expr (basic_block, tree);
-static edge find_taken_edge_switch_expr (basic_block, tree);
-static tree find_case_label_for_value (gimple, tree);
+static edge find_taken_edge_switch_expr (gimple_switch, basic_block, tree);
+static tree find_case_label_for_value (gimple_switch, tree);
void
init_empty_tree_cfg_for_function (struct function *fn)
@@ -804,7 +804,7 @@ make_edges (void)
fallthru = false;
break;
case GIMPLE_SWITCH:
- make_gimple_switch_edges (bb);
+ make_gimple_switch_edges (as_a <gimple_switch> (last), bb);
fallthru = false;
break;
case GIMPLE_RESX:
@@ -1127,7 +1127,7 @@ end_recording_case_labels (void)
{
gimple stmt = last_stmt (bb);
if (stmt && gimple_code (stmt) == GIMPLE_SWITCH)
- group_case_labels_stmt (stmt);
+ group_case_labels_stmt (as_a <gimple_switch> (stmt));
}
}
BITMAP_FREE (touched_switch_bbs);
@@ -1139,7 +1139,7 @@ end_recording_case_labels (void)
Otherwise return NULL. */
static tree
-get_cases_for_edge (edge e, gimple t)
+get_cases_for_edge (edge e, gimple_switch t)
{
tree *slot;
size_t i, n;
@@ -1178,9 +1178,8 @@ get_cases_for_edge (edge e, gimple t)
/* Create the edges for a GIMPLE_SWITCH starting at block BB. */
static void
-make_gimple_switch_edges (basic_block bb)
+make_gimple_switch_edges (gimple_switch entry, basic_block bb)
{
- gimple entry = last_stmt (bb);
size_t i, n;
n = gimple_switch_num_labels (entry);
@@ -1431,12 +1430,13 @@ cleanup_dead_labels (void)
case GIMPLE_SWITCH:
{
- size_t i, n = gimple_switch_num_labels (stmt);
+ gimple_switch switch_stmt = as_a <gimple_switch> (stmt);
+ size_t i, n = gimple_switch_num_labels (switch_stmt);
/* Replace all destination labels. */
for (i = 0; i < n; ++i)
{
- tree case_label = gimple_switch_label (stmt, i);
+ tree case_label = gimple_switch_label (switch_stmt, i);
label = CASE_LABEL (case_label);
new_label = main_block_label (label);
if (new_label != label)
@@ -1533,7 +1533,7 @@ cleanup_dead_labels (void)
Eg. three separate entries 1: 2: 3: become one entry 1..3: */
void
-group_case_labels_stmt (gimple stmt)
+group_case_labels_stmt (gimple_switch stmt)
{
int old_size = gimple_switch_num_labels (stmt);
int i, j, new_size = old_size;
@@ -1621,7 +1621,7 @@ group_case_labels (void)
{
gimple stmt = last_stmt (bb);
if (stmt && gimple_code (stmt) == GIMPLE_SWITCH)
- group_case_labels_stmt (stmt);
+ group_case_labels_stmt (as_a <gimple_switch> (stmt));
}
}
@@ -2096,7 +2096,7 @@ find_taken_edge (basic_block bb, tree val)
return find_taken_edge_cond_expr (bb, val);
if (gimple_code (stmt) == GIMPLE_SWITCH)
- return find_taken_edge_switch_expr (bb, val);
+ return find_taken_edge_switch_expr (as_a <gimple_switch> (stmt), bb, val);
if (computed_goto_p (stmt))
{
@@ -2155,14 +2155,13 @@ find_taken_edge_cond_expr (basic_block bb, tree val)
NULL if any edge may be taken. */
static edge
-find_taken_edge_switch_expr (basic_block bb, tree val)
+find_taken_edge_switch_expr (gimple_switch switch_stmt, basic_block bb,
+ tree val)
{
basic_block dest_bb;
edge e;
- gimple switch_stmt;
tree taken_case;
- switch_stmt = last_stmt (bb);
taken_case = find_case_label_for_value (switch_stmt, val);
dest_bb = label_to_block (CASE_LABEL (taken_case));
@@ -2177,7 +2176,7 @@ find_taken_edge_switch_expr (basic_block bb, tree val)
sorted: We can do a binary search for a case matching VAL. */
static tree
-find_case_label_for_value (gimple switch_stmt, tree val)
+find_case_label_for_value (gimple_switch switch_stmt, tree val)
{
size_t low, high, n = gimple_switch_num_labels (switch_stmt);
tree default_case = gimple_switch_default_label (switch_stmt);
@@ -4326,7 +4325,7 @@ verify_gimple_goto (gimple stmt)
is a problem, otherwise false. */
static bool
-verify_gimple_switch (gimple stmt)
+verify_gimple_switch (gimple_switch stmt)
{
unsigned int i, n;
tree elt, prev_upper_bound = NULL_TREE;
@@ -4508,7 +4507,7 @@ verify_gimple_stmt (gimple stmt)
return verify_gimple_goto (stmt);
case GIMPLE_SWITCH:
- return verify_gimple_switch (stmt);
+ return verify_gimple_switch (as_a <gimple_switch> (stmt));
case GIMPLE_RETURN:
return verify_gimple_return (stmt);
@@ -5235,26 +5234,27 @@ gimple_verify_flow_info (void)
case GIMPLE_SWITCH:
{
+ gimple_switch switch_stmt = as_a <gimple_switch> (stmt);
tree prev;
edge e;
size_t i, n;
- n = gimple_switch_num_labels (stmt);
+ n = gimple_switch_num_labels (switch_stmt);
/* Mark all the destination basic blocks. */
for (i = 0; i < n; ++i)
{
- tree lab = CASE_LABEL (gimple_switch_label (stmt, i));
+ tree lab = CASE_LABEL (gimple_switch_label (switch_stmt, i));
basic_block label_bb = label_to_block (lab);
gcc_assert (!label_bb->aux || label_bb->aux == (void *)1);
label_bb->aux = (void *)1;
}
/* Verify that the case labels are sorted. */
- prev = gimple_switch_label (stmt, 0);
+ prev = gimple_switch_label (switch_stmt, 0);
for (i = 1; i < n; ++i)
{
- tree c = gimple_switch_label (stmt, i);
+ tree c = gimple_switch_label (switch_stmt, i);
if (!CASE_LOW (c))
{
error ("found default case not at the start of "
@@ -5300,7 +5300,7 @@ gimple_verify_flow_info (void)
/* Check that we have all of them. */
for (i = 0; i < n; ++i)
{
- tree lab = CASE_LABEL (gimple_switch_label (stmt, i));
+ tree lab = CASE_LABEL (gimple_switch_label (switch_stmt, i));
basic_block label_bb = label_to_block (lab);
if (label_bb->aux != (void *)2)
@@ -5488,8 +5488,9 @@ gimple_redirect_edge_and_branch (edge e, basic_block dest)
case GIMPLE_SWITCH:
{
+ gimple_switch switch_stmt = as_a <gimple_switch> (stmt);
tree label = gimple_block_label (dest);
- tree cases = get_cases_for_edge (e, stmt);
+ tree cases = get_cases_for_edge (e, switch_stmt);
/* If we have a list of cases associated with E, then use it
as it's a lot faster than walking the entire case vector. */
@@ -5510,7 +5511,7 @@ gimple_redirect_edge_and_branch (edge e, basic_block dest)
to move all the cases associated with E to E2. */
if (e2)
{
- tree cases2 = get_cases_for_edge (e2, stmt);
+ tree cases2 = get_cases_for_edge (e2, switch_stmt);
CASE_CHAIN (last) = CASE_CHAIN (cases2);
CASE_CHAIN (cases2) = first;
@@ -5519,11 +5520,11 @@ gimple_redirect_edge_and_branch (edge e, basic_block dest)
}
else
{
- size_t i, n = gimple_switch_num_labels (stmt);
+ size_t i, n = gimple_switch_num_labels (switch_stmt);
for (i = 0; i < n; i++)
{
- tree elt = gimple_switch_label (stmt, i);
+ tree elt = gimple_switch_label (switch_stmt, i);
if (label_to_block (CASE_LABEL (elt)) == e->dest)
CASE_LABEL (elt) = label;
}
diff --git a/gcc/tree-cfg.h b/gcc/tree-cfg.h
index 751d0a2..2be38df 100644
--- a/gcc/tree-cfg.h
+++ b/gcc/tree-cfg.h
@@ -32,7 +32,7 @@ extern void end_recording_case_labels (void);
extern basic_block label_to_block_fn (struct function *, tree);
#define label_to_block(t) (label_to_block_fn (cfun, t))
extern void cleanup_dead_labels (void);
-extern void group_case_labels_stmt (gimple);
+extern void group_case_labels_stmt (gimple_switch);
extern void group_case_labels (void);
extern void replace_uses_by (tree, tree);
extern basic_block single_noncomplex_succ (basic_block bb);
diff --git a/gcc/tree-eh.c b/gcc/tree-eh.c
index d803253..df3f613 100644
--- a/gcc/tree-eh.c
+++ b/gcc/tree-eh.c
@@ -689,7 +689,8 @@ maybe_record_in_goto_queue (struct leh_state *state, gimple stmt)
of the labels will leave outer GIMPLE_TRY_FINALLY nodes. Verify this. */
static void
-verify_norecord_switch_expr (struct leh_state *state, gimple switch_expr)
+verify_norecord_switch_expr (struct leh_state *state,
+ gimple_switch switch_expr)
{
struct leh_tf_state *tf = state->tf;
size_t i, n;
@@ -2028,7 +2029,7 @@ lower_eh_constructs_2 (struct leh_state *state, gimple_stmt_iterator *gsi)
break;
case GIMPLE_SWITCH:
- verify_norecord_switch_expr (state, stmt);
+ verify_norecord_switch_expr (state, as_a <gimple_switch> (stmt));
break;
case GIMPLE_TRY:
diff --git a/gcc/tree-inline.c b/gcc/tree-inline.c
index a817989..c2b6471 100644
--- a/gcc/tree-inline.c
+++ b/gcc/tree-inline.c
@@ -3857,15 +3857,18 @@ estimate_num_insns (gimple stmt, eni_weights *weights)
break;
case GIMPLE_SWITCH:
- /* Take into account cost of the switch + guess 2 conditional jumps for
- each case label.
-
- TODO: once the switch expansion logic is sufficiently separated, we can
- do better job on estimating cost of the switch. */
- if (weights->time_based)
- cost = floor_log2 (gimple_switch_num_labels (stmt)) * 2;
- else
- cost = gimple_switch_num_labels (stmt) * 2;
+ {
+ gimple_switch switch_stmt = as_a <gimple_switch> (stmt);
+ /* Take into account cost of the switch + guess 2 conditional jumps for
+ each case label.
+
+ TODO: once the switch expansion logic is sufficiently separated, we can
+ do better job on estimating cost of the switch. */
+ if (weights->time_based)
+ cost = floor_log2 (gimple_switch_num_labels (switch_stmt)) * 2;
+ else
+ cost = gimple_switch_num_labels (switch_stmt) * 2;
+ }
break;
case GIMPLE_CALL:
diff --git a/gcc/tree-loop-distribution.c b/gcc/tree-loop-distribution.c
index 7a18622..bed8bf1 100644
--- a/gcc/tree-loop-distribution.c
+++ b/gcc/tree-loop-distribution.c
@@ -687,8 +687,9 @@ generate_loops_for_partition (struct loop *loop, partition_t partition,
}
else if (gimple_code (stmt) == GIMPLE_SWITCH)
{
+ gimple_switch switch_stmt = as_a <gimple_switch> (stmt);
gimple_switch_set_index
- (stmt, CASE_LOW (gimple_switch_label (stmt, 1)));
+ (switch_stmt, CASE_LOW (gimple_switch_label (switch_stmt, 1)));
update_stmt (stmt);
}
else
diff --git a/gcc/tree-ssa-dom.c b/gcc/tree-ssa-dom.c
index fec386e..9f51a4d 100644
--- a/gcc/tree-ssa-dom.c
+++ b/gcc/tree-ssa-dom.c
@@ -1795,19 +1795,20 @@ record_edge_info (basic_block bb)
if (gimple_code (stmt) == GIMPLE_SWITCH)
{
+ gimple_switch switch_stmt = as_a <gimple_switch> (stmt);
tree index = gimple_switch_index (stmt);
if (TREE_CODE (index) == SSA_NAME)
{
int i;
- int n_labels = gimple_switch_num_labels (stmt);
+ int n_labels = gimple_switch_num_labels (switch_stmt);
tree *info = XCNEWVEC (tree, last_basic_block_for_fn (cfun));
edge e;
edge_iterator ei;
for (i = 0; i < n_labels; i++)
{
- tree label = gimple_switch_label (stmt, i);
+ tree label = gimple_switch_label (switch_stmt, i);
basic_block target_bb = label_to_block (CASE_LABEL (label));
if (CASE_HIGH (label)
|| !CASE_LOW (label)
diff --git a/gcc/tree-ssa-forwprop.c b/gcc/tree-ssa-forwprop.c
index 0284301..d491bde 100644
--- a/gcc/tree-ssa-forwprop.c
+++ b/gcc/tree-ssa-forwprop.c
@@ -1286,7 +1286,7 @@ simplify_not_neg_expr (gimple_stmt_iterator *gsi_p)
have values outside the range of the new type. */
static void
-simplify_gimple_switch_label_vec (gimple stmt, tree index_type)
+simplify_gimple_switch_label_vec (gimple_switch stmt, tree index_type)
{
unsigned int branch_num = gimple_switch_num_labels (stmt);
auto_vec<tree> labels (branch_num);
@@ -1356,7 +1356,7 @@ simplify_gimple_switch_label_vec (gimple stmt, tree index_type)
the condition which we may be able to optimize better. */
static bool
-simplify_gimple_switch (gimple stmt)
+simplify_gimple_switch (gimple_switch stmt)
{
/* The optimization that we really care about is removing unnecessary
casts. That will let us do much better in propagating the inferred
@@ -3830,7 +3830,7 @@ pass_forwprop::execute (function *fun)
}
case GIMPLE_SWITCH:
- changed = simplify_gimple_switch (stmt);
+ changed = simplify_gimple_switch (as_a <gimple_switch> (stmt));
break;
case GIMPLE_COND:
diff --git a/gcc/tree-ssa-uncprop.c b/gcc/tree-ssa-uncprop.c
index a4c61bd..d43b7fc 100644
--- a/gcc/tree-ssa-uncprop.c
+++ b/gcc/tree-ssa-uncprop.c
@@ -174,12 +174,13 @@ associate_equivalences_with_edges (void)
target block creates an equivalence. */
else if (gimple_code (stmt) == GIMPLE_SWITCH)
{
- tree cond = gimple_switch_index (stmt);
+ gimple_switch switch_stmt = as_a <gimple_switch> (stmt);
+ tree cond = gimple_switch_index (switch_stmt);
if (TREE_CODE (cond) == SSA_NAME
&& !SSA_NAME_OCCURS_IN_ABNORMAL_PHI (cond))
{
- int i, n_labels = gimple_switch_num_labels (stmt);
+ int i, n_labels = gimple_switch_num_labels (switch_stmt);
tree *info = XCNEWVEC (tree, last_basic_block_for_fn (cfun));
/* Walk over the case label vector. Record blocks
@@ -187,7 +188,7 @@ associate_equivalences_with_edges (void)
a single value. */
for (i = 0; i < n_labels; i++)
{
- tree label = gimple_switch_label (stmt, i);
+ tree label = gimple_switch_label (switch_stmt, i);
basic_block bb = label_to_block (CASE_LABEL (label));
if (CASE_HIGH (label)
diff --git a/gcc/tree-switch-conversion.c b/gcc/tree-switch-conversion.c
index ae5853b..084eb1b 100644
--- a/gcc/tree-switch-conversion.c
+++ b/gcc/tree-switch-conversion.c
@@ -299,7 +299,7 @@ case_bit_test_cmp (const void *p1, const void *p2)
node targets. */
static void
-emit_case_bit_tests (gimple swtch, tree index_expr,
+emit_case_bit_tests (gimple_switch swtch, tree index_expr,
tree minval, tree range, tree maxval)
{
struct case_bit_test test[MAX_CASE_BIT_TESTS];
@@ -635,7 +635,7 @@ struct switch_conv_info
/* Collect information about GIMPLE_SWITCH statement SWTCH into INFO. */
static void
-collect_switch_conv_info (gimple swtch, struct switch_conv_info *info)
+collect_switch_conv_info (gimple_switch swtch, struct switch_conv_info *info)
{
unsigned int branch_num = gimple_switch_num_labels (swtch);
tree min_case, max_case;
@@ -880,7 +880,7 @@ gather_default_values (tree default_case, struct switch_conv_info *info)
order of phi nodes. SWTCH is the switch statement being converted. */
static void
-build_constructors (gimple swtch, struct switch_conv_info *info)
+build_constructors (gimple_switch swtch, struct switch_conv_info *info)
{
unsigned i, branch_num = gimple_switch_num_labels (swtch);
tree pos = info->range_min;
@@ -974,7 +974,7 @@ constructor_contains_same_values_p (vec<constructor_elt, va_gc> *vec)
all the constants. */
static tree
-array_value_type (gimple swtch, tree type, int num,
+array_value_type (gimple_switch swtch, tree type, int num,
struct switch_conv_info *info)
{
unsigned int i, len = vec_safe_length (info->constructors[num]);
@@ -1051,8 +1051,8 @@ array_value_type (gimple swtch, tree type, int num,
new array. */
static void
-build_one_array (gimple swtch, int num, tree arr_index_type, gimple phi,
- tree tidx, struct switch_conv_info *info)
+build_one_array (gimple_switch swtch, int num, tree arr_index_type,
+ gimple phi, tree tidx, struct switch_conv_info *info)
{
tree name, cst;
gimple load;
@@ -1117,7 +1117,7 @@ build_one_array (gimple swtch, int num, tree arr_index_type, gimple phi,
them. */
static void
-build_arrays (gimple swtch, struct switch_conv_info *info)
+build_arrays (gimple_switch swtch, struct switch_conv_info *info)
{
tree arr_index_type;
tree tidx, sub, utype;
@@ -1238,7 +1238,7 @@ fix_phi_nodes (edge e1f, edge e2f, basic_block bbf,
*/
static void
-gen_inbound_check (gimple swtch, struct switch_conv_info *info)
+gen_inbound_check (gimple_switch swtch, struct switch_conv_info *info)
{
tree label_decl1 = create_artificial_label (UNKNOWN_LOCATION);
tree label_decl2 = create_artificial_label (UNKNOWN_LOCATION);
@@ -1358,7 +1358,7 @@ gen_inbound_check (gimple swtch, struct switch_conv_info *info)
conversion failed. */
static const char *
-process_switch (gimple swtch)
+process_switch (gimple_switch swtch)
{
struct switch_conv_info info;
@@ -1492,7 +1492,7 @@ pass_convert_switch::execute (function *fun)
putc ('\n', dump_file);
}
- failure_reason = process_switch (stmt);
+ failure_reason = process_switch (as_a <gimple_switch> (stmt));
if (! failure_reason)
{
if (dump_file)
diff --git a/gcc/tree-vrp.c b/gcc/tree-vrp.c
index 7ca0528..a014f21 100644
--- a/gcc/tree-vrp.c
+++ b/gcc/tree-vrp.c
@@ -169,7 +169,7 @@ static bool values_propagated;
static int *vr_phi_edge_counts;
typedef struct {
- gimple stmt;
+ gimple_switch stmt;
tree vec;
} switch_update;
@@ -5779,7 +5779,7 @@ compare_case_labels (const void *p1, const void *p2)
list of assertions for the corresponding operands. */
static bool
-find_switch_asserts (basic_block bb, gimple last)
+find_switch_asserts (basic_block bb, gimple_switch last)
{
bool need_assert;
gimple_stmt_iterator bsi;
@@ -5950,7 +5950,7 @@ find_assert_locations_1 (basic_block bb, sbitmap live)
if (last
&& gimple_code (last) == GIMPLE_SWITCH
&& !ZERO_SSA_OPERANDS (last, SSA_OP_USE))
- need_assert |= find_switch_asserts (bb, last);
+ need_assert |= find_switch_asserts (bb, as_a <gimple_switch> (last));
/* Traverse all the statements in BB marking used names and looking
for statements that may infer assertions for their used operands. */
@@ -7433,7 +7433,7 @@ vrp_visit_cond_stmt (gimple stmt, edge *taken_edge_p)
returned. */
static bool
-find_case_label_index (gimple stmt, size_t start_idx, tree val, size_t *idx)
+find_case_label_index (gimple_switch stmt, size_t start_idx, tree val, size_t *idx)
{
size_t n = gimple_switch_num_labels (stmt);
size_t low, high;
@@ -7483,7 +7483,7 @@ find_case_label_index (gimple stmt, size_t start_idx, tree val, size_t *idx)
Returns true if the default label is not needed. */
static bool
-find_case_label_range (gimple stmt, tree min, tree max, size_t *min_idx,
+find_case_label_range (gimple_switch stmt, tree min, tree max, size_t *min_idx,
size_t *max_idx)
{
size_t i, j;
@@ -7539,7 +7539,7 @@ find_case_label_range (gimple stmt, tree min, tree max, size_t *min_idx,
Returns true if the default label is not needed. */
static bool
-find_case_label_ranges (gimple stmt, value_range_t *vr, size_t *min_idx1,
+find_case_label_ranges (gimple_switch stmt, value_range_t *vr, size_t *min_idx1,
size_t *max_idx1, size_t *min_idx2,
size_t *max_idx2)
{
@@ -7617,7 +7617,7 @@ find_case_label_ranges (gimple stmt, value_range_t *vr, size_t *min_idx1,
SSA_PROP_VARYING. */
static enum ssa_prop_result
-vrp_visit_switch_stmt (gimple stmt, edge *taken_edge_p)
+vrp_visit_switch_stmt (gimple_switch stmt, edge *taken_edge_p)
{
tree op, val;
value_range_t *vr;
@@ -7732,7 +7732,7 @@ vrp_visit_stmt (gimple stmt, edge *taken_edge_p, tree *output_p)
else if (gimple_code (stmt) == GIMPLE_COND)
return vrp_visit_cond_stmt (stmt, taken_edge_p);
else if (gimple_code (stmt) == GIMPLE_SWITCH)
- return vrp_visit_switch_stmt (stmt, taken_edge_p);
+ return vrp_visit_switch_stmt (as_a <gimple_switch> (stmt), taken_edge_p);
/* All other statements produce nothing of interest for VRP, so mark
their outputs varying and prevent further simulation. */
@@ -9220,7 +9220,7 @@ simplify_cond_using_ranges (gimple stmt)
argument. */
static bool
-simplify_switch_using_ranges (gimple stmt)
+simplify_switch_using_ranges (gimple_switch stmt)
{
tree op = gimple_switch_index (stmt);
value_range_t *vr;
@@ -9615,7 +9615,7 @@ simplify_stmt_using_ranges (gimple_stmt_iterator *gsi)
else if (gimple_code (stmt) == GIMPLE_COND)
return simplify_cond_using_ranges (stmt);
else if (gimple_code (stmt) == GIMPLE_SWITCH)
- return simplify_switch_using_ranges (stmt);
+ return simplify_switch_using_ranges (as_a <gimple_switch> (stmt));
else if (is_gimple_call (stmt)
&& gimple_call_internal_p (stmt))
return simplify_internal_call_using_ranges (gsi, stmt);
--
1.8.5.3
^ permalink raw reply [flat|nested] 93+ messages in thread
* [gimple-classes, committed 87/92] Convert various gimple to gimple_phi within ssa-iterators.h
2014-10-27 20:35 [gimple-classes, committed 00/92] Initial slew of commits David Malcolm
` (23 preceding siblings ...)
2014-10-27 20:36 ` [gimple-classes, committed 04/92] Introduce gimple_assign " David Malcolm
@ 2014-10-27 20:36 ` David Malcolm
2014-10-27 20:36 ` [gimple-classes, committed 70/92] Concretize gimple_switch_index and gimple_switch_index_ptr David Malcolm
` (66 subsequent siblings)
91 siblings, 0 replies; 93+ messages in thread
From: David Malcolm @ 2014-10-27 20:36 UTC (permalink / raw)
To: gcc-patches; +Cc: David Malcolm
This corresponds to:
[PATCH 89/89] Convert various gimple to gimple_phi within ssa-iterators.h
https://gcc.gnu.org/ml/gcc-patches/2014-04/msg01177.html
from the original 89-patch kit
That earlier patch was approved by Jeff:
> OK once prereq go in.
in https://gcc.gnu.org/ml/gcc-patches/2014-05/msg00861.html
gcc/
* ssa-iterators.h (FOR_EACH_PHI_OR_STMT_USE): Add checked cast to
gimple_phi.
(FOR_EACH_PHI_OR_STMT_DEF): Likewise.
* ssa-iterators.h (single_phi_def): Require a gimple_phi.
(op_iter_init_phiuse): Likewise.
(op_iter_init_phidef): Likewise.
* tree-ssa-loop-im.c (extract_true_false_args_from_phi): Likewise.
* tree-ssa-loop-im.c (link_use_stmts_after): Replace check against
GIMPLE_PHI with add a dyn_cast to gimple_phi, using result as needed.
(determine_max_movement): Likewise.
* tree-ssa-reassoc.c (is_phi_for_stmt): Likewise.
* tree-ssa-sccvn.c (start_over:): Likewise.
* tree-ssa-loop-im.c
(move_computations_dom_walker::before_dom_children): Split iterator
into gimple_stmt_iterator and a gimple_phi_iterator so that a local
can become a gimple_phi.
---
gcc/ChangeLog.gimple-classes | 24 ++++++++++++++++++++++++
gcc/ssa-iterators.h | 18 +++++++++++-------
gcc/tree-ssa-loop-im.c | 20 +++++++++-----------
gcc/tree-ssa-reassoc.c | 6 ++++--
gcc/tree-ssa-sccvn.c | 4 ++--
5 files changed, 50 insertions(+), 22 deletions(-)
diff --git a/gcc/ChangeLog.gimple-classes b/gcc/ChangeLog.gimple-classes
index 015940e..04bb1a7 100644
--- a/gcc/ChangeLog.gimple-classes
+++ b/gcc/ChangeLog.gimple-classes
@@ -1,5 +1,29 @@
2014-10-24 David Malcolm <dmalcolm@redhat.com>
+ Convert various gimple to gimple_phi within ssa-iterators.h
+
+ * ssa-iterators.h (FOR_EACH_PHI_OR_STMT_USE): Add checked cast to
+ gimple_phi.
+ (FOR_EACH_PHI_OR_STMT_DEF): Likewise.
+
+ * ssa-iterators.h (single_phi_def): Require a gimple_phi.
+ (op_iter_init_phiuse): Likewise.
+ (op_iter_init_phidef): Likewise.
+ * tree-ssa-loop-im.c (extract_true_false_args_from_phi): Likewise.
+
+ * tree-ssa-loop-im.c (link_use_stmts_after): Replace check against
+ GIMPLE_PHI with add a dyn_cast to gimple_phi, using result as needed.
+ (determine_max_movement): Likewise.
+ * tree-ssa-reassoc.c (is_phi_for_stmt): Likewise.
+ * tree-ssa-sccvn.c (start_over:): Likewise.
+
+ * tree-ssa-loop-im.c
+ (move_computations_dom_walker::before_dom_children): Split iterator
+ into gimple_stmt_iterator and a gimple_phi_iterator so that a local
+ can become a gimple_phi.
+
+2014-10-24 David Malcolm <dmalcolm@redhat.com>
+
Use gimple_phi in many more places.
* gimple-ssa-strength-reduction.c (slsr_process_phi): Require a
diff --git a/gcc/ssa-iterators.h b/gcc/ssa-iterators.h
index f332b7c..58b529b 100644
--- a/gcc/ssa-iterators.h
+++ b/gcc/ssa-iterators.h
@@ -194,7 +194,9 @@ struct ssa_op_iter
a real stmt or a PHI node, looking at the USE nodes matching FLAGS. */
#define FOR_EACH_PHI_OR_STMT_USE(USEVAR, STMT, ITER, FLAGS) \
for ((USEVAR) = (gimple_code (STMT) == GIMPLE_PHI \
- ? op_iter_init_phiuse (&(ITER), STMT, FLAGS) \
+ ? op_iter_init_phiuse (&(ITER), \
+ as_a <gimple_phi> (STMT), \
+ FLAGS) \
: op_iter_init_use (&(ITER), STMT, FLAGS)); \
!op_iter_done (&(ITER)); \
(USEVAR) = op_iter_next_use (&(ITER)))
@@ -203,7 +205,9 @@ struct ssa_op_iter
a real stmt or a PHI node, looking at the DEF nodes matching FLAGS. */
#define FOR_EACH_PHI_OR_STMT_DEF(DEFVAR, STMT, ITER, FLAGS) \
for ((DEFVAR) = (gimple_code (STMT) == GIMPLE_PHI \
- ? op_iter_init_phidef (&(ITER), STMT, FLAGS) \
+ ? op_iter_init_phidef (&(ITER), \
+ as_a <gimple_phi> (STMT), \
+ FLAGS) \
: op_iter_init_def (&(ITER), STMT, FLAGS)); \
!op_iter_done (&(ITER)); \
(DEFVAR) = op_iter_next_def (&(ITER)))
@@ -749,7 +753,7 @@ num_ssa_operands (gimple stmt, int flags)
/* If there is a single DEF in the PHI node which matches FLAG, return it.
Otherwise return NULL_DEF_OPERAND_P. */
static inline tree
-single_phi_def (gimple stmt, int flags)
+single_phi_def (gimple_phi stmt, int flags)
{
tree def = PHI_RESULT (stmt);
if ((flags & SSA_OP_DEF) && is_gimple_reg (def))
@@ -762,7 +766,7 @@ single_phi_def (gimple stmt, int flags)
/* Initialize the iterator PTR for uses matching FLAGS in PHI. FLAGS should
be either SSA_OP_USES or SSA_OP_VIRTUAL_USES. */
static inline use_operand_p
-op_iter_init_phiuse (ssa_op_iter *ptr, gimple phi, int flags)
+op_iter_init_phiuse (ssa_op_iter *ptr, gimple_phi phi, int flags)
{
tree phi_def = gimple_phi_result (phi);
int comp;
@@ -792,7 +796,7 @@ op_iter_init_phiuse (ssa_op_iter *ptr, gimple phi, int flags)
/* Start an iterator for a PHI definition. */
static inline def_operand_p
-op_iter_init_phidef (ssa_op_iter *ptr, gimple phi, int flags)
+op_iter_init_phidef (ssa_op_iter *ptr, gimple_phi phi, int flags)
{
tree phi_def = PHI_RESULT (phi);
int comp;
@@ -881,9 +885,9 @@ link_use_stmts_after (use_operand_p head, imm_use_iterator *imm)
/* Only look at virtual or real uses, depending on the type of HEAD. */
flag = (is_gimple_reg (use) ? SSA_OP_USE : SSA_OP_VIRTUAL_USES);
- if (gimple_code (head_stmt) == GIMPLE_PHI)
+ if (gimple_phi phi = dyn_cast <gimple_phi> (head_stmt))
{
- FOR_EACH_PHI_ARG (use_p, head_stmt, op_iter, flag)
+ FOR_EACH_PHI_ARG (use_p, phi, op_iter, flag)
if (USE_FROM_PTR (use_p) == use)
last_p = move_use_after_head (use_p, head, last_p);
}
diff --git a/gcc/tree-ssa-loop-im.c b/gcc/tree-ssa-loop-im.c
index 07823ca..7d39cbf 100644
--- a/gcc/tree-ssa-loop-im.c
+++ b/gcc/tree-ssa-loop-im.c
@@ -622,7 +622,7 @@ mem_ref_in_stmt (gimple stmt)
else return false. */
static bool
-extract_true_false_args_from_phi (basic_block dom, gimple phi,
+extract_true_false_args_from_phi (basic_block dom, gimple_phi phi,
tree *true_arg_p, tree *false_arg_p)
{
basic_block bb = gimple_bb (phi);
@@ -705,7 +705,7 @@ determine_max_movement (gimple stmt, bool must_preserve_exec)
level = superloop_at_depth (loop, 1);
lim_data->max_loop = level;
- if (gimple_code (stmt) == GIMPLE_PHI)
+ if (gimple_phi phi = dyn_cast <gimple_phi> (stmt))
{
use_operand_p use_p;
unsigned min_cost = UINT_MAX;
@@ -716,7 +716,7 @@ determine_max_movement (gimple stmt, bool must_preserve_exec)
evaluated. For this reason the PHI cost (and thus the
cost we remove from the loop by doing the invariant motion)
is that of the cheapest PHI argument dependency chain. */
- FOR_EACH_PHI_ARG (use_p, stmt, iter, SSA_OP_USE)
+ FOR_EACH_PHI_ARG (use_p, phi, iter, SSA_OP_USE)
{
val = USE_FROM_PTR (use_p);
@@ -746,7 +746,7 @@ determine_max_movement (gimple stmt, bool must_preserve_exec)
min_cost = MIN (min_cost, total_cost);
lim_data->cost += min_cost;
- if (gimple_phi_num_args (stmt) > 1)
+ if (gimple_phi_num_args (phi) > 1)
{
basic_block dom = get_immediate_dominator (CDI_DOMINATORS, bb);
gimple cond;
@@ -758,7 +758,7 @@ determine_max_movement (gimple stmt, bool must_preserve_exec)
/* Verify that this is an extended form of a diamond and
the PHI arguments are completely controlled by the
predicate in DOM. */
- if (!extract_true_false_args_from_phi (dom, stmt, NULL, NULL))
+ if (!extract_true_false_args_from_phi (dom, phi, NULL, NULL))
return false;
/* Fold in dependencies and cost of the condition. */
@@ -1165,18 +1165,16 @@ void
move_computations_dom_walker::before_dom_children (basic_block bb)
{
struct loop *level;
- gimple_stmt_iterator bsi;
- gimple stmt;
unsigned cost = 0;
struct lim_aux_data *lim_data;
if (!loop_outer (bb->loop_father))
return;
- for (bsi = gsi_start_phis (bb); !gsi_end_p (bsi); )
+ for (gimple_phi_iterator bsi = gsi_start_phis (bb); !gsi_end_p (bsi); )
{
gimple_assign new_stmt;
- stmt = gsi_stmt (bsi);
+ gimple_phi stmt = bsi.phi ();
lim_data = get_lim_data (stmt);
if (lim_data == NULL)
@@ -1230,11 +1228,11 @@ move_computations_dom_walker::before_dom_children (basic_block bb)
remove_phi_node (&bsi, false);
}
- for (bsi = gsi_start_bb (bb); !gsi_end_p (bsi); )
+ for (gimple_stmt_iterator bsi = gsi_start_bb (bb); !gsi_end_p (bsi); )
{
edge e;
- stmt = gsi_stmt (bsi);
+ gimple stmt = gsi_stmt (bsi);
lim_data = get_lim_data (stmt);
if (lim_data == NULL)
diff --git a/gcc/tree-ssa-reassoc.c b/gcc/tree-ssa-reassoc.c
index 2512e91..9f7f4b0 100644
--- a/gcc/tree-ssa-reassoc.c
+++ b/gcc/tree-ssa-reassoc.c
@@ -3068,6 +3068,7 @@ static bool
is_phi_for_stmt (gimple stmt, tree operand)
{
gimple def_stmt;
+ gimple_phi def_phi;
tree lhs;
use_operand_p arg_p;
ssa_op_iter i;
@@ -3078,10 +3079,11 @@ is_phi_for_stmt (gimple stmt, tree operand)
lhs = gimple_assign_lhs (stmt);
def_stmt = SSA_NAME_DEF_STMT (operand);
- if (gimple_code (def_stmt) != GIMPLE_PHI)
+ def_phi = dyn_cast <gimple_phi> (def_stmt);
+ if (!def_phi)
return false;
- FOR_EACH_PHI_ARG (arg_p, def_stmt, i, SSA_OP_USE)
+ FOR_EACH_PHI_ARG (arg_p, def_phi, i, SSA_OP_USE)
if (lhs == USE_FROM_PTR (arg_p))
return true;
return false;
diff --git a/gcc/tree-ssa-sccvn.c b/gcc/tree-ssa-sccvn.c
index 48fb2dd..3e4254d 100644
--- a/gcc/tree-ssa-sccvn.c
+++ b/gcc/tree-ssa-sccvn.c
@@ -3934,8 +3934,8 @@ start_over:
if (!gimple_nop_p (defstmt))
{
/* Push a new iterator. */
- if (gimple_code (defstmt) == GIMPLE_PHI)
- usep = op_iter_init_phiuse (&iter, defstmt, SSA_OP_ALL_USES);
+ if (gimple_phi phi = dyn_cast <gimple_phi> (defstmt))
+ usep = op_iter_init_phiuse (&iter, phi, SSA_OP_ALL_USES);
else
usep = op_iter_init_use (&iter, defstmt, SSA_OP_ALL_USES);
}
--
1.8.5.3
^ permalink raw reply [flat|nested] 93+ messages in thread
* [gimple-classes, committed 57/92] Make gimple_goto_set_dest require a gimple_goto
2014-10-27 20:35 [gimple-classes, committed 00/92] Initial slew of commits David Malcolm
` (18 preceding siblings ...)
2014-10-27 20:36 ` [gimple-classes, committed 61/92] Concretize gimple_eh_filter_set_types and gimple_eh_filter_set_failure David Malcolm
@ 2014-10-27 20:36 ` David Malcolm
2014-10-27 20:36 ` [gimple-classes, committed 66/92] Concretize three gimple_return_ accessors David Malcolm
` (71 subsequent siblings)
91 siblings, 0 replies; 93+ messages in thread
From: David Malcolm @ 2014-10-27 20:36 UTC (permalink / raw)
To: gcc-patches; +Cc: David Malcolm
This corresponds to:
[PATCH 59/89] Make gimple_goto_set_dest require a gimple_goto
https://gcc.gnu.org/ml/gcc-patches/2014-04/msg01193.html
from the original 89-patch kit
That earlier patch was approved by Jeff:
> OK once prerequisites have gone in.
in https://gcc.gnu.org/ml/gcc-patches/2014-05/msg00815.html
gcc/
* gimple.h (gimple_goto_set_dest): Require a gimple_goto.
* tree-cfg.c (factor_computed_gotos): Add checked cast to
gimple_goto.
(cleanup_dead_labels): Likewise.
---
gcc/ChangeLog.gimple-classes | 10 ++++++++++
gcc/gimple.h | 3 +--
gcc/tree-cfg.c | 5 +++--
3 files changed, 14 insertions(+), 4 deletions(-)
diff --git a/gcc/ChangeLog.gimple-classes b/gcc/ChangeLog.gimple-classes
index 2e1ea10..dd735af 100644
--- a/gcc/ChangeLog.gimple-classes
+++ b/gcc/ChangeLog.gimple-classes
@@ -1,5 +1,15 @@
2014-10-24 David Malcolm <dmalcolm@redhat.com>
+ Make gimple_goto_set_dest require a gimple_goto
+
+ * gimple.h (gimple_goto_set_dest): Require a gimple_goto.
+
+ * tree-cfg.c (factor_computed_gotos): Add checked cast to
+ gimple_goto.
+ (cleanup_dead_labels): Likewise.
+
+2014-10-24 David Malcolm <dmalcolm@redhat.com>
+
Make gimple_label_set_label require a gimple_label
* gimple.h (gimple_label_set_label): Require a gimple_label.
diff --git a/gcc/gimple.h b/gcc/gimple.h
index e195dd4..fc80407 100644
--- a/gcc/gimple.h
+++ b/gcc/gimple.h
@@ -3237,9 +3237,8 @@ gimple_goto_dest (const_gimple gs)
/* Set DEST to be the destination of the unconditonal jump GS. */
static inline void
-gimple_goto_set_dest (gimple gs, tree dest)
+gimple_goto_set_dest (gimple_goto gs, tree dest)
{
- GIMPLE_CHECK (gs, GIMPLE_GOTO);
gimple_set_op (gs, 0, dest);
}
diff --git a/gcc/tree-cfg.c b/gcc/tree-cfg.c
index 697a3f1..be4c00e 100644
--- a/gcc/tree-cfg.c
+++ b/gcc/tree-cfg.c
@@ -1466,10 +1466,11 @@ cleanup_dead_labels (void)
case GIMPLE_GOTO:
if (!computed_goto_p (stmt))
{
- label = gimple_goto_dest (stmt);
+ gimple_goto goto_stmt = as_a <gimple_goto> (stmt);
+ label = gimple_goto_dest (goto_stmt);
new_label = main_block_label (label);
if (new_label != label)
- gimple_goto_set_dest (stmt, new_label);
+ gimple_goto_set_dest (goto_stmt, new_label);
}
break;
--
1.8.5.3
^ permalink raw reply [flat|nested] 93+ messages in thread
* [gimple-classes, committed 40/92] Introduce gimple_omp_single
2014-10-27 20:35 [gimple-classes, committed 00/92] Initial slew of commits David Malcolm
` (9 preceding siblings ...)
2014-10-27 20:35 ` [gimple-classes, committed 03/92] Introduce gimple_cond and use it in various places David Malcolm
@ 2014-10-27 20:36 ` David Malcolm
2014-10-27 20:36 ` [gimple-classes, committed 05/92] Introduce gimple_label and use it in a few places David Malcolm
` (80 subsequent siblings)
91 siblings, 0 replies; 93+ messages in thread
From: David Malcolm @ 2014-10-27 20:36 UTC (permalink / raw)
To: gcc-patches; +Cc: David Malcolm
This corresponds to:
[PATCH 42/89] Introduce gimple_omp_single
https://gcc.gnu.org/ml/gcc-patches/2014-04/msg01206.html
from the original 89-patch kit
That earlier patch was approved by Jeff:
> OK with expected changes due to renaming/updates to const handling.
> Please repost the final patch for archival purposes.
in https://gcc.gnu.org/ml/gcc-patches/2014-05/msg00807.html
gcc/
* coretypes.h (gimple_omp_single): New typedef.
(const_gimple_omp_single): New typedef.
* gimple.h (gimple_build_omp_single): Return a gimple_omp_single
rather than a plain gimple.
(gimple_omp_single_set_clauses): Require a gimple_omp_single
rather than a plain gimple.
* gimple-pretty-print.c (dump_gimple_omp_single): Require a
gimple_omp_single rather than a plain gimple.
(pp_gimple_stmt_1): Add checked cast to gimple_omp_single within
GIMPLE_OMP_SINGLE case of switch statement.
* gimple.c (gimple_build_omp_single): Return a gimple_omp_single
rather than a plain gimple.
* omp-low.c (scan_omp_single): Require a gimple_omp_single rather
than a plain gimple.
(scan_omp_1_stmt): Add checked cast to gimple_omp_single within
GIMPLE_OMP_SINGLE case of switch statement.
(lower_omp_single_simple): Require a gimple_omp_single rather
than a plain gimple.
(lower_omp_single_copy): Likewise.
(lower_omp_single): Strengthen local "single_stmt" from gimple to
gimple_omp_single.
---
gcc/ChangeLog.gimple-classes | 30 ++++++++++++++++++++++++++++++
gcc/coretypes.h | 4 ++++
gcc/gimple-pretty-print.c | 6 ++++--
gcc/gimple.c | 5 +++--
gcc/gimple.h | 8 +++-----
gcc/omp-low.c | 12 +++++++-----
6 files changed, 51 insertions(+), 14 deletions(-)
diff --git a/gcc/ChangeLog.gimple-classes b/gcc/ChangeLog.gimple-classes
index 5dfdc22..88ebaa9 100644
--- a/gcc/ChangeLog.gimple-classes
+++ b/gcc/ChangeLog.gimple-classes
@@ -1,5 +1,35 @@
2014-10-24 David Malcolm <dmalcolm@redhat.com>
+ Introduce gimple_omp_single
+
+ * coretypes.h (gimple_omp_single): New typedef.
+ (const_gimple_omp_single): New typedef.
+
+ * gimple.h (gimple_build_omp_single): Return a gimple_omp_single
+ rather than a plain gimple.
+ (gimple_omp_single_set_clauses): Require a gimple_omp_single
+ rather than a plain gimple.
+
+ * gimple-pretty-print.c (dump_gimple_omp_single): Require a
+ gimple_omp_single rather than a plain gimple.
+ (pp_gimple_stmt_1): Add checked cast to gimple_omp_single within
+ GIMPLE_OMP_SINGLE case of switch statement.
+
+ * gimple.c (gimple_build_omp_single): Return a gimple_omp_single
+ rather than a plain gimple.
+
+ * omp-low.c (scan_omp_single): Require a gimple_omp_single rather
+ than a plain gimple.
+ (scan_omp_1_stmt): Add checked cast to gimple_omp_single within
+ GIMPLE_OMP_SINGLE case of switch statement.
+ (lower_omp_single_simple): Require a gimple_omp_single rather
+ than a plain gimple.
+ (lower_omp_single_copy): Likewise.
+ (lower_omp_single): Strengthen local "single_stmt" from gimple to
+ gimple_omp_single.
+
+2014-10-24 David Malcolm <dmalcolm@redhat.com>
+
Introduce gimple_omp_task
* coretypes.h (gimple_omp_task): New typedef.
diff --git a/gcc/coretypes.h b/gcc/coretypes.h
index 323e23c..ea8f8f4 100644
--- a/gcc/coretypes.h
+++ b/gcc/coretypes.h
@@ -196,6 +196,10 @@ struct gimple_statement_omp_task;
typedef struct gimple_statement_omp_task *gimple_omp_task;
typedef const struct gimple_statement_omp_task *const_gimple_omp_task;
+struct gimple_statement_omp_single;
+typedef struct gimple_statement_omp_single *gimple_omp_single;
+typedef const struct gimple_statement_omp_single *const_gimple_omp_single;
+
union section;
typedef union section section;
struct gcc_options;
diff --git a/gcc/gimple-pretty-print.c b/gcc/gimple-pretty-print.c
index 2cb6fc8..61eacd2 100644
--- a/gcc/gimple-pretty-print.c
+++ b/gcc/gimple-pretty-print.c
@@ -1278,7 +1278,8 @@ dump_gimple_omp_continue (pretty_printer *buffer, gimple_omp_continue gs,
/* Dump a GIMPLE_OMP_SINGLE tuple on the pretty_printer BUFFER. */
static void
-dump_gimple_omp_single (pretty_printer *buffer, gimple gs, int spc, int flags)
+dump_gimple_omp_single (pretty_printer *buffer, gimple_omp_single gs,
+ int spc, int flags)
{
if (flags & TDF_RAW)
{
@@ -2166,7 +2167,8 @@ pp_gimple_stmt_1 (pretty_printer *buffer, gimple gs, int spc, int flags)
break;
case GIMPLE_OMP_SINGLE:
- dump_gimple_omp_single (buffer, gs, spc, flags);
+ dump_gimple_omp_single (buffer, as_a <gimple_omp_single> (gs), spc,
+ flags);
break;
case GIMPLE_OMP_TARGET:
diff --git a/gcc/gimple.c b/gcc/gimple.c
index 9510014..bf5f315 100644
--- a/gcc/gimple.c
+++ b/gcc/gimple.c
@@ -1034,10 +1034,11 @@ gimple_build_omp_sections_switch (void)
CLAUSES are any of the OMP single construct's clauses: private, firstprivate,
copyprivate, nowait. */
-gimple
+gimple_omp_single
gimple_build_omp_single (gimple_seq body, tree clauses)
{
- gimple p = gimple_alloc (GIMPLE_OMP_SINGLE, 0);
+ gimple_omp_single p =
+ as_a <gimple_omp_single> (gimple_alloc (GIMPLE_OMP_SINGLE, 0));
if (body)
gimple_omp_set_body (p, body);
gimple_omp_single_set_clauses (p, clauses);
diff --git a/gcc/gimple.h b/gcc/gimple.h
index a9903de..1caf745 100644
--- a/gcc/gimple.h
+++ b/gcc/gimple.h
@@ -1355,7 +1355,7 @@ gimple gimple_build_omp_ordered (gimple_seq);
gimple gimple_build_omp_return (bool);
gimple gimple_build_omp_sections (gimple_seq, tree);
gimple gimple_build_omp_sections_switch (void);
-gimple gimple_build_omp_single (gimple_seq, tree);
+gimple_omp_single gimple_build_omp_single (gimple_seq, tree);
gimple gimple_build_omp_target (gimple_seq, int, tree);
gimple gimple_build_omp_teams (gimple_seq, tree);
gimple_omp_atomic_load gimple_build_omp_atomic_load (tree, tree);
@@ -5082,13 +5082,11 @@ gimple_omp_single_clauses_ptr (gimple gs)
}
-/* Set CLAUSES to be the clauses associated with OMP_SINGLE GS. */
+/* Set CLAUSES to be the clauses associated with OMP_SINGLE_STMT. */
static inline void
-gimple_omp_single_set_clauses (gimple gs, tree clauses)
+gimple_omp_single_set_clauses (gimple_omp_single omp_single_stmt, tree clauses)
{
- gimple_statement_omp_single *omp_single_stmt =
- as_a <gimple_statement_omp_single *> (gs);
omp_single_stmt->clauses = clauses;
}
diff --git a/gcc/omp-low.c b/gcc/omp-low.c
index c51e6da..3f68ab2 100644
--- a/gcc/omp-low.c
+++ b/gcc/omp-low.c
@@ -2307,7 +2307,7 @@ scan_omp_sections (gimple stmt, omp_context *outer_ctx)
/* Scan an OpenMP single directive. */
static void
-scan_omp_single (gimple stmt, omp_context *outer_ctx)
+scan_omp_single (gimple_omp_single stmt, omp_context *outer_ctx)
{
omp_context *ctx;
tree name;
@@ -2818,7 +2818,7 @@ scan_omp_1_stmt (gimple_stmt_iterator *gsi, bool *handled_ops_p,
break;
case GIMPLE_OMP_SINGLE:
- scan_omp_single (stmt, ctx);
+ scan_omp_single (as_a <gimple_omp_single> (stmt), ctx);
break;
case GIMPLE_OMP_SECTION:
@@ -8974,7 +8974,7 @@ lower_omp_sections (gimple_stmt_iterator *gsi_p, omp_context *ctx)
to a synchronization analysis pass. */
static void
-lower_omp_single_simple (gimple single_stmt, gimple_seq *pre_p)
+lower_omp_single_simple (gimple_omp_single single_stmt, gimple_seq *pre_p)
{
location_t loc = gimple_location (single_stmt);
tree tlabel = create_artificial_label (loc);
@@ -9029,7 +9029,8 @@ lower_omp_single_simple (gimple single_stmt, gimple_seq *pre_p)
to a synchronization analysis pass. */
static void
-lower_omp_single_copy (gimple single_stmt, gimple_seq *pre_p, omp_context *ctx)
+lower_omp_single_copy (gimple_omp_single single_stmt, gimple_seq *pre_p,
+ omp_context *ctx)
{
tree ptr_type, t, l0, l1, l2, bfn_decl;
gimple_seq copyin_seq;
@@ -9085,7 +9086,8 @@ static void
lower_omp_single (gimple_stmt_iterator *gsi_p, omp_context *ctx)
{
tree block;
- gimple t, single_stmt = gsi_stmt (*gsi_p);
+ gimple t;
+ gimple_omp_single single_stmt = as_a <gimple_omp_single> (gsi_stmt (*gsi_p));
gimple_bind bind;
gimple_seq bind_body, bind_body_tail = NULL, dlist;
--
1.8.5.3
^ permalink raw reply [flat|nested] 93+ messages in thread
* [gimple-classes, committed 51/92] More gimple_phi
2014-10-27 20:35 [gimple-classes, committed 00/92] Initial slew of commits David Malcolm
` (14 preceding siblings ...)
2014-10-27 20:36 ` [gimple-classes, committed 82/92] Concretize gimple_call_arg_flags David Malcolm
@ 2014-10-27 20:36 ` David Malcolm
2014-10-27 20:36 ` [gimple-classes, committed 43/92] Introduce gimple_omp_sections David Malcolm
` (75 subsequent siblings)
91 siblings, 0 replies; 93+ messages in thread
From: David Malcolm @ 2014-10-27 20:36 UTC (permalink / raw)
To: gcc-patches; +Cc: David Malcolm
This corresponds to:
[PATCH 53/89] More gimple_phi
https://gcc.gnu.org/ml/gcc-patches/2014-04/msg01200.html
from the original 89-patch kit
That earlier patch was approved by Jeff:
> Ok once prerequisites have gone in.
in https://gcc.gnu.org/ml/gcc-patches/2014-05/msg00812.html
gcc/
* gimple.h (gimple_phi_set_result): Require a gimple_phi rather
than a plain gimple.
(gimple_phi_set_arg): Likewise.
* tree-outof-ssa.c (remove_gimple_phi_args): Likewise; add a checked
cast to gimple_phi.
* tree-sra.c (replace_removed_params_ssa_names): Add a checked
cast to gimple_phi.
---
gcc/ChangeLog.gimple-classes | 14 ++++++++++++++
gcc/gimple.h | 18 ++++++++----------
gcc/tree-outof-ssa.c | 4 ++--
gcc/tree-sra.c | 2 +-
4 files changed, 25 insertions(+), 13 deletions(-)
diff --git a/gcc/ChangeLog.gimple-classes b/gcc/ChangeLog.gimple-classes
index 4a78ca0..8662070 100644
--- a/gcc/ChangeLog.gimple-classes
+++ b/gcc/ChangeLog.gimple-classes
@@ -1,5 +1,19 @@
2014-10-24 David Malcolm <dmalcolm@redhat.com>
+ More gimple_phi
+
+ * gimple.h (gimple_phi_set_result): Require a gimple_phi rather
+ than a plain gimple.
+ (gimple_phi_set_arg): Likewise.
+
+ * tree-outof-ssa.c (remove_gimple_phi_args): Likewise; add a checked
+ cast to gimple_phi.
+
+ * tree-sra.c (replace_removed_params_ssa_names): Add a checked
+ cast to gimple_phi.
+
+2014-10-24 David Malcolm <dmalcolm@redhat.com>
+
Make gimple_phi_arg_edge require a gimple_phi
* gimple.h (gimple_phi_arg_edge): Require a gimple_phi rather
diff --git a/gcc/gimple.h b/gcc/gimple.h
index 96d9245..eff62d2 100644
--- a/gcc/gimple.h
+++ b/gcc/gimple.h
@@ -3909,15 +3909,14 @@ gimple_phi_result_ptr (gimple gs)
return &phi_stmt->result;
}
-/* Set RESULT to be the SSA name created by GIMPLE_PHI GS. */
+/* Set RESULT to be the SSA name created by GIMPLE_PHI PHI. */
static inline void
-gimple_phi_set_result (gimple gs, tree result)
+gimple_phi_set_result (gimple_phi phi, tree result)
{
- gimple_phi phi_stmt = as_a <gimple_phi> (gs);
- phi_stmt->result = result;
+ phi->result = result;
if (result && TREE_CODE (result) == SSA_NAME)
- SSA_NAME_DEF_STMT (result) = gs;
+ SSA_NAME_DEF_STMT (result) = phi;
}
@@ -3933,14 +3932,13 @@ gimple_phi_arg (gimple gs, unsigned index)
}
/* Set PHIARG to be the argument corresponding to incoming edge INDEX
- for GIMPLE_PHI GS. */
+ for GIMPLE_PHI PHI. */
static inline void
-gimple_phi_set_arg (gimple gs, unsigned index, struct phi_arg_d * phiarg)
+gimple_phi_set_arg (gimple_phi phi, unsigned index, struct phi_arg_d * phiarg)
{
- gimple_phi phi_stmt = as_a <gimple_phi> (gs);
- gcc_gimple_checking_assert (index <= phi_stmt->nargs);
- phi_stmt->args[index] = *phiarg;
+ gcc_gimple_checking_assert (index <= phi->nargs);
+ phi->args[index] = *phiarg;
}
/* Return the PHI nodes for basic block BB, or NULL if there are no
diff --git a/gcc/tree-outof-ssa.c b/gcc/tree-outof-ssa.c
index 432c2b2..68814e3 100644
--- a/gcc/tree-outof-ssa.c
+++ b/gcc/tree-outof-ssa.c
@@ -788,7 +788,7 @@ eliminate_phi (edge e, elim_graph g)
check to see if this allows another PHI node to be removed. */
static void
-remove_gimple_phi_args (gimple phi)
+remove_gimple_phi_args (gimple_phi phi)
{
use_operand_p arg_p;
ssa_op_iter iter;
@@ -816,7 +816,7 @@ remove_gimple_phi_args (gimple phi)
/* Also remove the def if it is a PHI node. */
if (gimple_code (stmt) == GIMPLE_PHI)
{
- remove_gimple_phi_args (stmt);
+ remove_gimple_phi_args (as_a <gimple_phi> (stmt));
gsi = gsi_for_stmt (stmt);
remove_phi_node (&gsi, true);
}
diff --git a/gcc/tree-sra.c b/gcc/tree-sra.c
index 3cdd100..9f67f6d 100644
--- a/gcc/tree-sra.c
+++ b/gcc/tree-sra.c
@@ -4556,7 +4556,7 @@ replace_removed_params_ssa_names (gimple stmt,
else if (is_gimple_call (stmt))
gimple_call_set_lhs (stmt, name);
else
- gimple_phi_set_result (stmt, name);
+ gimple_phi_set_result (as_a <gimple_phi> (stmt), name);
replace_uses_by (lhs, name);
release_ssa_name (lhs);
--
1.8.5.3
^ permalink raw reply [flat|nested] 93+ messages in thread
* [gimple-classes, committed 66/92] Concretize three gimple_return_ accessors
2014-10-27 20:35 [gimple-classes, committed 00/92] Initial slew of commits David Malcolm
` (19 preceding siblings ...)
2014-10-27 20:36 ` [gimple-classes, committed 57/92] Make gimple_goto_set_dest require a gimple_goto David Malcolm
@ 2014-10-27 20:36 ` David Malcolm
2014-10-27 20:36 ` [gimple-classes, committed 92/92] Update gimple.texi class hierarchy diagram David Malcolm
` (70 subsequent siblings)
91 siblings, 0 replies; 93+ messages in thread
From: David Malcolm @ 2014-10-27 20:36 UTC (permalink / raw)
To: gcc-patches; +Cc: David Malcolm
This corresponds to:
[PATCH 68/89] Concretize three gimple_return_ accessors
https://gcc.gnu.org/ml/gcc-patches/2014-04/msg01233.html
from the original 89-patch kit
That earlier patch was approved by Jeff:
> Fine once prereqs go in.
in https://gcc.gnu.org/ml/gcc-patches/2014-05/msg00865.html
gcc/
* gimple.h (gimple_return_retval_ptr): Require a const_gimple_return
rather than a const_gimple.
(gimple_return_retval): Likewise.
(gimple_return_set_retval): Require a gimple_return.
* cfgexpand.c (expand_gimple_stmt_1): Add a checked cast to
gimple_return.
(expand_gimple_basic_block): Likewise.
* tree-complex.c (expand_complex_move): Likewise.
(expand_complex_comparison): Likewise.
* tree-inline.c (remap_gimple_stmt): Likewise.
* tree-sra.c (scan_function): Likewise.
(sra_modify_function_body): Likewise.
(ipa_sra_modify_function_body): Likewise.
* tree-ssa-structalias.c (find_func_aliases): Likewise.
* gimple-ssa-isolate-paths.c (isolate_path): Strengthen local
"ret" from gimple to gimple_return.
(find_implicit_erroneous_behaviour): Replace a check for code
GIMPLE_RETURN with a dyn_cast and a new local.
(find_explicit_erroneous_behaviour): Likewise.
* gimple-walk.c (walk_stmt_load_store_addr_ops): Likewise.
* gimple.c (infer_nonnull_range): Likewise.
* ipa-split.c (find_return_bb): Likewise.
(find_retval): Likewise.
(split_function): Likewise.
* omp-low.c (ipa_simd_modify_function_body): Likewise.
* tree-cfg.c (pass_warn_function_return::execute): Likewise.
* tree-nrv.c (tree_nrv): Likewise.
* tree-ssa-alias.c (ref_maybe_used_by_stmt_p): Likewise.
* tree-ssa-dce.c (propagate_necessity): Likewise.
* tree-ssa-structalias.c (find_func_clobbers): Likewise.
* tree-tailcall.c (find_tail_calls): Likewise.
* predict.c (apply_return_prediction): Rework the search for
return_stmt so that the latter can have type gimple_return.
---
gcc/ChangeLog.gimple-classes | 41 +++++++++++++++++++++++++++++++++++++++++
gcc/cfgexpand.c | 4 ++--
gcc/gimple-ssa-isolate-paths.c | 16 ++++++++++------
gcc/gimple-walk.c | 4 ++--
gcc/gimple.c | 14 +++++++-------
gcc/gimple.h | 9 +++------
gcc/ipa-split.c | 13 +++++++------
gcc/omp-low.c | 4 ++--
gcc/predict.c | 13 ++++++++-----
gcc/tree-cfg.c | 5 +++--
gcc/tree-complex.c | 9 ++++++---
gcc/tree-inline.c | 2 +-
gcc/tree-nrv.c | 4 ++--
gcc/tree-sra.c | 6 +++---
gcc/tree-ssa-alias.c | 4 ++--
gcc/tree-ssa-dce.c | 4 ++--
gcc/tree-ssa-structalias.c | 12 +++++++-----
gcc/tree-tailcall.c | 2 +-
gcc/ubsan.c | 2 +-
19 files changed, 110 insertions(+), 58 deletions(-)
diff --git a/gcc/ChangeLog.gimple-classes b/gcc/ChangeLog.gimple-classes
index f2f9a05..c024a2b 100644
--- a/gcc/ChangeLog.gimple-classes
+++ b/gcc/ChangeLog.gimple-classes
@@ -1,5 +1,46 @@
2014-10-24 David Malcolm <dmalcolm@redhat.com>
+ Concretize three gimple_return_ accessors
+
+ * gimple.h (gimple_return_retval_ptr): Require a const_gimple_return
+ rather than a const_gimple.
+ (gimple_return_retval): Likewise.
+ (gimple_return_set_retval): Require a gimple_return.
+
+ * cfgexpand.c (expand_gimple_stmt_1): Add a checked cast to
+ gimple_return.
+ (expand_gimple_basic_block): Likewise.
+ * tree-complex.c (expand_complex_move): Likewise.
+ (expand_complex_comparison): Likewise.
+ * tree-inline.c (remap_gimple_stmt): Likewise.
+ * tree-sra.c (scan_function): Likewise.
+ (sra_modify_function_body): Likewise.
+ (ipa_sra_modify_function_body): Likewise.
+ * tree-ssa-structalias.c (find_func_aliases): Likewise.
+
+ * gimple-ssa-isolate-paths.c (isolate_path): Strengthen local
+ "ret" from gimple to gimple_return.
+ (find_implicit_erroneous_behaviour): Replace a check for code
+ GIMPLE_RETURN with a dyn_cast and a new local.
+ (find_explicit_erroneous_behaviour): Likewise.
+ * gimple-walk.c (walk_stmt_load_store_addr_ops): Likewise.
+ * gimple.c (infer_nonnull_range): Likewise.
+ * ipa-split.c (find_return_bb): Likewise.
+ (find_retval): Likewise.
+ (split_function): Likewise.
+ * omp-low.c (ipa_simd_modify_function_body): Likewise.
+ * tree-cfg.c (pass_warn_function_return::execute): Likewise.
+ * tree-nrv.c (tree_nrv): Likewise.
+ * tree-ssa-alias.c (ref_maybe_used_by_stmt_p): Likewise.
+ * tree-ssa-dce.c (propagate_necessity): Likewise.
+ * tree-ssa-structalias.c (find_func_clobbers): Likewise.
+ * tree-tailcall.c (find_tail_calls): Likewise.
+
+ * predict.c (apply_return_prediction): Rework the search for
+ return_stmt so that the latter can have type gimple_return.
+
+2014-10-24 David Malcolm <dmalcolm@redhat.com>
+
Make gimple_phi_arg_location require a gimple_phi.
* gimple.h (gimple_phi_arg_location): Require a gimple_phi.
diff --git a/gcc/cfgexpand.c b/gcc/cfgexpand.c
index 4287232..0715b83 100644
--- a/gcc/cfgexpand.c
+++ b/gcc/cfgexpand.c
@@ -3220,7 +3220,7 @@ expand_gimple_stmt_1 (gimple stmt)
break;
case GIMPLE_RETURN:
- op0 = gimple_return_retval (stmt);
+ op0 = gimple_return_retval (as_a <gimple_return> (stmt));
if (op0 && op0 != error_mark_node)
{
@@ -4915,7 +4915,7 @@ expand_gimple_basic_block (basic_block bb, bool disable_tail_calls)
if (!gsi_end_p (gsi)
&& gimple_code (gsi_stmt (gsi)) == GIMPLE_RETURN)
{
- gimple ret_stmt = gsi_stmt (gsi);
+ gimple_return ret_stmt = as_a <gimple_return> (gsi_stmt (gsi));
gcc_assert (single_succ_p (bb));
gcc_assert (single_succ (bb) == EXIT_BLOCK_PTR_FOR_FN (cfun));
diff --git a/gcc/gimple-ssa-isolate-paths.c b/gcc/gimple-ssa-isolate-paths.c
index 528b3eb..49c9086 100644
--- a/gcc/gimple-ssa-isolate-paths.c
+++ b/gcc/gimple-ssa-isolate-paths.c
@@ -205,7 +205,7 @@ isolate_path (basic_block bb, basic_block duplicate,
{
if (ret_zero)
{
- gimple ret = gsi_stmt (si2);
+ gimple_return ret = as_a <gimple_return> (gsi_stmt (si2));
tree zero = build_zero_cst (TREE_TYPE (gimple_return_retval (ret)));
gimple_return_set_retval (ret, zero);
update_stmt (ret);
@@ -285,8 +285,12 @@ find_implicit_erroneous_behaviour (void)
{
FOR_EACH_IMM_USE_STMT (use_stmt, iter, lhs)
{
- if (gimple_code (use_stmt) != GIMPLE_RETURN
- || gimple_return_retval (use_stmt) != lhs)
+ gimple_return return_stmt =
+ dyn_cast <gimple_return> (use_stmt);
+ if (!return_stmt)
+ continue;
+
+ if (gimple_return_retval (return_stmt) != lhs)
continue;
if (warning_at (gimple_location (use_stmt),
@@ -399,9 +403,9 @@ find_explicit_erroneous_behaviour (void)
/* Detect returning the address of a local variable. This only
becomes undefined behavior if the result is used, so we do not
insert a trap and only return NULL instead. */
- if (gimple_code (stmt) == GIMPLE_RETURN)
+ if (gimple_return return_stmt = dyn_cast <gimple_return> (stmt))
{
- tree val = gimple_return_retval (stmt);
+ tree val = gimple_return_retval (return_stmt);
if (val && TREE_CODE (val) == ADDR_EXPR)
{
tree valbase = get_base_address (TREE_OPERAND (val, 0));
@@ -425,7 +429,7 @@ find_explicit_erroneous_behaviour (void)
OPT_Wreturn_local_addr, msg))
inform (DECL_SOURCE_LOCATION(valbase), "declared here");
tree zero = build_zero_cst (TREE_TYPE (val));
- gimple_return_set_retval (stmt, zero);
+ gimple_return_set_retval (return_stmt, zero);
update_stmt (stmt);
}
}
diff --git a/gcc/gimple-walk.c b/gcc/gimple-walk.c
index bbc5963..57aa780 100644
--- a/gcc/gimple-walk.c
+++ b/gcc/gimple-walk.c
@@ -852,9 +852,9 @@ walk_stmt_load_store_addr_ops (gimple stmt, void *data,
}
}
}
- else if (gimple_code (stmt) == GIMPLE_RETURN)
+ else if (gimple_return return_stmt = dyn_cast <gimple_return> (stmt))
{
- tree op = gimple_return_retval (stmt);
+ tree op = gimple_return_retval (return_stmt);
if (op)
{
if (visit_addr
diff --git a/gcc/gimple.c b/gcc/gimple.c
index 0fac6b4..a244617 100644
--- a/gcc/gimple.c
+++ b/gcc/gimple.c
@@ -2653,13 +2653,13 @@ infer_nonnull_range (gimple stmt, tree op, bool dereference, bool attribute)
/* If this function is marked as returning non-null, then we can
infer OP is non-null if it is used in the return statement. */
- if (attribute
- && gimple_code (stmt) == GIMPLE_RETURN
- && gimple_return_retval (stmt)
- && operand_equal_p (gimple_return_retval (stmt), op, 0)
- && lookup_attribute ("returns_nonnull",
- TYPE_ATTRIBUTES (TREE_TYPE (current_function_decl))))
- return true;
+ if (attribute)
+ if (gimple_return return_stmt = dyn_cast <gimple_return> (stmt))
+ if (gimple_return_retval (return_stmt)
+ && operand_equal_p (gimple_return_retval (return_stmt), op, 0)
+ && lookup_attribute ("returns_nonnull",
+ TYPE_ATTRIBUTES (TREE_TYPE (current_function_decl))))
+ return true;
return false;
}
diff --git a/gcc/gimple.h b/gcc/gimple.h
index 688c375..e1afe99 100644
--- a/gcc/gimple.h
+++ b/gcc/gimple.h
@@ -5513,18 +5513,16 @@ gimple_transaction_set_subcode (gimple_transaction transaction_stmt,
/* Return a pointer to the return value for GIMPLE_RETURN GS. */
static inline tree *
-gimple_return_retval_ptr (const_gimple gs)
+gimple_return_retval_ptr (const_gimple_return gs)
{
- GIMPLE_CHECK (gs, GIMPLE_RETURN);
return gimple_op_ptr (gs, 0);
}
/* Return the return value for GIMPLE_RETURN GS. */
static inline tree
-gimple_return_retval (const_gimple gs)
+gimple_return_retval (const_gimple_return gs)
{
- GIMPLE_CHECK (gs, GIMPLE_RETURN);
return gimple_op (gs, 0);
}
@@ -5532,9 +5530,8 @@ gimple_return_retval (const_gimple gs)
/* Set RETVAL to be the return value for GIMPLE_RETURN GS. */
static inline void
-gimple_return_set_retval (gimple gs, tree retval)
+gimple_return_set_retval (gimple_return gs, tree retval)
{
- GIMPLE_CHECK (gs, GIMPLE_RETURN);
gimple_set_op (gs, 0, retval);
}
diff --git a/gcc/ipa-split.c b/gcc/ipa-split.c
index 59901dc..e5df578 100644
--- a/gcc/ipa-split.c
+++ b/gcc/ipa-split.c
@@ -710,10 +710,10 @@ find_return_bb (void)
|| is_gimple_min_invariant (gimple_assign_rhs1 (stmt)))
&& retval == gimple_assign_lhs (stmt))
;
- else if (gimple_code (stmt) == GIMPLE_RETURN)
+ else if (gimple_return return_stmt = dyn_cast <gimple_return> (stmt))
{
found_return = true;
- retval = gimple_return_retval (stmt);
+ retval = gimple_return_retval (return_stmt);
}
else
break;
@@ -731,8 +731,8 @@ find_retval (basic_block return_bb)
{
gimple_stmt_iterator bsi;
for (bsi = gsi_start_bb (return_bb); !gsi_end_p (bsi); gsi_next (&bsi))
- if (gimple_code (gsi_stmt (bsi)) == GIMPLE_RETURN)
- return gimple_return_retval (gsi_stmt (bsi));
+ if (gimple_return return_stmt = dyn_cast <gimple_return> (gsi_stmt (bsi)))
+ return gimple_return_retval (return_stmt);
else if (gimple_code (gsi_stmt (bsi)) == GIMPLE_ASSIGN
&& !gimple_clobber_p (gsi_stmt (bsi)))
return gimple_assign_rhs1 (gsi_stmt (bsi));
@@ -1446,9 +1446,10 @@ split_function (struct split_point *split_point)
gimple_stmt_iterator bsi;
for (bsi = gsi_start_bb (return_bb); !gsi_end_p (bsi);
gsi_next (&bsi))
- if (gimple_code (gsi_stmt (bsi)) == GIMPLE_RETURN)
+ if (gimple_return return_stmt =
+ dyn_cast <gimple_return> (gsi_stmt (bsi)))
{
- gimple_return_set_retval (gsi_stmt (bsi), retval);
+ gimple_return_set_retval (return_stmt, retval);
break;
}
else if (gimple_code (gsi_stmt (bsi)) == GIMPLE_ASSIGN
diff --git a/gcc/omp-low.c b/gcc/omp-low.c
index 6174c3f..1e1ee1d 100644
--- a/gcc/omp-low.c
+++ b/gcc/omp-low.c
@@ -11951,9 +11951,9 @@ ipa_simd_modify_function_body (struct cgraph_node *node,
wi.info = &info;
walk_gimple_op (stmt, ipa_simd_modify_stmt_ops, &wi);
- if (gimple_code (stmt) == GIMPLE_RETURN)
+ if (gimple_return return_stmt = dyn_cast <gimple_return> (stmt))
{
- tree retval = gimple_return_retval (stmt);
+ tree retval = gimple_return_retval (return_stmt);
if (!retval)
{
gsi_remove (&gsi, true);
diff --git a/gcc/predict.c b/gcc/predict.c
index 5e8a0e9..c21cc29 100644
--- a/gcc/predict.c
+++ b/gcc/predict.c
@@ -2145,7 +2145,7 @@ return_prediction (tree val, enum prediction *prediction)
static void
apply_return_prediction (void)
{
- gimple return_stmt = NULL;
+ gimple_return return_stmt = NULL;
tree return_val;
edge e;
gimple_phi phi;
@@ -2156,10 +2156,13 @@ apply_return_prediction (void)
FOR_EACH_EDGE (e, ei, EXIT_BLOCK_PTR_FOR_FN (cfun)->preds)
{
- return_stmt = last_stmt (e->src);
- if (return_stmt
- && gimple_code (return_stmt) == GIMPLE_RETURN)
- break;
+ gimple last = last_stmt (e->src);
+ if (last
+ && gimple_code (last) == GIMPLE_RETURN)
+ {
+ return_stmt = as_a <gimple_return> (last);
+ break;
+ }
}
if (!e)
return;
diff --git a/gcc/tree-cfg.c b/gcc/tree-cfg.c
index b0d94ee..4aaeb6d 100644
--- a/gcc/tree-cfg.c
+++ b/gcc/tree-cfg.c
@@ -8335,8 +8335,9 @@ pass_warn_function_return::execute (function *fun)
FOR_EACH_EDGE (e, ei, EXIT_BLOCK_PTR_FOR_FN (fun)->preds)
{
gimple last = last_stmt (e->src);
- if (gimple_code (last) == GIMPLE_RETURN
- && gimple_return_retval (last) == NULL
+ gimple_return return_stmt = dyn_cast <gimple_return> (last);
+ if (return_stmt
+ && gimple_return_retval (return_stmt) == NULL
&& !gimple_no_warning_p (last))
{
location = gimple_location (last);
diff --git a/gcc/tree-complex.c b/gcc/tree-complex.c
index d2b4f01..a7cbceb 100644
--- a/gcc/tree-complex.c
+++ b/gcc/tree-complex.c
@@ -855,7 +855,7 @@ expand_complex_move (gimple_stmt_iterator *gsi, tree type)
stmt = gsi_stmt (*gsi);
gcc_assert (gimple_code (stmt) == GIMPLE_RETURN);
- gimple_return_set_retval (stmt, lhs);
+ gimple_return_set_retval (as_a <gimple_return> (stmt), lhs);
}
update_stmt (stmt);
@@ -1391,8 +1391,11 @@ expand_complex_comparison (gimple_stmt_iterator *gsi, tree ar, tree ai,
switch (gimple_code (stmt))
{
case GIMPLE_RETURN:
- type = TREE_TYPE (gimple_return_retval (stmt));
- gimple_return_set_retval (stmt, fold_convert (type, cc));
+ {
+ gimple_return return_stmt = as_a <gimple_return> (stmt);
+ type = TREE_TYPE (gimple_return_retval (return_stmt));
+ gimple_return_set_retval (return_stmt, fold_convert (type, cc));
+ }
break;
case GIMPLE_ASSIGN:
diff --git a/gcc/tree-inline.c b/gcc/tree-inline.c
index 945614a..11446d7 100644
--- a/gcc/tree-inline.c
+++ b/gcc/tree-inline.c
@@ -1302,7 +1302,7 @@ remap_gimple_stmt (gimple stmt, copy_body_data *id)
statement. */
if (gimple_code (stmt) == GIMPLE_RETURN && id->transform_return_to_modify)
{
- tree retval = gimple_return_retval (stmt);
+ tree retval = gimple_return_retval (as_a <gimple_return> (stmt));
/* If we're returning something, just turn that into an
assignment into the equivalent of the original RESULT_DECL.
diff --git a/gcc/tree-nrv.c b/gcc/tree-nrv.c
index 91a9531..cc16aa2 100644
--- a/gcc/tree-nrv.c
+++ b/gcc/tree-nrv.c
@@ -180,12 +180,12 @@ pass_nrv::execute (function *fun)
gimple stmt = gsi_stmt (gsi);
tree ret_val;
- if (gimple_code (stmt) == GIMPLE_RETURN)
+ if (gimple_return return_stmt = dyn_cast <gimple_return> (stmt))
{
/* In a function with an aggregate return value, the
gimplifier has changed all non-empty RETURN_EXPRs to
return the RESULT_DECL. */
- ret_val = gimple_return_retval (stmt);
+ ret_val = gimple_return_retval (return_stmt);
if (ret_val)
gcc_assert (ret_val == result);
}
diff --git a/gcc/tree-sra.c b/gcc/tree-sra.c
index 9f67f6d..50464f1 100644
--- a/gcc/tree-sra.c
+++ b/gcc/tree-sra.c
@@ -1280,7 +1280,7 @@ scan_function (void)
switch (gimple_code (stmt))
{
case GIMPLE_RETURN:
- t = gimple_return_retval (stmt);
+ t = gimple_return_retval (as_a <gimple_return> (stmt));
if (t != NULL_TREE)
ret |= build_access_from_expr (t, stmt, false);
if (final_bbs)
@@ -3389,7 +3389,7 @@ sra_modify_function_body (void)
switch (gimple_code (stmt))
{
case GIMPLE_RETURN:
- t = gimple_return_retval_ptr (stmt);
+ t = gimple_return_retval_ptr (as_a <gimple_return> (stmt));
if (*t != NULL_TREE)
modified |= sra_modify_expr (t, &gsi, false);
break;
@@ -4652,7 +4652,7 @@ ipa_sra_modify_function_body (ipa_parm_adjustment_vec adjustments)
switch (gimple_code (stmt))
{
case GIMPLE_RETURN:
- t = gimple_return_retval_ptr (stmt);
+ t = gimple_return_retval_ptr (as_a <gimple_return> (stmt));
if (*t != NULL_TREE)
modified |= ipa_modify_expr (t, true, adjustments);
break;
diff --git a/gcc/tree-ssa-alias.c b/gcc/tree-ssa-alias.c
index 611b16f..07ecbd1 100644
--- a/gcc/tree-ssa-alias.c
+++ b/gcc/tree-ssa-alias.c
@@ -1826,9 +1826,9 @@ ref_maybe_used_by_stmt_p (gimple stmt, ao_ref *ref)
}
else if (is_gimple_call (stmt))
return ref_maybe_used_by_call_p (as_a <gimple_call> (stmt), ref);
- else if (gimple_code (stmt) == GIMPLE_RETURN)
+ else if (gimple_return return_stmt = dyn_cast <gimple_return> (stmt))
{
- tree retval = gimple_return_retval (stmt);
+ tree retval = gimple_return_retval (return_stmt);
if (retval
&& TREE_CODE (retval) != SSA_NAME
&& !is_gimple_min_invariant (retval)
diff --git a/gcc/tree-ssa-dce.c b/gcc/tree-ssa-dce.c
index f853512..aba2d98 100644
--- a/gcc/tree-ssa-dce.c
+++ b/gcc/tree-ssa-dce.c
@@ -868,9 +868,9 @@ propagate_necessity (bool aggressive)
mark_all_reaching_defs_necessary (stmt);
}
}
- else if (gimple_code (stmt) == GIMPLE_RETURN)
+ else if (gimple_return return_stmt = dyn_cast <gimple_return> (stmt))
{
- tree rhs = gimple_return_retval (stmt);
+ tree rhs = gimple_return_retval (return_stmt);
/* A return statement may perform a load. */
if (rhs
&& TREE_CODE (rhs) != SSA_NAME
diff --git a/gcc/tree-ssa-structalias.c b/gcc/tree-ssa-structalias.c
index a130268..550bfb4 100644
--- a/gcc/tree-ssa-structalias.c
+++ b/gcc/tree-ssa-structalias.c
@@ -4732,12 +4732,13 @@ find_func_aliases (struct function *fn, gimple origt)
}
/* Handle escapes through return. */
else if (gimple_code (t) == GIMPLE_RETURN
- && gimple_return_retval (t) != NULL_TREE)
+ && gimple_return_retval (as_a <gimple_return> (t)) != NULL_TREE)
{
+ gimple_return return_stmt = as_a <gimple_return> (t);
fi = NULL;
if (!in_ipa_mode
|| !(fi = get_vi_for_tree (fn->decl)))
- make_escape_constraint (gimple_return_retval (t));
+ make_escape_constraint (gimple_return_retval (return_stmt));
else if (in_ipa_mode
&& fi != NULL)
{
@@ -4746,7 +4747,7 @@ find_func_aliases (struct function *fn, gimple origt)
unsigned i;
lhs = get_function_part_constraint (fi, fi_result);
- get_constraint_for_rhs (gimple_return_retval (t), &rhsc);
+ get_constraint_for_rhs (gimple_return_retval (return_stmt), &rhsc);
FOR_EACH_VEC_ELT (rhsc, i, rhsp)
process_constraint (new_constraint (lhs, *rhsp));
}
@@ -4885,10 +4886,11 @@ find_func_clobbers (struct function *fn, gimple origt)
/* Account for uses in assigments and returns. */
if (gimple_assign_single_p (t)
|| (gimple_code (t) == GIMPLE_RETURN
- && gimple_return_retval (t) != NULL_TREE))
+ && gimple_return_retval (as_a <gimple_return> (t)) != NULL_TREE))
{
tree rhs = (gimple_assign_single_p (t)
- ? gimple_assign_rhs1 (t) : gimple_return_retval (t));
+ ? gimple_assign_rhs1 (t)
+ : gimple_return_retval (as_a <gimple_return> (t)));
tree tem = rhs;
while (handled_component_p (tem))
tem = TREE_OPERAND (tem, 0);
diff --git a/gcc/tree-tailcall.c b/gcc/tree-tailcall.c
index 5a1763c..9bf3c42 100644
--- a/gcc/tree-tailcall.c
+++ b/gcc/tree-tailcall.c
@@ -586,7 +586,7 @@ find_tail_calls (basic_block bb, struct tailcall **ret)
}
/* See if this is a tail call we can handle. */
- ret_var = gimple_return_retval (stmt);
+ ret_var = gimple_return_retval (as_a <gimple_return> (stmt));
/* We may proceed if there either is no return value, or the return value
is identical to the call's return. */
diff --git a/gcc/ubsan.c b/gcc/ubsan.c
index bc4f501..78320d5 100644
--- a/gcc/ubsan.c
+++ b/gcc/ubsan.c
@@ -1364,7 +1364,7 @@ instrument_nonnull_arg (gimple_stmt_iterator *gsi)
static void
instrument_nonnull_return (gimple_stmt_iterator *gsi)
{
- gimple stmt = gsi_stmt (*gsi);
+ gimple_return stmt = as_a <gimple_return> (gsi_stmt (*gsi));
location_t loc[2];
tree arg = gimple_return_retval (stmt);
/* infer_nonnull_range needs flag_delete_null_pointer_checks set,
--
1.8.5.3
^ permalink raw reply [flat|nested] 93+ messages in thread
* [gimple-classes, committed 83/92] Concretize gimple_assign_nontemporal_move_p
2014-10-27 20:35 [gimple-classes, committed 00/92] Initial slew of commits David Malcolm
` (26 preceding siblings ...)
2014-10-27 20:36 ` [gimple-classes, committed 25/92] Introduce gimple_eh_must_not_throw David Malcolm
@ 2014-10-27 20:37 ` David Malcolm
2014-10-27 20:38 ` [gimple-classes, committed 73/92] Concretize gimple_cond_set_{lhs|rhs} David Malcolm
` (63 subsequent siblings)
91 siblings, 0 replies; 93+ messages in thread
From: David Malcolm @ 2014-10-27 20:37 UTC (permalink / raw)
To: gcc-patches; +Cc: David Malcolm
This corresponds to:
[PATCH 85/89] Concretize gimple_assign_nontemporal_move_p
https://gcc.gnu.org/ml/gcc-patches/2014-04/msg01202.html
from the original 89-patch kit
That earlier patch was approved by Jeff:
> OK when prereqs have gone in.
in https://gcc.gnu.org/ml/gcc-patches/2014-05/msg00853.html
gcc/
* gimple.h (gimple_assign_nontemporal_move_p): Require a
const_gimple_assign rather than a const_gimple.
* cfgexpand.c (expand_gimple_stmt_1): Add local assign_stmt and
checked cast within "case GIMPLE_ASSIGN".
* gimple-streamer-out.c (output_gimple_stmt): Add checked cast to
gimple_assign.
---
gcc/ChangeLog.gimple-classes | 13 +++++++++++++
gcc/cfgexpand.c | 18 ++++++++++--------
gcc/gimple-streamer-out.c | 5 ++++-
gcc/gimple.h | 3 +--
4 files changed, 28 insertions(+), 11 deletions(-)
diff --git a/gcc/ChangeLog.gimple-classes b/gcc/ChangeLog.gimple-classes
index e064bcf..572fe5a 100644
--- a/gcc/ChangeLog.gimple-classes
+++ b/gcc/ChangeLog.gimple-classes
@@ -1,5 +1,18 @@
2014-10-24 David Malcolm <dmalcolm@redhat.com>
+ Concretize gimple_assign_nontemporal_move_p
+
+ * gimple.h (gimple_assign_nontemporal_move_p): Require a
+ const_gimple_assign rather than a const_gimple.
+
+ * cfgexpand.c (expand_gimple_stmt_1): Add local assign_stmt and
+ checked cast within "case GIMPLE_ASSIGN".
+
+ * gimple-streamer-out.c (output_gimple_stmt): Add checked cast to
+ gimple_assign.
+
+2014-10-24 David Malcolm <dmalcolm@redhat.com>
+
Concretize gimple_call_arg_flags
* gimple.h (gimple_call_arg_flags): Require a const_gimple_call
diff --git a/gcc/cfgexpand.c b/gcc/cfgexpand.c
index 65de5b2..88bcd72 100644
--- a/gcc/cfgexpand.c
+++ b/gcc/cfgexpand.c
@@ -3251,7 +3251,8 @@ expand_gimple_stmt_1 (gimple stmt)
case GIMPLE_ASSIGN:
{
- tree lhs = gimple_assign_lhs (stmt);
+ gimple_assign assign_stmt = as_a <gimple_assign> (stmt);
+ tree lhs = gimple_assign_lhs (assign_stmt);
/* Tree expand used to fiddle with |= and &= of two bitfield
COMPONENT_REFs here. This can't happen with gimple, the LHS
@@ -3261,7 +3262,7 @@ expand_gimple_stmt_1 (gimple stmt)
|| get_gimple_rhs_class (gimple_expr_code (stmt))
== GIMPLE_SINGLE_RHS)
{
- tree rhs = gimple_assign_rhs1 (stmt);
+ tree rhs = gimple_assign_rhs1 (assign_stmt);
gcc_assert (get_gimple_rhs_class (gimple_expr_code (stmt))
== GIMPLE_SINGLE_RHS);
if (gimple_has_location (stmt) && CAN_HAVE_LOCATION_P (rhs))
@@ -3272,12 +3273,13 @@ expand_gimple_stmt_1 (gimple stmt)
;
else
expand_assignment (lhs, rhs,
- gimple_assign_nontemporal_move_p (stmt));
+ gimple_assign_nontemporal_move_p (
+ assign_stmt));
}
else
{
rtx target, temp;
- bool nontemporal = gimple_assign_nontemporal_move_p (stmt);
+ bool nontemporal = gimple_assign_nontemporal_move_p (assign_stmt);
struct separate_ops ops;
bool promoted = false;
@@ -3285,18 +3287,18 @@ expand_gimple_stmt_1 (gimple stmt)
if (GET_CODE (target) == SUBREG && SUBREG_PROMOTED_VAR_P (target))
promoted = true;
- ops.code = gimple_assign_rhs_code (stmt);
+ ops.code = gimple_assign_rhs_code (assign_stmt);
ops.type = TREE_TYPE (lhs);
switch (get_gimple_rhs_class (gimple_expr_code (stmt)))
{
case GIMPLE_TERNARY_RHS:
- ops.op2 = gimple_assign_rhs3 (stmt);
+ ops.op2 = gimple_assign_rhs3 (assign_stmt);
/* Fallthru */
case GIMPLE_BINARY_RHS:
- ops.op1 = gimple_assign_rhs2 (stmt);
+ ops.op1 = gimple_assign_rhs2 (assign_stmt);
/* Fallthru */
case GIMPLE_UNARY_RHS:
- ops.op0 = gimple_assign_rhs1 (stmt);
+ ops.op0 = gimple_assign_rhs1 (assign_stmt);
break;
default:
gcc_unreachable ();
diff --git a/gcc/gimple-streamer-out.c b/gcc/gimple-streamer-out.c
index 71def75..e429b31 100644
--- a/gcc/gimple-streamer-out.c
+++ b/gcc/gimple-streamer-out.c
@@ -80,7 +80,10 @@ output_gimple_stmt (struct output_block *ob, gimple stmt)
bp_pack_var_len_unsigned (&bp, gimple_num_ops (stmt));
bp_pack_value (&bp, gimple_no_warning_p (stmt), 1);
if (is_gimple_assign (stmt))
- bp_pack_value (&bp, gimple_assign_nontemporal_move_p (stmt), 1);
+ bp_pack_value (&bp,
+ gimple_assign_nontemporal_move_p (
+ as_a <gimple_assign> (stmt)),
+ 1);
bp_pack_value (&bp, gimple_has_volatile_ops (stmt), 1);
hist = gimple_histogram_value (cfun, stmt);
bp_pack_value (&bp, hist != NULL, 1);
diff --git a/gcc/gimple.h b/gcc/gimple.h
index a396ec3..5570c54 100644
--- a/gcc/gimple.h
+++ b/gcc/gimple.h
@@ -2426,9 +2426,8 @@ gimple_assign_set_rhs_with_ops (gimple_stmt_iterator *gsi, enum tree_code code,
/* Returns true if GS is a nontemporal move. */
static inline bool
-gimple_assign_nontemporal_move_p (const_gimple gs)
+gimple_assign_nontemporal_move_p (const_gimple_assign gs)
{
- GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
return gs->nontemporal_move;
}
--
1.8.5.3
^ permalink raw reply [flat|nested] 93+ messages in thread
* [gimple-classes, committed 88/92] Preparatory work before subclass renaming
2014-10-27 20:35 [gimple-classes, committed 00/92] Initial slew of commits David Malcolm
` (40 preceding siblings ...)
2014-10-27 20:38 ` [gimple-classes, committed 86/92] Use gimple_phi in many more places David Malcolm
@ 2014-10-27 20:38 ` David Malcolm
2014-10-27 20:38 ` [gimple-classes, committed 77/92] Concretize gimple_call_nothrow_p David Malcolm
` (49 subsequent siblings)
91 siblings, 0 replies; 93+ messages in thread
From: David Malcolm @ 2014-10-27 20:38 UTC (permalink / raw)
To: gcc-patches; +Cc: David Malcolm
Various variables have names that confuse my subclass renaming
script. Rename them now to simplify the mass-renaming.
gcc/ChangeLog.gimple-classes:
* tree-inline.h (struct copy_body_data): Rename field
"gimple_call" to "call_stmt".
* gimplify.c (gimplify_bind_expr): Rename local "gimple_bind" to
"bind_stmt".
(gimplify_switch_expr): Rename local "gimple_switch" to
"switch_stmt".
(gimplify_cond_expr): Rename local "gimple_cond" to "cond_stmt".
* tree-eh.c (lower_catch): Rename local "gcatch" to "catch_stmt".
* tree-inline.c (copy_bb): Update for renaming of field within
struct copy_body_data from "gimple_call" to "call_stmt".
(copy_cfg_body): Likewise.
(copy_debug_stmt): Likewise.
(expand_call_inline): Likewise.
---
gcc/ChangeLog.gimple-classes | 17 +++++++++++++++++
gcc/gimplify.c | 26 +++++++++++++-------------
gcc/tree-eh.c | 8 ++++----
gcc/tree-inline.c | 24 ++++++++++++------------
gcc/tree-inline.h | 2 +-
5 files changed, 47 insertions(+), 30 deletions(-)
diff --git a/gcc/ChangeLog.gimple-classes b/gcc/ChangeLog.gimple-classes
index 04bb1a7..041342d 100644
--- a/gcc/ChangeLog.gimple-classes
+++ b/gcc/ChangeLog.gimple-classes
@@ -1,5 +1,22 @@
2014-10-24 David Malcolm <dmalcolm@redhat.com>
+ * tree-inline.h (struct copy_body_data): Rename field
+ "gimple_call" to "call_stmt".
+
+ * gimplify.c (gimplify_bind_expr): Rename local "gimple_bind" to
+ "bind_stmt".
+ (gimplify_switch_expr): Rename local "gimple_switch" to
+ "switch_stmt".
+ (gimplify_cond_expr): Rename local "gimple_cond" to "cond_stmt".
+ * tree-eh.c (lower_catch): Rename local "gcatch" to "catch_stmt".
+ * tree-inline.c (copy_bb): Update for renaming of field within
+ struct copy_body_data from "gimple_call" to "call_stmt".
+ (copy_cfg_body): Likewise.
+ (copy_debug_stmt): Likewise.
+ (expand_call_inline): Likewise.
+
+2014-10-24 David Malcolm <dmalcolm@redhat.com>
+
Convert various gimple to gimple_phi within ssa-iterators.h
* ssa-iterators.h (FOR_EACH_PHI_OR_STMT_USE): Add checked cast to
diff --git a/gcc/gimplify.c b/gcc/gimplify.c
index 037fb2b..bb87f26 100644
--- a/gcc/gimplify.c
+++ b/gcc/gimplify.c
@@ -1043,7 +1043,7 @@ gimplify_bind_expr (tree *expr_p, gimple_seq *pre_p)
tree bind_expr = *expr_p;
bool old_save_stack = gimplify_ctxp->save_stack;
tree t;
- gimple_bind gimple_bind;
+ gimple_bind bind_stmt;
gimple_seq body, cleanup;
gimple_call stack_save;
location_t start_locus = 0, end_locus = 0;
@@ -1088,16 +1088,16 @@ gimplify_bind_expr (tree *expr_p, gimple_seq *pre_p)
DECL_GIMPLE_REG_P (t) = 1;
}
- gimple_bind = gimple_build_bind (BIND_EXPR_VARS (bind_expr), NULL,
+ bind_stmt = gimple_build_bind (BIND_EXPR_VARS (bind_expr), NULL,
BIND_EXPR_BLOCK (bind_expr));
- gimple_push_bind_expr (gimple_bind);
+ gimple_push_bind_expr (bind_stmt);
gimplify_ctxp->save_stack = false;
/* Gimplify the body into the GIMPLE_BIND tuple's body. */
body = NULL;
gimplify_stmt (&BIND_EXPR_BODY (bind_expr), &body);
- gimple_bind_set_body (gimple_bind, body);
+ gimple_bind_set_body (bind_stmt, body);
/* Source location wise, the cleanup code (stack_restore and clobbers)
belongs to the end of the block, so propagate what we have. The
@@ -1157,19 +1157,19 @@ gimplify_bind_expr (tree *expr_p, gimple_seq *pre_p)
gimple_seq new_body;
new_body = NULL;
- gs = gimple_build_try (gimple_bind_body (gimple_bind), cleanup,
+ gs = gimple_build_try (gimple_bind_body (bind_stmt), cleanup,
GIMPLE_TRY_FINALLY);
if (stack_save)
gimplify_seq_add_stmt (&new_body, stack_save);
gimplify_seq_add_stmt (&new_body, gs);
- gimple_bind_set_body (gimple_bind, new_body);
+ gimple_bind_set_body (bind_stmt, new_body);
}
gimplify_ctxp->save_stack = old_save_stack;
gimple_pop_bind_expr ();
- gimplify_seq_add_stmt (pre_p, gimple_bind);
+ gimplify_seq_add_stmt (pre_p, bind_stmt);
if (temp)
{
@@ -1484,7 +1484,7 @@ gimplify_switch_expr (tree *expr_p, gimple_seq *pre_p)
vec<tree> labels;
vec<tree> saved_labels;
tree default_case = NULL_TREE;
- gimple_switch gimple_switch;
+ gimple_switch switch_stmt;
/* If someone can be bothered to fill in the labels, they can
be bothered to null out the body too. */
@@ -1513,9 +1513,9 @@ gimplify_switch_expr (tree *expr_p, gimple_seq *pre_p)
gimplify_seq_add_stmt (&switch_body_seq, new_default);
}
- gimple_switch = gimple_build_switch (SWITCH_COND (switch_expr),
+ switch_stmt = gimple_build_switch (SWITCH_COND (switch_expr),
default_case, labels);
- gimplify_seq_add_stmt (pre_p, gimple_switch);
+ gimplify_seq_add_stmt (pre_p, switch_stmt);
gimplify_seq_add_seq (pre_p, switch_body_seq);
labels.release ();
}
@@ -2957,7 +2957,7 @@ gimplify_cond_expr (tree *expr_p, gimple_seq *pre_p, fallback_t fallback)
enum gimplify_status ret;
tree label_true, label_false, label_cont;
bool have_then_clause_p, have_else_clause_p;
- gimple_cond gimple_cond;
+ gimple_cond cond_stmt;
enum tree_code pred_code;
gimple_seq seq = NULL;
@@ -3106,10 +3106,10 @@ gimplify_cond_expr (tree *expr_p, gimple_seq *pre_p, fallback_t fallback)
gimple_cond_get_ops_from_tree (COND_EXPR_COND (expr), &pred_code, &arm1,
&arm2);
- gimple_cond = gimple_build_cond (pred_code, arm1, arm2, label_true,
+ cond_stmt = gimple_build_cond (pred_code, arm1, arm2, label_true,
label_false);
- gimplify_seq_add_stmt (&seq, gimple_cond);
+ gimplify_seq_add_stmt (&seq, cond_stmt);
label_cont = NULL_TREE;
if (!have_then_clause_p)
{
diff --git a/gcc/tree-eh.c b/gcc/tree-eh.c
index ed087a1..13dad47 100644
--- a/gcc/tree-eh.c
+++ b/gcc/tree-eh.c
@@ -1790,13 +1790,13 @@ lower_catch (struct leh_state *state, gimple_try tp)
gsi_next (&gsi))
{
eh_catch c;
- gimple_catch gcatch;
+ gimple_catch catch_stmt;
gimple_seq handler;
- gcatch = as_a <gimple_catch> (gsi_stmt (gsi));
- c = gen_eh_region_catch (try_region, gimple_catch_types (gcatch));
+ catch_stmt = as_a <gimple_catch> (gsi_stmt (gsi));
+ c = gen_eh_region_catch (try_region, gimple_catch_types (catch_stmt));
- handler = gimple_catch_handler (gcatch);
+ handler = gimple_catch_handler (catch_stmt);
lower_eh_constructs_1 (&this_state, &handler);
c->label = create_artificial_label (UNKNOWN_LOCATION);
diff --git a/gcc/tree-inline.c b/gcc/tree-inline.c
index faa4656..fe1668c 100644
--- a/gcc/tree-inline.c
+++ b/gcc/tree-inline.c
@@ -1731,14 +1731,14 @@ copy_bb (copy_body_data *id, basic_block bb, int frequency_scale,
call_stmt = dyn_cast <gimple_call> (stmt);
if (call_stmt
&& gimple_call_va_arg_pack_p (call_stmt)
- && id->gimple_call)
+ && id->call_stmt)
{
/* __builtin_va_arg_pack () should be replaced by
all arguments corresponding to ... in the caller. */
tree p;
gimple_call new_call;
vec<tree> argarray;
- size_t nargs = gimple_call_num_args (id->gimple_call);
+ size_t nargs = gimple_call_num_args (id->call_stmt);
size_t n;
for (p = DECL_ARGUMENTS (id->src_fn); p; p = DECL_CHAIN (p))
@@ -1756,8 +1756,8 @@ copy_bb (copy_body_data *id, basic_block bb, int frequency_scale,
/* Append the arguments passed in '...' */
memcpy (argarray.address () + gimple_call_num_args (call_stmt),
- gimple_call_arg_ptr (id->gimple_call, 0)
- + (gimple_call_num_args (id->gimple_call) - nargs),
+ gimple_call_arg_ptr (id->call_stmt, 0)
+ + (gimple_call_num_args (id->call_stmt) - nargs),
nargs * sizeof (tree));
new_call = gimple_build_call_vec (gimple_call_fn (call_stmt),
@@ -1777,14 +1777,14 @@ copy_bb (copy_body_data *id, basic_block bb, int frequency_scale,
stmt = new_call;
}
else if (is_gimple_call (stmt)
- && id->gimple_call
+ && id->call_stmt
&& (decl = gimple_call_fndecl (stmt))
&& DECL_BUILT_IN_CLASS (decl) == BUILT_IN_NORMAL
&& DECL_FUNCTION_CODE (decl) == BUILT_IN_VA_ARG_PACK_LEN)
{
/* __builtin_va_arg_pack_len () should be replaced by
the number of anonymous arguments. */
- size_t nargs = gimple_call_num_args (id->gimple_call);
+ size_t nargs = gimple_call_num_args (id->call_stmt);
tree count, p;
gimple new_stmt;
@@ -2579,12 +2579,12 @@ copy_cfg_body (copy_body_data * id, gcov_type count, int frequency_scale,
/* Now that we've duplicated the blocks, duplicate their edges. */
basic_block abnormal_goto_dest = NULL;
- if (id->gimple_call
- && stmt_can_make_abnormal_goto (id->gimple_call))
+ if (id->call_stmt
+ && stmt_can_make_abnormal_goto (id->call_stmt))
{
- gimple_stmt_iterator gsi = gsi_for_stmt (id->gimple_call);
+ gimple_stmt_iterator gsi = gsi_for_stmt (id->call_stmt);
- bb = gimple_bb (id->gimple_call);
+ bb = gimple_bb (id->call_stmt);
gsi_next (&gsi);
if (gsi_end_p (gsi))
abnormal_goto_dest = get_abnormal_succ_dispatcher (bb);
@@ -2729,7 +2729,7 @@ copy_debug_stmt (gimple_debug stmt, copy_body_data *id)
t = gimple_debug_source_bind_get_value (stmt);
if (t != NULL_TREE
&& TREE_CODE (t) == PARM_DECL
- && id->gimple_call)
+ && id->call_stmt)
{
vec<tree, va_gc> **debug_args = decl_debug_args_lookup (id->src_fn);
unsigned int i;
@@ -4329,7 +4329,7 @@ expand_call_inline (basic_block bb, gimple stmt, copy_body_data *id)
id->src_fn = fn;
id->src_node = cg_edge->callee;
id->src_cfun = DECL_STRUCT_FUNCTION (fn);
- id->gimple_call = stmt;
+ id->call_stmt = stmt;
gcc_assert (!id->src_cfun->after_inlining);
diff --git a/gcc/tree-inline.h b/gcc/tree-inline.h
index 87351b1..364834f 100644
--- a/gcc/tree-inline.h
+++ b/gcc/tree-inline.h
@@ -75,7 +75,7 @@ struct copy_body_data
/* GIMPLE_CALL if va arg parameter packs should be expanded or NULL
is not. */
- gimple gimple_call;
+ gimple call_stmt;
/* Exception landing pad the inlined call lies in. */
int eh_lp_nr;
--
1.8.5.3
^ permalink raw reply [flat|nested] 93+ messages in thread
* [gimple-classes, committed 74/92] Concretize gimple_cond_{lhs|rhs}_ptr
2014-10-27 20:35 [gimple-classes, committed 00/92] Initial slew of commits David Malcolm
` (32 preceding siblings ...)
2014-10-27 20:38 ` [gimple-classes, committed 02/92] Introduce gimple_bind and use it for accessors David Malcolm
@ 2014-10-27 20:38 ` David Malcolm
2014-10-27 20:38 ` [gimple-classes, committed 72/92] Concretize gimple_cond_set_code David Malcolm
` (57 subsequent siblings)
91 siblings, 0 replies; 93+ messages in thread
From: David Malcolm @ 2014-10-27 20:38 UTC (permalink / raw)
To: gcc-patches; +Cc: David Malcolm
This corresponds to:
[PATCH 76/89] Concretize gimple_cond_{lhs|rhs}_ptr
https://gcc.gnu.org/ml/gcc-patches/2014-04/msg01170.html
from the original 89-patch kit
That earlier patch was approved by Jeff:
> OK when prereqs go in.
in https://gcc.gnu.org/ml/gcc-patches/2014-05/msg00851.html
gcc/
* gimple.h (gimple_cond_lhs_ptr): Require a const_gimple_cond
rather than just a const_gimple_cond.
(gimple_cond_rhs_ptr): Likewise.
* gimplify-me.c (gimple_regimplify_operands): Add a checked cast
to gimple_cond within "case GIMPLE_COND".
* omp-low.c (lower_omp_1): Likewise.
* omp-low.c (expand_omp_simd): Introduce a new local cond_stmt
to express that the conditional is indeed a gimple_cond.
* tree-ssa-loop-ivopts.c (extract_cond_operands): Add a checked
cast to gimple_cond within a region where the code is known to
be GIMPLE_COND.
---
gcc/ChangeLog.gimple-classes | 19 +++++++++++++++++++
gcc/gimple.h | 6 ++----
gcc/gimplify-me.c | 11 +++++++----
gcc/omp-low.c | 30 ++++++++++++++++++------------
gcc/tree-ssa-loop-ivopts.c | 5 +++--
5 files changed, 49 insertions(+), 22 deletions(-)
diff --git a/gcc/ChangeLog.gimple-classes b/gcc/ChangeLog.gimple-classes
index ece5b80..a5fd662 100644
--- a/gcc/ChangeLog.gimple-classes
+++ b/gcc/ChangeLog.gimple-classes
@@ -1,5 +1,24 @@
2014-10-24 David Malcolm <dmalcolm@redhat.com>
+ Concretize gimple_cond_{lhs|rhs}_ptr
+
+ * gimple.h (gimple_cond_lhs_ptr): Require a const_gimple_cond
+ rather than just a const_gimple_cond.
+ (gimple_cond_rhs_ptr): Likewise.
+
+ * gimplify-me.c (gimple_regimplify_operands): Add a checked cast
+ to gimple_cond within "case GIMPLE_COND".
+ * omp-low.c (lower_omp_1): Likewise.
+
+ * omp-low.c (expand_omp_simd): Introduce a new local cond_stmt
+ to express that the conditional is indeed a gimple_cond.
+
+ * tree-ssa-loop-ivopts.c (extract_cond_operands): Add a checked
+ cast to gimple_cond within a region where the code is known to
+ be GIMPLE_COND.
+
+2014-10-24 David Malcolm <dmalcolm@redhat.com>
+
Concretize gimple_cond_set_{lhs|rhs}
* gimple.h (gimple_cond_set_lhs): Require a gimple_cond.
diff --git a/gcc/gimple.h b/gcc/gimple.h
index eae7b60..4afb86f 100644
--- a/gcc/gimple.h
+++ b/gcc/gimple.h
@@ -3027,9 +3027,8 @@ gimple_cond_lhs (const_gimple gs)
statement GS. */
static inline tree *
-gimple_cond_lhs_ptr (const_gimple gs)
+gimple_cond_lhs_ptr (const_gimple_cond gs)
{
- GIMPLE_CHECK (gs, GIMPLE_COND);
return gimple_op_ptr (gs, 0);
}
@@ -3056,9 +3055,8 @@ gimple_cond_rhs (const_gimple gs)
conditional GS. */
static inline tree *
-gimple_cond_rhs_ptr (const_gimple gs)
+gimple_cond_rhs_ptr (const_gimple_cond gs)
{
- GIMPLE_CHECK (gs, GIMPLE_COND);
return gimple_op_ptr (gs, 1);
}
diff --git a/gcc/gimplify-me.c b/gcc/gimplify-me.c
index 5ecd169..7326f2e 100644
--- a/gcc/gimplify-me.c
+++ b/gcc/gimplify-me.c
@@ -168,10 +168,13 @@ gimple_regimplify_operands (gimple stmt, gimple_stmt_iterator *gsi_p)
switch (gimple_code (stmt))
{
case GIMPLE_COND:
- gimplify_expr (gimple_cond_lhs_ptr (stmt), &pre, NULL,
- is_gimple_val, fb_rvalue);
- gimplify_expr (gimple_cond_rhs_ptr (stmt), &pre, NULL,
- is_gimple_val, fb_rvalue);
+ {
+ gimple_cond cond_stmt = as_a <gimple_cond> (stmt);
+ gimplify_expr (gimple_cond_lhs_ptr (cond_stmt), &pre, NULL,
+ is_gimple_val, fb_rvalue);
+ gimplify_expr (gimple_cond_rhs_ptr (cond_stmt), &pre, NULL,
+ is_gimple_val, fb_rvalue);
+ }
break;
case GIMPLE_SWITCH:
gimplify_expr (gimple_switch_index_ptr (as_a <gimple_switch> (stmt)),
diff --git a/gcc/omp-low.c b/gcc/omp-low.c
index 2ab49c3..cd0869f 100644
--- a/gcc/omp-low.c
+++ b/gcc/omp-low.c
@@ -7073,6 +7073,7 @@ expand_omp_simd (struct omp_region *region, struct omp_for_data *fd)
basic_block entry_bb, cont_bb, exit_bb, l0_bb, l1_bb, l2_bb, l2_dom_bb;
gimple_stmt_iterator gsi;
gimple stmt;
+ gimple_cond cond_stmt;
bool broken_loop = region->cont == NULL;
edge e, ne;
tree *counts = NULL;
@@ -7232,15 +7233,15 @@ expand_omp_simd (struct omp_region *region, struct omp_for_data *fd)
t = force_gimple_operand_gsi (&gsi, t, true, NULL_TREE,
false, GSI_CONTINUE_LINKING);
t = build2 (fd->loop.cond_code, boolean_type_node, fd->loop.v, t);
- stmt = gimple_build_cond_empty (t);
- gsi_insert_after (&gsi, stmt, GSI_CONTINUE_LINKING);
- if (walk_tree (gimple_cond_lhs_ptr (stmt), expand_omp_regimplify_p,
+ cond_stmt = gimple_build_cond_empty (t);
+ gsi_insert_after (&gsi, cond_stmt, GSI_CONTINUE_LINKING);
+ if (walk_tree (gimple_cond_lhs_ptr (cond_stmt), expand_omp_regimplify_p,
NULL, NULL)
- || walk_tree (gimple_cond_rhs_ptr (stmt), expand_omp_regimplify_p,
+ || walk_tree (gimple_cond_rhs_ptr (cond_stmt), expand_omp_regimplify_p,
NULL, NULL))
{
- gsi = gsi_for_stmt (stmt);
- gimple_regimplify_operands (stmt, &gsi);
+ gsi = gsi_for_stmt (cond_stmt);
+ gimple_regimplify_operands (cond_stmt, &gsi);
}
/* Remove GIMPLE_OMP_RETURN. */
@@ -10473,12 +10474,17 @@ lower_omp_1 (gimple_stmt_iterator *gsi_p, omp_context *ctx)
switch (gimple_code (stmt))
{
case GIMPLE_COND:
- if ((ctx || task_shared_vars)
- && (walk_tree (gimple_cond_lhs_ptr (stmt), lower_omp_regimplify_p,
- ctx ? NULL : &wi, NULL)
- || walk_tree (gimple_cond_rhs_ptr (stmt), lower_omp_regimplify_p,
- ctx ? NULL : &wi, NULL)))
- gimple_regimplify_operands (stmt, gsi_p);
+ {
+ gimple_cond cond_stmt = as_a <gimple_cond> (stmt);
+ if ((ctx || task_shared_vars)
+ && (walk_tree (gimple_cond_lhs_ptr (cond_stmt),
+ lower_omp_regimplify_p,
+ ctx ? NULL : &wi, NULL)
+ || walk_tree (gimple_cond_rhs_ptr (cond_stmt),
+ lower_omp_regimplify_p,
+ ctx ? NULL : &wi, NULL)))
+ gimple_regimplify_operands (cond_stmt, gsi_p);
+ }
break;
case GIMPLE_CATCH:
lower_omp (gimple_catch_handler_ptr (as_a <gimple_catch> (stmt)), ctx);
diff --git a/gcc/tree-ssa-loop-ivopts.c b/gcc/tree-ssa-loop-ivopts.c
index 76dc7d8..0b47a21 100644
--- a/gcc/tree-ssa-loop-ivopts.c
+++ b/gcc/tree-ssa-loop-ivopts.c
@@ -1379,8 +1379,9 @@ extract_cond_operands (struct ivopts_data *data, gimple stmt,
if (gimple_code (stmt) == GIMPLE_COND)
{
- op0 = gimple_cond_lhs_ptr (stmt);
- op1 = gimple_cond_rhs_ptr (stmt);
+ gimple_cond cond_stmt = as_a <gimple_cond> (stmt);
+ op0 = gimple_cond_lhs_ptr (cond_stmt);
+ op1 = gimple_cond_rhs_ptr (cond_stmt);
}
else
{
--
1.8.5.3
^ permalink raw reply [flat|nested] 93+ messages in thread
* [gimple-classes, committed 75/92] Concretize various expressions from gimple to gimple_cond
2014-10-27 20:35 [gimple-classes, committed 00/92] Initial slew of commits David Malcolm
` (35 preceding siblings ...)
2014-10-27 20:38 ` [gimple-classes, committed 31/92] Use more concrete types for various gimple statements David Malcolm
@ 2014-10-27 20:38 ` David Malcolm
2014-10-27 20:38 ` [gimple-classes, committed 49/92] Update GRAPHITE to use more concrete gimple statement classes David Malcolm
` (54 subsequent siblings)
91 siblings, 0 replies; 93+ messages in thread
From: David Malcolm @ 2014-10-27 20:38 UTC (permalink / raw)
To: gcc-patches; +Cc: David Malcolm
This corresponds to:
[PATCH 77/89] Concretize various expressions from gimple to gimple_cond
https://gcc.gnu.org/ml/gcc-patches/2014-04/msg01196.html
from the original 89-patch kit
That earlier patch was approved by Jeff:
> OK once prereqs go in.
in https://gcc.gnu.org/ml/gcc-patches/2014-05/msg00858.html
gcc/
* ipa-split.c (check_forbidden_calls): Replace check against
GIMPLE_COND with a dyn_cast<gimple_cond>, introducing a
gimple_cond local.
* predict.c (predict_extra_loop_exits): Likewise.
* tree-vrp.c (fold_predicate_in): Likewise.
(simplify_stmt_for_jump_threading): Likewise.
* predict.c (is_comparison_with_loop_invariant_p): Require a
gimple_cond.
(predict_iv_comparison): Add checked cast to gimple_cond once we
know the code is GIMPLE_COND.
(predict_loops): Change type of "stmt" to gimple_cond,
adding checked casts to its assignments (which are both guarded by
checks against GIMPLE_COND).
* tree-vrp.c (find_conditional_asserts): Require a gimple_cond.
(vrp_evaluate_conditional): Likewise.
(find_assert_locations_1): Add checked cast to gimple_cond.
(vrp_visit_stmt): Likewise.
---
gcc/ChangeLog.gimple-classes | 24 ++++++++++++++++++++++++
gcc/ipa-split.c | 5 +++--
gcc/predict.c | 21 ++++++++++++++-------
gcc/tree-vrp.c | 25 +++++++++++++------------
4 files changed, 54 insertions(+), 21 deletions(-)
diff --git a/gcc/ChangeLog.gimple-classes b/gcc/ChangeLog.gimple-classes
index a5fd662..86e1718 100644
--- a/gcc/ChangeLog.gimple-classes
+++ b/gcc/ChangeLog.gimple-classes
@@ -1,5 +1,29 @@
2014-10-24 David Malcolm <dmalcolm@redhat.com>
+ Concretize various expressions from gimple to gimple_cond
+
+ * ipa-split.c (check_forbidden_calls): Replace check against
+ GIMPLE_COND with a dyn_cast<gimple_cond>, introducing a
+ gimple_cond local.
+ * predict.c (predict_extra_loop_exits): Likewise.
+ * tree-vrp.c (fold_predicate_in): Likewise.
+ (simplify_stmt_for_jump_threading): Likewise.
+
+ * predict.c (is_comparison_with_loop_invariant_p): Require a
+ gimple_cond.
+ (predict_iv_comparison): Add checked cast to gimple_cond once we
+ know the code is GIMPLE_COND.
+ (predict_loops): Change type of "stmt" to gimple_cond,
+ adding checked casts to its assignments (which are both guarded by
+ checks against GIMPLE_COND).
+
+ * tree-vrp.c (find_conditional_asserts): Require a gimple_cond.
+ (vrp_evaluate_conditional): Likewise.
+ (find_assert_locations_1): Add checked cast to gimple_cond.
+ (vrp_visit_stmt): Likewise.
+
+2014-10-24 David Malcolm <dmalcolm@redhat.com>
+
Concretize gimple_cond_{lhs|rhs}_ptr
* gimple.h (gimple_cond_lhs_ptr): Require a const_gimple_cond
diff --git a/gcc/ipa-split.c b/gcc/ipa-split.c
index e5df578..08dbf7d 100644
--- a/gcc/ipa-split.c
+++ b/gcc/ipa-split.c
@@ -353,9 +353,10 @@ check_forbidden_calls (gimple stmt)
basic_block use_bb, forbidden_bb;
enum tree_code code;
edge true_edge, false_edge;
- gimple use_stmt = USE_STMT (use_p);
+ gimple_cond use_stmt;
- if (gimple_code (use_stmt) != GIMPLE_COND)
+ use_stmt = dyn_cast <gimple_cond> (USE_STMT (use_p));
+ if (!use_stmt)
continue;
/* Assuming canonical form for GIMPLE_COND here, with constant
diff --git a/gcc/predict.c b/gcc/predict.c
index c21cc29..38d4a1d 100644
--- a/gcc/predict.c
+++ b/gcc/predict.c
@@ -1104,7 +1104,7 @@ get_base_value (tree t)
Otherwise return false and set LOOP_INVAIANT to NULL. */
static bool
-is_comparison_with_loop_invariant_p (gimple stmt, struct loop *loop,
+is_comparison_with_loop_invariant_p (gimple_cond stmt, struct loop *loop,
tree *loop_invariant,
enum tree_code *compare_code,
tree *loop_step,
@@ -1269,7 +1269,8 @@ predict_iv_comparison (struct loop *loop, basic_block bb,
stmt = last_stmt (bb);
if (!stmt || gimple_code (stmt) != GIMPLE_COND)
return;
- if (!is_comparison_with_loop_invariant_p (stmt, loop, &compare_var,
+ if (!is_comparison_with_loop_invariant_p (as_a <gimple_cond> (stmt),
+ loop, &compare_var,
&compare_code,
&compare_step_var,
&compare_base))
@@ -1445,10 +1446,16 @@ predict_extra_loop_exits (edge exit_edge)
gimple lhs_def_stmt;
gimple_phi phi_stmt;
tree cmp_rhs, cmp_lhs;
- gimple cmp_stmt = last_stmt (exit_edge->src);
+ gimple last;
+ gimple_cond cmp_stmt;
- if (!cmp_stmt || gimple_code (cmp_stmt) != GIMPLE_COND)
+ last = last_stmt (exit_edge->src);
+ if (!last)
+ return;
+ cmp_stmt = dyn_cast <gimple_cond> (last);
+ if (!cmp_stmt)
return;
+
cmp_rhs = gimple_cond_rhs (cmp_stmt);
cmp_lhs = gimple_cond_lhs (cmp_stmt);
if (!TREE_CONSTANT (cmp_rhs)
@@ -1515,7 +1522,7 @@ predict_loops (void)
tree loop_bound_step = NULL;
tree loop_bound_var = NULL;
tree loop_iv_base = NULL;
- gimple stmt = NULL;
+ gimple_cond stmt = NULL;
exits = get_loop_exit_edges (loop);
n_exits = exits.length ();
@@ -1582,12 +1589,12 @@ predict_loops (void)
if (nb_iter->stmt
&& gimple_code (nb_iter->stmt) == GIMPLE_COND)
{
- stmt = nb_iter->stmt;
+ stmt = as_a <gimple_cond> (nb_iter->stmt);
break;
}
if (!stmt && last_stmt (loop->header)
&& gimple_code (last_stmt (loop->header)) == GIMPLE_COND)
- stmt = last_stmt (loop->header);
+ stmt = as_a <gimple_cond> (last_stmt (loop->header));
if (stmt)
is_comparison_with_loop_invariant_p (stmt, loop,
&loop_bound_var,
diff --git a/gcc/tree-vrp.c b/gcc/tree-vrp.c
index afd54bf..303af8d 100644
--- a/gcc/tree-vrp.c
+++ b/gcc/tree-vrp.c
@@ -5701,7 +5701,7 @@ register_edge_assert_for (tree name, edge e, gimple_stmt_iterator si,
list of assertions for the corresponding operands. */
static bool
-find_conditional_asserts (basic_block bb, gimple last)
+find_conditional_asserts (basic_block bb, gimple_cond last)
{
bool need_assert;
gimple_stmt_iterator bsi;
@@ -5943,7 +5943,7 @@ find_assert_locations_1 (basic_block bb, sbitmap live)
&& gimple_code (last) == GIMPLE_COND
&& !fp_predicate (last)
&& !ZERO_SSA_OPERANDS (last, SSA_OP_USE))
- need_assert |= find_conditional_asserts (bb, last);
+ need_assert |= find_conditional_asserts (bb, as_a <gimple_cond> (last));
/* If BB's last statement is a switch statement involving integer
operands, determine if we need to add ASSERT_EXPRs. */
@@ -7318,7 +7318,7 @@ vrp_evaluate_conditional (enum tree_code code, tree op0, tree op1, gimple stmt)
SSA_PROP_VARYING. */
static enum ssa_prop_result
-vrp_visit_cond_stmt (gimple stmt, edge *taken_edge_p)
+vrp_visit_cond_stmt (gimple_cond stmt, edge *taken_edge_p)
{
tree val;
bool sop;
@@ -7730,7 +7730,7 @@ vrp_visit_stmt (gimple stmt, edge *taken_edge_p, tree *output_p)
else if (is_gimple_assign (stmt) || is_gimple_call (stmt))
return vrp_visit_assignment_or_call (stmt, output_p);
else if (gimple_code (stmt) == GIMPLE_COND)
- return vrp_visit_cond_stmt (stmt, taken_edge_p);
+ return vrp_visit_cond_stmt (as_a <gimple_cond> (stmt), taken_edge_p);
else if (gimple_code (stmt) == GIMPLE_SWITCH)
return vrp_visit_switch_stmt (as_a <gimple_switch> (stmt), taken_edge_p);
@@ -9644,10 +9644,10 @@ fold_predicate_in (gimple_stmt_iterator *si)
gimple_assign_rhs2 (stmt),
stmt);
}
- else if (gimple_code (stmt) == GIMPLE_COND)
- val = vrp_evaluate_conditional (gimple_cond_code (stmt),
- gimple_cond_lhs (stmt),
- gimple_cond_rhs (stmt),
+ else if (gimple_cond cond_stmt = dyn_cast <gimple_cond> (stmt))
+ val = vrp_evaluate_conditional (gimple_cond_code (cond_stmt),
+ gimple_cond_lhs (cond_stmt),
+ gimple_cond_rhs (cond_stmt),
stmt);
else
return false;
@@ -9712,10 +9712,11 @@ static vec<tree> equiv_stack;
static tree
simplify_stmt_for_jump_threading (gimple stmt, gimple within_stmt)
{
- if (gimple_code (stmt) == GIMPLE_COND)
- return vrp_evaluate_conditional (gimple_cond_code (stmt),
- gimple_cond_lhs (stmt),
- gimple_cond_rhs (stmt), within_stmt);
+ if (gimple_cond cond_stmt = dyn_cast <gimple_cond> (stmt))
+ return vrp_evaluate_conditional (gimple_cond_code (cond_stmt),
+ gimple_cond_lhs (cond_stmt),
+ gimple_cond_rhs (cond_stmt),
+ within_stmt);
if (gimple_assign assign_stmt = dyn_cast <gimple_assign> (stmt))
{
--
1.8.5.3
^ permalink raw reply [flat|nested] 93+ messages in thread
* [gimple-classes, committed 86/92] Use gimple_phi in many more places.
2014-10-27 20:35 [gimple-classes, committed 00/92] Initial slew of commits David Malcolm
` (39 preceding siblings ...)
2014-10-27 20:38 ` [gimple-classes, committed 68/92] Concretize locals within expand_omp_for_init_counts David Malcolm
@ 2014-10-27 20:38 ` David Malcolm
2014-10-27 20:38 ` [gimple-classes, committed 88/92] Preparatory work before subclass renaming David Malcolm
` (50 subsequent siblings)
91 siblings, 0 replies; 93+ messages in thread
From: David Malcolm @ 2014-10-27 20:38 UTC (permalink / raw)
To: gcc-patches; +Cc: David Malcolm
This corresponds to:
[PATCH 88/89] Use gimple_phi in many more places.
https://gcc.gnu.org/ml/gcc-patches/2014-04/msg01176.html
from the original 89-patch kit
That earlier patch was approved by Jeff:
> Fine once prereqs go in.
in https://gcc.gnu.org/ml/gcc-patches/2014-05/msg00879.html
This patch converts almost every usage of gsi_start_phis to act on a
gimple_phi_iterator: everywhere (I believe) where the underlying
statements are then accessed via a gimple_phi_ accessor.
There are some places where the phi nodes then just go through
generic gimple APIs; in these cases I didn't bother converting
the iterators.
gcc/
* gimple-ssa-strength-reduction.c (slsr_process_phi): Require a
gimple_phi.
* ipa-inline-analysis.c (predicate_for_phi_result): Likewise.
* tree-emutls.c (lower_emutls_phi_arg): Likewise.
* tree-if-conv.c (predicate_scalar_phi): Likewise.
* tree-into-ssa.c (mark_virtual_phi_result_for_renaming): Likewise.
* tree-into-ssa.h (mark_virtual_phi_result_for_renaming): Likewise.
* tree-phinodes.c (degenerate_phi_result): Likewise.
* tree-phinodes.h (degenerate_phi_result): Likewise.
* tree-ssa.c (verify_use): Likewise.
* tree-switch-conversion.c (array_value_type): Likewise.
* graphite-scop-detection.c (same_close_phi_node): Require a pair
of gimple_phi.
(remove_duplicate_close_phi): Require a gimple_phi and a
gimple_phi_iterator.
(make_close_phi_nodes_unique): Convert a local into a
gimple_phi_iterator.
* gimple-pretty-print.c (gimple_dump_bb_for_graph): Split iterator
into gimple_stmt_iterator and gimple_phi_iterator, converting local
from gimple to gimple_phi.
* gimple-ssa-strength-reduction.c
(find_candidates_dom_walker::before_dom_children): Likewise.
* ipa-inline-analysis.c (estimate_function_body_sizes): Likewise.
* ipa-split.c (verify_non_ssa_vars): Likewise.
(visit_bb): Likewise.
(split_function): Likewise.
* lto-streamer-out.c (output_function): Likewise.
* sese.c (sese_build_liveouts_bb): Likewise.
* tree-cfg.c (gimple_can_merge_blocks_p): Likewise.
* tree-complex.c (init_dont_simulate_again): Likewise.
* tree-dfa.c (collect_dfa_stats): Likewise.
* tree-eh.c (sink_clobbers): Likewise.
* tree-emutls.c (lower_emutls_function_body): Likewise.
* tree-into-ssa.c (rewrite_dom_walker::before_dom_children):
Likewise.
(rewrite_update_dom_walker::before_dom_children): Likewise.
(prepare_block_for_update): Likewise.
* tree-loop-distribution.c (stmts_from_loop): Likewise.
(generate_loops_for_partition): Likewise.
(destroy_loop): Likewise.
(tree_loop_distribution): Likewise.
* tree-ssa-coalesce.c (build_ssa_conflict_graph): Likewise.
* tree-ssa-copy.c (init_copy_prop): Likewise.
* tree-ssa-copyrename.c (rename_ssa_copies): Likewise.
* tree-ssa-loop-ivcanon.c (propagate_constants_for_unrolling): Likewise.
* tree-ssa-loop-manip.c (find_uses_to_rename_bb): Likewise.
(verify_loop_closed_ssa): Likewise.
* tree-ssa-math-opts.c (execute_cse_reciprocals): Likewise.
* tree-ssa-pre.c (compute_avail): Likewise.
(eliminate_dom_walker::before_dom_children): Likewise.
* tree-ssa-strlen.c (strlen_dom_walker::before_dom_children): Likewise.
* tree-ssa-structalias.c (compute_points_to_sets): Likewise.
(ipa_pta_execute): Likewise.
* tree-ssa-tail-merge.c (same_succ_hash): Likewise.
(release_last_vdef): Likewise.
* tree-ssa.c (verify_ssa): Likewise.
(execute_update_addresses_taken): Likewise.
* tree-stdarg.c (check_all_va_list_escapes): Likewise.
(execute_optimize_stdarg): Likewise.
* tree-switch-conversion.c (build_arrays): Likewise.
* tree-vect-loop-manip.c (rename_variables_in_bb): Likewise.
* tree-vect-loop.c (vect_determine_vectorization_factor): Likewise.
(vect_analyze_loop_operations): Likewise.
(vect_transform_loop): Likewise.
* tree-vrp.c (find_assert_locations_1): Likewise.
(vrp_initialize): Likewise.
* graphite-sese-to-poly.c (gsi_for_phi_node): Convert psi to a
gimple_phi_iterator.
(rewrite_degenerate_phi): Require a gimple_phi_iterator; strengthen
local "phi" from gimple to gimple-phi.
* ipa-split.c (consider_split): Convert local psi to a
gimple_phi_iterator.
* tree-cfg.c (gimple_merge_blocks): Likewise.
* tree-eh.c (unsplit_eh): Replace reuse of gsi with a new
gimple_phi_iterator gpi, using it to convert statement from gimple
to a gimple_phi.
(cleanup_empty_eh_merge_phis): Strengthen ophi from gimple to
gimple_phi.
* tree-ssa-dce.c (eliminate_unnecessary_stmts): Replace reuse of
gsi with a new gimple_phi_iterator gpi, using it to convert
expressions from gimple to gimple_phi; add a checked cast to
gimple_phi.
* tree-if-conv.c (predicate_all_scalar_phis): Convert local phi_gsi
to be a gimple_phi_iterator; convert "phi" to be a gimple_phi.
* tree-parloops.c (loop_has_vector_phi_nodes): Convert local to be a
gimple_phi_iterator.
* tree-ssa-ccp.c (ccp_initialize): Likewise.
* tree-scalar-evolution.c (analyze_initial_condition): Add checked cast
to a gimple_phi.
* tree-ssa.c (insert_debug_temp_for_var_def): Likewise.
* tree-ssa-dom.c (get_rhs_or_phi_arg): Likewise.
---
gcc/ChangeLog.gimple-classes | 103 ++++++++++++++++++++++++++++++++++++
gcc/gimple-pretty-print.c | 10 ++--
gcc/gimple-ssa-strength-reduction.c | 11 ++--
gcc/graphite-scop-detection.c | 16 +++---
gcc/graphite-sese-to-poly.c | 6 +--
gcc/ipa-inline-analysis.c | 11 ++--
gcc/ipa-split.c | 48 +++++++++--------
gcc/lto-streamer-out.c | 15 +++---
gcc/sese.c | 9 ++--
gcc/tree-cfg.c | 12 +++--
gcc/tree-complex.c | 10 ++--
gcc/tree-dfa.c | 10 ++--
gcc/tree-eh.c | 18 ++++---
gcc/tree-emutls.c | 11 ++--
gcc/tree-if-conv.c | 9 ++--
gcc/tree-into-ssa.c | 28 +++++-----
gcc/tree-into-ssa.h | 2 +-
gcc/tree-loop-distribution.c | 48 +++++++++--------
gcc/tree-parloops.c | 4 +-
gcc/tree-phinodes.c | 2 +-
gcc/tree-phinodes.h | 2 +-
gcc/tree-scalar-evolution.c | 16 +++---
gcc/tree-ssa-ccp.c | 4 +-
gcc/tree-ssa-coalesce.c | 10 ++--
gcc/tree-ssa-copy.c | 10 ++--
gcc/tree-ssa-copyrename.c | 12 ++---
gcc/tree-ssa-dce.c | 10 ++--
gcc/tree-ssa-dom.c | 2 +-
gcc/tree-ssa-loop-ivcanon.c | 8 ++-
gcc/tree-ssa-loop-manip.c | 19 +++----
gcc/tree-ssa-math-opts.c | 13 ++---
gcc/tree-ssa-pre.c | 28 +++++-----
gcc/tree-ssa-strlen.c | 13 ++---
gcc/tree-ssa-structalias.c | 19 ++++---
gcc/tree-ssa-tail-merge.c | 19 +++----
gcc/tree-ssa.c | 24 ++++-----
gcc/tree-stdarg.c | 19 ++++---
gcc/tree-switch-conversion.c | 9 ++--
gcc/tree-vect-loop-manip.c | 9 ++--
gcc/tree-vect-loop.c | 34 ++++++------
gcc/tree-vrp.c | 19 +++----
41 files changed, 409 insertions(+), 273 deletions(-)
diff --git a/gcc/ChangeLog.gimple-classes b/gcc/ChangeLog.gimple-classes
index 030df86..015940e 100644
--- a/gcc/ChangeLog.gimple-classes
+++ b/gcc/ChangeLog.gimple-classes
@@ -1,5 +1,108 @@
2014-10-24 David Malcolm <dmalcolm@redhat.com>
+ Use gimple_phi in many more places.
+
+ * gimple-ssa-strength-reduction.c (slsr_process_phi): Require a
+ gimple_phi.
+ * ipa-inline-analysis.c (predicate_for_phi_result): Likewise.
+ * tree-emutls.c (lower_emutls_phi_arg): Likewise.
+ * tree-if-conv.c (predicate_scalar_phi): Likewise.
+ * tree-into-ssa.c (mark_virtual_phi_result_for_renaming): Likewise.
+ * tree-into-ssa.h (mark_virtual_phi_result_for_renaming): Likewise.
+ * tree-phinodes.c (degenerate_phi_result): Likewise.
+ * tree-phinodes.h (degenerate_phi_result): Likewise.
+ * tree-ssa.c (verify_use): Likewise.
+ * tree-switch-conversion.c (array_value_type): Likewise.
+
+ * graphite-scop-detection.c (same_close_phi_node): Require a pair
+ of gimple_phi.
+ (remove_duplicate_close_phi): Require a gimple_phi and a
+ gimple_phi_iterator.
+ (make_close_phi_nodes_unique): Convert a local into a
+ gimple_phi_iterator.
+
+ * gimple-pretty-print.c (gimple_dump_bb_for_graph): Split iterator
+ into gimple_stmt_iterator and gimple_phi_iterator, converting local
+ from gimple to gimple_phi.
+ * gimple-ssa-strength-reduction.c
+ (find_candidates_dom_walker::before_dom_children): Likewise.
+ * ipa-inline-analysis.c (estimate_function_body_sizes): Likewise.
+ * ipa-split.c (verify_non_ssa_vars): Likewise.
+ (visit_bb): Likewise.
+ (split_function): Likewise.
+ * lto-streamer-out.c (output_function): Likewise.
+ * sese.c (sese_build_liveouts_bb): Likewise.
+ * tree-cfg.c (gimple_can_merge_blocks_p): Likewise.
+ * tree-complex.c (init_dont_simulate_again): Likewise.
+ * tree-dfa.c (collect_dfa_stats): Likewise.
+ * tree-eh.c (sink_clobbers): Likewise.
+ * tree-emutls.c (lower_emutls_function_body): Likewise.
+ * tree-into-ssa.c (rewrite_dom_walker::before_dom_children):
+ Likewise.
+ (rewrite_update_dom_walker::before_dom_children): Likewise.
+ (prepare_block_for_update): Likewise.
+ * tree-loop-distribution.c (stmts_from_loop): Likewise.
+ (generate_loops_for_partition): Likewise.
+ (destroy_loop): Likewise.
+ (tree_loop_distribution): Likewise.
+ * tree-ssa-coalesce.c (build_ssa_conflict_graph): Likewise.
+ * tree-ssa-copy.c (init_copy_prop): Likewise.
+ * tree-ssa-copyrename.c (rename_ssa_copies): Likewise.
+ * tree-ssa-loop-ivcanon.c (propagate_constants_for_unrolling): Likewise.
+ * tree-ssa-loop-manip.c (find_uses_to_rename_bb): Likewise.
+ (verify_loop_closed_ssa): Likewise.
+ * tree-ssa-math-opts.c (execute_cse_reciprocals): Likewise.
+ * tree-ssa-pre.c (compute_avail): Likewise.
+ (eliminate_dom_walker::before_dom_children): Likewise.
+ * tree-ssa-strlen.c (strlen_dom_walker::before_dom_children): Likewise.
+ * tree-ssa-structalias.c (compute_points_to_sets): Likewise.
+ (ipa_pta_execute): Likewise.
+ * tree-ssa-tail-merge.c (same_succ_hash): Likewise.
+ (release_last_vdef): Likewise.
+ * tree-ssa.c (verify_ssa): Likewise.
+ (execute_update_addresses_taken): Likewise.
+ * tree-stdarg.c (check_all_va_list_escapes): Likewise.
+ (execute_optimize_stdarg): Likewise.
+ * tree-switch-conversion.c (build_arrays): Likewise.
+ * tree-vect-loop-manip.c (rename_variables_in_bb): Likewise.
+ * tree-vect-loop.c (vect_determine_vectorization_factor): Likewise.
+ (vect_analyze_loop_operations): Likewise.
+ (vect_transform_loop): Likewise.
+ * tree-vrp.c (find_assert_locations_1): Likewise.
+ (vrp_initialize): Likewise.
+
+ * graphite-sese-to-poly.c (gsi_for_phi_node): Convert psi to a
+ gimple_phi_iterator.
+ (rewrite_degenerate_phi): Require a gimple_phi_iterator; strengthen
+ local "phi" from gimple to gimple-phi.
+
+ * ipa-split.c (consider_split): Convert local psi to a
+ gimple_phi_iterator.
+ * tree-cfg.c (gimple_merge_blocks): Likewise.
+
+ * tree-eh.c (unsplit_eh): Replace reuse of gsi with a new
+ gimple_phi_iterator gpi, using it to convert statement from gimple
+ to a gimple_phi.
+ (cleanup_empty_eh_merge_phis): Strengthen ophi from gimple to
+ gimple_phi.
+ * tree-ssa-dce.c (eliminate_unnecessary_stmts): Replace reuse of
+ gsi with a new gimple_phi_iterator gpi, using it to convert
+ expressions from gimple to gimple_phi; add a checked cast to
+ gimple_phi.
+
+ * tree-if-conv.c (predicate_all_scalar_phis): Convert local phi_gsi
+ to be a gimple_phi_iterator; convert "phi" to be a gimple_phi.
+ * tree-parloops.c (loop_has_vector_phi_nodes): Convert local to be a
+ gimple_phi_iterator.
+ * tree-ssa-ccp.c (ccp_initialize): Likewise.
+
+ * tree-scalar-evolution.c (analyze_initial_condition): Add checked cast
+ to a gimple_phi.
+ * tree-ssa.c (insert_debug_temp_for_var_def): Likewise.
+ * tree-ssa-dom.c (get_rhs_or_phi_arg): Likewise.
+
+2014-10-24 David Malcolm <dmalcolm@redhat.com>
+
Use gimple_call in some places within tree-ssa-dom.c
* tree-ssa-dom.c (struct hashable_expr): Strengthen field
diff --git a/gcc/gimple-pretty-print.c b/gcc/gimple-pretty-print.c
index 40e79b1..8246052 100644
--- a/gcc/gimple-pretty-print.c
+++ b/gcc/gimple-pretty-print.c
@@ -2472,14 +2472,13 @@ gimple_dump_bb (FILE *file, basic_block bb, int indent, int flags)
void
gimple_dump_bb_for_graph (pretty_printer *pp, basic_block bb)
{
- gimple_stmt_iterator gsi;
-
pp_printf (pp, "<bb %d>:\n", bb->index);
pp_write_text_as_dot_label_to_stream (pp, /*for_record=*/true);
- for (gsi = gsi_start_phis (bb); !gsi_end_p (gsi); gsi_next (&gsi))
+ for (gimple_phi_iterator gsi = gsi_start_phis (bb); !gsi_end_p (gsi);
+ gsi_next (&gsi))
{
- gimple phi = gsi_stmt (gsi);
+ gimple_phi phi = gsi.phi ();
if (!virtual_operand_p (gimple_phi_result (phi))
|| (dump_flags & TDF_VOPS))
{
@@ -2492,7 +2491,8 @@ gimple_dump_bb_for_graph (pretty_printer *pp, basic_block bb)
}
}
- for (gsi = gsi_start_bb (bb); !gsi_end_p (gsi); gsi_next (&gsi))
+ for (gimple_stmt_iterator gsi = gsi_start_bb (bb); !gsi_end_p (gsi);
+ gsi_next (&gsi))
{
gimple stmt = gsi_stmt (gsi);
pp_bar (pp);
diff --git a/gcc/gimple-ssa-strength-reduction.c b/gcc/gimple-ssa-strength-reduction.c
index 1b6138f..ea1f99a 100644
--- a/gcc/gimple-ssa-strength-reduction.c
+++ b/gcc/gimple-ssa-strength-reduction.c
@@ -742,7 +742,7 @@ add_cand_for_stmt (gimple gs, slsr_cand_t c)
is used to help find a basis for subsequent candidates. */
static void
-slsr_process_phi (gimple phi, bool speed)
+slsr_process_phi (gimple_phi phi, bool speed)
{
unsigned i;
tree arg0_base = NULL_TREE, base_type;
@@ -1667,12 +1667,13 @@ void
find_candidates_dom_walker::before_dom_children (basic_block bb)
{
bool speed = optimize_bb_for_speed_p (bb);
- gimple_stmt_iterator gsi;
- for (gsi = gsi_start_phis (bb); !gsi_end_p (gsi); gsi_next (&gsi))
- slsr_process_phi (gsi_stmt (gsi), speed);
+ for (gimple_phi_iterator gsi = gsi_start_phis (bb); !gsi_end_p (gsi);
+ gsi_next (&gsi))
+ slsr_process_phi (gsi.phi (), speed);
- for (gsi = gsi_start_bb (bb); !gsi_end_p (gsi); gsi_next (&gsi))
+ for (gimple_stmt_iterator gsi = gsi_start_bb (bb); !gsi_end_p (gsi);
+ gsi_next (&gsi))
{
gimple gs = gsi_stmt (gsi);
diff --git a/gcc/graphite-scop-detection.c b/gcc/graphite-scop-detection.c
index 5e0c507..c81e85f 100644
--- a/gcc/graphite-scop-detection.c
+++ b/gcc/graphite-scop-detection.c
@@ -1255,7 +1255,7 @@ limit_scops (vec<scop_p> *scops)
argument. */
static inline bool
-same_close_phi_node (gimple p1, gimple p2)
+same_close_phi_node (gimple_phi p1, gimple_phi p2)
{
return operand_equal_p (gimple_phi_arg_def (p1, 0),
gimple_phi_arg_def (p2, 0), 0);
@@ -1265,15 +1265,15 @@ same_close_phi_node (gimple p1, gimple p2)
of PHI. */
static void
-remove_duplicate_close_phi (gimple phi, gimple_stmt_iterator *gsi)
+remove_duplicate_close_phi (gimple_phi phi, gimple_phi_iterator *gsi)
{
gimple use_stmt;
use_operand_p use_p;
imm_use_iterator imm_iter;
tree res = gimple_phi_result (phi);
- tree def = gimple_phi_result (gsi_stmt (*gsi));
+ tree def = gimple_phi_result (gsi->phi ());
- gcc_assert (same_close_phi_node (phi, gsi_stmt (*gsi)));
+ gcc_assert (same_close_phi_node (phi, gsi->phi ()));
FOR_EACH_IMM_USE_STMT (use_stmt, imm_iter, def)
{
@@ -1298,12 +1298,12 @@ remove_duplicate_close_phi (gimple phi, gimple_stmt_iterator *gsi)
static void
make_close_phi_nodes_unique (basic_block bb)
{
- gimple_stmt_iterator psi;
+ gimple_phi_iterator psi;
for (psi = gsi_start_phis (bb); !gsi_end_p (psi); gsi_next (&psi))
{
- gimple_stmt_iterator gsi = psi;
- gimple phi = gsi_stmt (psi);
+ gimple_phi_iterator gsi = psi;
+ gimple_phi phi = psi.phi ();
/* At this point, PHI should be a close phi in normal form. */
gcc_assert (gimple_phi_num_args (phi) == 1);
@@ -1311,7 +1311,7 @@ make_close_phi_nodes_unique (basic_block bb)
/* Iterate over the next phis and remove duplicates. */
gsi_next (&gsi);
while (!gsi_end_p (gsi))
- if (same_close_phi_node (phi, gsi_stmt (gsi)))
+ if (same_close_phi_node (phi, gsi.phi ()))
remove_duplicate_close_phi (phi, &gsi);
else
gsi_next (&gsi);
diff --git a/gcc/graphite-sese-to-poly.c b/gcc/graphite-sese-to-poly.c
index 33a661d..e2ca6fc 100644
--- a/gcc/graphite-sese-to-poly.c
+++ b/gcc/graphite-sese-to-poly.c
@@ -1938,7 +1938,7 @@ gsi_for_phi_node (gimple_phi stmt)
basic_block bb = gimple_bb (stmt);
for (psi = gsi_start_phis (bb); !gsi_end_p (psi); gsi_next (&psi))
- if (stmt == gsi_stmt (psi))
+ if (stmt == psi.phi ())
return psi;
gcc_unreachable ();
@@ -2269,12 +2269,12 @@ rewrite_phi_out_of_ssa (scop_p scop, gimple_phi_iterator *psi)
form "x = phi (y, y, ..., y)" to "x = y". */
static void
-rewrite_degenerate_phi (gimple_stmt_iterator *psi)
+rewrite_degenerate_phi (gimple_phi_iterator *psi)
{
tree rhs;
gimple stmt;
gimple_stmt_iterator gsi;
- gimple phi = gsi_stmt (*psi);
+ gimple_phi phi = psi->phi ();
tree res = gimple_phi_result (phi);
basic_block bb;
diff --git a/gcc/ipa-inline-analysis.c b/gcc/ipa-inline-analysis.c
index 1fb7ef3..8b22a43 100644
--- a/gcc/ipa-inline-analysis.c
+++ b/gcc/ipa-inline-analysis.c
@@ -2260,7 +2260,7 @@ phi_result_unknown_predicate (struct ipa_node_params *info,
NONCONSTANT_NAMES, if possible. */
static void
-predicate_for_phi_result (struct inline_summary *summary, gimple phi,
+predicate_for_phi_result (struct inline_summary *summary, gimple_phi phi,
struct predicate *p,
vec<predicate_t> nonconstant_names)
{
@@ -2443,7 +2443,6 @@ estimate_function_body_sizes (struct cgraph_node *node, bool early)
/* Benefits are scaled by probability of elimination that is in range
<0,2>. */
basic_block bb;
- gimple_stmt_iterator bsi;
struct function *my_function = DECL_STRUCT_FUNCTION (node->decl);
int freq;
struct inline_summary *info = inline_summary (node);
@@ -2524,7 +2523,8 @@ estimate_function_body_sizes (struct cgraph_node *node, bool early)
struct predicate phi_predicate;
bool first_phi = true;
- for (bsi = gsi_start_phis (bb); !gsi_end_p (bsi); gsi_next (&bsi))
+ for (gimple_phi_iterator bsi = gsi_start_phis (bb); !gsi_end_p (bsi);
+ gsi_next (&bsi))
{
if (first_phi
&& !phi_result_unknown_predicate (parms_info, info, bb,
@@ -2537,14 +2537,15 @@ estimate_function_body_sizes (struct cgraph_node *node, bool early)
fprintf (dump_file, " ");
print_gimple_stmt (dump_file, gsi_stmt (bsi), 0, 0);
}
- predicate_for_phi_result (info, gsi_stmt (bsi), &phi_predicate,
+ predicate_for_phi_result (info, bsi.phi (), &phi_predicate,
nonconstant_names);
}
}
fix_builtin_expect_stmt = find_foldable_builtin_expect (bb);
- for (bsi = gsi_start_bb (bb); !gsi_end_p (bsi); gsi_next (&bsi))
+ for (gimple_stmt_iterator bsi = gsi_start_bb (bb); !gsi_end_p (bsi);
+ gsi_next (&bsi))
{
gimple stmt = gsi_stmt (bsi);
int this_size = estimate_num_insns (stmt, &eni_size_weights);
diff --git a/gcc/ipa-split.c b/gcc/ipa-split.c
index 08dbf7d..56bd9ca 100644
--- a/gcc/ipa-split.c
+++ b/gcc/ipa-split.c
@@ -229,8 +229,6 @@ verify_non_ssa_vars (struct split_point *current, bitmap non_ssa_vars,
while (!worklist.is_empty ())
{
- gimple_stmt_iterator bsi;
-
bb = worklist.pop ();
FOR_EACH_EDGE (e, ei, bb->preds)
if (e->src != ENTRY_BLOCK_PTR_FOR_FN (cfun)
@@ -240,7 +238,8 @@ verify_non_ssa_vars (struct split_point *current, bitmap non_ssa_vars,
e->src->index));
worklist.safe_push (e->src);
}
- for (bsi = gsi_start_bb (bb); !gsi_end_p (bsi); gsi_next (&bsi))
+ for (gimple_stmt_iterator bsi = gsi_start_bb (bb); !gsi_end_p (bsi);
+ gsi_next (&bsi))
{
gimple stmt = gsi_stmt (bsi);
if (is_gimple_debug (stmt))
@@ -260,7 +259,8 @@ verify_non_ssa_vars (struct split_point *current, bitmap non_ssa_vars,
goto done;
}
}
- for (bsi = gsi_start_phis (bb); !gsi_end_p (bsi); gsi_next (&bsi))
+ for (gimple_phi_iterator bsi = gsi_start_phis (bb); !gsi_end_p (bsi);
+ gsi_next (&bsi))
{
if (walk_stmt_load_store_addr_ops
(gsi_stmt (bsi), non_ssa_vars, test_nonssa_use, test_nonssa_use,
@@ -274,10 +274,11 @@ verify_non_ssa_vars (struct split_point *current, bitmap non_ssa_vars,
{
if (e->dest != return_bb)
continue;
- for (bsi = gsi_start_phis (return_bb); !gsi_end_p (bsi);
+ for (gimple_phi_iterator bsi = gsi_start_phis (return_bb);
+ !gsi_end_p (bsi);
gsi_next (&bsi))
{
- gimple stmt = gsi_stmt (bsi);
+ gimple_phi stmt = bsi.phi ();
tree op = gimple_phi_arg_def (stmt, e->dest_idx);
if (virtual_operand_p (gimple_phi_result (stmt)))
@@ -622,15 +623,15 @@ consider_split (struct split_point *current, bitmap non_ssa_vars,
for the return value. If there are other PHIs, give up. */
if (return_bb != EXIT_BLOCK_PTR_FOR_FN (cfun))
{
- gimple_stmt_iterator psi;
+ gimple_phi_iterator psi;
for (psi = gsi_start_phis (return_bb); !gsi_end_p (psi); gsi_next (&psi))
- if (!virtual_operand_p (gimple_phi_result (gsi_stmt (psi)))
+ if (!virtual_operand_p (gimple_phi_result (psi.phi ()))
&& !(retval
&& current->split_part_set_retval
&& TREE_CODE (retval) == SSA_NAME
&& !DECL_BY_REFERENCE (DECL_RESULT (current_function_decl))
- && SSA_NAME_DEF_STMT (retval) == gsi_stmt (psi)))
+ && SSA_NAME_DEF_STMT (retval) == psi.phi ()))
{
if (dump_file && (dump_flags & TDF_DETAILS))
fprintf (dump_file,
@@ -798,12 +799,12 @@ visit_bb (basic_block bb, basic_block return_bb,
bitmap set_ssa_names, bitmap used_ssa_names,
bitmap non_ssa_vars)
{
- gimple_stmt_iterator bsi;
edge e;
edge_iterator ei;
bool can_split = true;
- for (bsi = gsi_start_bb (bb); !gsi_end_p (bsi); gsi_next (&bsi))
+ for (gimple_stmt_iterator bsi = gsi_start_bb (bb); !gsi_end_p (bsi);
+ gsi_next (&bsi))
{
gimple stmt = gsi_stmt (bsi);
tree op;
@@ -872,9 +873,10 @@ visit_bb (basic_block bb, basic_block return_bb,
mark_nonssa_use,
mark_nonssa_use);
}
- for (bsi = gsi_start_phis (bb); !gsi_end_p (bsi); gsi_next (&bsi))
+ for (gimple_phi_iterator bsi = gsi_start_phis (bb); !gsi_end_p (bsi);
+ gsi_next (&bsi))
{
- gimple stmt = gsi_stmt (bsi);
+ gimple_phi stmt = bsi.phi ();
unsigned int i;
if (virtual_operand_p (gimple_phi_result (stmt)))
@@ -896,9 +898,11 @@ visit_bb (basic_block bb, basic_block return_bb,
FOR_EACH_EDGE (e, ei, bb->succs)
if (e->dest == return_bb)
{
- for (bsi = gsi_start_phis (return_bb); !gsi_end_p (bsi); gsi_next (&bsi))
+ for (gimple_phi_iterator bsi = gsi_start_phis (return_bb);
+ !gsi_end_p (bsi);
+ gsi_next (&bsi))
{
- gimple stmt = gsi_stmt (bsi);
+ gimple_phi stmt = bsi.phi ();
tree op = gimple_phi_arg_def (stmt, e->dest_idx);
if (virtual_operand_p (gimple_phi_result (stmt)))
@@ -1122,7 +1126,6 @@ split_function (struct split_point *split_point)
cgraph_node *node, *cur_node = cgraph_node::get (current_function_decl);
basic_block return_bb = find_return_bb ();
basic_block call_bb;
- gimple_stmt_iterator gsi;
gimple_call call;
edge e;
edge_iterator ei;
@@ -1225,9 +1228,10 @@ split_function (struct split_point *split_point)
if (return_bb != EXIT_BLOCK_PTR_FOR_FN (cfun))
{
bool phi_p = false;
- for (gsi = gsi_start_phis (return_bb); !gsi_end_p (gsi);)
+ for (gimple_phi_iterator gsi = gsi_start_phis (return_bb);
+ !gsi_end_p (gsi);)
{
- gimple stmt = gsi_stmt (gsi);
+ gimple_phi stmt = gsi.phi ();
if (!virtual_operand_p (gimple_phi_result (stmt)))
{
gsi_next (&gsi);
@@ -1246,7 +1250,9 @@ split_function (struct split_point *split_point)
entry of the SESE region as the vuse of the call and the reaching
vdef of the exit of the SESE region as the vdef of the call. */
if (!phi_p)
- for (gsi = gsi_start_bb (return_bb); !gsi_end_p (gsi); gsi_next (&gsi))
+ for (gimple_stmt_iterator gsi = gsi_start_bb (return_bb);
+ !gsi_end_p (gsi);
+ gsi_next (&gsi))
{
gimple stmt = gsi_stmt (gsi);
if (gimple_vuse (stmt))
@@ -1289,7 +1295,7 @@ split_function (struct split_point *split_point)
/* Create the basic block we place call into. It is the entry basic block
split after last label. */
call_bb = split_point->entry_bb;
- for (gsi = gsi_start_bb (call_bb); !gsi_end_p (gsi);)
+ for (gimple_stmt_iterator gsi = gsi_start_bb (call_bb); !gsi_end_p (gsi);)
if (gimple_code (gsi_stmt (gsi)) == GIMPLE_LABEL)
{
last_stmt = gsi_stmt (gsi);
@@ -1301,7 +1307,7 @@ split_function (struct split_point *split_point)
remove_edge (e);
/* Produce the call statement. */
- gsi = gsi_last_bb (call_bb);
+ gimple_stmt_iterator gsi = gsi_last_bb (call_bb);
FOR_EACH_VEC_ELT (args_to_pass, i, arg)
if (!is_gimple_val (arg))
{
diff --git a/gcc/lto-streamer-out.c b/gcc/lto-streamer-out.c
index dad751b..0eb3f3c 100644
--- a/gcc/lto-streamer-out.c
+++ b/gcc/lto-streamer-out.c
@@ -2013,16 +2013,17 @@ output_function (struct cgraph_node *node)
set_gimple_stmt_max_uid (cfun, 0);
FOR_ALL_BB_FN (bb, cfun)
{
- gimple_stmt_iterator gsi;
- for (gsi = gsi_start_phis (bb); !gsi_end_p (gsi); gsi_next (&gsi))
+ for (gimple_phi_iterator gsi = gsi_start_phis (bb); !gsi_end_p (gsi);
+ gsi_next (&gsi))
{
- gimple stmt = gsi_stmt (gsi);
+ gimple_phi stmt = gsi.phi ();
/* Virtual PHIs are not going to be streamed. */
if (!virtual_operand_p (gimple_phi_result (stmt)))
gimple_set_uid (stmt, inc_gimple_stmt_max_uid (cfun));
}
- for (gsi = gsi_start_bb (bb); !gsi_end_p (gsi); gsi_next (&gsi))
+ for (gimple_stmt_iterator gsi = gsi_start_bb (bb); !gsi_end_p (gsi);
+ gsi_next (&gsi))
{
gimple stmt = gsi_stmt (gsi);
gimple_set_uid (stmt, inc_gimple_stmt_max_uid (cfun));
@@ -2032,10 +2033,10 @@ output_function (struct cgraph_node *node)
virtual phis now. */
FOR_ALL_BB_FN (bb, cfun)
{
- gimple_stmt_iterator gsi;
- for (gsi = gsi_start_phis (bb); !gsi_end_p (gsi); gsi_next (&gsi))
+ for (gimple_phi_iterator gsi = gsi_start_phis (bb); !gsi_end_p (gsi);
+ gsi_next (&gsi))
{
- gimple stmt = gsi_stmt (gsi);
+ gimple_phi stmt = gsi.phi ();
if (virtual_operand_p (gimple_phi_result (stmt)))
gimple_set_uid (stmt, inc_gimple_stmt_max_uid (cfun));
}
diff --git a/gcc/sese.c b/gcc/sese.c
index 5445dc0..dc3dc47 100644
--- a/gcc/sese.c
+++ b/gcc/sese.c
@@ -175,18 +175,19 @@ sese_build_liveouts_use (sese region, bitmap liveouts, basic_block bb,
static void
sese_build_liveouts_bb (sese region, bitmap liveouts, basic_block bb)
{
- gimple_stmt_iterator bsi;
edge e;
edge_iterator ei;
ssa_op_iter iter;
use_operand_p use_p;
FOR_EACH_EDGE (e, ei, bb->succs)
- for (bsi = gsi_start_phis (e->dest); !gsi_end_p (bsi); gsi_next (&bsi))
+ for (gimple_phi_iterator bsi = gsi_start_phis (e->dest); !gsi_end_p (bsi);
+ gsi_next (&bsi))
sese_build_liveouts_use (region, liveouts, bb,
- PHI_ARG_DEF_FROM_EDGE (gsi_stmt (bsi), e));
+ PHI_ARG_DEF_FROM_EDGE (bsi.phi (), e));
- for (bsi = gsi_start_bb (bb); !gsi_end_p (bsi); gsi_next (&bsi))
+ for (gimple_stmt_iterator bsi = gsi_start_bb (bb); !gsi_end_p (bsi);
+ gsi_next (&bsi))
{
gimple stmt = gsi_stmt (bsi);
diff --git a/gcc/tree-cfg.c b/gcc/tree-cfg.c
index ad530f3..97d5ffd 100644
--- a/gcc/tree-cfg.c
+++ b/gcc/tree-cfg.c
@@ -1643,7 +1643,6 @@ static bool
gimple_can_merge_blocks_p (basic_block a, basic_block b)
{
gimple stmt;
- gimple_stmt_iterator gsi;
if (!single_succ_p (a))
return false;
@@ -1673,7 +1672,8 @@ gimple_can_merge_blocks_p (basic_block a, basic_block b)
return false;
/* Examine the labels at the beginning of B. */
- for (gsi = gsi_start_bb (b); !gsi_end_p (gsi); gsi_next (&gsi))
+ for (gimple_stmt_iterator gsi = gsi_start_bb (b); !gsi_end_p (gsi);
+ gsi_next (&gsi))
{
tree lab;
gimple_label label_stmt = dyn_cast <gimple_label> (gsi_stmt (gsi));
@@ -1693,9 +1693,10 @@ gimple_can_merge_blocks_p (basic_block a, basic_block b)
/* It must be possible to eliminate all phi nodes in B. If ssa form
is not up-to-date and a name-mapping is registered, we cannot eliminate
any phis. Symbols marked for renaming are never a problem though. */
- for (gsi = gsi_start_phis (b); !gsi_end_p (gsi); gsi_next (&gsi))
+ for (gimple_phi_iterator gsi = gsi_start_phis (b); !gsi_end_p (gsi);
+ gsi_next (&gsi))
{
- gimple phi = gsi_stmt (gsi);
+ gimple_phi phi = gsi.phi ();
/* Technically only new names matter. */
if (name_registered_for_update_p (PHI_RESULT (phi)))
return false;
@@ -1807,7 +1808,8 @@ replace_uses_by (tree name, tree val)
static void
gimple_merge_blocks (basic_block a, basic_block b)
{
- gimple_stmt_iterator last, gsi, psi;
+ gimple_stmt_iterator last, gsi;
+ gimple_phi_iterator psi;
if (dump_file)
fprintf (dump_file, "Merging blocks %d and %d\n", a->index, b->index);
diff --git a/gcc/tree-complex.c b/gcc/tree-complex.c
index 6f6fef5..e155d11 100644
--- a/gcc/tree-complex.c
+++ b/gcc/tree-complex.c
@@ -201,20 +201,20 @@ static bool
init_dont_simulate_again (void)
{
basic_block bb;
- gimple_stmt_iterator gsi;
- gimple phi;
bool saw_a_complex_op = false;
FOR_EACH_BB_FN (bb, cfun)
{
- for (gsi = gsi_start_phis (bb); !gsi_end_p (gsi); gsi_next (&gsi))
+ for (gimple_phi_iterator gsi = gsi_start_phis (bb); !gsi_end_p (gsi);
+ gsi_next (&gsi))
{
- phi = gsi_stmt (gsi);
+ gimple_phi phi = gsi.phi ();
prop_set_simulate_again (phi,
is_complex_reg (gimple_phi_result (phi)));
}
- for (gsi = gsi_start_bb (bb); !gsi_end_p (gsi); gsi_next (&gsi))
+ for (gimple_stmt_iterator gsi = gsi_start_bb (bb); !gsi_end_p (gsi);
+ gsi_next (&gsi))
{
gimple stmt;
tree op0, op1;
diff --git a/gcc/tree-dfa.c b/gcc/tree-dfa.c
index 9e39028..22f486c 100644
--- a/gcc/tree-dfa.c
+++ b/gcc/tree-dfa.c
@@ -282,18 +282,18 @@ collect_dfa_stats (struct dfa_stats_d *dfa_stats_p ATTRIBUTE_UNUSED)
/* Walk all the statements in the function counting references. */
FOR_EACH_BB_FN (bb, cfun)
{
- gimple_stmt_iterator si;
-
- for (si = gsi_start_phis (bb); !gsi_end_p (si); gsi_next (&si))
+ for (gimple_phi_iterator si = gsi_start_phis (bb); !gsi_end_p (si);
+ gsi_next (&si))
{
- gimple phi = gsi_stmt (si);
+ gimple_phi phi = si.phi ();
dfa_stats_p->num_phis++;
dfa_stats_p->num_phi_args += gimple_phi_num_args (phi);
if (gimple_phi_num_args (phi) > dfa_stats_p->max_num_phi_args)
dfa_stats_p->max_num_phi_args = gimple_phi_num_args (phi);
}
- for (si = gsi_start_bb (bb); !gsi_end_p (si); gsi_next (&si))
+ for (gimple_stmt_iterator si = gsi_start_bb (bb); !gsi_end_p (si);
+ gsi_next (&si))
{
gimple stmt = gsi_stmt (si);
dfa_stats_p->num_defs += NUM_SSA_OPERANDS (stmt, SSA_OP_DEF);
diff --git a/gcc/tree-eh.c b/gcc/tree-eh.c
index cd84756..ed087a1 100644
--- a/gcc/tree-eh.c
+++ b/gcc/tree-eh.c
@@ -3469,14 +3469,15 @@ sink_clobbers (basic_block bb)
/* See if there is a virtual PHI node to take an updated virtual
operand from. */
- gimple vphi = NULL;
+ gimple_phi vphi = NULL;
tree vuse = NULL_TREE;
- for (gsi = gsi_start_phis (succbb); !gsi_end_p (gsi); gsi_next (&gsi))
+ for (gimple_phi_iterator gpi = gsi_start_phis (succbb);
+ !gsi_end_p (gpi); gsi_next (&gpi))
{
- tree res = gimple_phi_result (gsi_stmt (gsi));
+ tree res = gimple_phi_result (gpi.phi ());
if (virtual_operand_p (res))
{
- vphi = gsi_stmt (gsi);
+ vphi = gpi.phi ();
vuse = res;
break;
}
@@ -4031,9 +4032,10 @@ unsplit_eh (eh_landing_pad lp)
that doesn't appear to handle virtuals. Propagate by hand. */
if (!gimple_seq_empty_p (phi_nodes (bb)))
{
- for (gsi = gsi_start_phis (bb); !gsi_end_p (gsi); )
+ for (gimple_phi_iterator gpi = gsi_start_phis (bb); !gsi_end_p (gpi); )
{
- gimple use_stmt, phi = gsi_stmt (gsi);
+ gimple use_stmt;
+ gimple_phi phi = gpi.phi ();
tree lhs = gimple_phi_result (phi);
tree rhs = gimple_phi_arg_def (phi, 0);
use_operand_p use_p;
@@ -4048,7 +4050,7 @@ unsplit_eh (eh_landing_pad lp)
if (SSA_NAME_OCCURS_IN_ABNORMAL_PHI (lhs))
SSA_NAME_OCCURS_IN_ABNORMAL_PHI (rhs) = 1;
- remove_phi_node (&gsi, true);
+ remove_phi_node (&gpi, true);
}
}
@@ -4191,7 +4193,7 @@ cleanup_empty_eh_merge_phis (basic_block new_bb, basic_block old_bb,
we don't know what values from the other edges into NEW_BB to use. */
for (ogsi = gsi_start_phis (old_bb); !gsi_end_p (ogsi); gsi_next (&ogsi))
{
- gimple ophi = gsi_stmt (ogsi);
+ gimple_phi ophi = ogsi.phi ();
tree oresult = gimple_phi_result (ophi);
if (!bitmap_bit_p (ophi_handled, SSA_NAME_VERSION (oresult)))
goto fail;
diff --git a/gcc/tree-emutls.c b/gcc/tree-emutls.c
index 8d62dba..94efc6f 100644
--- a/gcc/tree-emutls.c
+++ b/gcc/tree-emutls.c
@@ -556,7 +556,8 @@ lower_emutls_stmt (gimple stmt, struct lower_emutls_data *d)
/* Lower the I'th operand of PHI. */
static void
-lower_emutls_phi_arg (gimple phi, unsigned int i, struct lower_emutls_data *d)
+lower_emutls_phi_arg (gimple_phi phi, unsigned int i,
+ struct lower_emutls_data *d)
{
struct walk_stmt_info wi;
struct phi_arg_d *pd = gimple_phi_arg (phi, i);
@@ -617,7 +618,6 @@ lower_emutls_function_body (struct cgraph_node *node)
FOR_EACH_BB_FN (d.bb, cfun)
{
- gimple_stmt_iterator gsi;
unsigned int i, nedge;
/* Lower each of the PHI nodes of the block, as we may have
@@ -639,10 +639,10 @@ lower_emutls_function_body (struct cgraph_node *node)
clear_access_vars ();
d.seq = NULL;
- for (gsi = gsi_start_phis (d.bb);
+ for (gimple_phi_iterator gsi = gsi_start_phis (d.bb);
!gsi_end_p (gsi);
gsi_next (&gsi))
- lower_emutls_phi_arg (gsi_stmt (gsi), i, &d);
+ lower_emutls_phi_arg (gsi.phi (), i, &d);
/* Insert all statements generated by all phi nodes for this
particular edge all at once. */
@@ -660,7 +660,8 @@ lower_emutls_function_body (struct cgraph_node *node)
clear_access_vars ();
/* Lower each of the statements of the block. */
- for (gsi = gsi_start_bb (d.bb); !gsi_end_p (gsi); gsi_next (&gsi))
+ for (gimple_stmt_iterator gsi = gsi_start_bb (d.bb); !gsi_end_p (gsi);
+ gsi_next (&gsi))
{
d.seq = NULL;
lower_emutls_stmt (gsi_stmt (gsi), &d);
diff --git a/gcc/tree-if-conv.c b/gcc/tree-if-conv.c
index f7f27da..61bc882 100644
--- a/gcc/tree-if-conv.c
+++ b/gcc/tree-if-conv.c
@@ -1561,7 +1561,7 @@ convert_scalar_cond_reduction (gimple reduc, gimple_stmt_iterator *gsi,
TRUE_BB is selected. */
static void
-predicate_scalar_phi (gimple phi, tree cond,
+predicate_scalar_phi (gimple_phi phi, tree cond,
basic_block true_bb,
gimple_stmt_iterator *gsi)
{
@@ -1636,9 +1636,10 @@ predicate_all_scalar_phis (struct loop *loop)
for (i = 1; i < orig_loop_num_nodes; i++)
{
- gimple phi;
+ gimple_phi phi;
tree cond = NULL_TREE;
- gimple_stmt_iterator gsi, phi_gsi;
+ gimple_stmt_iterator gsi;
+ gimple_phi_iterator phi_gsi;
basic_block true_bb = NULL;
bb = ifc_bbs[i];
@@ -1656,7 +1657,7 @@ predicate_all_scalar_phis (struct loop *loop)
while (!gsi_end_p (phi_gsi))
{
- phi = gsi_stmt (phi_gsi);
+ phi = phi_gsi.phi ();
predicate_scalar_phi (phi, cond, true_bb, &gsi);
release_phi_node (phi);
gsi_next (&phi_gsi);
diff --git a/gcc/tree-into-ssa.c b/gcc/tree-into-ssa.c
index b4e0e4b..9733217 100644
--- a/gcc/tree-into-ssa.c
+++ b/gcc/tree-into-ssa.c
@@ -1434,8 +1434,6 @@ public:
void
rewrite_dom_walker::before_dom_children (basic_block bb)
{
- gimple_stmt_iterator gsi;
-
if (dump_file && (dump_flags & TDF_DETAILS))
fprintf (dump_file, "\n\nRenaming block #%d\n\n", bb->index);
@@ -1445,7 +1443,8 @@ rewrite_dom_walker::before_dom_children (basic_block bb)
/* Step 1. Register new definitions for every PHI node in the block.
Conceptually, all the PHI nodes are executed in parallel and each PHI
node introduces a new version for the associated variable. */
- for (gsi = gsi_start_phis (bb); !gsi_end_p (gsi); gsi_next (&gsi))
+ for (gimple_phi_iterator gsi = gsi_start_phis (bb); !gsi_end_p (gsi);
+ gsi_next (&gsi))
{
tree result = gimple_phi_result (gsi_stmt (gsi));
register_new_def (result, SSA_NAME_VAR (result));
@@ -1455,7 +1454,8 @@ rewrite_dom_walker::before_dom_children (basic_block bb)
with its immediate reaching definitions. Update the current definition
of a variable when a new real or virtual definition is found. */
if (bitmap_bit_p (interesting_blocks, bb->index))
- for (gsi = gsi_start_bb (bb); !gsi_end_p (gsi); gsi_next (&gsi))
+ for (gimple_stmt_iterator gsi = gsi_start_bb (bb); !gsi_end_p (gsi);
+ gsi_next (&gsi))
rewrite_stmt (&gsi);
/* Step 3. Visit all the successor blocks of BB looking for PHI nodes.
@@ -2084,7 +2084,6 @@ void
rewrite_update_dom_walker::before_dom_children (basic_block bb)
{
bool is_abnormal_phi;
- gimple_stmt_iterator gsi;
if (dump_file && (dump_flags & TDF_DETAILS))
fprintf (dump_file, "Registering new PHI nodes in block #%d\n",
@@ -2105,10 +2104,11 @@ rewrite_update_dom_walker::before_dom_children (basic_block bb)
register it as a new definition for its corresponding name. Also
register definitions for names whose underlying symbols are
marked for renaming. */
- for (gsi = gsi_start_phis (bb); !gsi_end_p (gsi); gsi_next (&gsi))
+ for (gimple_phi_iterator gsi = gsi_start_phis (bb); !gsi_end_p (gsi);
+ gsi_next (&gsi))
{
tree lhs, lhs_sym;
- gimple phi = gsi_stmt (gsi);
+ gimple_phi phi = gsi.phi ();
if (!register_defs_p (phi))
continue;
@@ -2140,7 +2140,8 @@ rewrite_update_dom_walker::before_dom_children (basic_block bb)
if (bitmap_bit_p (interesting_blocks, bb->index))
{
gcc_checking_assert (bitmap_bit_p (blocks_to_update, bb->index));
- for (gsi = gsi_start_bb (bb); !gsi_end_p (gsi); gsi_next (&gsi))
+ for (gimple_stmt_iterator gsi = gsi_start_bb (bb); !gsi_end_p (gsi);
+ gsi_next (&gsi))
rewrite_update_stmt (gsi_stmt (gsi), gsi);
}
@@ -2495,7 +2496,6 @@ static void
prepare_block_for_update (basic_block bb, bool insert_phi_p)
{
basic_block son;
- gimple_stmt_iterator si;
edge e;
edge_iterator ei;
@@ -2503,9 +2503,10 @@ prepare_block_for_update (basic_block bb, bool insert_phi_p)
/* Process PHI nodes marking interesting those that define or use
the symbols that we are interested in. */
- for (si = gsi_start_phis (bb); !gsi_end_p (si); gsi_next (&si))
+ for (gimple_phi_iterator si = gsi_start_phis (bb); !gsi_end_p (si);
+ gsi_next (&si))
{
- gimple phi = gsi_stmt (si);
+ gimple_phi phi = si.phi ();
tree lhs_sym, lhs = gimple_phi_result (phi);
if (TREE_CODE (lhs) == SSA_NAME
@@ -2529,7 +2530,8 @@ prepare_block_for_update (basic_block bb, bool insert_phi_p)
}
/* Process the statements. */
- for (si = gsi_start_bb (bb); !gsi_end_p (si); gsi_next (&si))
+ for (gimple_stmt_iterator si = gsi_start_bb (bb); !gsi_end_p (si);
+ gsi_next (&si))
{
gimple stmt;
ssa_op_iter i;
@@ -2908,7 +2910,7 @@ mark_virtual_operand_for_renaming (tree name)
removed. */
void
-mark_virtual_phi_result_for_renaming (gimple phi)
+mark_virtual_phi_result_for_renaming (gimple_phi phi)
{
if (dump_file && (dump_flags & TDF_DETAILS))
{
diff --git a/gcc/tree-into-ssa.h b/gcc/tree-into-ssa.h
index 977f6e7..8d82074 100644
--- a/gcc/tree-into-ssa.h
+++ b/gcc/tree-into-ssa.h
@@ -26,7 +26,7 @@ void delete_update_ssa (void);
tree create_new_def_for (tree, gimple, def_operand_p);
void mark_virtual_operands_for_renaming (struct function *);
void mark_virtual_operand_for_renaming (tree);
-void mark_virtual_phi_result_for_renaming (gimple);
+void mark_virtual_phi_result_for_renaming (gimple_phi);
bool need_ssa_update_p (struct function *);
bool name_registered_for_update_p (tree);
void release_ssa_name_after_update_ssa (tree);
diff --git a/gcc/tree-loop-distribution.c b/gcc/tree-loop-distribution.c
index a6cd30f..4bb9b0c 100644
--- a/gcc/tree-loop-distribution.c
+++ b/gcc/tree-loop-distribution.c
@@ -393,16 +393,16 @@ stmts_from_loop (struct loop *loop, vec<gimple> *stmts)
for (i = 0; i < loop->num_nodes; i++)
{
basic_block bb = bbs[i];
- gimple_stmt_iterator bsi;
- gimple stmt;
- for (bsi = gsi_start_phis (bb); !gsi_end_p (bsi); gsi_next (&bsi))
- if (!virtual_operand_p (gimple_phi_result (gsi_stmt (bsi))))
- stmts->safe_push (gsi_stmt (bsi));
+ for (gimple_phi_iterator bsi = gsi_start_phis (bb); !gsi_end_p (bsi);
+ gsi_next (&bsi))
+ if (!virtual_operand_p (gimple_phi_result (bsi.phi ())))
+ stmts->safe_push (bsi.phi ());
- for (bsi = gsi_start_bb (bb); !gsi_end_p (bsi); gsi_next (&bsi))
+ for (gimple_stmt_iterator bsi = gsi_start_bb (bb); !gsi_end_p (bsi);
+ gsi_next (&bsi))
{
- stmt = gsi_stmt (bsi);
+ gimple stmt = gsi_stmt (bsi);
if (gimple_code (stmt) != GIMPLE_LABEL && !is_gimple_debug (stmt))
stmts->safe_push (stmt);
}
@@ -620,7 +620,6 @@ generate_loops_for_partition (struct loop *loop, partition_t partition,
bool copy_p)
{
unsigned i;
- gimple_stmt_iterator bsi;
basic_block *bbs;
if (copy_p)
@@ -639,15 +638,16 @@ generate_loops_for_partition (struct loop *loop, partition_t partition,
{
basic_block bb = bbs[i];
- for (bsi = gsi_start_phis (bb); !gsi_end_p (bsi); gsi_next (&bsi))
+ for (gimple_phi_iterator bsi = gsi_start_phis (bb); !gsi_end_p (bsi);
+ gsi_next (&bsi))
{
- gimple phi = gsi_stmt (bsi);
+ gimple_phi phi = bsi.phi ();
if (!virtual_operand_p (gimple_phi_result (phi))
&& !bitmap_bit_p (partition->stmts, gimple_uid (phi)))
reset_debug_uses (phi);
}
- for (bsi = gsi_start_bb (bb); !gsi_end_p (bsi); gsi_next (&bsi))
+ for (gimple_stmt_iterator bsi = gsi_start_bb (bb); !gsi_end_p (bsi); gsi_next (&bsi))
{
gimple stmt = gsi_stmt (bsi);
if (gimple_code (stmt) != GIMPLE_LABEL
@@ -661,9 +661,9 @@ generate_loops_for_partition (struct loop *loop, partition_t partition,
{
basic_block bb = bbs[i];
- for (bsi = gsi_start_phis (bb); !gsi_end_p (bsi);)
+ for (gimple_phi_iterator bsi = gsi_start_phis (bb); !gsi_end_p (bsi);)
{
- gimple phi = gsi_stmt (bsi);
+ gimple_phi phi = bsi.phi ();
if (!virtual_operand_p (gimple_phi_result (phi))
&& !bitmap_bit_p (partition->stmts, gimple_uid (phi)))
remove_phi_node (&bsi, true);
@@ -671,7 +671,7 @@ generate_loops_for_partition (struct loop *loop, partition_t partition,
gsi_next (&bsi);
}
- for (bsi = gsi_start_bb (bb); !gsi_end_p (bsi);)
+ for (gimple_stmt_iterator bsi = gsi_start_bb (bb); !gsi_end_p (bsi);)
{
gimple stmt = gsi_stmt (bsi);
if (gimple_code (stmt) != GIMPLE_LABEL
@@ -902,14 +902,15 @@ destroy_loop (struct loop *loop)
Make sure we replace all uses of virtual defs that will remain
outside of the loop with the bare symbol as delete_basic_block
will release them. */
- gimple_stmt_iterator gsi;
- for (gsi = gsi_start_phis (bbs[i]); !gsi_end_p (gsi); gsi_next (&gsi))
+ for (gimple_phi_iterator gsi = gsi_start_phis (bbs[i]); !gsi_end_p (gsi);
+ gsi_next (&gsi))
{
- gimple phi = gsi_stmt (gsi);
+ gimple_phi phi = gsi.phi ();
if (virtual_operand_p (gimple_phi_result (phi)))
mark_virtual_phi_result_for_renaming (phi);
}
- for (gsi = gsi_start_bb (bbs[i]); !gsi_end_p (gsi); gsi_next (&gsi))
+ for (gimple_stmt_iterator gsi = gsi_start_bb (bbs[i]); !gsi_end_p (gsi);
+ gsi_next (&gsi))
{
gimple stmt = gsi_stmt (gsi);
tree vdef = gimple_vdef (stmt);
@@ -1742,10 +1743,11 @@ pass_loop_distribution::execute (function *fun)
bbs = get_loop_body_in_dom_order (loop);
for (i = 0; i < loop->num_nodes; ++i)
{
- gimple_stmt_iterator gsi;
- for (gsi = gsi_start_phis (bbs[i]); !gsi_end_p (gsi); gsi_next (&gsi))
+ for (gimple_phi_iterator gsi = gsi_start_phis (bbs[i]);
+ !gsi_end_p (gsi);
+ gsi_next (&gsi))
{
- gimple phi = gsi_stmt (gsi);
+ gimple_phi phi = gsi.phi ();
if (virtual_operand_p (gimple_phi_result (phi)))
continue;
/* Distribute stmts which have defs that are used outside of
@@ -1754,7 +1756,9 @@ pass_loop_distribution::execute (function *fun)
continue;
work_list.safe_push (phi);
}
- for (gsi = gsi_start_bb (bbs[i]); !gsi_end_p (gsi); gsi_next (&gsi))
+ for (gimple_stmt_iterator gsi = gsi_start_bb (bbs[i]);
+ !gsi_end_p (gsi);
+ gsi_next (&gsi))
{
gimple stmt = gsi_stmt (gsi);
diff --git a/gcc/tree-parloops.c b/gcc/tree-parloops.c
index ac37b0f..d7159cf 100644
--- a/gcc/tree-parloops.c
+++ b/gcc/tree-parloops.c
@@ -1926,12 +1926,12 @@ loop_has_vector_phi_nodes (struct loop *loop ATTRIBUTE_UNUSED)
{
unsigned i;
basic_block *bbs = get_loop_body_in_dom_order (loop);
- gimple_stmt_iterator gsi;
+ gimple_phi_iterator gsi;
bool res = true;
for (i = 0; i < loop->num_nodes; i++)
for (gsi = gsi_start_phis (bbs[i]); !gsi_end_p (gsi); gsi_next (&gsi))
- if (TREE_CODE (TREE_TYPE (PHI_RESULT (gsi_stmt (gsi)))) == VECTOR_TYPE)
+ if (TREE_CODE (TREE_TYPE (PHI_RESULT (gsi.phi ()))) == VECTOR_TYPE)
goto end;
res = false;
diff --git a/gcc/tree-phinodes.c b/gcc/tree-phinodes.c
index 4f86090..0213ecd 100644
--- a/gcc/tree-phinodes.c
+++ b/gcc/tree-phinodes.c
@@ -478,7 +478,7 @@ remove_phi_nodes (basic_block bb)
NULL. */
tree
-degenerate_phi_result (gimple phi)
+degenerate_phi_result (gimple_phi phi)
{
tree lhs = gimple_phi_result (phi);
tree val = NULL;
diff --git a/gcc/tree-phinodes.h b/gcc/tree-phinodes.h
index dcde99e..0ff7fda 100644
--- a/gcc/tree-phinodes.h
+++ b/gcc/tree-phinodes.h
@@ -29,7 +29,7 @@ extern void add_phi_arg (gimple_phi, tree, edge, source_location);
extern void remove_phi_args (edge);
extern void remove_phi_node (gimple_stmt_iterator *, bool);
extern void remove_phi_nodes (basic_block);
-extern tree degenerate_phi_result (gimple);
+extern tree degenerate_phi_result (gimple_phi);
extern void set_phi_nodes (basic_block, gimple_seq);
static inline use_operand_p
diff --git a/gcc/tree-scalar-evolution.c b/gcc/tree-scalar-evolution.c
index bb67cc7..19b63f5 100644
--- a/gcc/tree-scalar-evolution.c
+++ b/gcc/tree-scalar-evolution.c
@@ -1596,13 +1596,15 @@ analyze_initial_condition (gimple_phi loop_phi_node)
if (TREE_CODE (init_cond) == SSA_NAME)
{
gimple def = SSA_NAME_DEF_STMT (init_cond);
- tree res;
- if (gimple_code (def) == GIMPLE_PHI
- && (res = degenerate_phi_result (def)) != NULL_TREE
- /* Only allow invariants here, otherwise we may break
- loop-closed SSA form. */
- && is_gimple_min_invariant (res))
- init_cond = res;
+ if (gimple_phi phi = dyn_cast <gimple_phi> (def))
+ {
+ tree res = degenerate_phi_result (phi);
+ if (res != NULL_TREE
+ /* Only allow invariants here, otherwise we may break
+ loop-closed SSA form. */
+ && is_gimple_min_invariant (res))
+ init_cond = res;
+ }
}
if (dump_file && (dump_flags & TDF_SCEV))
diff --git a/gcc/tree-ssa-ccp.c b/gcc/tree-ssa-ccp.c
index 33fa392..114a063 100644
--- a/gcc/tree-ssa-ccp.c
+++ b/gcc/tree-ssa-ccp.c
@@ -829,11 +829,11 @@ ccp_initialize (void)
except for phi nodes for virtual operands when we do not do store ccp. */
FOR_EACH_BB_FN (bb, cfun)
{
- gimple_stmt_iterator i;
+ gimple_phi_iterator i;
for (i = gsi_start_phis (bb); !gsi_end_p (i); gsi_next (&i))
{
- gimple phi = gsi_stmt (i);
+ gimple_phi phi = i.phi ();
if (virtual_operand_p (gimple_phi_result (phi)))
prop_set_simulate_again (phi, false);
diff --git a/gcc/tree-ssa-coalesce.c b/gcc/tree-ssa-coalesce.c
index a21cea6..bf75455 100644
--- a/gcc/tree-ssa-coalesce.c
+++ b/gcc/tree-ssa-coalesce.c
@@ -824,12 +824,11 @@ build_ssa_conflict_graph (tree_live_info_p liveinfo)
FOR_EACH_BB_FN (bb, cfun)
{
- gimple_stmt_iterator gsi;
-
/* Start with live on exit temporaries. */
live_track_init (live, live_on_exit (liveinfo, bb));
- for (gsi = gsi_last_bb (bb); !gsi_end_p (gsi); gsi_prev (&gsi))
+ for (gimple_stmt_iterator gsi = gsi_last_bb (bb); !gsi_end_p (gsi);
+ gsi_prev (&gsi))
{
tree var;
gimple stmt = gsi_stmt (gsi);
@@ -866,9 +865,10 @@ build_ssa_conflict_graph (tree_live_info_p liveinfo)
There must be a conflict recorded between the result of the PHI and
any variables that are live. Otherwise the out-of-ssa translation
may create incorrect code. */
- for (gsi = gsi_start_phis (bb); !gsi_end_p (gsi); gsi_next (&gsi))
+ for (gimple_phi_iterator gsi = gsi_start_phis (bb); !gsi_end_p (gsi);
+ gsi_next (&gsi))
{
- gimple phi = gsi_stmt (gsi);
+ gimple_phi phi = gsi.phi ();
tree result = PHI_RESULT (phi);
if (live_track_live_p (live, result))
live_track_process_def (live, result, graph);
diff --git a/gcc/tree-ssa-copy.c b/gcc/tree-ssa-copy.c
index f7e8566..9864aee 100644
--- a/gcc/tree-ssa-copy.c
+++ b/gcc/tree-ssa-copy.c
@@ -452,9 +452,8 @@ init_copy_prop (void)
FOR_EACH_BB_FN (bb, cfun)
{
- gimple_stmt_iterator si;
-
- for (si = gsi_start_bb (bb); !gsi_end_p (si); gsi_next (&si))
+ for (gimple_stmt_iterator si = gsi_start_bb (bb); !gsi_end_p (si);
+ gsi_next (&si))
{
gimple stmt = gsi_stmt (si);
ssa_op_iter iter;
@@ -478,9 +477,10 @@ init_copy_prop (void)
set_copy_of_val (def, def);
}
- for (si = gsi_start_phis (bb); !gsi_end_p (si); gsi_next (&si))
+ for (gimple_phi_iterator si = gsi_start_phis (bb); !gsi_end_p (si);
+ gsi_next (&si))
{
- gimple phi = gsi_stmt (si);
+ gimple_phi phi = si.phi ();
tree def;
def = gimple_phi_result (phi);
diff --git a/gcc/tree-ssa-copyrename.c b/gcc/tree-ssa-copyrename.c
index 4412381..37a47cd 100644
--- a/gcc/tree-ssa-copyrename.c
+++ b/gcc/tree-ssa-copyrename.c
@@ -339,9 +339,8 @@ pass_rename_ssa_copies::execute (function *fun)
{
var_map map;
basic_block bb;
- gimple_stmt_iterator gsi;
tree var, part_var;
- gimple stmt, phi;
+ gimple stmt;
unsigned x;
FILE *debug;
@@ -357,7 +356,8 @@ pass_rename_ssa_copies::execute (function *fun)
FOR_EACH_BB_FN (bb, fun)
{
/* Scan for real copies. */
- for (gsi = gsi_start_bb (bb); !gsi_end_p (gsi); gsi_next (&gsi))
+ for (gimple_stmt_iterator gsi = gsi_start_bb (bb); !gsi_end_p (gsi);
+ gsi_next (&gsi))
{
stmt = gsi_stmt (gsi);
if (gimple_assign_ssa_name_copy_p (stmt))
@@ -373,12 +373,12 @@ pass_rename_ssa_copies::execute (function *fun)
FOR_EACH_BB_FN (bb, fun)
{
/* Treat PHI nodes as copies between the result and each argument. */
- for (gsi = gsi_start_phis (bb); !gsi_end_p (gsi); gsi_next (&gsi))
+ for (gimple_phi_iterator gsi = gsi_start_phis (bb); !gsi_end_p (gsi);
+ gsi_next (&gsi))
{
size_t i;
tree res;
-
- phi = gsi_stmt (gsi);
+ gimple_phi phi = gsi.phi ();
res = gimple_phi_result (phi);
/* Do not process virtual SSA_NAMES. */
diff --git a/gcc/tree-ssa-dce.c b/gcc/tree-ssa-dce.c
index aba2d98..3b7b39d 100644
--- a/gcc/tree-ssa-dce.c
+++ b/gcc/tree-ssa-dce.c
@@ -1278,13 +1278,15 @@ eliminate_unnecessary_stmts (void)
if (!bitmap_bit_p (bb_contains_live_stmts, bb->index)
|| !(bb->flags & BB_REACHABLE))
{
- for (gsi = gsi_start_phis (bb); !gsi_end_p (gsi); gsi_next (&gsi))
- if (virtual_operand_p (gimple_phi_result (gsi_stmt (gsi))))
+ for (gimple_phi_iterator gsi = gsi_start_phis (bb); !gsi_end_p (gsi);
+ gsi_next (&gsi))
+ if (virtual_operand_p (gimple_phi_result (gsi.phi ())))
{
bool found = false;
imm_use_iterator iter;
- FOR_EACH_IMM_USE_STMT (stmt, iter, gimple_phi_result (gsi_stmt (gsi)))
+ FOR_EACH_IMM_USE_STMT (stmt, iter,
+ gimple_phi_result (gsi.phi ()))
{
if (!(gimple_bb (stmt)->flags & BB_REACHABLE))
continue;
@@ -1296,7 +1298,7 @@ eliminate_unnecessary_stmts (void)
}
}
if (found)
- mark_virtual_phi_result_for_renaming (gsi_stmt (gsi));
+ mark_virtual_phi_result_for_renaming (gsi.phi ());
}
if (!(bb->flags & BB_REACHABLE))
diff --git a/gcc/tree-ssa-dom.c b/gcc/tree-ssa-dom.c
index a49601c..2edee91 100644
--- a/gcc/tree-ssa-dom.c
+++ b/gcc/tree-ssa-dom.c
@@ -2645,7 +2645,7 @@ static tree
get_rhs_or_phi_arg (gimple stmt)
{
if (gimple_code (stmt) == GIMPLE_PHI)
- return degenerate_phi_result (stmt);
+ return degenerate_phi_result (as_a <gimple_phi> (stmt));
else if (gimple_assign_single_p (stmt))
return gimple_assign_rhs1 (stmt);
else
diff --git a/gcc/tree-ssa-loop-ivcanon.c b/gcc/tree-ssa-loop-ivcanon.c
index a07d3a1..82009f1 100644
--- a/gcc/tree-ssa-loop-ivcanon.c
+++ b/gcc/tree-ssa-loop-ivcanon.c
@@ -1069,12 +1069,10 @@ propagate_into_all_uses (tree ssa_name, tree val)
static void
propagate_constants_for_unrolling (basic_block bb)
{
- gimple_stmt_iterator gsi;
-
/* Look for degenerate PHI nodes with constant argument. */
- for (gsi = gsi_start_phis (bb); !gsi_end_p (gsi); )
+ for (gimple_phi_iterator gsi = gsi_start_phis (bb); !gsi_end_p (gsi); )
{
- gimple phi = gsi_stmt (gsi);
+ gimple_phi phi = gsi.phi ();
tree result = gimple_phi_result (phi);
tree arg = gimple_phi_arg_def (phi, 0);
@@ -1089,7 +1087,7 @@ propagate_constants_for_unrolling (basic_block bb)
}
/* Look for assignments to SSA names with constant RHS. */
- for (gsi = gsi_start_bb (bb); !gsi_end_p (gsi); )
+ for (gimple_stmt_iterator gsi = gsi_start_bb (bb); !gsi_end_p (gsi); )
{
gimple stmt = gsi_stmt (gsi);
tree lhs;
diff --git a/gcc/tree-ssa-loop-manip.c b/gcc/tree-ssa-loop-manip.c
index bb3da81..65157d7 100644
--- a/gcc/tree-ssa-loop-manip.c
+++ b/gcc/tree-ssa-loop-manip.c
@@ -431,20 +431,21 @@ find_uses_to_rename_stmt (gimple stmt, bitmap *use_blocks, bitmap need_phis)
static void
find_uses_to_rename_bb (basic_block bb, bitmap *use_blocks, bitmap need_phis)
{
- gimple_stmt_iterator bsi;
edge e;
edge_iterator ei;
FOR_EACH_EDGE (e, ei, bb->succs)
- for (bsi = gsi_start_phis (e->dest); !gsi_end_p (bsi); gsi_next (&bsi))
+ for (gimple_phi_iterator bsi = gsi_start_phis (e->dest); !gsi_end_p (bsi);
+ gsi_next (&bsi))
{
- gimple phi = gsi_stmt (bsi);
+ gimple_phi phi = bsi.phi ();
if (! virtual_operand_p (gimple_phi_result (phi)))
find_uses_to_rename_use (bb, PHI_ARG_DEF_FROM_EDGE (phi, e),
use_blocks, need_phis);
}
- for (bsi = gsi_start_bb (bb); !gsi_end_p (bsi); gsi_next (&bsi))
+ for (gimple_stmt_iterator bsi = gsi_start_bb (bb); !gsi_end_p (bsi);
+ gsi_next (&bsi))
find_uses_to_rename_stmt (gsi_stmt (bsi), use_blocks, need_phis);
}
@@ -590,8 +591,6 @@ DEBUG_FUNCTION void
verify_loop_closed_ssa (bool verify_ssa_p)
{
basic_block bb;
- gimple_stmt_iterator bsi;
- gimple phi;
edge e;
edge_iterator ei;
@@ -605,15 +604,17 @@ verify_loop_closed_ssa (bool verify_ssa_p)
FOR_EACH_BB_FN (bb, cfun)
{
- for (bsi = gsi_start_phis (bb); !gsi_end_p (bsi); gsi_next (&bsi))
+ for (gimple_phi_iterator bsi = gsi_start_phis (bb); !gsi_end_p (bsi);
+ gsi_next (&bsi))
{
- phi = gsi_stmt (bsi);
+ gimple_phi phi = bsi.phi ();
FOR_EACH_EDGE (e, ei, bb->preds)
check_loop_closed_ssa_use (e->src,
PHI_ARG_DEF_FROM_EDGE (phi, e));
}
- for (bsi = gsi_start_bb (bb); !gsi_end_p (bsi); gsi_next (&bsi))
+ for (gimple_stmt_iterator bsi = gsi_start_bb (bb); !gsi_end_p (bsi);
+ gsi_next (&bsi))
check_loop_closed_ssa_stmt (bb, gsi_stmt (bsi));
}
diff --git a/gcc/tree-ssa-math-opts.c b/gcc/tree-ssa-math-opts.c
index 1010ff0..8dca2af 100644
--- a/gcc/tree-ssa-math-opts.c
+++ b/gcc/tree-ssa-math-opts.c
@@ -566,20 +566,20 @@ pass_cse_reciprocals::execute (function *fun)
FOR_EACH_BB_FN (bb, fun)
{
- gimple_stmt_iterator gsi;
- gimple phi;
tree def;
- for (gsi = gsi_start_phis (bb); !gsi_end_p (gsi); gsi_next (&gsi))
+ for (gimple_phi_iterator gsi = gsi_start_phis (bb); !gsi_end_p (gsi);
+ gsi_next (&gsi))
{
- phi = gsi_stmt (gsi);
+ gimple_phi phi = gsi.phi ();
def = PHI_RESULT (phi);
if (! virtual_operand_p (def)
&& FLOAT_TYPE_P (TREE_TYPE (def)))
execute_cse_reciprocals_1 (NULL, def);
}
- for (gsi = gsi_after_labels (bb); !gsi_end_p (gsi); gsi_next (&gsi))
+ for (gimple_stmt_iterator gsi = gsi_after_labels (bb); !gsi_end_p (gsi);
+ gsi_next (&gsi))
{
gimple stmt = gsi_stmt (gsi);
@@ -594,7 +594,8 @@ pass_cse_reciprocals::execute (function *fun)
continue;
/* Scan for a/func(b) and convert it to reciprocal a*rfunc(b). */
- for (gsi = gsi_after_labels (bb); !gsi_end_p (gsi); gsi_next (&gsi))
+ for (gimple_stmt_iterator gsi = gsi_after_labels (bb); !gsi_end_p (gsi);
+ gsi_next (&gsi))
{
gimple stmt = gsi_stmt (gsi);
tree fndecl;
diff --git a/gcc/tree-ssa-pre.c b/gcc/tree-ssa-pre.c
index c5e1f85..96f2bea 100644
--- a/gcc/tree-ssa-pre.c
+++ b/gcc/tree-ssa-pre.c
@@ -3614,7 +3614,6 @@ compute_avail (void)
/* Loop until the worklist is empty. */
while (sp)
{
- gimple_stmt_iterator gsi;
gimple stmt;
basic_block dom;
@@ -3631,9 +3630,10 @@ compute_avail (void)
}
/* Generate values for PHI nodes. */
- for (gsi = gsi_start_phis (block); !gsi_end_p (gsi); gsi_next (&gsi))
+ for (gimple_phi_iterator gsi = gsi_start_phis (block); !gsi_end_p (gsi);
+ gsi_next (&gsi))
{
- tree result = gimple_phi_result (gsi_stmt (gsi));
+ tree result = gimple_phi_result (gsi.phi ());
/* We have no need for virtual phis, as they don't represent
actual computations. */
@@ -3653,7 +3653,8 @@ compute_avail (void)
/* Now compute value numbers and populate value sets with all
the expressions computed in BLOCK. */
- for (gsi = gsi_start_bb (block); !gsi_end_p (gsi); gsi_next (&gsi))
+ for (gimple_stmt_iterator gsi = gsi_start_bb (block); !gsi_end_p (gsi);
+ gsi_next (&gsi))
{
ssa_op_iter iter;
tree op;
@@ -3949,9 +3950,6 @@ public:
void
eliminate_dom_walker::before_dom_children (basic_block b)
{
- gimple_stmt_iterator gsi;
- gimple stmt;
-
/* Mark new bb. */
el_avail_stack.safe_push (NULL_TREE);
@@ -3959,9 +3957,9 @@ eliminate_dom_walker::before_dom_children (basic_block b)
tailmerging. Eventually we can reduce its reliance on SCCVN now
that we fully copy/constant-propagate (most) things. */
- for (gsi = gsi_start_phis (b); !gsi_end_p (gsi);)
+ for (gimple_phi_iterator gsi = gsi_start_phis (b); !gsi_end_p (gsi);)
{
- gimple phi = gsi_stmt (gsi);
+ gimple_phi phi = gsi.phi ();
tree res = PHI_RESULT (phi);
if (virtual_operand_p (res))
@@ -4022,10 +4020,12 @@ eliminate_dom_walker::before_dom_children (basic_block b)
gsi_next (&gsi);
}
- for (gsi = gsi_start_bb (b); !gsi_end_p (gsi); gsi_next (&gsi))
+ for (gimple_stmt_iterator gsi = gsi_start_bb (b);
+ !gsi_end_p (gsi);
+ gsi_next (&gsi))
{
tree sprime = NULL_TREE;
- stmt = gsi_stmt (gsi);
+ gimple stmt = gsi_stmt (gsi);
tree lhs = gimple_get_lhs (stmt);
if (lhs && TREE_CODE (lhs) == SSA_NAME
&& !gimple_has_volatile_ops (stmt)
@@ -4412,9 +4412,11 @@ eliminate_dom_walker::before_dom_children (basic_block b)
edge e;
FOR_EACH_EDGE (e, ei, b->succs)
{
- for (gsi = gsi_start_phis (e->dest); !gsi_end_p (gsi); gsi_next (&gsi))
+ for (gimple_phi_iterator gsi = gsi_start_phis (e->dest);
+ !gsi_end_p (gsi);
+ gsi_next (&gsi))
{
- gimple phi = gsi_stmt (gsi);
+ gimple_phi phi = gsi.phi ();
use_operand_p use_p = PHI_ARG_DEF_PTR_FROM_EDGE (phi, e);
tree arg = USE_FROM_PTR (use_p);
if (TREE_CODE (arg) != SSA_NAME
diff --git a/gcc/tree-ssa-strlen.c b/gcc/tree-ssa-strlen.c
index bb42cc7..e29efcb 100644
--- a/gcc/tree-ssa-strlen.c
+++ b/gcc/tree-ssa-strlen.c
@@ -2025,7 +2025,6 @@ public:
void
strlen_dom_walker::before_dom_children (basic_block bb)
{
- gimple_stmt_iterator gsi;
basic_block dombb = get_immediate_dominator (CDI_DOMINATORS, bb);
if (dombb == NULL)
@@ -2035,9 +2034,10 @@ strlen_dom_walker::before_dom_children (basic_block bb)
stridx_to_strinfo = ((vec<strinfo, va_heap, vl_embed> *) dombb->aux);
if (stridx_to_strinfo)
{
- for (gsi = gsi_start_phis (bb); !gsi_end_p (gsi); gsi_next (&gsi))
+ for (gimple_phi_iterator gsi = gsi_start_phis (bb); !gsi_end_p (gsi);
+ gsi_next (&gsi))
{
- gimple phi = gsi_stmt (gsi);
+ gimple_phi phi = gsi.phi ();
if (virtual_operand_p (gimple_phi_result (phi)))
{
bitmap visited = BITMAP_ALLOC (NULL);
@@ -2074,9 +2074,10 @@ strlen_dom_walker::before_dom_children (basic_block bb)
/* If all PHI arguments have the same string index, the PHI result
has it as well. */
- for (gsi = gsi_start_phis (bb); !gsi_end_p (gsi); gsi_next (&gsi))
+ for (gimple_phi_iterator gsi = gsi_start_phis (bb); !gsi_end_p (gsi);
+ gsi_next (&gsi))
{
- gimple phi = gsi_stmt (gsi);
+ gimple_phi phi = gsi.phi ();
tree result = gimple_phi_result (phi);
if (!virtual_operand_p (result) && POINTER_TYPE_P (TREE_TYPE (result)))
{
@@ -2094,7 +2095,7 @@ strlen_dom_walker::before_dom_children (basic_block bb)
}
/* Attempt to optimize individual statements. */
- for (gsi = gsi_start_bb (bb); !gsi_end_p (gsi); )
+ for (gimple_stmt_iterator gsi = gsi_start_bb (bb); !gsi_end_p (gsi); )
if (strlen_optimize_stmt (&gsi))
gsi_next (&gsi);
diff --git a/gcc/tree-ssa-structalias.c b/gcc/tree-ssa-structalias.c
index 550bfb4..193607d 100644
--- a/gcc/tree-ssa-structalias.c
+++ b/gcc/tree-ssa-structalias.c
@@ -6776,17 +6776,17 @@ compute_points_to_sets (void)
/* Now walk all statements and build the constraint set. */
FOR_EACH_BB_FN (bb, cfun)
{
- gimple_stmt_iterator gsi;
-
- for (gsi = gsi_start_phis (bb); !gsi_end_p (gsi); gsi_next (&gsi))
+ for (gimple_phi_iterator gsi = gsi_start_phis (bb); !gsi_end_p (gsi);
+ gsi_next (&gsi))
{
- gimple phi = gsi_stmt (gsi);
+ gimple_phi phi = gsi.phi ();
if (! virtual_operand_p (gimple_phi_result (phi)))
find_func_aliases (cfun, phi);
}
- for (gsi = gsi_start_bb (bb); !gsi_end_p (gsi); gsi_next (&gsi))
+ for (gimple_stmt_iterator gsi = gsi_start_bb (bb); !gsi_end_p (gsi);
+ gsi_next (&gsi))
{
gimple stmt = gsi_stmt (gsi);
@@ -7166,18 +7166,17 @@ ipa_pta_execute (void)
/* Build constriants for the function body. */
FOR_EACH_BB_FN (bb, func)
{
- gimple_stmt_iterator gsi;
-
- for (gsi = gsi_start_phis (bb); !gsi_end_p (gsi);
+ for (gimple_phi_iterator gsi = gsi_start_phis (bb); !gsi_end_p (gsi);
gsi_next (&gsi))
{
- gimple phi = gsi_stmt (gsi);
+ gimple_phi phi = gsi.phi ();
if (! virtual_operand_p (gimple_phi_result (phi)))
find_func_aliases (func, phi);
}
- for (gsi = gsi_start_bb (bb); !gsi_end_p (gsi); gsi_next (&gsi))
+ for (gimple_stmt_iterator gsi = gsi_start_bb (bb); !gsi_end_p (gsi);
+ gsi_next (&gsi))
{
gimple stmt = gsi_stmt (gsi);
diff --git a/gcc/tree-ssa-tail-merge.c b/gcc/tree-ssa-tail-merge.c
index a98fc90..e7a865a 100644
--- a/gcc/tree-ssa-tail-merge.c
+++ b/gcc/tree-ssa-tail-merge.c
@@ -457,13 +457,12 @@ same_succ_hash (const_same_succ e)
unsigned int first = bitmap_first_set_bit (e->bbs);
basic_block bb = BASIC_BLOCK_FOR_FN (cfun, first);
int size = 0;
- gimple_stmt_iterator gsi;
gimple stmt;
tree arg;
unsigned int s;
bitmap_iterator bs;
- for (gsi = gsi_start_nondebug_bb (bb);
+ for (gimple_stmt_iterator gsi = gsi_start_nondebug_bb (bb);
!gsi_end_p (gsi); gsi_next_nondebug (&gsi))
{
stmt = gsi_stmt (gsi);
@@ -506,10 +505,12 @@ same_succ_hash (const_same_succ e)
EXECUTE_IF_SET_IN_BITMAP (e->succs, 0, s, bs)
{
int n = find_edge (bb, BASIC_BLOCK_FOR_FN (cfun, s))->dest_idx;
- for (gsi = gsi_start_phis (BASIC_BLOCK_FOR_FN (cfun, s)); !gsi_end_p (gsi);
+ for (gimple_phi_iterator gsi =
+ gsi_start_phis (BASIC_BLOCK_FOR_FN (cfun, s));
+ !gsi_end_p (gsi);
gsi_next (&gsi))
{
- gimple phi = gsi_stmt (gsi);
+ gimple_phi phi = gsi.phi ();
tree lhs = gimple_phi_result (phi);
tree val = gimple_phi_arg_def (phi, n);
@@ -846,9 +847,8 @@ same_succ_flush_bbs (bitmap bbs)
static void
release_last_vdef (basic_block bb)
{
- gimple_stmt_iterator i;
-
- for (i = gsi_last_bb (bb); !gsi_end_p (i); gsi_prev_nondebug (&i))
+ for (gimple_stmt_iterator i = gsi_last_bb (bb); !gsi_end_p (i);
+ gsi_prev_nondebug (&i))
{
gimple stmt = gsi_stmt (i);
if (gimple_vdef (stmt) == NULL_TREE)
@@ -858,9 +858,10 @@ release_last_vdef (basic_block bb)
return;
}
- for (i = gsi_start_phis (bb); !gsi_end_p (i); gsi_next (&i))
+ for (gimple_phi_iterator i = gsi_start_phis (bb); !gsi_end_p (i);
+ gsi_next (&i))
{
- gimple phi = gsi_stmt (i);
+ gimple_phi phi = i.phi ();
tree res = gimple_phi_result (phi);
if (!virtual_operand_p (res))
diff --git a/gcc/tree-ssa.c b/gcc/tree-ssa.c
index a85dff9..9721413 100644
--- a/gcc/tree-ssa.c
+++ b/gcc/tree-ssa.c
@@ -358,7 +358,7 @@ insert_debug_temp_for_var_def (gimple_stmt_iterator *gsi, tree var)
we'll have to drop debug information. */
if (gimple_code (def_stmt) == GIMPLE_PHI)
{
- value = degenerate_phi_result (def_stmt);
+ value = degenerate_phi_result (as_a <gimple_phi> (def_stmt));
if (value && walk_tree (&value, find_released_ssa_name, NULL, NULL))
value = NULL;
/* error_mark_node is what fixup_noreturn_call changes PHI arguments
@@ -830,7 +830,7 @@ verify_use (basic_block bb, basic_block def_bb, use_operand_p use_p,
definition of SSA_NAME. */
static bool
-verify_phi_args (gimple phi, basic_block bb, basic_block *definition_block)
+verify_phi_args (gimple_phi phi, basic_block bb, basic_block *definition_block)
{
edge e;
bool err = false;
@@ -961,9 +961,7 @@ verify_ssa (bool check_modified_stmt, bool check_ssa_operands)
FOR_EACH_BB_FN (bb, cfun)
{
edge e;
- gimple phi;
edge_iterator ei;
- gimple_stmt_iterator gsi;
/* Make sure that all edges have a clear 'aux' field. */
FOR_EACH_EDGE (e, ei, bb->preds)
@@ -977,9 +975,9 @@ verify_ssa (bool check_modified_stmt, bool check_ssa_operands)
}
/* Verify the arguments for every PHI node in the block. */
- for (gsi = gsi_start_phis (bb); !gsi_end_p (gsi); gsi_next (&gsi))
+ for (gimple_phi_iterator gsi = gsi_start_phis (bb); !gsi_end_p (gsi); gsi_next (&gsi))
{
- phi = gsi_stmt (gsi);
+ gimple_phi phi = gsi.phi ();
if (verify_phi_args (phi, bb, definition_block))
goto err;
@@ -988,7 +986,8 @@ verify_ssa (bool check_modified_stmt, bool check_ssa_operands)
}
/* Now verify all the uses and vuses in every statement of the block. */
- for (gsi = gsi_start_bb (bb); !gsi_end_p (gsi); gsi_next (&gsi))
+ for (gimple_stmt_iterator gsi = gsi_start_bb (bb); !gsi_end_p (gsi);
+ gsi_next (&gsi))
{
gimple stmt = gsi_stmt (gsi);
use_operand_p use_p;
@@ -1397,7 +1396,6 @@ maybe_optimize_var (tree var, bitmap addresses_taken, bitmap not_reg_needs,
void
execute_update_addresses_taken (void)
{
- gimple_stmt_iterator gsi;
basic_block bb;
bitmap addresses_taken = BITMAP_ALLOC (NULL);
bitmap not_reg_needs = BITMAP_ALLOC (NULL);
@@ -1411,7 +1409,8 @@ execute_update_addresses_taken (void)
the function body. */
FOR_EACH_BB_FN (bb, cfun)
{
- for (gsi = gsi_start_bb (bb); !gsi_end_p (gsi); gsi_next (&gsi))
+ for (gimple_stmt_iterator gsi = gsi_start_bb (bb); !gsi_end_p (gsi);
+ gsi_next (&gsi))
{
gimple stmt = gsi_stmt (gsi);
enum gimple_code code = gimple_code (stmt);
@@ -1481,10 +1480,11 @@ execute_update_addresses_taken (void)
}
}
- for (gsi = gsi_start_phis (bb); !gsi_end_p (gsi); gsi_next (&gsi))
+ for (gimple_phi_iterator gsi = gsi_start_phis (bb); !gsi_end_p (gsi);
+ gsi_next (&gsi))
{
size_t i;
- gimple phi = gsi_stmt (gsi);
+ gimple_phi phi = gsi.phi ();
for (i = 0; i < gimple_phi_num_args (phi); i++)
{
@@ -1513,7 +1513,7 @@ execute_update_addresses_taken (void)
if (!bitmap_empty_p (suitable_for_renaming))
{
FOR_EACH_BB_FN (bb, cfun)
- for (gsi = gsi_start_bb (bb); !gsi_end_p (gsi);)
+ for (gimple_stmt_iterator gsi = gsi_start_bb (bb); !gsi_end_p (gsi);)
{
gimple stmt = gsi_stmt (gsi);
diff --git a/gcc/tree-stdarg.c b/gcc/tree-stdarg.c
index a9d0a48..973e866 100644
--- a/gcc/tree-stdarg.c
+++ b/gcc/tree-stdarg.c
@@ -538,14 +538,13 @@ check_all_va_list_escapes (struct stdarg_info *si)
FOR_EACH_BB_FN (bb, cfun)
{
- gimple_stmt_iterator i;
-
- for (i = gsi_start_phis (bb); !gsi_end_p (i); gsi_next (&i))
+ for (gimple_phi_iterator i = gsi_start_phis (bb); !gsi_end_p (i);
+ gsi_next (&i))
{
tree lhs;
use_operand_p uop;
ssa_op_iter soi;
- gimple phi = gsi_stmt (i);
+ gimple_phi phi = i.phi ();
lhs = PHI_RESULT (phi);
if (virtual_operand_p (lhs)
@@ -571,7 +570,8 @@ check_all_va_list_escapes (struct stdarg_info *si)
}
}
- for (i = gsi_start_bb (bb); !gsi_end_p (i); gsi_next (&i))
+ for (gimple_stmt_iterator i = gsi_start_bb (bb); !gsi_end_p (i);
+ gsi_next (&i))
{
gimple stmt = gsi_stmt (i);
tree use;
@@ -835,8 +835,6 @@ pass_stdarg::execute (function *fun)
FOR_EACH_BB_FN (bb, fun)
{
- gimple_stmt_iterator i;
-
si.compute_sizes = -1;
si.bb = bb;
@@ -850,9 +848,10 @@ pass_stdarg::execute (function *fun)
use_operand_p uop;
ssa_op_iter soi;
- for (i = gsi_start_phis (bb); !gsi_end_p (i); gsi_next (&i))
+ for (gimple_phi_iterator i = gsi_start_phis (bb); !gsi_end_p (i);
+ gsi_next (&i))
{
- gimple phi = gsi_stmt (i);
+ gimple_phi phi = i.phi ();
lhs = PHI_RESULT (phi);
if (virtual_operand_p (lhs))
@@ -882,7 +881,7 @@ pass_stdarg::execute (function *fun)
}
}
- for (i = gsi_start_bb (bb);
+ for (gimple_stmt_iterator i = gsi_start_bb (bb);
!gsi_end_p (i) && !va_list_escapes;
gsi_next (&i))
{
diff --git a/gcc/tree-switch-conversion.c b/gcc/tree-switch-conversion.c
index 692b0d1..dc84ef2 100644
--- a/gcc/tree-switch-conversion.c
+++ b/gcc/tree-switch-conversion.c
@@ -1052,7 +1052,7 @@ array_value_type (gimple_switch swtch, tree type, int num,
static void
build_one_array (gimple_switch swtch, int num, tree arr_index_type,
- gimple phi, tree tidx, struct switch_conv_info *info)
+ gimple_phi phi, tree tidx, struct switch_conv_info *info)
{
tree name, cst;
gimple load;
@@ -1123,6 +1123,7 @@ build_arrays (gimple_switch swtch, struct switch_conv_info *info)
tree tidx, sub, utype;
gimple stmt;
gimple_stmt_iterator gsi;
+ gimple_phi_iterator gpi;
int i;
location_t loc = gimple_location (swtch);
@@ -1148,9 +1149,9 @@ build_arrays (gimple_switch swtch, struct switch_conv_info *info)
update_stmt (stmt);
info->arr_ref_first = stmt;
- for (gsi = gsi_start_phis (info->final_bb), i = 0;
- !gsi_end_p (gsi); gsi_next (&gsi), i++)
- build_one_array (swtch, i, arr_index_type, gsi_stmt (gsi), tidx, info);
+ for (gpi = gsi_start_phis (info->final_bb), i = 0;
+ !gsi_end_p (gpi); gsi_next (&gpi), i++)
+ build_one_array (swtch, i, arr_index_type, gpi.phi (), tidx, info);
}
/* Generates and appropriately inserts loads of default values at the position
diff --git a/gcc/tree-vect-loop-manip.c b/gcc/tree-vect-loop-manip.c
index 95c00fa..c6a5c4f 100644
--- a/gcc/tree-vect-loop-manip.c
+++ b/gcc/tree-vect-loop-manip.c
@@ -85,7 +85,6 @@ rename_use_op (use_operand_p op_p)
static void
rename_variables_in_bb (basic_block bb)
{
- gimple_stmt_iterator gsi;
gimple stmt;
use_operand_p use_p;
ssa_op_iter iter;
@@ -93,7 +92,8 @@ rename_variables_in_bb (basic_block bb)
edge_iterator ei;
struct loop *loop = bb->loop_father;
- for (gsi = gsi_start_bb (bb); !gsi_end_p (gsi); gsi_next (&gsi))
+ for (gimple_stmt_iterator gsi = gsi_start_bb (bb); !gsi_end_p (gsi);
+ gsi_next (&gsi))
{
stmt = gsi_stmt (gsi);
FOR_EACH_SSA_USE_OPERAND (use_p, stmt, iter, SSA_OP_ALL_USES)
@@ -104,8 +104,9 @@ rename_variables_in_bb (basic_block bb)
{
if (!flow_bb_inside_loop_p (loop, e->src))
continue;
- for (gsi = gsi_start_phis (bb); !gsi_end_p (gsi); gsi_next (&gsi))
- rename_use_op (PHI_ARG_DEF_PTR_FROM_EDGE (gsi_stmt (gsi), e));
+ for (gimple_phi_iterator gsi = gsi_start_phis (bb); !gsi_end_p (gsi);
+ gsi_next (&gsi))
+ rename_use_op (PHI_ARG_DEF_PTR_FROM_EDGE (gsi.phi (), e));
}
}
diff --git a/gcc/tree-vect-loop.c b/gcc/tree-vect-loop.c
index 19535b3..6c5053f 100644
--- a/gcc/tree-vect-loop.c
+++ b/gcc/tree-vect-loop.c
@@ -187,10 +187,9 @@ vect_determine_vectorization_factor (loop_vec_info loop_vinfo)
struct loop *loop = LOOP_VINFO_LOOP (loop_vinfo);
basic_block *bbs = LOOP_VINFO_BBS (loop_vinfo);
int nbbs = loop->num_nodes;
- gimple_stmt_iterator si;
unsigned int vectorization_factor = 0;
tree scalar_type;
- gimple phi;
+ gimple_phi phi;
tree vectype;
unsigned int nunits;
stmt_vec_info stmt_info;
@@ -209,9 +208,10 @@ vect_determine_vectorization_factor (loop_vec_info loop_vinfo)
{
basic_block bb = bbs[i];
- for (si = gsi_start_phis (bb); !gsi_end_p (si); gsi_next (&si))
+ for (gimple_phi_iterator si = gsi_start_phis (bb); !gsi_end_p (si);
+ gsi_next (&si))
{
- phi = gsi_stmt (si);
+ phi = si.phi ();
stmt_info = vinfo_for_stmt (phi);
if (dump_enabled_p ())
{
@@ -269,7 +269,8 @@ vect_determine_vectorization_factor (loop_vec_info loop_vinfo)
}
}
- for (si = gsi_start_bb (bb); !gsi_end_p (si) || analyze_pattern_stmt;)
+ for (gimple_stmt_iterator si = gsi_start_bb (bb);
+ !gsi_end_p (si) || analyze_pattern_stmt;)
{
tree vf_vectype;
@@ -1334,10 +1335,8 @@ vect_analyze_loop_operations (loop_vec_info loop_vinfo, bool slp)
struct loop *loop = LOOP_VINFO_LOOP (loop_vinfo);
basic_block *bbs = LOOP_VINFO_BBS (loop_vinfo);
int nbbs = loop->num_nodes;
- gimple_stmt_iterator si;
unsigned int vectorization_factor = 0;
int i;
- gimple phi;
stmt_vec_info stmt_info;
bool need_to_vectorize = false;
int min_profitable_iters;
@@ -1364,7 +1363,8 @@ vect_analyze_loop_operations (loop_vec_info loop_vinfo, bool slp)
for (i = 0; i < nbbs; i++)
{
basic_block bb = bbs[i];
- for (si = gsi_start_bb (bb); !gsi_end_p (si); gsi_next (&si))
+ for (gimple_stmt_iterator si = gsi_start_bb (bb); !gsi_end_p (si);
+ gsi_next (&si))
{
gimple stmt = gsi_stmt (si);
stmt_vec_info stmt_info = vinfo_for_stmt (stmt);
@@ -1394,9 +1394,10 @@ vect_analyze_loop_operations (loop_vec_info loop_vinfo, bool slp)
{
basic_block bb = bbs[i];
- for (si = gsi_start_phis (bb); !gsi_end_p (si); gsi_next (&si))
+ for (gimple_phi_iterator si = gsi_start_phis (bb); !gsi_end_p (si);
+ gsi_next (&si))
{
- phi = gsi_stmt (si);
+ gimple_phi phi = si.phi ();
ok = true;
stmt_info = vinfo_for_stmt (phi);
@@ -1499,7 +1500,8 @@ vect_analyze_loop_operations (loop_vec_info loop_vinfo, bool slp)
}
}
- for (si = gsi_start_bb (bb); !gsi_end_p (si); gsi_next (&si))
+ for (gimple_stmt_iterator si = gsi_start_bb (bb); !gsi_end_p (si);
+ gsi_next (&si))
{
gimple stmt = gsi_stmt (si);
if (!gimple_clobber_p (stmt)
@@ -5773,7 +5775,6 @@ vect_transform_loop (loop_vec_info loop_vinfo)
struct loop *loop = LOOP_VINFO_LOOP (loop_vinfo);
basic_block *bbs = LOOP_VINFO_BBS (loop_vinfo);
int nbbs = loop->num_nodes;
- gimple_stmt_iterator si;
int i;
tree ratio = NULL;
int vectorization_factor = LOOP_VINFO_VECT_FACTOR (loop_vinfo);
@@ -5882,11 +5883,11 @@ vect_transform_loop (loop_vec_info loop_vinfo)
{
basic_block bb = bbs[i];
stmt_vec_info stmt_info;
- gimple phi;
- for (si = gsi_start_phis (bb); !gsi_end_p (si); gsi_next (&si))
+ for (gimple_phi_iterator si = gsi_start_phis (bb); !gsi_end_p (si);
+ gsi_next (&si))
{
- phi = gsi_stmt (si);
+ gimple_phi phi = si.phi ();
if (dump_enabled_p ())
{
dump_printf_loc (MSG_NOTE, vect_location,
@@ -5920,7 +5921,8 @@ vect_transform_loop (loop_vec_info loop_vinfo)
}
pattern_stmt = NULL;
- for (si = gsi_start_bb (bb); !gsi_end_p (si) || transform_pattern_stmt;)
+ for (gimple_stmt_iterator si = gsi_start_bb (bb);
+ !gsi_end_p (si) || transform_pattern_stmt;)
{
bool is_store;
diff --git a/gcc/tree-vrp.c b/gcc/tree-vrp.c
index 303af8d..a164870 100644
--- a/gcc/tree-vrp.c
+++ b/gcc/tree-vrp.c
@@ -5930,7 +5930,6 @@ find_switch_asserts (basic_block bb, gimple_switch last)
static bool
find_assert_locations_1 (basic_block bb, sbitmap live)
{
- gimple_stmt_iterator si;
gimple last;
bool need_assert;
@@ -5954,7 +5953,8 @@ find_assert_locations_1 (basic_block bb, sbitmap live)
/* Traverse all the statements in BB marking used names and looking
for statements that may infer assertions for their used operands. */
- for (si = gsi_last_bb (bb); !gsi_end_p (si); gsi_prev (&si))
+ for (gimple_stmt_iterator si = gsi_last_bb (bb); !gsi_end_p (si);
+ gsi_prev (&si))
{
gimple stmt;
tree op;
@@ -6027,11 +6027,12 @@ find_assert_locations_1 (basic_block bb, sbitmap live)
}
/* Traverse all PHI nodes in BB, updating live. */
- for (si = gsi_start_phis (bb); !gsi_end_p (si); gsi_next (&si))
+ for (gimple_phi_iterator si = gsi_start_phis (bb); !gsi_end_p (si);
+ gsi_next (&si))
{
use_operand_p arg_p;
ssa_op_iter i;
- gimple phi = gsi_stmt (si);
+ gimple_phi phi = si.phi ();
tree res = gimple_phi_result (phi);
if (virtual_operand_p (res))
@@ -6833,11 +6834,10 @@ vrp_initialize (void)
FOR_EACH_BB_FN (bb, cfun)
{
- gimple_stmt_iterator si;
-
- for (si = gsi_start_phis (bb); !gsi_end_p (si); gsi_next (&si))
+ for (gimple_phi_iterator si = gsi_start_phis (bb); !gsi_end_p (si);
+ gsi_next (&si))
{
- gimple phi = gsi_stmt (si);
+ gimple_phi phi = si.phi ();
if (!stmt_interesting_for_vrp (phi))
{
tree lhs = PHI_RESULT (phi);
@@ -6848,7 +6848,8 @@ vrp_initialize (void)
prop_set_simulate_again (phi, true);
}
- for (si = gsi_start_bb (bb); !gsi_end_p (si); gsi_next (&si))
+ for (gimple_stmt_iterator si = gsi_start_bb (bb); !gsi_end_p (si);
+ gsi_next (&si))
{
gimple stmt = gsi_stmt (si);
--
1.8.5.3
^ permalink raw reply [flat|nested] 93+ messages in thread
* [gimple-classes, committed 77/92] Concretize gimple_call_nothrow_p
2014-10-27 20:35 [gimple-classes, committed 00/92] Initial slew of commits David Malcolm
` (41 preceding siblings ...)
2014-10-27 20:38 ` [gimple-classes, committed 88/92] Preparatory work before subclass renaming David Malcolm
@ 2014-10-27 20:38 ` David Malcolm
2014-10-27 20:38 ` [gimple-classes, committed 90/92] Automated renaming of gimple subclasses David Malcolm
` (48 subsequent siblings)
91 siblings, 0 replies; 93+ messages in thread
From: David Malcolm @ 2014-10-27 20:38 UTC (permalink / raw)
To: gcc-patches; +Cc: David Malcolm
This corresponds to:
[PATCH 79/89] Concretize gimple_call_nothrow_p
https://gcc.gnu.org/ml/gcc-patches/2014-04/msg01204.html
from the original 89-patch kit
That earlier patch was approved by Jeff:
> OK once prerequisites have gone in.
in https://gcc.gnu.org/ml/gcc-patches/2014-05/msg00844.html
gcc/
* gimple.h (gimple_call_nothrow_p): Require a gimple_call.
* tree-eh.c (stmt_could_throw_p): Add checked cast to gimple_call.
* tree-vect-slp.c (vect_build_slp_tree_1): Replace call to
is_gimple_call with dyn_cast<gimple_call>, introducing a local.
---
gcc/ChangeLog.gimple-classes | 11 +++++++++++
gcc/gimple.h | 3 +--
gcc/tree-eh.c | 2 +-
gcc/tree-vect-slp.c | 15 ++++++++-------
4 files changed, 21 insertions(+), 10 deletions(-)
diff --git a/gcc/ChangeLog.gimple-classes b/gcc/ChangeLog.gimple-classes
index 21e051b..503fff5 100644
--- a/gcc/ChangeLog.gimple-classes
+++ b/gcc/ChangeLog.gimple-classes
@@ -1,5 +1,16 @@
2014-10-24 David Malcolm <dmalcolm@redhat.com>
+ Concretize gimple_call_nothrow_p
+
+ * gimple.h (gimple_call_nothrow_p): Require a gimple_call.
+
+ * tree-eh.c (stmt_could_throw_p): Add checked cast to gimple_call.
+
+ * tree-vect-slp.c (vect_build_slp_tree_1): Replace call to
+ is_gimple_call with dyn_cast<gimple_call>, introducing a local.
+
+2014-10-24 David Malcolm <dmalcolm@redhat.com>
+
Concretize gimple_call_set_nothrow
* gimple.h (gimple_call_set_nothrow): Require a gimple_call.
diff --git a/gcc/gimple.h b/gcc/gimple.h
index e220228..ac6d664 100644
--- a/gcc/gimple.h
+++ b/gcc/gimple.h
@@ -2923,9 +2923,8 @@ gimple_call_set_nothrow (gimple_call s, bool nothrow_p)
/* Return true if S is a nothrow call. */
static inline bool
-gimple_call_nothrow_p (gimple s)
+gimple_call_nothrow_p (gimple_call s)
{
- GIMPLE_CHECK (s, GIMPLE_CALL);
return (gimple_call_flags (s) & ECF_NOTHROW) != 0;
}
diff --git a/gcc/tree-eh.c b/gcc/tree-eh.c
index 2ef68c9..cd84756 100644
--- a/gcc/tree-eh.c
+++ b/gcc/tree-eh.c
@@ -2792,7 +2792,7 @@ stmt_could_throw_p (gimple stmt)
return true;
case GIMPLE_CALL:
- return !gimple_call_nothrow_p (stmt);
+ return !gimple_call_nothrow_p (as_a <gimple_call> (stmt));
case GIMPLE_ASSIGN:
case GIMPLE_COND:
diff --git a/gcc/tree-vect-slp.c b/gcc/tree-vect-slp.c
index 5984229..8541de8 100644
--- a/gcc/tree-vect-slp.c
+++ b/gcc/tree-vect-slp.c
@@ -505,20 +505,21 @@ vect_build_slp_tree_1 (loop_vec_info loop_vinfo, bb_vec_info bb_vinfo,
vectorization_factor = *max_nunits;
}
- if (is_gimple_call (stmt))
+ if (gimple_call call_stmt = dyn_cast <gimple_call> (stmt))
{
rhs_code = CALL_EXPR;
- if (gimple_call_internal_p (stmt)
- || gimple_call_tail_p (stmt)
- || gimple_call_noreturn_p (stmt)
- || !gimple_call_nothrow_p (stmt)
- || gimple_call_chain (stmt))
+ if (gimple_call_internal_p (call_stmt)
+ || gimple_call_tail_p (call_stmt)
+ || gimple_call_noreturn_p (call_stmt)
+ || !gimple_call_nothrow_p (call_stmt)
+ || gimple_call_chain (call_stmt))
{
if (dump_enabled_p ())
{
dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location,
"Build SLP failed: unsupported call type ");
- dump_gimple_stmt (MSG_MISSED_OPTIMIZATION, TDF_SLIM, stmt, 0);
+ dump_gimple_stmt (MSG_MISSED_OPTIMIZATION, TDF_SLIM,
+ call_stmt, 0);
dump_printf (MSG_MISSED_OPTIMIZATION, "\n");
}
/* Fatal mismatch. */
--
1.8.5.3
^ permalink raw reply [flat|nested] 93+ messages in thread
* [gimple-classes, committed 85/92] Use gimple_call in some places within tree-ssa-dom.c
2014-10-27 20:35 [gimple-classes, committed 00/92] Initial slew of commits David Malcolm
` (37 preceding siblings ...)
2014-10-27 20:38 ` [gimple-classes, committed 49/92] Update GRAPHITE to use more concrete gimple statement classes David Malcolm
@ 2014-10-27 20:38 ` David Malcolm
2014-10-27 20:38 ` [gimple-classes, committed 68/92] Concretize locals within expand_omp_for_init_counts David Malcolm
` (52 subsequent siblings)
91 siblings, 0 replies; 93+ messages in thread
From: David Malcolm @ 2014-10-27 20:38 UTC (permalink / raw)
To: gcc-patches; +Cc: David Malcolm
This corresponds to:
[PATCH 87/89] Use gimple_call in some places within tree-ssa-dom.c
https://gcc.gnu.org/ml/gcc-patches/2014-04/msg01173.html
from the original 89-patch kit
That earlier patch was approved by Jeff:
> OK when prereqs go in.
in https://gcc.gnu.org/ml/gcc-patches/2014-05/msg00856.html
gcc/
* tree-ssa-dom.c (struct hashable_expr): Strengthen field
call.fn_from from gimple to gimple_call.
(initialize_hash_element): Replace check against GIMPLE_CALL
with dyn_cast<gimple_call> and update gimple_call_ uses to use
new gimple_call local, along with fn_from initializer.
(iterative_hash_hashable_expr): Strengthen type of local "fn_from"
from gimple to gimple_call.
(print_expr_hash_elt): Likewise.
---
gcc/ChangeLog.gimple-classes | 13 +++++++++++++
gcc/tree-ssa-dom.c | 20 ++++++++++----------
2 files changed, 23 insertions(+), 10 deletions(-)
diff --git a/gcc/ChangeLog.gimple-classes b/gcc/ChangeLog.gimple-classes
index 9255151..030df86 100644
--- a/gcc/ChangeLog.gimple-classes
+++ b/gcc/ChangeLog.gimple-classes
@@ -1,5 +1,18 @@
2014-10-24 David Malcolm <dmalcolm@redhat.com>
+ Use gimple_call in some places within tree-ssa-dom.c
+
+ * tree-ssa-dom.c (struct hashable_expr): Strengthen field
+ call.fn_from from gimple to gimple_call.
+ (initialize_hash_element): Replace check against GIMPLE_CALL
+ with dyn_cast<gimple_call> and update gimple_call_ uses to use
+ new gimple_call local, along with fn_from initializer.
+ (iterative_hash_hashable_expr): Strengthen type of local "fn_from"
+ from gimple to gimple_call.
+ (print_expr_hash_elt): Likewise.
+
+2014-10-24 David Malcolm <dmalcolm@redhat.com>
+
Concretize gimple_call_copy_flags and ipa_modify_call_arguments
* gimple.h (gimple_call_copy_flags): Require gimple_calls.
diff --git a/gcc/tree-ssa-dom.c b/gcc/tree-ssa-dom.c
index 47e45da..a49601c 100644
--- a/gcc/tree-ssa-dom.c
+++ b/gcc/tree-ssa-dom.c
@@ -81,7 +81,7 @@ struct hashable_expr
struct { enum tree_code op; tree opnd; } unary;
struct { enum tree_code op; tree opnd0, opnd1; } binary;
struct { enum tree_code op; tree opnd0, opnd1, opnd2; } ternary;
- struct { gimple fn_from; bool pure; size_t nargs; tree *args; } call;
+ struct { gimple_call fn_from; bool pure; size_t nargs; tree *args; } call;
struct { size_t nargs; tree *args; } phi;
} ops;
};
@@ -325,18 +325,18 @@ initialize_hash_element (gimple stmt, tree lhs,
expr->ops.binary.opnd0 = gimple_cond_lhs (stmt);
expr->ops.binary.opnd1 = gimple_cond_rhs (stmt);
}
- else if (code == GIMPLE_CALL)
+ else if (gimple_call call_stmt = dyn_cast <gimple_call> (stmt))
{
- size_t nargs = gimple_call_num_args (stmt);
+ size_t nargs = gimple_call_num_args (call_stmt);
size_t i;
- gcc_assert (gimple_call_lhs (stmt));
+ gcc_assert (gimple_call_lhs (call_stmt));
- expr->type = TREE_TYPE (gimple_call_lhs (stmt));
+ expr->type = TREE_TYPE (gimple_call_lhs (call_stmt));
expr->kind = EXPR_CALL;
- expr->ops.call.fn_from = stmt;
+ expr->ops.call.fn_from = call_stmt;
- if (gimple_call_flags (stmt) & (ECF_CONST | ECF_PURE))
+ if (gimple_call_flags (call_stmt) & (ECF_CONST | ECF_PURE))
expr->ops.call.pure = true;
else
expr->ops.call.pure = false;
@@ -344,7 +344,7 @@ initialize_hash_element (gimple stmt, tree lhs,
expr->ops.call.nargs = nargs;
expr->ops.call.args = XCNEWVEC (tree, nargs);
for (i = 0; i < nargs; i++)
- expr->ops.call.args[i] = gimple_call_arg (stmt, i);
+ expr->ops.call.args[i] = gimple_call_arg (call_stmt, i);
}
else if (gimple_switch swtch_stmt = dyn_cast <gimple_switch> (stmt))
{
@@ -635,7 +635,7 @@ add_hashable_expr (const struct hashable_expr *expr, hash &hstate)
{
size_t i;
enum tree_code code = CALL_EXPR;
- gimple fn_from;
+ gimple_call fn_from;
hstate.add_object (code);
fn_from = expr->ops.call.fn_from;
@@ -711,7 +711,7 @@ print_expr_hash_elt (FILE * stream, const struct expr_hash_elt *element)
{
size_t i;
size_t nargs = element->expr.ops.call.nargs;
- gimple fn_from;
+ gimple_call fn_from;
fn_from = element->expr.ops.call.fn_from;
if (gimple_call_internal_p (fn_from))
--
1.8.5.3
^ permalink raw reply [flat|nested] 93+ messages in thread
* [gimple-classes, committed 80/92] Concretize gimple_call_set_fntype
2014-10-27 20:35 [gimple-classes, committed 00/92] Initial slew of commits David Malcolm
` (28 preceding siblings ...)
2014-10-27 20:38 ` [gimple-classes, committed 73/92] Concretize gimple_cond_set_{lhs|rhs} David Malcolm
@ 2014-10-27 20:38 ` David Malcolm
2014-10-27 20:38 ` [gimple-classes, committed 84/92] Concretize gimple_call_copy_flags and ipa_modify_call_arguments David Malcolm
` (61 subsequent siblings)
91 siblings, 0 replies; 93+ messages in thread
From: David Malcolm @ 2014-10-27 20:38 UTC (permalink / raw)
To: gcc-patches; +Cc: David Malcolm
This corresponds to:
[PATCH 82/89] Concretize gimple_call_set_fntype
https://gcc.gnu.org/ml/gcc-patches/2014-04/msg01187.html
from the original 89-patch kit
That earlier patch was approved by Jeff:
> This is fine once prerequisites have gone in.
in https://gcc.gnu.org/ml/gcc-patches/2014-05/msg00840.html
gcc/
* gimple-fold.c (gimple_fold_builtin_sprintf_chk): Strengthen
local "stmt" from gimple to gimple_call.
* gimple.h (gimple_call_set_fntype): Require a gimple_call.
* omp-low.c (lower_omp_1): Add a new local gimple_call "call_stmt",
from a checked cast to gimple_call within the "case GIMPLE_CALL",
for the regions where "stmt" is not subsequently overwritten.
---
gcc/ChangeLog.gimple-classes | 13 +++++++++++++
gcc/gimple-fold.c | 2 +-
gcc/gimple.h | 7 +++----
gcc/omp-low.c | 12 +++++++-----
4 files changed, 24 insertions(+), 10 deletions(-)
diff --git a/gcc/ChangeLog.gimple-classes b/gcc/ChangeLog.gimple-classes
index ae57d57..f0737b9 100644
--- a/gcc/ChangeLog.gimple-classes
+++ b/gcc/ChangeLog.gimple-classes
@@ -1,5 +1,18 @@
2014-10-24 David Malcolm <dmalcolm@redhat.com>
+ Concretize gimple_call_set_fntype
+
+ * gimple-fold.c (gimple_fold_builtin_sprintf_chk): Strengthen
+ local "stmt" from gimple to gimple_call.
+
+ * gimple.h (gimple_call_set_fntype): Require a gimple_call.
+
+ * omp-low.c (lower_omp_1): Add a new local gimple_call "call_stmt",
+ from a checked cast to gimple_call within the "case GIMPLE_CALL",
+ for the regions where "stmt" is not subsequently overwritten.
+
+2014-10-24 David Malcolm <dmalcolm@redhat.com>
+
Concretize gimple_call_set_fn
* gimple.h (gimple_call_set_fn): Require a gimple_call.
diff --git a/gcc/gimple-fold.c b/gcc/gimple-fold.c
index c6ba019..20bdc7d 100644
--- a/gcc/gimple-fold.c
+++ b/gcc/gimple-fold.c
@@ -2050,7 +2050,7 @@ static bool
gimple_fold_builtin_sprintf_chk (gimple_stmt_iterator *gsi,
enum built_in_function fcode)
{
- gimple stmt = gsi_stmt (*gsi);
+ gimple_call stmt = as_a <gimple_call> (gsi_stmt (*gsi));
tree dest, size, len, fn, fmt, flag;
const char *fmt_str;
unsigned nargs = gimple_call_num_args (stmt);
diff --git a/gcc/gimple.h b/gcc/gimple.h
index a7ec1d5..d37c441 100644
--- a/gcc/gimple.h
+++ b/gcc/gimple.h
@@ -2644,13 +2644,12 @@ gimple_call_fntype (const_gimple gs)
return call_stmt->u.fntype;
}
-/* Set the type of the function called by GS to FNTYPE. */
+/* Set the type of the function called by CALL_STMT to FNTYPE. */
static inline void
-gimple_call_set_fntype (gimple gs, tree fntype)
+gimple_call_set_fntype (gimple_call call_stmt, tree fntype)
{
- gimple_statement_call *call_stmt = as_a <gimple_statement_call *> (gs);
- gcc_gimple_checking_assert (!gimple_call_internal_p (gs));
+ gcc_gimple_checking_assert (!gimple_call_internal_p (call_stmt));
call_stmt->u.fntype = fntype;
}
diff --git a/gcc/omp-low.c b/gcc/omp-low.c
index cd0869f..993206f 100644
--- a/gcc/omp-low.c
+++ b/gcc/omp-low.c
@@ -10455,6 +10455,7 @@ lower_omp_1 (gimple_stmt_iterator *gsi_p, omp_context *ctx)
{
gimple stmt = gsi_stmt (*gsi_p);
struct walk_stmt_info wi;
+ gimple_call call_stmt;
if (gimple_has_location (stmt))
input_location = gimple_location (stmt);
@@ -10570,7 +10571,8 @@ lower_omp_1 (gimple_stmt_iterator *gsi_p, omp_context *ctx)
break;
case GIMPLE_CALL:
tree fndecl;
- fndecl = gimple_call_fndecl (stmt);
+ call_stmt = as_a <gimple_call> (stmt);
+ fndecl = gimple_call_fndecl (call_stmt);
if (fndecl
&& DECL_BUILT_IN_CLASS (fndecl) == BUILT_IN_NORMAL)
switch (DECL_FUNCTION_CODE (fndecl))
@@ -10585,7 +10587,7 @@ lower_omp_1 (gimple_stmt_iterator *gsi_p, omp_context *ctx)
cctx = ctx;
if (gimple_code (cctx->stmt) == GIMPLE_OMP_SECTION)
cctx = cctx->outer;
- gcc_assert (gimple_call_lhs (stmt) == NULL_TREE);
+ gcc_assert (gimple_call_lhs (call_stmt) == NULL_TREE);
if (!cctx->cancellable)
{
if (DECL_FUNCTION_CODE (fndecl)
@@ -10599,12 +10601,12 @@ lower_omp_1 (gimple_stmt_iterator *gsi_p, omp_context *ctx)
if (DECL_FUNCTION_CODE (fndecl) == BUILT_IN_GOMP_BARRIER)
{
fndecl = builtin_decl_explicit (BUILT_IN_GOMP_BARRIER_CANCEL);
- gimple_call_set_fndecl (stmt, fndecl);
- gimple_call_set_fntype (stmt, TREE_TYPE (fndecl));
+ gimple_call_set_fndecl (call_stmt, fndecl);
+ gimple_call_set_fntype (call_stmt, TREE_TYPE (fndecl));
}
tree lhs;
lhs = create_tmp_var (TREE_TYPE (TREE_TYPE (fndecl)), NULL);
- gimple_call_set_lhs (stmt, lhs);
+ gimple_call_set_lhs (call_stmt, lhs);
tree fallthru_label;
fallthru_label = create_artificial_label (UNKNOWN_LOCATION);
gimple g;
--
1.8.5.3
^ permalink raw reply [flat|nested] 93+ messages in thread
* [gimple-classes, committed 63/92] Concretize three gimple_try_set_ accessors
2014-10-27 20:35 [gimple-classes, committed 00/92] Initial slew of commits David Malcolm
` (43 preceding siblings ...)
2014-10-27 20:38 ` [gimple-classes, committed 90/92] Automated renaming of gimple subclasses David Malcolm
@ 2014-10-27 20:38 ` David Malcolm
2014-10-27 20:40 ` [gimple-classes, committed 09/92] Update ssa_prop_visit_phi_fn callbacks to take a gimple_phi David Malcolm
` (46 subsequent siblings)
91 siblings, 0 replies; 93+ messages in thread
From: David Malcolm @ 2014-10-27 20:38 UTC (permalink / raw)
To: gcc-patches; +Cc: David Malcolm
This corresponds to:
[PATCH 65/89] Concretize three gimple_try_set_ accessors
https://gcc.gnu.org/ml/gcc-patches/2014-04/msg01167.html
from the original 89-patch kit
That earlier patch was approved by Jeff:
> OK once prerequisites have gone in.
in https://gcc.gnu.org/ml/gcc-patches/2014-05/msg00831.html
gcc/
* gimple.c (gimple_copy): Add checked casts to gimple_try.
* gimple.h (gimple_try_set_kind): Require a gimple_try.
(gimple_try_set_eval): Likewise.
(gimple_try_set_cleanup): Likewise.
* tree-eh.c (optimize_double_finally): Require a pair of gimple_try
statements.
(refactor_eh_r): Convert code comparisons to dynamic casts.
---
gcc/ChangeLog.gimple-classes | 14 ++++++++++++++
gcc/gimple.c | 12 ++++++++----
gcc/gimple.h | 13 +++++--------
gcc/tree-eh.c | 15 +++++++--------
4 files changed, 34 insertions(+), 20 deletions(-)
diff --git a/gcc/ChangeLog.gimple-classes b/gcc/ChangeLog.gimple-classes
index b874697..af8a440 100644
--- a/gcc/ChangeLog.gimple-classes
+++ b/gcc/ChangeLog.gimple-classes
@@ -1,5 +1,19 @@
2014-10-24 David Malcolm <dmalcolm@redhat.com>
+ Concretize three gimple_try_set_ accessors
+
+ * gimple.c (gimple_copy): Add checked casts to gimple_try.
+
+ * gimple.h (gimple_try_set_kind): Require a gimple_try.
+ (gimple_try_set_eval): Likewise.
+ (gimple_try_set_cleanup): Likewise.
+
+ * tree-eh.c (optimize_double_finally): Require a pair of gimple_try
+ statements.
+ (refactor_eh_r): Convert code comparisons to dynamic casts.
+
+2014-10-24 David Malcolm <dmalcolm@redhat.com>
+
Concretize gimple_try_set_catch_is_cleanup
* gimple.h (gimple_try_set_catch_is_cleanup): Require a gimple_try.
diff --git a/gcc/gimple.c b/gcc/gimple.c
index 0775477..0fac6b4 100644
--- a/gcc/gimple.c
+++ b/gcc/gimple.c
@@ -1709,10 +1709,14 @@ gimple_copy (gimple stmt)
break;
case GIMPLE_TRY:
- new_seq = gimple_seq_copy (gimple_try_eval (stmt));
- gimple_try_set_eval (copy, new_seq);
- new_seq = gimple_seq_copy (gimple_try_cleanup (stmt));
- gimple_try_set_cleanup (copy, new_seq);
+ {
+ gimple_try try_stmt = as_a <gimple_try> (stmt);
+ gimple_try try_copy = as_a <gimple_try> (copy);
+ new_seq = gimple_seq_copy (gimple_try_eval (try_stmt));
+ gimple_try_set_eval (try_copy, new_seq);
+ new_seq = gimple_seq_copy (gimple_try_cleanup (try_stmt));
+ gimple_try_set_cleanup (try_copy, new_seq);
+ }
break;
case GIMPLE_OMP_FOR:
diff --git a/gcc/gimple.h b/gcc/gimple.h
index 990e90d..3c11a4a 100644
--- a/gcc/gimple.h
+++ b/gcc/gimple.h
@@ -3711,9 +3711,8 @@ gimple_try_kind (const_gimple gs)
/* Set the kind of try block represented by GIMPLE_TRY GS. */
static inline void
-gimple_try_set_kind (gimple gs, enum gimple_try_flags kind)
+gimple_try_set_kind (gimple_try gs, enum gimple_try_flags kind)
{
- GIMPLE_CHECK (gs, GIMPLE_TRY);
gcc_gimple_checking_assert (kind == GIMPLE_TRY_CATCH
|| kind == GIMPLE_TRY_FINALLY);
if (gimple_try_kind (gs) != kind)
@@ -3786,23 +3785,21 @@ gimple_try_set_catch_is_cleanup (gimple_try g, bool catch_is_cleanup)
/* Set EVAL to be the sequence of statements to use as the body for
- GIMPLE_TRY GS. */
+ GIMPLE_TRY TRY_STMT. */
static inline void
-gimple_try_set_eval (gimple gs, gimple_seq eval)
+gimple_try_set_eval (gimple_try try_stmt, gimple_seq eval)
{
- gimple_statement_try *try_stmt = as_a <gimple_statement_try *> (gs);
try_stmt->eval = eval;
}
/* Set CLEANUP to be the sequence of statements to use as the cleanup
- body for GIMPLE_TRY GS. */
+ body for GIMPLE_TRY TRY_STMT. */
static inline void
-gimple_try_set_cleanup (gimple gs, gimple_seq cleanup)
+gimple_try_set_cleanup (gimple_try try_stmt, gimple_seq cleanup)
{
- gimple_statement_try *try_stmt = as_a <gimple_statement_try *> (gs);
try_stmt->cleanup = cleanup;
}
diff --git a/gcc/tree-eh.c b/gcc/tree-eh.c
index b496c08..da54772 100644
--- a/gcc/tree-eh.c
+++ b/gcc/tree-eh.c
@@ -3024,7 +3024,7 @@ same_handler_p (gimple_seq oneh, gimple_seq twoh)
temporary used in the initializer for A. */
static void
-optimize_double_finally (gimple one, gimple two)
+optimize_double_finally (gimple_try one, gimple_try two)
{
gimple oneh;
gimple_stmt_iterator gsi;
@@ -3071,13 +3071,12 @@ refactor_eh_r (gimple_seq seq)
two = NULL;
else
two = gsi_stmt (gsi);
- if (one
- && two
- && gimple_code (one) == GIMPLE_TRY
- && gimple_code (two) == GIMPLE_TRY
- && gimple_try_kind (one) == GIMPLE_TRY_FINALLY
- && gimple_try_kind (two) == GIMPLE_TRY_FINALLY)
- optimize_double_finally (one, two);
+ if (one && two)
+ if (gimple_try try_one = dyn_cast <gimple_try> (one))
+ if (gimple_try try_two = dyn_cast <gimple_try> (two))
+ if (gimple_try_kind (try_one) == GIMPLE_TRY_FINALLY
+ && gimple_try_kind (try_two) == GIMPLE_TRY_FINALLY)
+ optimize_double_finally (try_one, try_two);
if (one)
switch (gimple_code (one))
{
--
1.8.5.3
^ permalink raw reply [flat|nested] 93+ messages in thread
* [gimple-classes, committed 54/92] Various gimple to gimple_call conversions in IPA
2014-10-27 20:35 [gimple-classes, committed 00/92] Initial slew of commits David Malcolm
` (30 preceding siblings ...)
2014-10-27 20:38 ` [gimple-classes, committed 84/92] Concretize gimple_call_copy_flags and ipa_modify_call_arguments David Malcolm
@ 2014-10-27 20:38 ` David Malcolm
2014-10-27 20:38 ` [gimple-classes, committed 02/92] Introduce gimple_bind and use it for accessors David Malcolm
` (59 subsequent siblings)
91 siblings, 0 replies; 93+ messages in thread
From: David Malcolm @ 2014-10-27 20:38 UTC (permalink / raw)
To: gcc-patches; +Cc: David Malcolm
This corresponds to:
[PATCH 56/89] Various gimple to gimple_call conversions in IPA
https://gcc.gnu.org/ml/gcc-patches/2014-04/msg01179.html
from the original 89-patch kit
That earlier patch was approved by Jeff:
> OK once prereqs go in.
in https://gcc.gnu.org/ml/gcc-patches/2014-05/msg00857.html
gcc/
* ipa-prop.c (detect_type_change_from_memory_writes): Require a
gimple_call rather than a plain gimple.
(detect_type_change): Likewise.
(detect_type_change_ssa): Likewise.
(compute_complex_assign_jump_func): Likewise.
(compute_complex_ancestor_jump_func): Likewise.
(compute_known_type_jump_func): Likewise.
(determine_locally_known_aggregate_parts): Likewise.
(ipa_compute_jump_functions_for_edge): Strengthen local "call" to
a gimple_call; add checked cast to gimple_phi.
(ipa_note_param_call): Require a gimple_call rather than a plain
gimple.
(ipa_analyze_indirect_call_uses): Likewise.
(ipa_analyze_virtual_call_uses): Likewise.
(ipa_analyze_call_uses): Likewise.
(ipa_analyze_stmt_uses):Add checked cast to gimple_call.
* tree-ssa-pre.c (eliminate_dom_walker::before_dom_children):
Replace use of is_gimple_call with dyn_cast<gimple_call> and a
new local "call_stmt".
---
gcc/ChangeLog.gimple-classes | 25 +++++++++++++++++++++++++
gcc/ipa-prop.c | 33 +++++++++++++++++++--------------
gcc/tree-ssa-pre.c | 6 +++---
3 files changed, 47 insertions(+), 17 deletions(-)
diff --git a/gcc/ChangeLog.gimple-classes b/gcc/ChangeLog.gimple-classes
index 115f7ea..6fd5738 100644
--- a/gcc/ChangeLog.gimple-classes
+++ b/gcc/ChangeLog.gimple-classes
@@ -1,5 +1,30 @@
2014-10-24 David Malcolm <dmalcolm@redhat.com>
+ Various gimple to gimple_call conversions in IPA
+
+ * ipa-prop.c (detect_type_change_from_memory_writes): Require a
+ gimple_call rather than a plain gimple.
+ (detect_type_change): Likewise.
+ (detect_type_change_ssa): Likewise.
+ (compute_complex_assign_jump_func): Likewise.
+ (compute_complex_ancestor_jump_func): Likewise.
+ (compute_known_type_jump_func): Likewise.
+ (determine_locally_known_aggregate_parts): Likewise.
+ (ipa_compute_jump_functions_for_edge): Strengthen local "call" to
+ a gimple_call; add checked cast to gimple_phi.
+ (ipa_note_param_call): Require a gimple_call rather than a plain
+ gimple.
+ (ipa_analyze_indirect_call_uses): Likewise.
+ (ipa_analyze_virtual_call_uses): Likewise.
+ (ipa_analyze_call_uses): Likewise.
+ (ipa_analyze_stmt_uses):Add checked cast to gimple_call.
+
+ * tree-ssa-pre.c (eliminate_dom_walker::before_dom_children):
+ Replace use of is_gimple_call with dyn_cast<gimple_call> and a
+ new local "call_stmt".
+
+2014-10-24 David Malcolm <dmalcolm@redhat.com>
+
Use gimple_call for callgraph edges
* cgraph.h (cgraph_edge::call_stmt): Strengthen field from plain
diff --git a/gcc/ipa-prop.c b/gcc/ipa-prop.c
index 45bfbc6..5a861f8 100644
--- a/gcc/ipa-prop.c
+++ b/gcc/ipa-prop.c
@@ -831,7 +831,7 @@ param_type_may_change_p (tree function, tree arg, gimple call)
static bool
detect_type_change_from_memory_writes (tree arg, tree base, tree comp_type,
- gimple call, struct ipa_jump_func *jfunc,
+ gimple_call call, struct ipa_jump_func *jfunc,
HOST_WIDE_INT offset)
{
struct prop_type_change_info tci;
@@ -891,7 +891,7 @@ detect_type_change_from_memory_writes (tree arg, tree base, tree comp_type,
returned by get_ref_base_and_extent, as is the offset. */
static bool
-detect_type_change (tree arg, tree base, tree comp_type, gimple call,
+detect_type_change (tree arg, tree base, tree comp_type, gimple_call call,
struct ipa_jump_func *jfunc, HOST_WIDE_INT offset)
{
if (!flag_devirtualize)
@@ -912,7 +912,7 @@ detect_type_change (tree arg, tree base, tree comp_type, gimple call,
static bool
detect_type_change_ssa (tree arg, tree comp_type,
- gimple call, struct ipa_jump_func *jfunc)
+ gimple_call call, struct ipa_jump_func *jfunc)
{
gcc_checking_assert (TREE_CODE (arg) == SSA_NAME);
if (!flag_devirtualize
@@ -1289,7 +1289,7 @@ static void
compute_complex_assign_jump_func (struct func_body_info *fbi,
struct ipa_node_params *info,
struct ipa_jump_func *jfunc,
- gimple call, gimple stmt, tree name,
+ gimple_call call, gimple stmt, tree name,
tree param_type)
{
HOST_WIDE_INT offset, size, max_size;
@@ -1445,7 +1445,8 @@ static void
compute_complex_ancestor_jump_func (struct func_body_info *fbi,
struct ipa_node_params *info,
struct ipa_jump_func *jfunc,
- gimple call, gimple phi, tree param_type)
+ gimple_call call, gimple_phi phi,
+ tree param_type)
{
HOST_WIDE_INT offset;
gimple assign, cond;
@@ -1516,7 +1517,7 @@ compute_complex_ancestor_jump_func (struct func_body_info *fbi,
static void
compute_known_type_jump_func (tree op, struct ipa_jump_func *jfunc,
- gimple call, tree expected_type)
+ gimple_call call, tree expected_type)
{
HOST_WIDE_INT offset, size, max_size;
tree base;
@@ -1680,7 +1681,8 @@ build_agg_jump_func_from_list (struct ipa_known_agg_contents_list *list,
subsequently stored. */
static void
-determine_locally_known_aggregate_parts (gimple call, tree arg, tree arg_type,
+determine_locally_known_aggregate_parts (gimple_call call, tree arg,
+ tree arg_type,
struct ipa_jump_func *jfunc)
{
struct ipa_known_agg_contents_list *list = NULL;
@@ -1876,7 +1878,7 @@ ipa_compute_jump_functions_for_edge (struct func_body_info *fbi,
{
struct ipa_node_params *info = IPA_NODE_REF (cs->caller);
struct ipa_edge_args *args = IPA_EDGE_REF (cs);
- gimple call = cs->call_stmt;
+ gimple_call call = cs->call_stmt;
int n, arg_num = gimple_call_num_args (call);
bool useful_context = false;
@@ -1952,7 +1954,9 @@ ipa_compute_jump_functions_for_edge (struct func_body_info *fbi,
call, stmt, arg, param_type);
else if (gimple_code (stmt) == GIMPLE_PHI)
compute_complex_ancestor_jump_func (fbi, info, jfunc,
- call, stmt, param_type);
+ call,
+ as_a <gimple_phi> (stmt),
+ param_type);
}
}
else
@@ -2078,7 +2082,8 @@ ipa_is_ssa_with_stmt_def (tree t)
indirect call graph edge. */
static struct cgraph_edge *
-ipa_note_param_call (struct cgraph_node *node, int param_index, gimple stmt)
+ipa_note_param_call (struct cgraph_node *node, int param_index,
+ gimple_call stmt)
{
struct cgraph_edge *cs;
@@ -2149,7 +2154,7 @@ ipa_note_param_call (struct cgraph_node *node, int param_index, gimple stmt)
passed by value or reference. */
static void
-ipa_analyze_indirect_call_uses (struct func_body_info *fbi, gimple call,
+ipa_analyze_indirect_call_uses (struct func_body_info *fbi, gimple_call call,
tree target)
{
struct ipa_node_params *info = fbi->info;
@@ -2288,7 +2293,7 @@ ipa_analyze_indirect_call_uses (struct func_body_info *fbi, gimple call,
static void
ipa_analyze_virtual_call_uses (struct func_body_info *fbi,
- gimple call, tree target)
+ gimple_call call, tree target)
{
tree obj = OBJ_TYPE_REF_OBJECT (target);
int index;
@@ -2344,7 +2349,7 @@ ipa_analyze_virtual_call_uses (struct func_body_info *fbi,
containing intermediate information about each formal parameter. */
static void
-ipa_analyze_call_uses (struct func_body_info *fbi, gimple call)
+ipa_analyze_call_uses (struct func_body_info *fbi, gimple_call call)
{
tree target = gimple_call_fn (call);
@@ -2393,7 +2398,7 @@ static void
ipa_analyze_stmt_uses (struct func_body_info *fbi, gimple stmt)
{
if (is_gimple_call (stmt))
- ipa_analyze_call_uses (fbi, stmt);
+ ipa_analyze_call_uses (fbi, as_a <gimple_call> (stmt));
}
/* Callback of walk_stmt_load_store_addr_ops for the visit_load.
diff --git a/gcc/tree-ssa-pre.c b/gcc/tree-ssa-pre.c
index a9bacff..189363a 100644
--- a/gcc/tree-ssa-pre.c
+++ b/gcc/tree-ssa-pre.c
@@ -4298,9 +4298,9 @@ eliminate_dom_walker::before_dom_children (basic_block b)
/* Visit indirect calls and turn them into direct calls if
possible using the devirtualization machinery. */
- if (is_gimple_call (stmt))
+ if (gimple_call call_stmt = dyn_cast <gimple_call> (stmt))
{
- tree fn = gimple_call_fn (stmt);
+ tree fn = gimple_call_fn (call_stmt);
if (fn
&& flag_devirtualize
&& virtual_method_call_p (fn))
@@ -4339,7 +4339,7 @@ eliminate_dom_walker::before_dom_children (basic_block b)
"function %s\n",
cgraph_node::get (fn)->name ());
}
- gimple_call_set_fndecl (stmt, fn);
+ gimple_call_set_fndecl (call_stmt, fn);
gimple_set_modified (stmt, true);
}
}
--
1.8.5.3
^ permalink raw reply [flat|nested] 93+ messages in thread
* [gimple-classes, committed 02/92] Introduce gimple_bind and use it for accessors.
2014-10-27 20:35 [gimple-classes, committed 00/92] Initial slew of commits David Malcolm
` (31 preceding siblings ...)
2014-10-27 20:38 ` [gimple-classes, committed 54/92] Various gimple to gimple_call conversions in IPA David Malcolm
@ 2014-10-27 20:38 ` David Malcolm
2014-10-27 20:38 ` [gimple-classes, committed 74/92] Concretize gimple_cond_{lhs|rhs}_ptr David Malcolm
` (58 subsequent siblings)
91 siblings, 0 replies; 93+ messages in thread
From: David Malcolm @ 2014-10-27 20:38 UTC (permalink / raw)
To: gcc-patches; +Cc: David Malcolm
This corresponds to:
[PATCH 03/89] Introduce gimple_bind and use it for accessors.
https://gcc.gnu.org/ml/gcc-patches/2014-04/msg01190.html
from the original 89-patch kit
That earlier patch was approved by Jeff:
> This is fine, with the same requested changes as #2; specifically
> using an explicit cast
> rather than hiding the conversion in a method. Once those changes are
> in place, it's good for 4.9.1.
in https://gcc.gnu.org/ml/gcc-patches/2014-04/msg01485.html
This updates all of the gimple_bind_* accessors in gimple.h from taking a
plain gimple to taking a gimple_bind (or const_gimple_bind), with the
checking happening at the point of cast.
Various other types are strengthened from gimple to gimple_bind, and from
plain vec<gimple> to vec<gimple_bind>.
gcc/
* coretypes.h (gimple_bind): New typedef.
(const_gimple_bind): New typedef.
* gdbhooks.py (build_pretty_printer): Add gimple_bind
and its variants, using the gimple printer.
* gimple-pretty-print.c (dump_gimple_bind): Update type-signature to
require a gimple_bind rather than just a gimple.
* gimple.c (gimple_build_bind): Return a gimple_bind rather than
just a gimple.
* gimple.h (gimple_build_bind): Likewise.
* gimple.h (gimple_seq_first_stmt_as_a_bind): New.
* gimple.h (gimple_bind_vars): Update type-signature to
require a gimple_bind rather than just a gimple, removing
as_a and hence run-time check.
(gimple_bind_set_vars): Likewise.
(gimple_bind_append_vars): Likewise.
(gimple_bind_body_ptr): Likewise.
(gimple_bind_body): Likewise.
(gimple_bind_set_body): Likewise.
(gimple_bind_add_stmt): Likewise.
(gimple_bind_add_seq): Likewise.
(gimple_bind_block): Likewise.
(gimple_bind_set_block): Likewise.
* gimplify.c (gimple_push_bind_expr): Likewise.
(gimple_current_bind_expr): Likewise.
* tree-inline.c (copy_gimple_bind): Likewise.
* gimplify.h (gimple_current_bind_expr): Return a gimple_bind
rather than a plain gimple.
(gimplify_body): Likewise.
(gimple_bind_expr_stack): Return a vec<gimple_bind> rather than
a vec<gimple>.
* gimplify.c (struct gimplify_ctx): Strengthen field
"bind_expr_stack" from vec<gimple> to vec<gimple_bind>.
(gimple_bind_expr_stack): Likewise for type of returned value.
* gimplify.c (gimplify_body): Strengthen various types from gimple
to gimple_bind, including the return type.
* gimplify.c (declare_vars): Introduce "gs" as a generic gimple,
so that local "scope" can be of type gimple_bind once we've reached
the region where it must be of code GIMPLE_BIND.
* gimple-low.c (lower_gimple_bind): Add checked cast to
gimple_bind, since both callers (lower_function_body and
lower_stmt) have checked the code for us.
* gimple.c (gimple_copy): Add checked cast to gimple_bind in
region guarded by check for code GIMPLE_BIND.
* gimple-low.c (gimple_stmt_may_fallthru): Likewise.
* gimple-pretty-print.c (pp_gimple_stmt_1): Likewise.
* gimple-walk.c (walk_gimple_stmt): Likewise.
* omp-low.c (scan_omp_1_stmt): Likewise.
(lower_omp_1): Likewise.
(lower_omp_for): Likewise.
* tree-cfg.c (verify_gimple_in_seq_2): Likewise.
(do_warn_unused_result): Likewise.
* tree-inline.c (remap_gimple_stmt): Likewise.
(estimate_num_insns): Likewise.
* tree-nested.c (convert_nonlocal_reference_stmt): Likewise.
* gimplify.c (gimplify_bind_expr): Update local(s) to be a
gimple_bind rather than just a gimple.
(gimplify_function_tree): Likewise.
* omp-low.c (lower_omp_sections): Likewise.
(lower_omp_single): Likewise.
(lower_omp_master): Likewise.
(lower_omp_taskgroup): Likewise.
(lower_omp_ordered): Likewise.
(lower_omp_critical): Likewise.
(lower_omp_taskreg): Likewise.
(lower_omp_teams): Likewise.
* omp-low.c (lower_omp_for): Likewise; use
gimple_seq_first_stmt_as_a_bind to encapsulate the checked cast.
(lower_omp_target): Likewise.
* tree-nested.c (finalize_nesting_tree_1): Likewise.
* gimple.c (empty_stmt_p): Add dyn_cast to a gimple_bind.
* tree-inline.c (replace_locals_stmt): Add dyn_cast to gimple_bind.
gcc/c-family/
* c-gimplify.c (add_block_to_enclosing): Strengthen local "stack"
from being just a vec<gimple> to a vec<gimple_bind>.
gcc/java/
* java-gimplify.c (java_gimplify_block): Update local to be a
gimple_bind rather than just a gimple.
Conflicts:
gcc/omp-low.c
gcc/tree-nested.c
---
gcc/ChangeLog.gimple-classes | 89 +++++++++++++++++++++++++++++++++++
gcc/c-family/ChangeLog.gimple-classes | 12 +++++
gcc/c-family/c-gimplify.c | 4 +-
gcc/coretypes.h | 4 ++
gcc/gdbhooks.py | 4 +-
gcc/gimple-low.c | 5 +-
gcc/gimple-pretty-print.c | 4 +-
gcc/gimple-walk.c | 5 +-
gcc/gimple.c | 21 +++++----
gcc/gimple.h | 43 +++++++++--------
gcc/gimplify.c | 37 ++++++++-------
gcc/gimplify.h | 6 +--
gcc/java/ChangeLog.gimple-classes | 12 +++++
gcc/java/java-gimplify.c | 2 +-
gcc/omp-low.c | 40 ++++++++++------
gcc/tree-cfg.c | 5 +-
gcc/tree-inline.c | 12 +++--
gcc/tree-nested.c | 22 +++++----
18 files changed, 235 insertions(+), 92 deletions(-)
create mode 100644 gcc/c-family/ChangeLog.gimple-classes
create mode 100644 gcc/java/ChangeLog.gimple-classes
diff --git a/gcc/ChangeLog.gimple-classes b/gcc/ChangeLog.gimple-classes
index 08dbf95..dc1edc86 100644
--- a/gcc/ChangeLog.gimple-classes
+++ b/gcc/ChangeLog.gimple-classes
@@ -1,5 +1,94 @@
2014-10-24 David Malcolm <dmalcolm@redhat.com>
+ Introduce gimple_bind and use it for accessors.
+
+ * coretypes.h (gimple_bind): New typedef.
+ (const_gimple_bind): New typedef.
+
+ * gdbhooks.py (build_pretty_printer): Add gimple_bind
+ and its variants, using the gimple printer.
+
+ * gimple-pretty-print.c (dump_gimple_bind): Update type-signature to
+ require a gimple_bind rather than just a gimple.
+
+ * gimple.c (gimple_build_bind): Return a gimple_bind rather than
+ just a gimple.
+ * gimple.h (gimple_build_bind): Likewise.
+
+ * gimple.h (gimple_seq_first_stmt_as_a_bind): New.
+
+ * gimple.h (gimple_bind_vars): Update type-signature to
+ require a gimple_bind rather than just a gimple, removing
+ as_a and hence run-time check.
+ (gimple_bind_set_vars): Likewise.
+ (gimple_bind_append_vars): Likewise.
+ (gimple_bind_body_ptr): Likewise.
+ (gimple_bind_body): Likewise.
+ (gimple_bind_set_body): Likewise.
+ (gimple_bind_add_stmt): Likewise.
+ (gimple_bind_add_seq): Likewise.
+ (gimple_bind_block): Likewise.
+ (gimple_bind_set_block): Likewise.
+ * gimplify.c (gimple_push_bind_expr): Likewise.
+ (gimple_current_bind_expr): Likewise.
+ * tree-inline.c (copy_gimple_bind): Likewise.
+
+ * gimplify.h (gimple_current_bind_expr): Return a gimple_bind
+ rather than a plain gimple.
+ (gimplify_body): Likewise.
+ (gimple_bind_expr_stack): Return a vec<gimple_bind> rather than
+ a vec<gimple>.
+
+ * gimplify.c (struct gimplify_ctx): Strengthen field
+ "bind_expr_stack" from vec<gimple> to vec<gimple_bind>.
+ (gimple_bind_expr_stack): Likewise for type of returned value.
+
+ * gimplify.c (gimplify_body): Strengthen various types from gimple
+ to gimple_bind, including the return type.
+
+ * gimplify.c (declare_vars): Introduce "gs" as a generic gimple,
+ so that local "scope" can be of type gimple_bind once we've reached
+ the region where it must be of code GIMPLE_BIND.
+
+ * gimple-low.c (lower_gimple_bind): Add checked cast to
+ gimple_bind, since both callers (lower_function_body and
+ lower_stmt) have checked the code for us.
+
+ * gimple.c (gimple_copy): Add checked cast to gimple_bind in
+ region guarded by check for code GIMPLE_BIND.
+ * gimple-low.c (gimple_stmt_may_fallthru): Likewise.
+ * gimple-pretty-print.c (pp_gimple_stmt_1): Likewise.
+ * gimple-walk.c (walk_gimple_stmt): Likewise.
+ * omp-low.c (scan_omp_1_stmt): Likewise.
+ (lower_omp_1): Likewise.
+ (lower_omp_for): Likewise.
+ * tree-cfg.c (verify_gimple_in_seq_2): Likewise.
+ (do_warn_unused_result): Likewise.
+ * tree-inline.c (remap_gimple_stmt): Likewise.
+ (estimate_num_insns): Likewise.
+ * tree-nested.c (convert_nonlocal_reference_stmt): Likewise.
+
+ * gimplify.c (gimplify_bind_expr): Update local(s) to be a
+ gimple_bind rather than just a gimple.
+ (gimplify_function_tree): Likewise.
+ * omp-low.c (lower_omp_sections): Likewise.
+ (lower_omp_single): Likewise.
+ (lower_omp_master): Likewise.
+ (lower_omp_taskgroup): Likewise.
+ (lower_omp_ordered): Likewise.
+ (lower_omp_critical): Likewise.
+ (lower_omp_taskreg): Likewise.
+ (lower_omp_teams): Likewise.
+ * omp-low.c (lower_omp_for): Likewise; use
+ gimple_seq_first_stmt_as_a_bind to encapsulate the checked cast.
+ (lower_omp_target): Likewise.
+ * tree-nested.c (finalize_nesting_tree_1): Likewise.
+
+ * gimple.c (empty_stmt_p): Add dyn_cast to a gimple_bind.
+ * tree-inline.c (replace_locals_stmt): Add dyn_cast to gimple_bind.
+
+2014-10-24 David Malcolm <dmalcolm@redhat.com>
+
Introduce gimple_switch and use it in various places
* gimple.h (gimple_statement_switch): New subclass of
diff --git a/gcc/c-family/ChangeLog.gimple-classes b/gcc/c-family/ChangeLog.gimple-classes
new file mode 100644
index 0000000..2ad7003
--- /dev/null
+++ b/gcc/c-family/ChangeLog.gimple-classes
@@ -0,0 +1,12 @@
+2014-10-24 David Malcolm <dmalcolm@redhat.com>
+
+ Introduce gimple_bind and use it for accessors.
+
+ * c-gimplify.c (add_block_to_enclosing): Strengthen local "stack"
+ from being just a vec<gimple> to a vec<gimple_bind>.
+
+Copyright (C) 2014 Free Software Foundation, Inc.
+
+Copying and distribution of this file, with or without modification,
+are permitted in any medium without royalty provided the copyright
+notice and this notice are preserved.
diff --git a/gcc/c-family/c-gimplify.c b/gcc/c-family/c-gimplify.c
index 2c08124..11a0ade 100644
--- a/gcc/c-family/c-gimplify.c
+++ b/gcc/c-family/c-gimplify.c
@@ -164,8 +164,8 @@ add_block_to_enclosing (tree block)
{
unsigned i;
tree enclosing;
- gimple bind;
- vec<gimple> stack = gimple_bind_expr_stack ();
+ gimple_bind bind;
+ vec<gimple_bind> stack = gimple_bind_expr_stack ();
FOR_EACH_VEC_ELT (stack, i, bind)
if (gimple_bind_block (bind))
diff --git a/gcc/coretypes.h b/gcc/coretypes.h
index 1f586c9..9beb07c 100644
--- a/gcc/coretypes.h
+++ b/gcc/coretypes.h
@@ -94,6 +94,10 @@ struct gimple_statement_switch;
typedef struct gimple_statement_switch *gimple_switch;
typedef const struct gimple_statement_switch *const_gimple_switch;
+struct gimple_statement_bind;
+typedef struct gimple_statement_bind *gimple_bind;
+typedef const struct gimple_statement_bind *const_gimple_bind;
+
union section;
typedef union section section;
struct gcc_options;
diff --git a/gcc/gdbhooks.py b/gcc/gdbhooks.py
index 94568f1..48a0658 100644
--- a/gcc/gdbhooks.py
+++ b/gcc/gdbhooks.py
@@ -459,7 +459,9 @@ def build_pretty_printer():
# Keep this in the same order as gimple.def:
'gimple_switch', 'const_gimple_switch',
- 'gimple_statement_switch *'],
+ 'gimple_statement_switch *',
+ 'gimple_bind', 'const_gimple_bind',
+ 'gimple_statement_bind *'],
'gimple',
GimplePrinter)
diff --git a/gcc/gimple-low.c b/gcc/gimple-low.c
index c8a6e6b..ef84c28 100644
--- a/gcc/gimple-low.c
+++ b/gcc/gimple-low.c
@@ -378,7 +378,7 @@ static void
lower_gimple_bind (gimple_stmt_iterator *gsi, struct lower_data *data)
{
tree old_block = data->block;
- gimple stmt = gsi_stmt (*gsi);
+ gimple_bind stmt = as_a <gimple_bind> (gsi_stmt (*gsi));
tree new_block = gimple_bind_block (stmt);
if (new_block)
@@ -572,7 +572,8 @@ gimple_stmt_may_fallthru (gimple stmt)
return false;
case GIMPLE_BIND:
- return gimple_seq_may_fallthru (gimple_bind_body (stmt));
+ return gimple_seq_may_fallthru (
+ gimple_bind_body (as_a <gimple_bind> (stmt)));
case GIMPLE_TRY:
if (gimple_try_kind (stmt) == GIMPLE_TRY_CATCH)
diff --git a/gcc/gimple-pretty-print.c b/gcc/gimple-pretty-print.c
index 9701f2d..d47236f 100644
--- a/gcc/gimple-pretty-print.c
+++ b/gcc/gimple-pretty-print.c
@@ -899,7 +899,7 @@ dump_gimple_goto (pretty_printer *buffer, gimple gs, int spc, int flags)
TDF_* in dumpfile.h). */
static void
-dump_gimple_bind (pretty_printer *buffer, gimple gs, int spc, int flags)
+dump_gimple_bind (pretty_printer *buffer, gimple_bind gs, int spc, int flags)
{
if (flags & TDF_RAW)
dump_gimple_fmt (buffer, spc, flags, "%G <", gs);
@@ -2093,7 +2093,7 @@ pp_gimple_stmt_1 (pretty_printer *buffer, gimple gs, int spc, int flags)
break;
case GIMPLE_BIND:
- dump_gimple_bind (buffer, gs, spc, flags);
+ dump_gimple_bind (buffer, as_a <gimple_bind> (gs), spc, flags);
break;
case GIMPLE_CALL:
diff --git a/gcc/gimple-walk.c b/gcc/gimple-walk.c
index f4f6757..830516e 100644
--- a/gcc/gimple-walk.c
+++ b/gcc/gimple-walk.c
@@ -541,8 +541,9 @@ walk_gimple_stmt (gimple_stmt_iterator *gsi, walk_stmt_fn callback_stmt,
switch (gimple_code (stmt))
{
case GIMPLE_BIND:
- ret = walk_gimple_seq_mod (gimple_bind_body_ptr (stmt), callback_stmt,
- callback_op, wi);
+ ret =
+ walk_gimple_seq_mod (gimple_bind_body_ptr (as_a <gimple_bind> (stmt)),
+ callback_stmt, callback_op, wi);
if (ret)
return wi->callback_result;
break;
diff --git a/gcc/gimple.c b/gcc/gimple.c
index a8bd72c..64201f0 100644
--- a/gcc/gimple.c
+++ b/gcc/gimple.c
@@ -513,10 +513,10 @@ gimple_build_nop (void)
VARS are the variables in BODY.
BLOCK is the containing block. */
-gimple
+gimple_bind
gimple_build_bind (tree vars, gimple_seq body, tree block)
{
- gimple p = gimple_alloc (GIMPLE_BIND, 0);
+ gimple_bind p = as_a <gimple_bind> (gimple_alloc (GIMPLE_BIND, 0));
gimple_bind_set_vars (p, vars);
if (body)
gimple_bind_set_body (p, body);
@@ -1261,8 +1261,8 @@ empty_stmt_p (gimple stmt)
{
if (gimple_code (stmt) == GIMPLE_NOP)
return true;
- if (gimple_code (stmt) == GIMPLE_BIND)
- return empty_body_p (gimple_bind_body (stmt));
+ if (gimple_bind bind_stmt = dyn_cast <gimple_bind> (stmt))
+ return empty_body_p (gimple_bind_body (bind_stmt));
return false;
}
@@ -1640,10 +1640,15 @@ gimple_copy (gimple stmt)
switch (gimple_code (stmt))
{
case GIMPLE_BIND:
- new_seq = gimple_seq_copy (gimple_bind_body (stmt));
- gimple_bind_set_body (copy, new_seq);
- gimple_bind_set_vars (copy, unshare_expr (gimple_bind_vars (stmt)));
- gimple_bind_set_block (copy, gimple_bind_block (stmt));
+ {
+ gimple_bind bind_stmt = as_a <gimple_bind> (stmt);
+ gimple_bind bind_copy = as_a <gimple_bind> (copy);
+ new_seq = gimple_seq_copy (gimple_bind_body (bind_stmt));
+ gimple_bind_set_body (bind_copy, new_seq);
+ gimple_bind_set_vars (bind_copy,
+ unshare_expr (gimple_bind_vars (bind_stmt)));
+ gimple_bind_set_block (bind_copy, gimple_bind_block (bind_stmt));
+ }
break;
case GIMPLE_CATCH:
diff --git a/gcc/gimple.h b/gcc/gimple.h
index 1b25e67..812fc2a 100644
--- a/gcc/gimple.h
+++ b/gcc/gimple.h
@@ -1204,7 +1204,7 @@ void gimple_cond_set_condition_from_tree (gimple, tree);
gimple gimple_build_label (tree label);
gimple gimple_build_goto (tree dest);
gimple gimple_build_nop (void);
-gimple gimple_build_bind (tree, gimple_seq, tree);
+gimple_bind gimple_build_bind (tree, gimple_seq, tree);
gimple gimple_build_asm_vec (const char *, vec<tree, va_gc> *,
vec<tree, va_gc> *, vec<tree, va_gc> *,
vec<tree, va_gc> *);
@@ -1340,6 +1340,16 @@ gimple_seq_first_stmt (gimple_seq s)
return n;
}
+/* Return the first statement in GIMPLE sequence S as a gimple_bind,
+ verifying that it has code GIMPLE_BIND in a checked build. */
+
+static inline gimple_bind
+gimple_seq_first_stmt_as_a_bind (gimple_seq s)
+{
+ gimple_seq_node n = gimple_seq_first (s);
+ return as_a <gimple_bind> (n);
+}
+
/* Return the last node in GIMPLE sequence S. */
@@ -3131,10 +3141,8 @@ gimple_goto_set_dest (gimple gs, tree dest)
/* Return the variables declared in the GIMPLE_BIND statement GS. */
static inline tree
-gimple_bind_vars (const_gimple gs)
+gimple_bind_vars (const_gimple_bind bind_stmt)
{
- const gimple_statement_bind *bind_stmt =
- as_a <const gimple_statement_bind *> (gs);
return bind_stmt->vars;
}
@@ -3143,9 +3151,8 @@ gimple_bind_vars (const_gimple gs)
statement GS. */
static inline void
-gimple_bind_set_vars (gimple gs, tree vars)
+gimple_bind_set_vars (gimple_bind bind_stmt, tree vars)
{
- gimple_statement_bind *bind_stmt = as_a <gimple_statement_bind *> (gs);
bind_stmt->vars = vars;
}
@@ -3154,24 +3161,22 @@ gimple_bind_set_vars (gimple gs, tree vars)
statement GS. */
static inline void
-gimple_bind_append_vars (gimple gs, tree vars)
+gimple_bind_append_vars (gimple_bind bind_stmt, tree vars)
{
- gimple_statement_bind *bind_stmt = as_a <gimple_statement_bind *> (gs);
bind_stmt->vars = chainon (bind_stmt->vars, vars);
}
static inline gimple_seq *
-gimple_bind_body_ptr (gimple gs)
+gimple_bind_body_ptr (gimple_bind bind_stmt)
{
- gimple_statement_bind *bind_stmt = as_a <gimple_statement_bind *> (gs);
return &bind_stmt->body;
}
/* Return the GIMPLE sequence contained in the GIMPLE_BIND statement GS. */
static inline gimple_seq
-gimple_bind_body (gimple gs)
+gimple_bind_body (gimple_bind gs)
{
return *gimple_bind_body_ptr (gs);
}
@@ -3181,9 +3186,8 @@ gimple_bind_body (gimple gs)
statement GS. */
static inline void
-gimple_bind_set_body (gimple gs, gimple_seq seq)
+gimple_bind_set_body (gimple_bind bind_stmt, gimple_seq seq)
{
- gimple_statement_bind *bind_stmt = as_a <gimple_statement_bind *> (gs);
bind_stmt->body = seq;
}
@@ -3191,9 +3195,8 @@ gimple_bind_set_body (gimple gs, gimple_seq seq)
/* Append a statement to the end of a GIMPLE_BIND's body. */
static inline void
-gimple_bind_add_stmt (gimple gs, gimple stmt)
+gimple_bind_add_stmt (gimple_bind bind_stmt, gimple stmt)
{
- gimple_statement_bind *bind_stmt = as_a <gimple_statement_bind *> (gs);
gimple_seq_add_stmt (&bind_stmt->body, stmt);
}
@@ -3201,9 +3204,8 @@ gimple_bind_add_stmt (gimple gs, gimple stmt)
/* Append a sequence of statements to the end of a GIMPLE_BIND's body. */
static inline void
-gimple_bind_add_seq (gimple gs, gimple_seq seq)
+gimple_bind_add_seq (gimple_bind bind_stmt, gimple_seq seq)
{
- gimple_statement_bind *bind_stmt = as_a <gimple_statement_bind *> (gs);
gimple_seq_add_seq (&bind_stmt->body, seq);
}
@@ -3212,10 +3214,8 @@ gimple_bind_add_seq (gimple gs, gimple_seq seq)
GS. This is analogous to the BIND_EXPR_BLOCK field in trees. */
static inline tree
-gimple_bind_block (const_gimple gs)
+gimple_bind_block (const_gimple_bind bind_stmt)
{
- const gimple_statement_bind *bind_stmt =
- as_a <const gimple_statement_bind *> (gs);
return bind_stmt->block;
}
@@ -3224,9 +3224,8 @@ gimple_bind_block (const_gimple gs)
statement GS. */
static inline void
-gimple_bind_set_block (gimple gs, tree block)
+gimple_bind_set_block (gimple_bind bind_stmt, tree block)
{
- gimple_statement_bind *bind_stmt = as_a <gimple_statement_bind *> (gs);
gcc_gimple_checking_assert (block == NULL_TREE
|| TREE_CODE (block) == BLOCK);
bind_stmt->block = block;
diff --git a/gcc/gimplify.c b/gcc/gimplify.c
index 6ee85f2..df4e085 100644
--- a/gcc/gimplify.c
+++ b/gcc/gimplify.c
@@ -113,7 +113,7 @@ struct gimplify_ctx
{
struct gimplify_ctx *prev_context;
- vec<gimple> bind_expr_stack;
+ vec<gimple_bind> bind_expr_stack;
tree temps;
gimple_seq conditional_cleanups;
tree exit_label;
@@ -264,10 +264,10 @@ pop_gimplify_context (gimple body)
/* Push a GIMPLE_BIND tuple onto the stack of bindings. */
static void
-gimple_push_bind_expr (gimple gimple_bind)
+gimple_push_bind_expr (gimple_bind bind_stmt)
{
gimplify_ctxp->bind_expr_stack.reserve (8);
- gimplify_ctxp->bind_expr_stack.safe_push (gimple_bind);
+ gimplify_ctxp->bind_expr_stack.safe_push (bind_stmt);
}
/* Pop the first element off the stack of bindings. */
@@ -280,7 +280,7 @@ gimple_pop_bind_expr (void)
/* Return the first element of the stack of bindings. */
-gimple
+gimple_bind
gimple_current_bind_expr (void)
{
return gimplify_ctxp->bind_expr_stack.last ();
@@ -288,7 +288,7 @@ gimple_current_bind_expr (void)
/* Return the stack of bindings created during gimplification. */
-vec<gimple>
+vec<gimple_bind>
gimple_bind_expr_stack (void)
{
return gimplify_ctxp->bind_expr_stack;
@@ -565,14 +565,14 @@ get_initialized_tmp_var (tree val, gimple_seq *pre_p, gimple_seq *post_p)
generate debug info for them; otherwise don't. */
void
-declare_vars (tree vars, gimple scope, bool debug_info)
+declare_vars (tree vars, gimple gs, bool debug_info)
{
tree last = vars;
if (last)
{
tree temps, block;
- gcc_assert (gimple_code (scope) == GIMPLE_BIND);
+ gimple_bind scope = as_a <gimple_bind> (gs);
temps = nreverse (last);
@@ -1043,7 +1043,7 @@ gimplify_bind_expr (tree *expr_p, gimple_seq *pre_p)
tree bind_expr = *expr_p;
bool old_save_stack = gimplify_ctxp->save_stack;
tree t;
- gimple gimple_bind;
+ gimple_bind gimple_bind;
gimple_seq body, cleanup;
gimple stack_save;
location_t start_locus = 0, end_locus = 0;
@@ -8730,12 +8730,13 @@ gimplify_one_sizepos (tree *expr_p, gimple_seq *stmt_p)
containing the sequence of corresponding GIMPLE statements. If DO_PARMS
is true, also gimplify the parameters. */
-gimple
+gimple_bind
gimplify_body (tree fndecl, bool do_parms)
{
location_t saved_location = input_location;
gimple_seq parm_stmts, seq;
- gimple outer_bind;
+ gimple outer_stmt;
+ gimple_bind outer_bind;
struct cgraph_node *cgn;
timevar_push (TV_TREE_GIMPLIFY);
@@ -8775,18 +8776,18 @@ gimplify_body (tree fndecl, bool do_parms)
/* Gimplify the function's body. */
seq = NULL;
gimplify_stmt (&DECL_SAVED_TREE (fndecl), &seq);
- outer_bind = gimple_seq_first_stmt (seq);
- if (!outer_bind)
+ outer_stmt = gimple_seq_first_stmt (seq);
+ if (!outer_stmt)
{
- outer_bind = gimple_build_nop ();
- gimplify_seq_add_stmt (&seq, outer_bind);
+ outer_stmt = gimple_build_nop ();
+ gimplify_seq_add_stmt (&seq, outer_stmt);
}
/* The body must contain exactly one statement, a GIMPLE_BIND. If this is
not the case, wrap everything in a GIMPLE_BIND to make it so. */
- if (gimple_code (outer_bind) == GIMPLE_BIND
+ if (gimple_code (outer_stmt) == GIMPLE_BIND
&& gimple_seq_first (seq) == gimple_seq_last (seq))
- ;
+ outer_bind = as_a <gimple_bind> (outer_stmt);
else
outer_bind = gimple_build_bind (NULL_TREE, seq, NULL);
@@ -8900,7 +8901,7 @@ gimplify_function_tree (tree fndecl)
{
tree parm, ret;
gimple_seq seq;
- gimple bind;
+ gimple_bind bind;
gcc_assert (!gimple_body (fndecl));
@@ -8944,7 +8945,7 @@ gimplify_function_tree (tree fndecl)
&& !flag_instrument_functions_exclude_p (fndecl))
{
tree x;
- gimple new_bind;
+ gimple_bind new_bind;
gimple tf;
gimple_seq cleanup = NULL, body = NULL;
tree tmp_var;
diff --git a/gcc/gimplify.h b/gcc/gimplify.h
index 5085ccf..f4161e6 100644
--- a/gcc/gimplify.h
+++ b/gcc/gimplify.h
@@ -53,8 +53,8 @@ extern void free_gimplify_stack (void);
extern void push_gimplify_context (bool in_ssa = false,
bool rhs_cond_ok = false);
extern void pop_gimplify_context (gimple);
-extern gimple gimple_current_bind_expr (void);
-extern vec<gimple> gimple_bind_expr_stack (void);
+extern gimple_bind gimple_current_bind_expr (void);
+extern vec<gimple_bind> gimple_bind_expr_stack (void);
extern void gimplify_and_add (tree, gimple_seq *);
extern tree get_formal_tmp_var (tree, gimple_seq *);
extern tree get_initialized_tmp_var (tree, gimple_seq *, gimple_seq *);
@@ -76,7 +76,7 @@ extern enum gimplify_status gimplify_expr (tree *, gimple_seq *, gimple_seq *,
extern void gimplify_type_sizes (tree, gimple_seq *);
extern void gimplify_one_sizepos (tree *, gimple_seq *);
-extern gimple gimplify_body (tree, bool);
+extern gimple_bind gimplify_body (tree, bool);
extern enum gimplify_status gimplify_arg (tree *, gimple_seq *, location_t);
extern void gimplify_function_tree (tree);
extern enum gimplify_status gimplify_va_arg_expr (tree *, gimple_seq *,
diff --git a/gcc/java/ChangeLog.gimple-classes b/gcc/java/ChangeLog.gimple-classes
new file mode 100644
index 0000000..9c93d9b
--- /dev/null
+++ b/gcc/java/ChangeLog.gimple-classes
@@ -0,0 +1,12 @@
+2014-10-24 David Malcolm <dmalcolm@redhat.com>
+
+ Introduce gimple_bind and use it for accessors.
+
+ * java-gimplify.c (java_gimplify_block): Update local to be a
+ gimple_bind rather than just a gimple.
+
+Copyright (C) 2014 Free Software Foundation, Inc.
+
+Copying and distribution of this file, with or without modification,
+are permitted in any medium without royalty provided the copyright
+notice and this notice are preserved.
diff --git a/gcc/java/java-gimplify.c b/gcc/java/java-gimplify.c
index 6c7a1b6..4565482 100644
--- a/gcc/java/java-gimplify.c
+++ b/gcc/java/java-gimplify.c
@@ -128,7 +128,7 @@ java_gimplify_block (tree java_block)
{
tree decls = BLOCK_VARS (java_block);
tree body = BLOCK_EXPR_BODY (java_block);
- gimple outer = gimple_current_bind_expr ();
+ gimple_bind outer = gimple_current_bind_expr ();
tree block;
/* Don't bother with empty blocks. */
diff --git a/gcc/omp-low.c b/gcc/omp-low.c
index 0e50637..f084542 100644
--- a/gcc/omp-low.c
+++ b/gcc/omp-low.c
@@ -2841,7 +2841,9 @@ scan_omp_1_stmt (gimple_stmt_iterator *gsi, bool *handled_ops_p,
*handled_ops_p = false;
if (ctx)
- for (var = gimple_bind_vars (stmt); var ; var = DECL_CHAIN (var))
+ for (var = gimple_bind_vars (as_a <gimple_bind> (stmt));
+ var ;
+ var = DECL_CHAIN (var))
insert_decl_map (&ctx->cb, var, var);
}
break;
@@ -8858,7 +8860,8 @@ lower_omp_sections (gimple_stmt_iterator *gsi_p, omp_context *ctx)
{
tree block, control;
gimple_stmt_iterator tgsi;
- gimple stmt, new_stmt, bind, t;
+ gimple stmt, t;
+ gimple_bind new_stmt, bind;
gimple_seq ilist, dlist, olist, new_body;
stmt = gsi_stmt (*gsi_p);
@@ -9067,7 +9070,8 @@ static void
lower_omp_single (gimple_stmt_iterator *gsi_p, omp_context *ctx)
{
tree block;
- gimple t, bind, single_stmt = gsi_stmt (*gsi_p);
+ gimple t, single_stmt = gsi_stmt (*gsi_p);
+ gimple_bind bind;
gimple_seq bind_body, bind_body_tail = NULL, dlist;
push_gimplify_context ();
@@ -9125,7 +9129,8 @@ static void
lower_omp_master (gimple_stmt_iterator *gsi_p, omp_context *ctx)
{
tree block, lab = NULL, x, bfn_decl;
- gimple stmt = gsi_stmt (*gsi_p), bind;
+ gimple stmt = gsi_stmt (*gsi_p);
+ gimple_bind bind;
location_t loc = gimple_location (stmt);
gimple_seq tseq;
@@ -9165,7 +9170,8 @@ lower_omp_master (gimple_stmt_iterator *gsi_p, omp_context *ctx)
static void
lower_omp_taskgroup (gimple_stmt_iterator *gsi_p, omp_context *ctx)
{
- gimple stmt = gsi_stmt (*gsi_p), bind, x;
+ gimple stmt = gsi_stmt (*gsi_p), x;
+ gimple_bind bind;
tree block = make_node (BLOCK);
bind = gimple_build_bind (NULL, NULL, block);
@@ -9193,7 +9199,8 @@ static void
lower_omp_ordered (gimple_stmt_iterator *gsi_p, omp_context *ctx)
{
tree block;
- gimple stmt = gsi_stmt (*gsi_p), bind, x;
+ gimple stmt = gsi_stmt (*gsi_p), x;
+ gimple_bind bind;
push_gimplify_context ();
@@ -9236,7 +9243,8 @@ lower_omp_critical (gimple_stmt_iterator *gsi_p, omp_context *ctx)
{
tree block;
tree name, lock, unlock;
- gimple stmt = gsi_stmt (*gsi_p), bind;
+ gimple stmt = gsi_stmt (*gsi_p);
+ gimple_bind bind;
location_t loc = gimple_location (stmt);
gimple_seq tbody;
@@ -9378,7 +9386,8 @@ lower_omp_for (gimple_stmt_iterator *gsi_p, omp_context *ctx)
{
tree *rhs_p, block;
struct omp_for_data fd, *fdp = NULL;
- gimple stmt = gsi_stmt (*gsi_p), new_stmt;
+ gimple stmt = gsi_stmt (*gsi_p);
+ gimple_bind new_stmt;
gimple_seq omp_for_body, body, dlist;
size_t i;
@@ -9399,7 +9408,8 @@ lower_omp_for (gimple_stmt_iterator *gsi_p, omp_context *ctx)
if (!gimple_seq_empty_p (omp_for_body)
&& gimple_code (gimple_seq_first_stmt (omp_for_body)) == GIMPLE_BIND)
{
- gimple inner_bind = gimple_seq_first_stmt (omp_for_body);
+ gimple_bind inner_bind =
+ as_a <gimple_bind> (gimple_seq_first_stmt (omp_for_body));
tree vars = gimple_bind_vars (inner_bind);
gimple_bind_append_vars (new_stmt, vars);
/* bind_vars/BLOCK_VARS are being moved to new_stmt/block, don't
@@ -9896,12 +9906,12 @@ lower_omp_taskreg (gimple_stmt_iterator *gsi_p, omp_context *ctx)
tree clauses;
tree child_fn, t;
gimple stmt = gsi_stmt (*gsi_p);
- gimple par_bind, bind, dep_bind = NULL;
+ gimple_bind par_bind, bind, dep_bind = NULL;
gimple_seq par_body, olist, ilist, par_olist, par_rlist, par_ilist, new_body;
location_t loc = gimple_location (stmt);
clauses = gimple_omp_taskreg_clauses (stmt);
- par_bind = gimple_seq_first_stmt (gimple_omp_body (stmt));
+ par_bind = gimple_seq_first_stmt_as_a_bind (gimple_omp_body (stmt));
par_body = gimple_bind_body (par_bind);
child_fn = ctx->cb.dst_fn;
if (gimple_code (stmt) == GIMPLE_OMP_PARALLEL
@@ -10018,7 +10028,7 @@ lower_omp_target (gimple_stmt_iterator *gsi_p, omp_context *ctx)
tree clauses;
tree child_fn, t, c;
gimple stmt = gsi_stmt (*gsi_p);
- gimple tgt_bind = NULL, bind;
+ gimple_bind tgt_bind = NULL, bind;
gimple_seq tgt_body = NULL, olist, ilist, new_body;
location_t loc = gimple_location (stmt);
int kind = gimple_omp_target_kind (stmt);
@@ -10027,7 +10037,7 @@ lower_omp_target (gimple_stmt_iterator *gsi_p, omp_context *ctx)
clauses = gimple_omp_target_clauses (stmt);
if (kind == GF_OMP_TARGET_KIND_REGION)
{
- tgt_bind = gimple_seq_first_stmt (gimple_omp_body (stmt));
+ tgt_bind = gimple_seq_first_stmt_as_a_bind (gimple_omp_body (stmt));
tgt_body = gimple_bind_body (tgt_bind);
}
else if (kind == GF_OMP_TARGET_KIND_DATA)
@@ -10331,7 +10341,7 @@ lower_omp_teams (gimple_stmt_iterator *gsi_p, omp_context *ctx)
push_gimplify_context ();
tree block = make_node (BLOCK);
- gimple bind = gimple_build_bind (NULL, NULL, block);
+ gimple_bind bind = gimple_build_bind (NULL, NULL, block);
gsi_replace (gsi_p, bind, true);
gimple_seq bind_body = NULL;
gimple_seq dlist = NULL;
@@ -10460,7 +10470,7 @@ lower_omp_1 (gimple_stmt_iterator *gsi_p, omp_context *ctx)
lower_omp (gimple_transaction_body_ptr (stmt), ctx);
break;
case GIMPLE_BIND:
- lower_omp (gimple_bind_body_ptr (stmt), ctx);
+ lower_omp (gimple_bind_body_ptr (as_a <gimple_bind> (stmt)), ctx);
break;
case GIMPLE_OMP_PARALLEL:
case GIMPLE_OMP_TASK:
diff --git a/gcc/tree-cfg.c b/gcc/tree-cfg.c
index ffbe8f7..20d9c5e 100644
--- a/gcc/tree-cfg.c
+++ b/gcc/tree-cfg.c
@@ -4622,7 +4622,8 @@ verify_gimple_in_seq_2 (gimple_seq stmts)
switch (gimple_code (stmt))
{
case GIMPLE_BIND:
- err |= verify_gimple_in_seq_2 (gimple_bind_body (stmt));
+ err |= verify_gimple_in_seq_2 (
+ gimple_bind_body (as_a <gimple_bind> (stmt)));
break;
case GIMPLE_TRY:
@@ -8351,7 +8352,7 @@ do_warn_unused_result (gimple_seq seq)
switch (gimple_code (g))
{
case GIMPLE_BIND:
- do_warn_unused_result (gimple_bind_body (g));
+ do_warn_unused_result (gimple_bind_body (as_a <gimple_bind >(g)));
break;
case GIMPLE_TRY:
do_warn_unused_result (gimple_try_eval (g));
diff --git a/gcc/tree-inline.c b/gcc/tree-inline.c
index c2b6471..5b7cdea 100644
--- a/gcc/tree-inline.c
+++ b/gcc/tree-inline.c
@@ -792,7 +792,7 @@ remap_gimple_seq (gimple_seq body, copy_body_data *id)
block using the mapping information in ID. */
static gimple
-copy_gimple_bind (gimple stmt, copy_body_data *id)
+copy_gimple_bind (gimple_bind stmt, copy_body_data *id)
{
gimple new_bind;
tree new_block, new_vars;
@@ -1334,7 +1334,7 @@ remap_gimple_stmt (gimple stmt, copy_body_data *id)
switch (gimple_code (stmt))
{
case GIMPLE_BIND:
- copy = copy_gimple_bind (stmt, id);
+ copy = copy_gimple_bind (as_a <gimple_bind> (stmt), id);
break;
case GIMPLE_CATCH:
@@ -3962,7 +3962,9 @@ estimate_num_insns (gimple stmt, eni_weights *weights)
return 10;
case GIMPLE_BIND:
- return estimate_num_insns_seq (gimple_bind_body (stmt), weights);
+ return estimate_num_insns_seq (
+ gimple_bind_body (as_a <gimple_bind> (stmt)),
+ weights);
case GIMPLE_EH_FILTER:
return estimate_num_insns_seq (gimple_eh_filter_failure (stmt), weights);
@@ -4882,9 +4884,9 @@ replace_locals_stmt (gimple_stmt_iterator *gsip,
struct walk_stmt_info *wi)
{
copy_body_data *id = (copy_body_data *) wi->info;
- gimple stmt = gsi_stmt (*gsip);
+ gimple gs = gsi_stmt (*gsip);
- if (gimple_code (stmt) == GIMPLE_BIND)
+ if (gimple_bind stmt = dyn_cast <gimple_bind> (gs))
{
tree block = gimple_bind_block (stmt);
diff --git a/gcc/tree-nested.c b/gcc/tree-nested.c
index a378a02..1f54a07 100644
--- a/gcc/tree-nested.c
+++ b/gcc/tree-nested.c
@@ -1425,10 +1425,12 @@ convert_nonlocal_reference_stmt (gimple_stmt_iterator *gsi, bool *handled_ops_p,
break;
case GIMPLE_BIND:
- if (!optimize && gimple_bind_block (stmt))
- note_nonlocal_block_vlas (info, gimple_bind_block (stmt));
+ {
+ gimple_bind bind_stmt = as_a <gimple_bind> (stmt);
+ if (!optimize && gimple_bind_block (bind_stmt))
+ note_nonlocal_block_vlas (info, gimple_bind_block (bind_stmt));
- for (tree var = gimple_bind_vars (stmt); var; var = DECL_CHAIN (var))
+ for (tree var = gimple_bind_vars (bind_stmt); var; var = DECL_CHAIN (var))
if (TREE_CODE (var) == NAMELIST_DECL)
{
/* Adjust decls mentioned in NAMELIST_DECL. */
@@ -1449,7 +1451,7 @@ convert_nonlocal_reference_stmt (gimple_stmt_iterator *gsi, bool *handled_ops_p,
*handled_ops_p = false;
return NULL_TREE;
-
+ }
case GIMPLE_COND:
wi->val_only = true;
wi->is_lhs = false;
@@ -2007,7 +2009,9 @@ convert_local_reference_stmt (gimple_stmt_iterator *gsi, bool *handled_ops_p,
return NULL_TREE;
case GIMPLE_BIND:
- for (tree var = gimple_bind_vars (stmt); var; var = DECL_CHAIN (var))
+ for (tree var = gimple_bind_vars (as_a <gimple_bind> (stmt));
+ var;
+ var = DECL_CHAIN (var))
if (TREE_CODE (var) == NAMELIST_DECL)
{
/* Adjust decls mentioned in NAMELIST_DECL. */
@@ -2773,9 +2777,9 @@ finalize_nesting_tree_1 (struct nesting_info *root)
/* If we created initialization statements, insert them. */
if (stmt_list)
{
- gimple bind;
+ gimple_bind bind;
annotate_all_with_location (stmt_list, DECL_SOURCE_LOCATION (context));
- bind = gimple_seq_first_stmt (gimple_body (context));
+ bind = gimple_seq_first_stmt_as_a_bind (gimple_body (context));
gimple_seq_add_seq (&stmt_list, gimple_bind_body (bind));
gimple_bind_set_body (bind, stmt_list);
}
@@ -2804,7 +2808,7 @@ finalize_nesting_tree_1 (struct nesting_info *root)
if (root->debug_var_chain)
{
tree debug_var;
- gimple scope;
+ gimple_bind scope;
remap_vla_decls (DECL_INITIAL (root->context), root);
@@ -2859,7 +2863,7 @@ finalize_nesting_tree_1 (struct nesting_info *root)
delete id.cb.decl_map;
}
- scope = gimple_seq_first_stmt (gimple_body (root->context));
+ scope = gimple_seq_first_stmt_as_a_bind (gimple_body (root->context));
if (gimple_bind_block (scope))
declare_vars (root->debug_var_chain, scope, true);
else
--
1.8.5.3
^ permalink raw reply [flat|nested] 93+ messages in thread
* [gimple-classes, committed 84/92] Concretize gimple_call_copy_flags and ipa_modify_call_arguments
2014-10-27 20:35 [gimple-classes, committed 00/92] Initial slew of commits David Malcolm
` (29 preceding siblings ...)
2014-10-27 20:38 ` [gimple-classes, committed 80/92] Concretize gimple_call_set_fntype David Malcolm
@ 2014-10-27 20:38 ` David Malcolm
2014-10-27 20:38 ` [gimple-classes, committed 54/92] Various gimple to gimple_call conversions in IPA David Malcolm
` (60 subsequent siblings)
91 siblings, 0 replies; 93+ messages in thread
From: David Malcolm @ 2014-10-27 20:38 UTC (permalink / raw)
To: gcc-patches; +Cc: David Malcolm
This corresponds to:
[PATCH 86/89] Concretize gimple_call_copy_flags and ipa_modify_call_arguments
https://gcc.gnu.org/ml/gcc-patches/2014-04/msg01175.html
from the original 89-patch kit
That earlier patch was approved by Jeff:
> OK when prereqs go in.
in https://gcc.gnu.org/ml/gcc-patches/2014-05/msg00855.html
gcc/
* gimple.h (gimple_call_copy_flags): Require gimple_calls.
* ipa-prop.c (ipa_modify_call_arguments): Require a gimple_call.
* ipa-prop.h (ipa_modify_call_arguments): Likewise.
* tree-inline.c (copy_bb): Replace is_gimple_call with new local
and call to dyn_cast<gimple_call>, updating gimple_call_ uses to
use the type-checked local.
* tree-sra.c (convert_callers): Replace check for GIMPLE_CALL with
a dyn_cast.
---
gcc/ChangeLog.gimple-classes | 16 ++++++++++++++++
gcc/gimple.h | 4 +---
gcc/ipa-prop.c | 2 +-
gcc/ipa-prop.h | 2 +-
gcc/tree-inline.c | 20 +++++++++++---------
gcc/tree-sra.c | 5 +++--
6 files changed, 33 insertions(+), 16 deletions(-)
diff --git a/gcc/ChangeLog.gimple-classes b/gcc/ChangeLog.gimple-classes
index 572fe5a..9255151 100644
--- a/gcc/ChangeLog.gimple-classes
+++ b/gcc/ChangeLog.gimple-classes
@@ -1,5 +1,21 @@
2014-10-24 David Malcolm <dmalcolm@redhat.com>
+ Concretize gimple_call_copy_flags and ipa_modify_call_arguments
+
+ * gimple.h (gimple_call_copy_flags): Require gimple_calls.
+
+ * ipa-prop.c (ipa_modify_call_arguments): Require a gimple_call.
+ * ipa-prop.h (ipa_modify_call_arguments): Likewise.
+
+ * tree-inline.c (copy_bb): Replace is_gimple_call with new local
+ and call to dyn_cast<gimple_call>, updating gimple_call_ uses to
+ use the type-checked local.
+
+ * tree-sra.c (convert_callers): Replace check for GIMPLE_CALL with
+ a dyn_cast.
+
+2014-10-24 David Malcolm <dmalcolm@redhat.com>
+
Concretize gimple_assign_nontemporal_move_p
* gimple.h (gimple_assign_nontemporal_move_p): Require a
diff --git a/gcc/gimple.h b/gcc/gimple.h
index 5570c54..1722b6c 100644
--- a/gcc/gimple.h
+++ b/gcc/gimple.h
@@ -2948,10 +2948,8 @@ gimple_call_alloca_for_var_p (gimple_call s)
/* Copy all the GF_CALL_* flags from ORIG_CALL to DEST_CALL. */
static inline void
-gimple_call_copy_flags (gimple dest_call, gimple orig_call)
+gimple_call_copy_flags (gimple_call dest_call, gimple_call orig_call)
{
- GIMPLE_CHECK (dest_call, GIMPLE_CALL);
- GIMPLE_CHECK (orig_call, GIMPLE_CALL);
dest_call->subcode = orig_call->subcode;
}
diff --git a/gcc/ipa-prop.c b/gcc/ipa-prop.c
index 5a861f8..93fda45 100644
--- a/gcc/ipa-prop.c
+++ b/gcc/ipa-prop.c
@@ -4147,7 +4147,7 @@ ipa_modify_formal_parameters (tree fndecl, ipa_parm_adjustment_vec adjustments)
contain the corresponding call graph edge. */
void
-ipa_modify_call_arguments (struct cgraph_edge *cs, gimple stmt,
+ipa_modify_call_arguments (struct cgraph_edge *cs, gimple_call stmt,
ipa_parm_adjustment_vec adjustments)
{
struct cgraph_node *current_node = cgraph_node::get (current_function_decl);
diff --git a/gcc/ipa-prop.h b/gcc/ipa-prop.h
index 7a06af9..1beec51 100644
--- a/gcc/ipa-prop.h
+++ b/gcc/ipa-prop.h
@@ -705,7 +705,7 @@ typedef vec<ipa_parm_adjustment> ipa_parm_adjustment_vec;
vec<tree> ipa_get_vector_of_formal_parms (tree fndecl);
vec<tree> ipa_get_vector_of_formal_parm_types (tree fntype);
void ipa_modify_formal_parameters (tree fndecl, ipa_parm_adjustment_vec);
-void ipa_modify_call_arguments (struct cgraph_edge *, gimple,
+void ipa_modify_call_arguments (struct cgraph_edge *, gimple_call,
ipa_parm_adjustment_vec);
ipa_parm_adjustment_vec ipa_combine_adjustments (ipa_parm_adjustment_vec,
ipa_parm_adjustment_vec);
diff --git a/gcc/tree-inline.c b/gcc/tree-inline.c
index a0a299b..faa4656 100644
--- a/gcc/tree-inline.c
+++ b/gcc/tree-inline.c
@@ -1725,10 +1725,12 @@ copy_bb (copy_body_data *id, basic_block bb, int frequency_scale,
do
{
tree fn;
+ gimple_call call_stmt;
stmt = gsi_stmt (copy_gsi);
- if (is_gimple_call (stmt)
- && gimple_call_va_arg_pack_p (as_a <gimple_call> (stmt))
+ call_stmt = dyn_cast <gimple_call> (stmt);
+ if (call_stmt
+ && gimple_call_va_arg_pack_p (call_stmt)
&& id->gimple_call)
{
/* __builtin_va_arg_pack () should be replaced by
@@ -1743,33 +1745,33 @@ copy_bb (copy_body_data *id, basic_block bb, int frequency_scale,
nargs--;
/* Create the new array of arguments. */
- n = nargs + gimple_call_num_args (stmt);
+ n = nargs + gimple_call_num_args (call_stmt);
argarray.create (n);
argarray.safe_grow_cleared (n);
/* Copy all the arguments before '...' */
memcpy (argarray.address (),
- gimple_call_arg_ptr (stmt, 0),
- gimple_call_num_args (stmt) * sizeof (tree));
+ gimple_call_arg_ptr (call_stmt, 0),
+ gimple_call_num_args (call_stmt) * sizeof (tree));
/* Append the arguments passed in '...' */
- memcpy (argarray.address () + gimple_call_num_args (stmt),
+ memcpy (argarray.address () + gimple_call_num_args (call_stmt),
gimple_call_arg_ptr (id->gimple_call, 0)
+ (gimple_call_num_args (id->gimple_call) - nargs),
nargs * sizeof (tree));
- new_call = gimple_build_call_vec (gimple_call_fn (stmt),
+ new_call = gimple_build_call_vec (gimple_call_fn (call_stmt),
argarray);
argarray.release ();
/* Copy all GIMPLE_CALL flags, location and block, except
GF_CALL_VA_ARG_PACK. */
- gimple_call_copy_flags (new_call, stmt);
+ gimple_call_copy_flags (new_call, call_stmt);
gimple_call_set_va_arg_pack (new_call, false);
gimple_set_location (new_call, gimple_location (stmt));
gimple_set_block (new_call, gimple_block (stmt));
- gimple_call_set_lhs (new_call, gimple_call_lhs (stmt));
+ gimple_call_set_lhs (new_call, gimple_call_lhs (call_stmt));
gsi_replace (©_gsi, new_call, false);
stmt = new_call;
diff --git a/gcc/tree-sra.c b/gcc/tree-sra.c
index 50464f1..81e6f93 100644
--- a/gcc/tree-sra.c
+++ b/gcc/tree-sra.c
@@ -4884,9 +4884,10 @@ convert_callers (struct cgraph_node *node, tree old_decl,
for (gsi = gsi_start_bb (this_block); !gsi_end_p (gsi); gsi_next (&gsi))
{
- gimple stmt = gsi_stmt (gsi);
+ gimple_call stmt;
tree call_fndecl;
- if (gimple_code (stmt) != GIMPLE_CALL)
+ stmt = dyn_cast <gimple_call> (gsi_stmt (gsi));
+ if (!stmt)
continue;
call_fndecl = gimple_call_fndecl (stmt);
if (call_fndecl == old_decl)
--
1.8.5.3
^ permalink raw reply [flat|nested] 93+ messages in thread
* [gimple-classes, committed 49/92] Update GRAPHITE to use more concrete gimple statement classes
2014-10-27 20:35 [gimple-classes, committed 00/92] Initial slew of commits David Malcolm
` (36 preceding siblings ...)
2014-10-27 20:38 ` [gimple-classes, committed 75/92] Concretize various expressions from gimple to gimple_cond David Malcolm
@ 2014-10-27 20:38 ` David Malcolm
2014-10-27 20:38 ` [gimple-classes, committed 85/92] Use gimple_call in some places within tree-ssa-dom.c David Malcolm
` (53 subsequent siblings)
91 siblings, 0 replies; 93+ messages in thread
From: David Malcolm @ 2014-10-27 20:38 UTC (permalink / raw)
To: gcc-patches; +Cc: David Malcolm
This corresponds to:
[PATCH 51/89] Update GRAPHITE to use more concrete gimple statement classes
https://gcc.gnu.org/ml/gcc-patches/2014-04/msg01212.html
from the original 89-patch kit
That earlier patch was approved by Jeff:
> OK once prereqs go in.
in https://gcc.gnu.org/ml/gcc-patches/2014-05/msg00868.html
gcc/
* graphite-scop-detection.c (canonicalize_loop_closed_ssa):
Strengthen local "psi" to be a gimple_phi_iterator and "phi" to
a gimple_phi.
* graphite-sese-to-poly.c (phi_arg_in_outermost_loop): Require
a gimple_phi rathen than a plain gimple.
(remove_simple_copy_phi): Require a gimple_phi_iterator;
strengthen local "phi" to be a gimple_phi and "stmt" to be a
gimple_assign.
(remove_invariant_phi): Likewise.
(simple_copy_phi_p): Require a gimple_phi.
(reduction_phi_p): Require a gimple_phi_iterator; strengthen
local "phi" to be a gimple_phi.
(add_condition_to_pbb): Require a gimple_cond rather than a
plain gimple.
(add_conditions_to_domain): Add checked cast to gimple_cond
within GIMPLE_COND case of switch statement.
(single_pred_cond_non_loop_exit): Return a gimple_cond rather
than a plain gimple, via a checked cast.
(sese_dom_walker::before_dom_children): Strengthen local "stmt"
from gimple to gimple_cond.
(gsi_for_phi_node): Require a gimple_phi, and return a
gimple_phi_iterator.
(insert_out_of_ssa_copy): Strengthen local "stmt" from gimple to
gimple_assign.
(rewrite_reductions_out_of_ssa): Strengthen "psi" to be a
gimple_phi_iterator, and "phi" to be a gimple_phi.
(phi_contains_arg): Require a gimple_phi.
(follow_ssa_with_commutative_ops): Strengthen return type from
gimple to gimple_phi, by converting a check for code GIMPLE_PHI to
a dyn_cast<gimple_phi>, and strengthening local "res" from gimple
to gimple_phi.
(detect_commutative_reduction_arg): Strengthen return type from
gimple to gimple_phi, and strengthen local "phi" to be a
gimple_phi.
(detect_commutative_reduction_assign): Strengthen return type from
gimple to gimple_phi, and strengthen local "res" to be a
gimple_phi.
(follow_inital_value_to_phi): Strengthen return type from
gimple to gimple_phi. Replace check for code GIMPLE_PHI with
a dyn_cast<gimple_phi>.
(detect_commutative_reduction): Strengthen return type and locals
"loop_phi", "phi", "close_phi" from gimple to gimple_phi,
introducing a checked cast of "stmt" in region guarded by
scalar_close_phi_node_p (stmt).
(translate_scalar_reduction_to_array_for_stmt): Require param
"loop_phi" to be a gimple_phi. Strengthen local "assign" from
gimple to gimple_assign.
(remove_phi): Require a gimple_phi.
(close_phi_written_to_memory): Likewise.
(translate_scalar_reduction_to_array): We expect the first element
in each vector to be an arbitrary statement, but all of the
subsequent elements to be phi nodes. Hence the decls of gimple
locals "loop_phi" and "close_phi" are replaced with decls of gimple
"loop_stmt" and "close_stmt", with decls of the more-strongly typed
gimple_phi "loop_phi" and "close_phi" occurring lower down, within
the region where we're dealing with i > 0 and hence where we can
safely assign them using the checked cast as_a <gimple_phi>.
This allows many of the strengthenings from gimple to gimple_phi
above. We eliminate the local "stmt", since we can simply use
"loop_stmt".
(rewrite_commutative_reductions_out_of_ssa_close_phi): Strengthen
param "close_phi" from gimple to gimple_phi, and local "gsi" from
gimple_stmt_iterator to gimple_phi_iterator, converting uses of
gsi_stmt to gsi.phi for type-safety.
(scop_ivs_can_be_represented): Strengthen local "gsi" from
gimple_stmt_iterator to gimple_phi_iterator, and "phi" from gimple
to gimple_phi.
---
gcc/ChangeLog.gimple-classes | 73 ++++++++++++++++++++++++
gcc/graphite-scop-detection.c | 4 +-
gcc/graphite-sese-to-poly.c | 125 ++++++++++++++++++++++--------------------
3 files changed, 141 insertions(+), 61 deletions(-)
diff --git a/gcc/ChangeLog.gimple-classes b/gcc/ChangeLog.gimple-classes
index f7d2c73..abee412 100644
--- a/gcc/ChangeLog.gimple-classes
+++ b/gcc/ChangeLog.gimple-classes
@@ -1,5 +1,78 @@
2014-10-24 David Malcolm <dmalcolm@redhat.com>
+ Update GRAPHITE to use more concrete gimple statement classes
+
+ * graphite-scop-detection.c (canonicalize_loop_closed_ssa):
+ Strengthen local "psi" to be a gimple_phi_iterator and "phi" to
+ a gimple_phi.
+
+ * graphite-sese-to-poly.c (phi_arg_in_outermost_loop): Require
+ a gimple_phi rathen than a plain gimple.
+ (remove_simple_copy_phi): Require a gimple_phi_iterator;
+ strengthen local "phi" to be a gimple_phi and "stmt" to be a
+ gimple_assign.
+ (remove_invariant_phi): Likewise.
+ (simple_copy_phi_p): Require a gimple_phi.
+ (reduction_phi_p): Require a gimple_phi_iterator; strengthen
+ local "phi" to be a gimple_phi.
+ (add_condition_to_pbb): Require a gimple_cond rather than a
+ plain gimple.
+ (add_conditions_to_domain): Add checked cast to gimple_cond
+ within GIMPLE_COND case of switch statement.
+ (single_pred_cond_non_loop_exit): Return a gimple_cond rather
+ than a plain gimple, via a checked cast.
+ (sese_dom_walker::before_dom_children): Strengthen local "stmt"
+ from gimple to gimple_cond.
+ (gsi_for_phi_node): Require a gimple_phi, and return a
+ gimple_phi_iterator.
+ (insert_out_of_ssa_copy): Strengthen local "stmt" from gimple to
+ gimple_assign.
+ (rewrite_reductions_out_of_ssa): Strengthen "psi" to be a
+ gimple_phi_iterator, and "phi" to be a gimple_phi.
+ (phi_contains_arg): Require a gimple_phi.
+ (follow_ssa_with_commutative_ops): Strengthen return type from
+ gimple to gimple_phi, by converting a check for code GIMPLE_PHI to
+ a dyn_cast<gimple_phi>, and strengthening local "res" from gimple
+ to gimple_phi.
+ (detect_commutative_reduction_arg): Strengthen return type from
+ gimple to gimple_phi, and strengthen local "phi" to be a
+ gimple_phi.
+ (detect_commutative_reduction_assign): Strengthen return type from
+ gimple to gimple_phi, and strengthen local "res" to be a
+ gimple_phi.
+ (follow_inital_value_to_phi): Strengthen return type from
+ gimple to gimple_phi. Replace check for code GIMPLE_PHI with
+ a dyn_cast<gimple_phi>.
+ (detect_commutative_reduction): Strengthen return type and locals
+ "loop_phi", "phi", "close_phi" from gimple to gimple_phi,
+ introducing a checked cast of "stmt" in region guarded by
+ scalar_close_phi_node_p (stmt).
+ (translate_scalar_reduction_to_array_for_stmt): Require param
+ "loop_phi" to be a gimple_phi. Strengthen local "assign" from
+ gimple to gimple_assign.
+ (remove_phi): Require a gimple_phi.
+ (close_phi_written_to_memory): Likewise.
+ (translate_scalar_reduction_to_array): We expect the first element
+ in each vector to be an arbitrary statement, but all of the
+ subsequent elements to be phi nodes. Hence the decls of gimple
+ locals "loop_phi" and "close_phi" are replaced with decls of gimple
+ "loop_stmt" and "close_stmt", with decls of the more-strongly typed
+ gimple_phi "loop_phi" and "close_phi" occurring lower down, within
+ the region where we're dealing with i > 0 and hence where we can
+ safely assign them using the checked cast as_a <gimple_phi>.
+ This allows many of the strengthenings from gimple to gimple_phi
+ above. We eliminate the local "stmt", since we can simply use
+ "loop_stmt".
+ (rewrite_commutative_reductions_out_of_ssa_close_phi): Strengthen
+ param "close_phi" from gimple to gimple_phi, and local "gsi" from
+ gimple_stmt_iterator to gimple_phi_iterator, converting uses of
+ gsi_stmt to gsi.phi for type-safety.
+ (scop_ivs_can_be_represented): Strengthen local "gsi" from
+ gimple_stmt_iterator to gimple_phi_iterator, and "phi" from gimple
+ to gimple_phi.
+
+2014-10-24 David Malcolm <dmalcolm@redhat.com>
+
Make gimple_phi_arg_set_location require a gimple_phi
* gimple.h (gimple_phi_arg_set_location): Require a gimple_phi
diff --git a/gcc/graphite-scop-detection.c b/gcc/graphite-scop-detection.c
index 40ccad0..5e0c507 100644
--- a/gcc/graphite-scop-detection.c
+++ b/gcc/graphite-scop-detection.c
@@ -1338,14 +1338,14 @@ canonicalize_loop_closed_ssa (loop_p loop)
}
else
{
- gimple_stmt_iterator psi;
+ gimple_phi_iterator psi;
basic_block close = split_edge (e);
e = single_succ_edge (close);
for (psi = gsi_start_phis (bb); !gsi_end_p (psi); gsi_next (&psi))
{
- gimple phi = gsi_stmt (psi);
+ gimple_phi phi = psi.phi ();
unsigned i;
for (i = 0; i < gimple_phi_num_args (phi); i++)
diff --git a/gcc/graphite-sese-to-poly.c b/gcc/graphite-sese-to-poly.c
index c3adfe1..f58f750 100644
--- a/gcc/graphite-sese-to-poly.c
+++ b/gcc/graphite-sese-to-poly.c
@@ -94,7 +94,7 @@ tree_int_to_gmp (tree t, mpz_t res)
loop. */
static size_t
-phi_arg_in_outermost_loop (gimple phi)
+phi_arg_in_outermost_loop (gimple_phi phi)
{
loop_p loop = gimple_bb (phi)->loop_father;
size_t i, res = 0;
@@ -113,13 +113,13 @@ phi_arg_in_outermost_loop (gimple phi)
PSI by inserting on the loop ENTRY edge assignment "RES = INIT". */
static void
-remove_simple_copy_phi (gimple_stmt_iterator *psi)
+remove_simple_copy_phi (gimple_phi_iterator *psi)
{
- gimple phi = gsi_stmt (*psi);
+ gimple_phi phi = psi->phi ();
tree res = gimple_phi_result (phi);
size_t entry = phi_arg_in_outermost_loop (phi);
tree init = gimple_phi_arg_def (phi, entry);
- gimple stmt = gimple_build_assign (res, init);
+ gimple_assign stmt = gimple_build_assign (res, init);
edge e = gimple_phi_arg_edge (phi, entry);
remove_phi_node (psi, false);
@@ -130,16 +130,16 @@ remove_simple_copy_phi (gimple_stmt_iterator *psi)
loop ENTRY edge the assignment RES = INIT. */
static void
-remove_invariant_phi (sese region, gimple_stmt_iterator *psi)
+remove_invariant_phi (sese region, gimple_phi_iterator *psi)
{
- gimple phi = gsi_stmt (*psi);
+ gimple_phi phi = psi->phi ();
loop_p loop = loop_containing_stmt (phi);
tree res = gimple_phi_result (phi);
tree scev = scalar_evolution_in_region (region, loop, res);
size_t entry = phi_arg_in_outermost_loop (phi);
edge e = gimple_phi_arg_edge (phi, entry);
tree var;
- gimple stmt;
+ gimple_assign stmt;
gimple_seq stmts = NULL;
if (tree_contains_chrecs (scev, NULL))
@@ -158,7 +158,7 @@ remove_invariant_phi (sese region, gimple_stmt_iterator *psi)
/* Returns true when the phi node at PSI is of the form "a = phi (a, x)". */
static inline bool
-simple_copy_phi_p (gimple phi)
+simple_copy_phi_p (gimple_phi phi)
{
tree res;
@@ -175,10 +175,10 @@ simple_copy_phi_p (gimple phi)
be considered. */
static bool
-reduction_phi_p (sese region, gimple_stmt_iterator *psi)
+reduction_phi_p (sese region, gimple_phi_iterator *psi)
{
loop_p loop;
- gimple phi = gsi_stmt (*psi);
+ gimple_phi phi = psi->phi ();
tree res = gimple_phi_result (phi);
loop = loop_containing_stmt (phi);
@@ -1122,7 +1122,7 @@ create_pw_aff_from_tree (poly_bb_p pbb, tree t)
inequalities. */
static void
-add_condition_to_pbb (poly_bb_p pbb, gimple stmt, enum tree_code code)
+add_condition_to_pbb (poly_bb_p pbb, gimple_cond stmt, enum tree_code code)
{
isl_pw_aff *lhs = create_pw_aff_from_tree (pbb, gimple_cond_lhs (stmt));
isl_pw_aff *rhs = create_pw_aff_from_tree (pbb, gimple_cond_rhs (stmt));
@@ -1182,13 +1182,14 @@ add_conditions_to_domain (poly_bb_p pbb)
{
case GIMPLE_COND:
{
- enum tree_code code = gimple_cond_code (stmt);
+ gimple_cond cond_stmt = as_a <gimple_cond> (stmt);
+ enum tree_code code = gimple_cond_code (cond_stmt);
/* The conditions for ELSE-branches are inverted. */
if (!GBB_CONDITION_CASES (gbb)[i])
code = invert_tree_comparison (code, false);
- add_condition_to_pbb (pbb, stmt, code);
+ add_condition_to_pbb (pbb, cond_stmt, code);
break;
}
@@ -1218,7 +1219,7 @@ add_conditions_to_constraints (scop_p scop)
edge between BB and its predecessor is not a loop exit edge, and
the last statement of the single predecessor is a COND_EXPR. */
-static gimple
+static gimple_cond
single_pred_cond_non_loop_exit (basic_block bb)
{
if (single_pred_p (bb))
@@ -1233,7 +1234,7 @@ single_pred_cond_non_loop_exit (basic_block bb)
stmt = last_stmt (pred);
if (stmt && gimple_code (stmt) == GIMPLE_COND)
- return stmt;
+ return as_a <gimple_cond> (stmt);
}
return NULL;
@@ -1264,7 +1265,7 @@ void
sese_dom_walker::before_dom_children (basic_block bb)
{
gimple_bb_p gbb;
- gimple stmt;
+ gimple_cond stmt;
if (!bb_in_sese_p (bb, m_region))
return;
@@ -1930,10 +1931,10 @@ build_scop_drs (scop_p scop)
/* Return a gsi at the position of the phi node STMT. */
-static gimple_stmt_iterator
-gsi_for_phi_node (gimple stmt)
+static gimple_phi_iterator
+gsi_for_phi_node (gimple_phi stmt)
{
- gimple_stmt_iterator psi;
+ gimple_phi_iterator psi;
basic_block bb = gimple_bb (stmt);
for (psi = gsi_start_phis (bb); !gsi_end_p (psi); gsi_next (&psi))
@@ -2005,7 +2006,7 @@ insert_out_of_ssa_copy (scop_p scop, tree res, tree expr, gimple after_stmt)
gimple_seq stmts;
gimple_stmt_iterator gsi;
tree var = force_gimple_operand (expr, &stmts, true, NULL_TREE);
- gimple stmt = gimple_build_assign (unshare_expr (res), var);
+ gimple_assign stmt = gimple_build_assign (unshare_expr (res), var);
auto_vec<gimple, 3> x;
gimple_seq_add_stmt (&stmts, stmt);
@@ -2294,14 +2295,14 @@ static void
rewrite_reductions_out_of_ssa (scop_p scop)
{
basic_block bb;
- gimple_stmt_iterator psi;
+ gimple_phi_iterator psi;
sese region = SCOP_REGION (scop);
FOR_EACH_BB_FN (bb, cfun)
if (bb_in_sese_p (bb, region))
for (psi = gsi_start_phis (bb); !gsi_end_p (psi);)
{
- gimple phi = gsi_stmt (psi);
+ gimple_phi phi = psi.phi ();
if (virtual_operand_p (gimple_phi_result (phi)))
{
@@ -2617,7 +2618,7 @@ is_reduction_operation_p (gimple stmt)
/* Returns true when PHI contains an argument ARG. */
static bool
-phi_contains_arg (gimple phi, tree arg)
+phi_contains_arg (gimple_phi phi, tree arg)
{
size_t i;
@@ -2630,7 +2631,7 @@ phi_contains_arg (gimple phi, tree arg)
/* Return a loop phi node that corresponds to a reduction containing LHS. */
-static gimple
+static gimple_phi
follow_ssa_with_commutative_ops (tree arg, tree lhs)
{
gimple stmt;
@@ -2644,10 +2645,10 @@ follow_ssa_with_commutative_ops (tree arg, tree lhs)
|| gimple_code (stmt) == GIMPLE_CALL)
return NULL;
- if (gimple_code (stmt) == GIMPLE_PHI)
+ if (gimple_phi phi = dyn_cast <gimple_phi> (stmt))
{
- if (phi_contains_arg (stmt, lhs))
- return stmt;
+ if (phi_contains_arg (phi, lhs))
+ return phi;
return NULL;
}
@@ -2659,7 +2660,8 @@ follow_ssa_with_commutative_ops (tree arg, tree lhs)
if (is_reduction_operation_p (stmt))
{
- gimple res = follow_ssa_with_commutative_ops (gimple_assign_rhs1 (stmt), lhs);
+ gimple_phi res =
+ follow_ssa_with_commutative_ops (gimple_assign_rhs1 (stmt), lhs);
return res ? res :
follow_ssa_with_commutative_ops (gimple_assign_rhs2 (stmt), lhs);
@@ -2671,12 +2673,12 @@ follow_ssa_with_commutative_ops (tree arg, tree lhs)
/* Detect commutative and associative scalar reductions starting at
the STMT. Return the phi node of the reduction cycle, or NULL. */
-static gimple
+static gimple_phi
detect_commutative_reduction_arg (tree lhs, gimple stmt, tree arg,
vec<gimple> *in,
vec<gimple> *out)
{
- gimple phi = follow_ssa_with_commutative_ops (arg, lhs);
+ gimple_phi phi = follow_ssa_with_commutative_ops (arg, lhs);
if (!phi)
return NULL;
@@ -2689,7 +2691,7 @@ detect_commutative_reduction_arg (tree lhs, gimple stmt, tree arg,
/* Detect commutative and associative scalar reductions starting at
STMT. Return the phi node of the reduction cycle, or NULL. */
-static gimple
+static gimple_phi
detect_commutative_reduction_assign (gimple stmt, vec<gimple> *in,
vec<gimple> *out)
{
@@ -2702,9 +2704,10 @@ detect_commutative_reduction_assign (gimple stmt, vec<gimple> *in,
if (is_reduction_operation_p (stmt))
{
- gimple res = detect_commutative_reduction_arg (lhs, stmt,
- gimple_assign_rhs1 (stmt),
- in, out);
+ gimple_phi res =
+ detect_commutative_reduction_arg (lhs, stmt,
+ gimple_assign_rhs1 (stmt),
+ in, out);
return res ? res
: detect_commutative_reduction_arg (lhs, stmt,
gimple_assign_rhs2 (stmt),
@@ -2716,7 +2719,7 @@ detect_commutative_reduction_assign (gimple stmt, vec<gimple> *in,
/* Return a loop phi node that corresponds to a reduction containing LHS. */
-static gimple
+static gimple_phi
follow_inital_value_to_phi (tree arg, tree lhs)
{
gimple stmt;
@@ -2726,9 +2729,9 @@ follow_inital_value_to_phi (tree arg, tree lhs)
stmt = SSA_NAME_DEF_STMT (arg);
- if (gimple_code (stmt) == GIMPLE_PHI
- && phi_contains_arg (stmt, lhs))
- return stmt;
+ if (gimple_phi phi = dyn_cast <gimple_phi> (stmt))
+ if (phi_contains_arg (phi, lhs))
+ return phi;
return NULL;
}
@@ -2802,13 +2805,14 @@ used_outside_reduction (tree def, gimple loop_phi)
the SCOP starting at the loop closed phi node STMT. Return the phi
node of the reduction cycle, or NULL. */
-static gimple
+static gimple_phi
detect_commutative_reduction (scop_p scop, gimple stmt, vec<gimple> *in,
vec<gimple> *out)
{
if (scalar_close_phi_node_p (stmt))
{
- gimple def, loop_phi, phi, close_phi = stmt;
+ gimple def;
+ gimple_phi loop_phi, phi, close_phi = as_a <gimple_phi> (stmt);
tree init, lhs, arg = gimple_phi_arg_def (close_phi, 0);
if (TREE_CODE (arg) != SSA_NAME)
@@ -2848,10 +2852,10 @@ detect_commutative_reduction (scop_p scop, gimple stmt, vec<gimple> *in,
static void
translate_scalar_reduction_to_array_for_stmt (scop_p scop, tree red,
- gimple stmt, gimple loop_phi)
+ gimple stmt, gimple_phi loop_phi)
{
tree res = gimple_phi_result (loop_phi);
- gimple assign = gimple_build_assign (res, unshare_expr (red));
+ gimple_assign assign = gimple_build_assign (res, unshare_expr (red));
gimple_stmt_iterator gsi;
insert_stmts (scop, assign, NULL, gsi_after_labels (gimple_bb (loop_phi)));
@@ -2866,7 +2870,7 @@ translate_scalar_reduction_to_array_for_stmt (scop_p scop, tree red,
the PHI_RESULT. */
static void
-remove_phi (gimple phi)
+remove_phi (gimple_phi phi)
{
imm_use_iterator imm_iter;
tree def;
@@ -2929,7 +2933,7 @@ dr_indices_valid_in_loop (tree ref ATTRIBUTE_UNUSED, tree *index, void *data)
NULL_TREE. */
static tree
-close_phi_written_to_memory (gimple close_phi)
+close_phi_written_to_memory (gimple_phi close_phi)
{
imm_use_iterator imm_iter;
use_operand_p use_p;
@@ -2984,30 +2988,33 @@ translate_scalar_reduction_to_array (scop_p scop,
vec<gimple> in,
vec<gimple> out)
{
- gimple loop_phi;
+ gimple loop_stmt;
unsigned int i = out.length () - 1;
- tree red = close_phi_written_to_memory (out[i]);
+ tree red = close_phi_written_to_memory (as_a <gimple_phi> (out[i]));
- FOR_EACH_VEC_ELT (in, i, loop_phi)
+ FOR_EACH_VEC_ELT (in, i, loop_stmt)
{
- gimple close_phi = out[i];
+ gimple close_stmt = out[i];
if (i == 0)
{
- gimple stmt = loop_phi;
- basic_block bb = split_reduction_stmt (scop, stmt);
+ basic_block bb = split_reduction_stmt (scop, loop_stmt);
poly_bb_p pbb = pbb_from_bb (bb);
PBB_IS_REDUCTION (pbb) = true;
- gcc_assert (close_phi == loop_phi);
+ gcc_assert (close_stmt == loop_stmt);
if (!red)
red = create_zero_dim_array
- (gimple_assign_lhs (stmt), "Commutative_Associative_Reduction");
+ (gimple_assign_lhs (loop_stmt), "Commutative_Associative_Reduction");
- translate_scalar_reduction_to_array_for_stmt (scop, red, stmt, in[1]);
+ translate_scalar_reduction_to_array_for_stmt (scop, red, loop_stmt,
+ as_a <gimple_phi> (in[1]));
continue;
}
+ gimple_phi loop_phi = as_a <gimple_phi> (loop_stmt);
+ gimple_phi close_phi = as_a <gimple_phi> (close_stmt);
+
if (i == in.length () - 1)
{
insert_out_of_ssa_copy (scop, gimple_phi_result (close_phi),
@@ -3027,7 +3034,7 @@ translate_scalar_reduction_to_array (scop_p scop,
static bool
rewrite_commutative_reductions_out_of_ssa_close_phi (scop_p scop,
- gimple close_phi)
+ gimple_phi close_phi)
{
bool res;
auto_vec<gimple, 10> in;
@@ -3048,7 +3055,7 @@ static bool
rewrite_commutative_reductions_out_of_ssa_loop (scop_p scop,
loop_p loop)
{
- gimple_stmt_iterator gsi;
+ gimple_phi_iterator gsi;
edge exit = single_exit (loop);
tree res;
bool changed = false;
@@ -3057,11 +3064,11 @@ rewrite_commutative_reductions_out_of_ssa_loop (scop_p scop,
return false;
for (gsi = gsi_start_phis (exit->dest); !gsi_end_p (gsi); gsi_next (&gsi))
- if ((res = gimple_phi_result (gsi_stmt (gsi)))
+ if ((res = gimple_phi_result (gsi.phi ()))
&& !virtual_operand_p (res)
&& !scev_analyzable_p (res, SCOP_REGION (scop)))
changed |= rewrite_commutative_reductions_out_of_ssa_close_phi
- (scop, gsi_stmt (gsi));
+ (scop, gsi.phi ());
return changed;
}
@@ -3098,7 +3105,7 @@ static bool
scop_ivs_can_be_represented (scop_p scop)
{
loop_p loop;
- gimple_stmt_iterator psi;
+ gimple_phi_iterator psi;
bool result = true;
FOR_EACH_LOOP (loop, 0)
@@ -3109,7 +3116,7 @@ scop_ivs_can_be_represented (scop_p scop)
for (psi = gsi_start_phis (loop->header);
!gsi_end_p (psi); gsi_next (&psi))
{
- gimple phi = gsi_stmt (psi);
+ gimple_phi phi = psi.phi ();
tree res = PHI_RESULT (phi);
tree type = TREE_TYPE (res);
--
1.8.5.3
^ permalink raw reply [flat|nested] 93+ messages in thread
* [gimple-classes, committed 68/92] Concretize locals within expand_omp_for_init_counts
2014-10-27 20:35 [gimple-classes, committed 00/92] Initial slew of commits David Malcolm
` (38 preceding siblings ...)
2014-10-27 20:38 ` [gimple-classes, committed 85/92] Use gimple_call in some places within tree-ssa-dom.c David Malcolm
@ 2014-10-27 20:38 ` David Malcolm
2014-10-27 20:38 ` [gimple-classes, committed 86/92] Use gimple_phi in many more places David Malcolm
` (51 subsequent siblings)
91 siblings, 0 replies; 93+ messages in thread
From: David Malcolm @ 2014-10-27 20:38 UTC (permalink / raw)
To: gcc-patches; +Cc: David Malcolm
This corresponds to:
[PATCH 70/89] Concretize locals within expand_omp_for_init_counts
https://gcc.gnu.org/ml/gcc-patches/2014-04/msg01183.html
from the original 89-patch kit
That earlier patch was approved by Jeff:
> OK once prerequisites have gone in.
in https://gcc.gnu.org/ml/gcc-patches/2014-05/msg00836.html
gcc/
* omp-low.c (expand_omp_for_init_counts): Eliminate local "stmt"
in favor of new locals "cond_stmt" and "assign_stmt" with more
concrete types.
---
gcc/ChangeLog.gimple-classes | 8 ++++++++
gcc/omp-low.c | 25 +++++++++++++------------
2 files changed, 21 insertions(+), 12 deletions(-)
diff --git a/gcc/ChangeLog.gimple-classes b/gcc/ChangeLog.gimple-classes
index 2bfebca..a046f12 100644
--- a/gcc/ChangeLog.gimple-classes
+++ b/gcc/ChangeLog.gimple-classes
@@ -1,5 +1,13 @@
2014-10-24 David Malcolm <dmalcolm@redhat.com>
+ Concretize locals within expand_omp_for_init_counts
+
+ * omp-low.c (expand_omp_for_init_counts): Eliminate local "stmt"
+ in favor of new locals "cond_stmt" and "assign_stmt" with more
+ concrete types.
+
+2014-10-24 David Malcolm <dmalcolm@redhat.com>
+
Make gimple_cond_set_{true|false}_label require gimple_cond.
* gimple.h (gimple_cond_set_true_label): Require a gimple_cond.
diff --git a/gcc/omp-low.c b/gcc/omp-low.c
index 1e1ee1d..be4037b 100644
--- a/gcc/omp-low.c
+++ b/gcc/omp-low.c
@@ -5193,7 +5193,6 @@ expand_omp_for_init_counts (struct omp_for_data *fd, gimple_stmt_iterator *gsi,
basic_block &l2_dom_bb)
{
tree t, type = TREE_TYPE (fd->loop.v);
- gimple stmt;
edge e, ne;
int i;
@@ -5232,6 +5231,7 @@ expand_omp_for_init_counts (struct omp_for_data *fd, gimple_stmt_iterator *gsi,
fold_convert (itype, fd->loops[i].n2)))
== NULL_TREE || !integer_onep (t)))
{
+ gimple_cond cond_stmt;
tree n1, n2;
n1 = fold_convert (itype, unshare_expr (fd->loops[i].n1));
n1 = force_gimple_operand_gsi (gsi, n1, true, NULL_TREE,
@@ -5239,27 +5239,28 @@ expand_omp_for_init_counts (struct omp_for_data *fd, gimple_stmt_iterator *gsi,
n2 = fold_convert (itype, unshare_expr (fd->loops[i].n2));
n2 = force_gimple_operand_gsi (gsi, n2, true, NULL_TREE,
true, GSI_SAME_STMT);
- stmt = gimple_build_cond (fd->loops[i].cond_code, n1, n2,
- NULL_TREE, NULL_TREE);
- gsi_insert_before (gsi, stmt, GSI_SAME_STMT);
- if (walk_tree (gimple_cond_lhs_ptr (stmt),
+ cond_stmt = gimple_build_cond (fd->loops[i].cond_code, n1, n2,
+ NULL_TREE, NULL_TREE);
+ gsi_insert_before (gsi, cond_stmt, GSI_SAME_STMT);
+ if (walk_tree (gimple_cond_lhs_ptr (cond_stmt),
expand_omp_regimplify_p, NULL, NULL)
- || walk_tree (gimple_cond_rhs_ptr (stmt),
+ || walk_tree (gimple_cond_rhs_ptr (cond_stmt),
expand_omp_regimplify_p, NULL, NULL))
{
- *gsi = gsi_for_stmt (stmt);
- gimple_regimplify_operands (stmt, gsi);
+ *gsi = gsi_for_stmt (cond_stmt);
+ gimple_regimplify_operands (cond_stmt, gsi);
}
- e = split_block (entry_bb, stmt);
+ e = split_block (entry_bb, cond_stmt);
if (zero_iter_bb == NULL)
{
+ gimple_assign assign_stmt;
first_zero_iter = i;
zero_iter_bb = create_empty_bb (entry_bb);
add_bb_to_loop (zero_iter_bb, entry_bb->loop_father);
*gsi = gsi_after_labels (zero_iter_bb);
- stmt = gimple_build_assign (fd->loop.n2,
- build_zero_cst (type));
- gsi_insert_before (gsi, stmt, GSI_SAME_STMT);
+ assign_stmt = gimple_build_assign (fd->loop.n2,
+ build_zero_cst (type));
+ gsi_insert_before (gsi, assign_stmt, GSI_SAME_STMT);
set_immediate_dominator (CDI_DOMINATORS, zero_iter_bb,
entry_bb);
}
--
1.8.5.3
^ permalink raw reply [flat|nested] 93+ messages in thread
* [gimple-classes, committed 90/92] Automated renaming of gimple subclasses
2014-10-27 20:35 [gimple-classes, committed 00/92] Initial slew of commits David Malcolm
` (42 preceding siblings ...)
2014-10-27 20:38 ` [gimple-classes, committed 77/92] Concretize gimple_call_nothrow_p David Malcolm
@ 2014-10-27 20:38 ` David Malcolm
2014-10-27 20:38 ` [gimple-classes, committed 63/92] Concretize three gimple_try_set_ accessors David Malcolm
` (47 subsequent siblings)
91 siblings, 0 replies; 93+ messages in thread
From: David Malcolm @ 2014-10-27 20:38 UTC (permalink / raw)
To: gcc-patches; +Cc: David Malcolm
This patch is huge (704K), so I've trimmed it.
The most pertinent data from the ChangeLog is:
Patch autogenerated by rename_gimple_subclasses.py from
https://github.com/davidmalcolm/gcc-refactoring-scripts
revision 7d754b63ff2bf47226a67b2c0af5d74b54d4709f
The full patch can be seen at:
https://gcc.gnu.org/git/?p=gcc.git;a=commitdiff;h=6cdf27b83b54e05769704e7a42a0851093317206
^ permalink raw reply [flat|nested] 93+ messages in thread
* [gimple-classes, committed 31/92] Use more concrete types for various gimple statements
2014-10-27 20:35 [gimple-classes, committed 00/92] Initial slew of commits David Malcolm
` (34 preceding siblings ...)
2014-10-27 20:38 ` [gimple-classes, committed 72/92] Concretize gimple_cond_set_code David Malcolm
@ 2014-10-27 20:38 ` David Malcolm
2014-10-27 20:38 ` [gimple-classes, committed 75/92] Concretize various expressions from gimple to gimple_cond David Malcolm
` (55 subsequent siblings)
91 siblings, 0 replies; 93+ messages in thread
From: David Malcolm @ 2014-10-27 20:38 UTC (permalink / raw)
To: gcc-patches; +Cc: David Malcolm
This corresponds to:
[PATCH 33/89] Use more concrete types for various gimple statements
https://gcc.gnu.org/ml/gcc-patches/2014-04/msg01226.html
from the original 89-patch kit
That earlier patch was approved by Jeff:
> OK after prerequisites have gone in.
in https://gcc.gnu.org/ml/gcc-patches/2014-05/msg00801.html
gcc/
* cgraphunit.c (thunk_adjust): Strengthen local "stmt" from gimple
to gimple_assign.
* gimple-ssa-isolate-paths.c
(insert_trap_and_remove_trailing_statements): Strengthen local
"new_stmt" from gimple to gimple_call.
* gimple-ssa-strength-reduction.c (replace_mult_candidate):
Strengthen local "copy_stmt" from gimple to gimple_assign.
(create_add_on_incoming_edge): Likewise, for "new_stmt".
(insert_initializers): Likewise, for "init_stmt".
(introduce_cast_before_cand): Likewise, for "cast_stmt".
(replace_one_candidate): Likewise, for "copy_stmt" and
"cast_stmt".
* gimplify.c (build_stack_save_restore): Require gimple_calls
rather than plain gimples.
(gimplify_bind_expr): Strengthen locals "stack_save" and
"stack_restore" from gimple to gimple_call. Strengthen "gs"
to gimple_try.
(gimplify_switch_expr): Strengthen local "gimple_switch" from
gimple to gimple_switch, and "new_default" to gimple_label.
(gimplify_cond_expr): Strengthen local "gimple_cond" from gimple
to gimple_cond.
(gimplify_init_constructor): Strengthen local "init" from gimple
to gimple_assign.
(gimplify_cleanup_point_expr): Strengthen local "gtry" from gimple
to gimple_try.
(gimple_push_cleanup): Strengthen locals "ffalse" and "ftrue" from
gimple to gimple_assign.
* tree-eh.c (do_goto_redirection): Strengthen local to gimple_goto.
(emit_post_landing_pad): Strengthen local to gimple_label.
* tree-outof-ssa.c (insert_backedge_copies): Strengthen local
"stmt" from gimple to gimple_assign.
* tree-parloops.c (take_address_of): Likewise.
* tree-predcom.c (replace_ref_with): Likewise, for "new_stmt".
(initialize_root_vars_lm): Likewise, for "init_stmt".
(reassociate_to_the_same_stmt): Likewise, for "new_stmt" and "tmp_stmt".
* tree-profile.c (gimple_gen_edge_profiler): Likewise, for "stmt1",
"stmt2", "stmt3".
(gimple_gen_ic_profiler): Likewise.
(gimple_gen_ic_func_profiler): Strengthen local "stmt1" from
gimple to gimple_call, and "stmt2" to gimple_assign.
* tree-scalar-evolution.c (scev_const_prop): Strengthen local
"ass" from gimple to gimple_assign.
* tree-sra.c (build_ref_for_offset): Likewise for "stmt".
(generate_subtree_copies): Likewise; also strengthen "ds" to
gimple_debug.
(init_subtree_with_zero): Likewise.
(sra_modify_expr): Likewise.
(load_assign_lhs_subreplacements): Likewise.
(sra_modify_assign): Strengthen "ds" to gimple_debug.
(sra_ipa_reset_debug_stmts): Likewise for "def_temp".
* tree-ssa-ccp.c (insert_clobber_before_stack_restore):
Strengthen local "clobber_stmt" from gimple to gimple_assign.
* tree-ssa-dce.c (remove_dead_stmt): Strengthen "note" to
gimple_debug.
* tree-ssa-dom.c (record_equivalences_from_stmt): Strengthen
local "new_stmt" from gimple to gimple_assign.
(optimize_stmt): Likewise.
* tree-ssa-forwprop.c (simplify_bitwise_binary): Likewise for
4 declarations of "newop".
(simplify_rotate): Likewise for "g".
* tree-ssa-loop-im.c (rewrite_reciprocal): Likewise for 3 locals.
(rewrite_bittest): Likewise for "stmt" and "stmt2".
(move_computations_dom_walker::before_dom_children): Likewise for
"new_stmt".
(execute_sm): Likewise for "load" and "store".
* tree-ssa-loop-ivcanon.c (remove_exits_and_undefined_stmts):
Strengthen local "stmt" from gimple to gimple_call.
(unloop_loops): Likewise.
* tree-ssa-loop-ivopts.c (rewrite_use_nonlinear_expr): Strengthen
local "ass" from gimple to gimple_assign.
(remove_unused_ivs): Strengthen "def_temp" to gimple_debug.
* tree-ssa-loop-manip.c (rewrite_phi_with_iv): Strengthen local "stmt"
from gimple to gimple_assign.
* tree-ssa-loop-prefetch.c (issue_prefetch_ref): Strengthen local
"prefetch" from gimple to gimple_call.
* tree-ssa-math-opts.c (insert_reciprocals): Strengthen local
"new_stmt" from gimple to gimple_assign.
(powi_as_mults_1): Likewise for "mult_stmt".
(powi_as_mults): Likewise for "div_stmt".
(build_and_insert_binop): Likewise for "stmt".
(build_and_insert_cast): Likewise.
(pass_cse_sincos::execute): Likewise for "stmt" and various decls
of "new_stmt".
(convert_mult_to_fma): Likewise for "fma_stmt".
* tree-ssa-phiopt.c (conditional_replacement): Likewise for "new_stmt".
(abs_replacement): Likewise.
* tree-ssa-phiprop.c (phiprop_insert_phi): Likewise for "tmp".
* tree-ssa-pre.c (create_expression_by_pieces): Likewise for "newstmt".
(eliminate_insert): Likewise for "tem".
* tree-ssa-propagate.c (update_gimple_call): Strengthen locals
"new_stmt" and "stmt" from gimple to gimple_call.
(update_call_from_tree): Likewise for "new_stmt".
* tree-ssa-reassoc.c (build_and_add_sum): Likewise for "sum".
(update_ops): Likewise for "g".
(maybe_optimize_range_tests): Likewise.
(rewrite_expr_tree_parallel): Require a gimple_assign rather than
a plain gimple.
(reassociate_bb): Add a checked cast to gimple_assign.
* tree-ssa.c (insert_debug_temp_for_var_def): Strengthen local
"def_temp" from gimple to gimple_debug.
* tree-switch-conversion.c (emit_case_bit_tests): Strengthen local
"shift_stmt" from gimple to gimple_assign.
* tree-tailcall.c (adjust_return_value_with_ops): Likewise for
"stmt".
(update_accumulator_with_ops): Likewise.
* tree-vect-data-refs.c (bump_vector_ptr): Likewise for
"incr_stmt".
* tree-vect-stmts.c (vectorizable_condition): Likewise for
"new_stmt".
* tree-vrp.c (build_assert_expr_for): Likewise for "assertion".
(simplify_truth_ops_using_ranges): Likewise for "newop".
(simplify_float_conversion_using_ranges): Likewise for "conv".
* ubsan.c (instrument_mem_ref): Strengthen local "g" from gimple
to gimple_call.
* value-prof.c (gimple_divmod_fixed_value): Require a
gimple_assign rather than a plain gimple; strengthen types of locals.
(gimple_mod_pow2): Likewise.
(gimple_mod_subtract): Likewise.
(gimple_divmod_fixed_value_transform): Strengthen local
"stmt" from gimple to gimple_assign.
(gimple_mod_pow2_value_transform): Likewise.
(gimple_mod_subtract_transform): Likewise.
(gimple_ic): Strengthen types of locals.
---
gcc/ChangeLog.gimple-classes | 161 ++++++++++++++++++++++++++++++++++++
gcc/cgraphunit.c | 2 +-
gcc/gimple-ssa-isolate-paths.c | 2 +-
gcc/gimple-ssa-strength-reduction.c | 17 ++--
gcc/gimplify.c | 22 ++---
gcc/tree-eh.c | 4 +-
gcc/tree-outof-ssa.c | 3 +-
gcc/tree-parloops.c | 2 +-
gcc/tree-predcom.c | 6 +-
gcc/tree-profile.c | 7 +-
gcc/tree-scalar-evolution.c | 2 +-
gcc/tree-sra.c | 35 ++++----
gcc/tree-ssa-ccp.c | 3 +-
gcc/tree-ssa-dce.c | 2 +-
gcc/tree-ssa-dom.c | 4 +-
gcc/tree-ssa-forwprop.c | 10 +--
gcc/tree-ssa-loop-im.c | 17 ++--
gcc/tree-ssa-loop-ivcanon.c | 4 +-
gcc/tree-ssa-loop-ivopts.c | 5 +-
gcc/tree-ssa-loop-manip.c | 2 +-
gcc/tree-ssa-loop-prefetch.c | 2 +-
gcc/tree-ssa-math-opts.c | 23 +++---
gcc/tree-ssa-phiopt.c | 6 +-
gcc/tree-ssa-phiprop.c | 2 +-
gcc/tree-ssa-pre.c | 9 +-
gcc/tree-ssa-propagate.c | 4 +-
gcc/tree-ssa-reassoc.c | 14 ++--
gcc/tree-ssa.c | 2 +-
gcc/tree-switch-conversion.c | 2 +-
gcc/tree-tailcall.c | 4 +-
gcc/tree-vect-data-refs.c | 2 +-
gcc/tree-vect-stmts.c | 2 +-
gcc/tree-vrp.c | 7 +-
gcc/ubsan.c | 2 +-
gcc/value-prof.c | 49 ++++++-----
35 files changed, 314 insertions(+), 126 deletions(-)
diff --git a/gcc/ChangeLog.gimple-classes b/gcc/ChangeLog.gimple-classes
index 983819a..5e6b383 100644
--- a/gcc/ChangeLog.gimple-classes
+++ b/gcc/ChangeLog.gimple-classes
@@ -1,5 +1,166 @@
2014-10-24 David Malcolm <dmalcolm@redhat.com>
+ Use more concrete types for various gimple statements
+
+ * cgraphunit.c (thunk_adjust): Strengthen local "stmt" from gimple
+ to gimple_assign.
+
+ * gimple-ssa-isolate-paths.c
+ (insert_trap_and_remove_trailing_statements): Strengthen local
+ "new_stmt" from gimple to gimple_call.
+
+ * gimple-ssa-strength-reduction.c (replace_mult_candidate):
+ Strengthen local "copy_stmt" from gimple to gimple_assign.
+ (create_add_on_incoming_edge): Likewise, for "new_stmt".
+ (insert_initializers): Likewise, for "init_stmt".
+ (introduce_cast_before_cand): Likewise, for "cast_stmt".
+ (replace_one_candidate): Likewise, for "copy_stmt" and
+ "cast_stmt".
+
+ * gimplify.c (build_stack_save_restore): Require gimple_calls
+ rather than plain gimples.
+ (gimplify_bind_expr): Strengthen locals "stack_save" and
+ "stack_restore" from gimple to gimple_call. Strengthen "gs"
+ to gimple_try.
+ (gimplify_switch_expr): Strengthen local "gimple_switch" from
+ gimple to gimple_switch, and "new_default" to gimple_label.
+ (gimplify_cond_expr): Strengthen local "gimple_cond" from gimple
+ to gimple_cond.
+ (gimplify_init_constructor): Strengthen local "init" from gimple
+ to gimple_assign.
+ (gimplify_cleanup_point_expr): Strengthen local "gtry" from gimple
+ to gimple_try.
+ (gimple_push_cleanup): Strengthen locals "ffalse" and "ftrue" from
+ gimple to gimple_assign.
+
+ * tree-eh.c (do_goto_redirection): Strengthen local to gimple_goto.
+ (emit_post_landing_pad): Strengthen local to gimple_label.
+
+ * tree-outof-ssa.c (insert_backedge_copies): Strengthen local
+ "stmt" from gimple to gimple_assign.
+
+ * tree-parloops.c (take_address_of): Likewise.
+
+ * tree-predcom.c (replace_ref_with): Likewise, for "new_stmt".
+ (initialize_root_vars_lm): Likewise, for "init_stmt".
+ (reassociate_to_the_same_stmt): Likewise, for "new_stmt" and "tmp_stmt".
+
+ * tree-profile.c (gimple_gen_edge_profiler): Likewise, for "stmt1",
+ "stmt2", "stmt3".
+ (gimple_gen_ic_profiler): Likewise.
+ (gimple_gen_ic_func_profiler): Strengthen local "stmt1" from
+ gimple to gimple_call, and "stmt2" to gimple_assign.
+
+ * tree-scalar-evolution.c (scev_const_prop): Strengthen local
+ "ass" from gimple to gimple_assign.
+
+ * tree-sra.c (build_ref_for_offset): Likewise for "stmt".
+ (generate_subtree_copies): Likewise; also strengthen "ds" to
+ gimple_debug.
+ (init_subtree_with_zero): Likewise.
+ (sra_modify_expr): Likewise.
+ (load_assign_lhs_subreplacements): Likewise.
+ (sra_modify_assign): Strengthen "ds" to gimple_debug.
+ (sra_ipa_reset_debug_stmts): Likewise for "def_temp".
+
+ * tree-ssa-ccp.c (insert_clobber_before_stack_restore):
+ Strengthen local "clobber_stmt" from gimple to gimple_assign.
+
+ * tree-ssa-dce.c (remove_dead_stmt): Strengthen "note" to
+ gimple_debug.
+
+ * tree-ssa-dom.c (record_equivalences_from_stmt): Strengthen
+ local "new_stmt" from gimple to gimple_assign.
+ (optimize_stmt): Likewise.
+
+ * tree-ssa-forwprop.c (simplify_bitwise_binary): Likewise for
+ 4 declarations of "newop".
+ (simplify_rotate): Likewise for "g".
+
+ * tree-ssa-loop-im.c (rewrite_reciprocal): Likewise for 3 locals.
+ (rewrite_bittest): Likewise for "stmt" and "stmt2".
+ (move_computations_dom_walker::before_dom_children): Likewise for
+ "new_stmt".
+ (execute_sm): Likewise for "load" and "store".
+
+ * tree-ssa-loop-ivcanon.c (remove_exits_and_undefined_stmts):
+ Strengthen local "stmt" from gimple to gimple_call.
+ (unloop_loops): Likewise.
+
+ * tree-ssa-loop-ivopts.c (rewrite_use_nonlinear_expr): Strengthen
+ local "ass" from gimple to gimple_assign.
+ (remove_unused_ivs): Strengthen "def_temp" to gimple_debug.
+
+ * tree-ssa-loop-manip.c (rewrite_phi_with_iv): Strengthen local "stmt"
+ from gimple to gimple_assign.
+
+ * tree-ssa-loop-prefetch.c (issue_prefetch_ref): Strengthen local
+ "prefetch" from gimple to gimple_call.
+
+ * tree-ssa-math-opts.c (insert_reciprocals): Strengthen local
+ "new_stmt" from gimple to gimple_assign.
+ (powi_as_mults_1): Likewise for "mult_stmt".
+ (powi_as_mults): Likewise for "div_stmt".
+ (build_and_insert_binop): Likewise for "stmt".
+ (build_and_insert_cast): Likewise.
+ (pass_cse_sincos::execute): Likewise for "stmt" and various decls
+ of "new_stmt".
+ (convert_mult_to_fma): Likewise for "fma_stmt".
+
+ * tree-ssa-phiopt.c (conditional_replacement): Likewise for "new_stmt".
+ (abs_replacement): Likewise.
+
+ * tree-ssa-phiprop.c (phiprop_insert_phi): Likewise for "tmp".
+
+ * tree-ssa-pre.c (create_expression_by_pieces): Likewise for "newstmt".
+ (eliminate_insert): Likewise for "tem".
+
+ * tree-ssa-propagate.c (update_gimple_call): Strengthen locals
+ "new_stmt" and "stmt" from gimple to gimple_call.
+ (update_call_from_tree): Likewise for "new_stmt".
+
+ * tree-ssa-reassoc.c (build_and_add_sum): Likewise for "sum".
+ (update_ops): Likewise for "g".
+ (maybe_optimize_range_tests): Likewise.
+ (rewrite_expr_tree_parallel): Require a gimple_assign rather than
+ a plain gimple.
+ (reassociate_bb): Add a checked cast to gimple_assign.
+
+ * tree-ssa.c (insert_debug_temp_for_var_def): Strengthen local
+ "def_temp" from gimple to gimple_debug.
+
+ * tree-switch-conversion.c (emit_case_bit_tests): Strengthen local
+ "shift_stmt" from gimple to gimple_assign.
+
+ * tree-tailcall.c (adjust_return_value_with_ops): Likewise for
+ "stmt".
+ (update_accumulator_with_ops): Likewise.
+
+ * tree-vect-data-refs.c (bump_vector_ptr): Likewise for
+ "incr_stmt".
+
+ * tree-vect-stmts.c (vectorizable_condition): Likewise for
+ "new_stmt".
+
+ * tree-vrp.c (build_assert_expr_for): Likewise for "assertion".
+ (simplify_truth_ops_using_ranges): Likewise for "newop".
+ (simplify_float_conversion_using_ranges): Likewise for "conv".
+
+ * ubsan.c (instrument_mem_ref): Strengthen local "g" from gimple
+ to gimple_call.
+
+ * value-prof.c (gimple_divmod_fixed_value): Require a
+ gimple_assign rather than a plain gimple; strengthen types of locals.
+ (gimple_mod_pow2): Likewise.
+ (gimple_mod_subtract): Likewise.
+ (gimple_divmod_fixed_value_transform): Strengthen local
+ "stmt" from gimple to gimple_assign.
+ (gimple_mod_pow2_value_transform): Likewise.
+ (gimple_mod_subtract_transform): Likewise.
+ (gimple_ic): Strengthen types of locals.
+
+2014-10-24 David Malcolm <dmalcolm@redhat.com>
+
Introduce gimple_try
* coretypes.h (gimple_try): New typedef.
diff --git a/gcc/cgraphunit.c b/gcc/cgraphunit.c
index 98d34be..b274162 100644
--- a/gcc/cgraphunit.c
+++ b/gcc/cgraphunit.c
@@ -1319,7 +1319,7 @@ thunk_adjust (gimple_stmt_iterator * bsi,
tree ptr, bool this_adjusting,
HOST_WIDE_INT fixed_offset, tree virtual_offset)
{
- gimple stmt;
+ gimple_assign stmt;
tree ret;
if (this_adjusting
diff --git a/gcc/gimple-ssa-isolate-paths.c b/gcc/gimple-ssa-isolate-paths.c
index 8016db4..528b3eb 100644
--- a/gcc/gimple-ssa-isolate-paths.c
+++ b/gcc/gimple-ssa-isolate-paths.c
@@ -96,7 +96,7 @@ insert_trap_and_remove_trailing_statements (gimple_stmt_iterator *si_p, tree op)
update_stmt (stmt);
}
- gimple new_stmt
+ gimple_call new_stmt
= gimple_build_call (builtin_decl_explicit (BUILT_IN_TRAP), 0);
gimple_seq seq = NULL;
gimple_seq_add_stmt (&seq, new_stmt);
diff --git a/gcc/gimple-ssa-strength-reduction.c b/gcc/gimple-ssa-strength-reduction.c
index 6bf54d6..2358bda 100644
--- a/gcc/gimple-ssa-strength-reduction.c
+++ b/gcc/gimple-ssa-strength-reduction.c
@@ -2052,7 +2052,7 @@ replace_mult_candidate (slsr_cand_t c, tree basis_name, widest_int bump)
if (bump == 0)
{
tree lhs = gimple_assign_lhs (c->cand_stmt);
- gimple copy_stmt = gimple_build_assign (lhs, basis_name);
+ gimple_assign copy_stmt = gimple_build_assign (lhs, basis_name);
gimple_stmt_iterator gsi = gsi_for_stmt (c->cand_stmt);
gimple_set_location (copy_stmt, gimple_location (c->cand_stmt));
gsi_replace (&gsi, copy_stmt, false);
@@ -2151,7 +2151,7 @@ create_add_on_incoming_edge (slsr_cand_t c, tree basis_name,
basic_block insert_bb;
gimple_stmt_iterator gsi;
tree lhs, basis_type;
- gimple new_stmt;
+ gimple_assign new_stmt;
/* If the add candidate along this incoming edge has the same
index as C's hidden basis, the hidden basis represents this
@@ -3108,7 +3108,7 @@ insert_initializers (slsr_cand_t c)
{
basic_block bb;
slsr_cand_t where = NULL;
- gimple init_stmt;
+ gimple_assign init_stmt;
tree stride_type, new_name, incr_tree;
widest_int incr = incr_vec[i].incr;
@@ -3246,7 +3246,7 @@ static tree
introduce_cast_before_cand (slsr_cand_t c, tree to_type, tree from_expr)
{
tree cast_lhs;
- gimple cast_stmt;
+ gimple_assign cast_stmt;
gimple_stmt_iterator gsi = gsi_for_stmt (c->cand_stmt);
cast_lhs = make_temp_ssa_name (to_type, NULL, "slsr");
@@ -3408,7 +3408,7 @@ replace_one_candidate (slsr_cand_t c, unsigned i, tree basis_name)
if (types_compatible_p (lhs_type, basis_type))
{
- gimple copy_stmt = gimple_build_assign (lhs, basis_name);
+ gimple_assign copy_stmt = gimple_build_assign (lhs, basis_name);
gimple_stmt_iterator gsi = gsi_for_stmt (c->cand_stmt);
gimple_set_location (copy_stmt, gimple_location (c->cand_stmt));
gsi_replace (&gsi, copy_stmt, false);
@@ -3420,9 +3420,10 @@ replace_one_candidate (slsr_cand_t c, unsigned i, tree basis_name)
else
{
gimple_stmt_iterator gsi = gsi_for_stmt (c->cand_stmt);
- gimple cast_stmt = gimple_build_assign_with_ops (NOP_EXPR, lhs,
- basis_name,
- NULL_TREE);
+ gimple_assign cast_stmt =
+ gimple_build_assign_with_ops (NOP_EXPR, lhs,
+ basis_name,
+ NULL_TREE);
gimple_set_location (cast_stmt, gimple_location (c->cand_stmt));
gsi_replace (&gsi, cast_stmt, false);
c->cand_stmt = cast_stmt;
diff --git a/gcc/gimplify.c b/gcc/gimplify.c
index e233da8..26cc2d0 100644
--- a/gcc/gimplify.c
+++ b/gcc/gimplify.c
@@ -1022,7 +1022,7 @@ voidify_wrapper_expr (tree wrapper, tree temp)
a temporary through which they communicate. */
static void
-build_stack_save_restore (gimple *save, gimple *restore)
+build_stack_save_restore (gimple_call *save, gimple_call *restore)
{
tree tmp_var;
@@ -1045,7 +1045,7 @@ gimplify_bind_expr (tree *expr_p, gimple_seq *pre_p)
tree t;
gimple_bind gimple_bind;
gimple_seq body, cleanup;
- gimple stack_save;
+ gimple_call stack_save;
location_t start_locus = 0, end_locus = 0;
tree temp = voidify_wrapper_expr (bind_expr, NULL);
@@ -1116,7 +1116,7 @@ gimplify_bind_expr (tree *expr_p, gimple_seq *pre_p)
stack_save = NULL;
if (gimplify_ctxp->save_stack)
{
- gimple stack_restore;
+ gimple_call stack_restore;
/* Save stack on entry and restore it on exit. Add a try_finally
block to achieve this. */
@@ -1153,7 +1153,7 @@ gimplify_bind_expr (tree *expr_p, gimple_seq *pre_p)
if (cleanup)
{
- gimple gs;
+ gimple_try gs;
gimple_seq new_body;
new_body = NULL;
@@ -1484,7 +1484,7 @@ gimplify_switch_expr (tree *expr_p, gimple_seq *pre_p)
vec<tree> labels;
vec<tree> saved_labels;
tree default_case = NULL_TREE;
- gimple gimple_switch;
+ gimple_switch gimple_switch;
/* If someone can be bothered to fill in the labels, they can
be bothered to null out the body too. */
@@ -1504,7 +1504,7 @@ gimplify_switch_expr (tree *expr_p, gimple_seq *pre_p)
if (!default_case)
{
- gimple new_default;
+ gimple_label new_default;
default_case
= build_case_label (NULL_TREE, NULL_TREE,
@@ -2957,7 +2957,7 @@ gimplify_cond_expr (tree *expr_p, gimple_seq *pre_p, fallback_t fallback)
enum gimplify_status ret;
tree label_true, label_false, label_cont;
bool have_then_clause_p, have_else_clause_p;
- gimple gimple_cond;
+ gimple_cond gimple_cond;
enum tree_code pred_code;
gimple_seq seq = NULL;
@@ -4059,7 +4059,7 @@ gimplify_init_constructor (tree *expr_p, gimple_seq *pre_p, gimple_seq *post_p,
{
tree lhs = TREE_OPERAND (*expr_p, 0);
tree rhs = TREE_OPERAND (*expr_p, 1);
- gimple init = gimple_build_assign (lhs, rhs);
+ gimple_assign init = gimple_build_assign (lhs, rhs);
gimplify_seq_add_stmt (pre_p, init);
*expr_p = NULL;
}
@@ -5208,7 +5208,7 @@ gimplify_cleanup_point_expr (tree *expr_p, gimple_seq *pre_p)
}
else
{
- gimple_statement_try *gtry;
+ gimple_try gtry;
gimple_seq seq;
enum gimple_try_flags kind;
@@ -5280,8 +5280,8 @@ gimple_push_cleanup (tree var, tree cleanup, bool eh_only, gimple_seq *pre_p)
val
*/
tree flag = create_tmp_var (boolean_type_node, "cleanup");
- gimple ffalse = gimple_build_assign (flag, boolean_false_node);
- gimple ftrue = gimple_build_assign (flag, boolean_true_node);
+ gimple_assign ffalse = gimple_build_assign (flag, boolean_false_node);
+ gimple_assign ftrue = gimple_build_assign (flag, boolean_true_node);
cleanup = build3 (COND_EXPR, void_type_node, flag, cleanup, NULL);
gimplify_stmt (&cleanup, &cleanup_stmts);
diff --git a/gcc/tree-eh.c b/gcc/tree-eh.c
index e45f234..a593cc7 100644
--- a/gcc/tree-eh.c
+++ b/gcc/tree-eh.c
@@ -769,7 +769,7 @@ static void
do_goto_redirection (struct goto_queue_node *q, tree finlab, gimple_seq mod,
struct leh_tf_state *tf)
{
- gimple x;
+ gimple_goto x;
gcc_assert (q->is_label);
@@ -789,7 +789,7 @@ static void
emit_post_landing_pad (gimple_seq *seq, eh_region region)
{
eh_landing_pad lp = region->landing_pads;
- gimple x;
+ gimple_label x;
if (lp == NULL)
lp = gen_eh_landing_pad (region);
diff --git a/gcc/tree-outof-ssa.c b/gcc/tree-outof-ssa.c
index 59236c4..432c2b2 100644
--- a/gcc/tree-outof-ssa.c
+++ b/gcc/tree-outof-ssa.c
@@ -1130,7 +1130,8 @@ insert_backedge_copies (void)
|| trivially_conflicts_p (bb, result, arg)))
{
tree name;
- gimple stmt, last = NULL;
+ gimple_assign stmt;
+ gimple last = NULL;
gimple_stmt_iterator gsi2;
gsi2 = gsi_last_bb (gimple_phi_arg_edge (phi, i)->src);
diff --git a/gcc/tree-parloops.c b/gcc/tree-parloops.c
index 341b749..f38848c 100644
--- a/gcc/tree-parloops.c
+++ b/gcc/tree-parloops.c
@@ -490,7 +490,7 @@ take_address_of (tree obj, tree type, edge entry,
{
int uid;
tree *var_p, name, addr;
- gimple stmt;
+ gimple_assign stmt;
gimple_seq stmts;
/* Since the address of OBJ is invariant, the trees may be shared.
diff --git a/gcc/tree-predcom.c b/gcc/tree-predcom.c
index dfda10e..14d20e9 100644
--- a/gcc/tree-predcom.c
+++ b/gcc/tree-predcom.c
@@ -1293,7 +1293,7 @@ static void
replace_ref_with (gimple stmt, tree new_tree, bool set, bool in_lhs)
{
tree val;
- gimple new_stmt;
+ gimple_assign new_stmt;
gimple_stmt_iterator bsi, psi;
if (gimple_code (stmt) == GIMPLE_PHI)
@@ -1562,7 +1562,7 @@ initialize_root_vars_lm (struct loop *loop, dref root, bool written,
}
else
{
- gimple init_stmt = gimple_build_assign (var, init);
+ gimple_assign init_stmt = gimple_build_assign (var, init);
gsi_insert_on_edge_immediate (entry, init_stmt);
}
}
@@ -2129,7 +2129,7 @@ static gimple
reassociate_to_the_same_stmt (tree name1, tree name2)
{
gimple stmt1, stmt2, root1, root2, s1, s2;
- gimple new_stmt, tmp_stmt;
+ gimple_assign new_stmt, tmp_stmt;
tree new_name, tmp_name, var, r1, r2;
unsigned dist1, dist2;
enum tree_code code;
diff --git a/gcc/tree-profile.c b/gcc/tree-profile.c
index d8f5031..5583322 100644
--- a/gcc/tree-profile.c
+++ b/gcc/tree-profile.c
@@ -294,7 +294,7 @@ void
gimple_gen_edge_profiler (int edgeno, edge e)
{
tree ref, one, gcov_type_tmp_var;
- gimple stmt1, stmt2, stmt3;
+ gimple_assign stmt1, stmt2, stmt3;
ref = tree_coverage_counter_ref (GCOV_COUNTER_ARCS, edgeno);
one = build_int_cst (gcov_type_node, 1);
@@ -402,7 +402,7 @@ void
gimple_gen_ic_profiler (histogram_value value, unsigned tag, unsigned base)
{
tree tmp1;
- gimple stmt1, stmt2, stmt3;
+ gimple_assign stmt1, stmt2, stmt3;
gimple stmt = value->hvalue.stmt;
gimple_stmt_iterator gsi = gsi_for_stmt (stmt);
tree ref_ptr = tree_coverage_counter_addr (tag, base);
@@ -444,7 +444,8 @@ gimple_gen_ic_func_profiler (void)
{
struct cgraph_node * c_node = cgraph_node::get (current_function_decl);
gimple_stmt_iterator gsi;
- gimple stmt1, stmt2;
+ gimple_call stmt1;
+ gimple_assign stmt2;
tree tree_uid, cur_func, void0;
if (c_node->only_called_directly_p ())
diff --git a/gcc/tree-scalar-evolution.c b/gcc/tree-scalar-evolution.c
index cff820f..bb67cc7 100644
--- a/gcc/tree-scalar-evolution.c
+++ b/gcc/tree-scalar-evolution.c
@@ -3345,7 +3345,7 @@ scev_const_prop (void)
basic_block bb;
tree name, type, ev;
gimple_phi phi;
- gimple ass;
+ gimple_assign ass;
struct loop *loop, *ex_loop;
bitmap ssa_names_to_remove = NULL;
unsigned i;
diff --git a/gcc/tree-sra.c b/gcc/tree-sra.c
index 67c4247..3cdd100 100644
--- a/gcc/tree-sra.c
+++ b/gcc/tree-sra.c
@@ -1531,7 +1531,7 @@ build_ref_for_offset (location_t loc, tree base, HOST_WIDE_INT offset,
offset such as array[var_index]. */
if (!base)
{
- gimple stmt;
+ gimple_assign stmt;
tree tmp, addr;
gcc_checking_assert (gsi);
@@ -2613,7 +2613,7 @@ generate_subtree_copies (struct access *access, tree agg,
|| access->offset + access->size > start_offset))
{
tree expr, repl = get_access_replacement (access);
- gimple stmt;
+ gimple_assign stmt;
expr = build_ref_for_model (loc, agg, access->offset - top_offset,
access, gsi, insert_after);
@@ -2651,7 +2651,7 @@ generate_subtree_copies (struct access *access, tree agg,
&& (chunk_size == 0
|| access->offset + access->size > start_offset))
{
- gimple ds;
+ gimple_debug ds;
tree drhs = build_debug_ref_for_model (loc, agg,
access->offset - top_offset,
access);
@@ -2687,7 +2687,7 @@ init_subtree_with_zero (struct access *access, gimple_stmt_iterator *gsi,
if (access->grp_to_be_replaced)
{
- gimple stmt;
+ gimple_assign stmt;
stmt = gimple_build_assign (get_access_replacement (access),
build_zero_cst (access->type));
@@ -2700,9 +2700,10 @@ init_subtree_with_zero (struct access *access, gimple_stmt_iterator *gsi,
}
else if (access->grp_to_be_debug_replaced)
{
- gimple ds = gimple_build_debug_bind (get_access_replacement (access),
- build_zero_cst (access->type),
- gsi_stmt (*gsi));
+ gimple_debug ds =
+ gimple_build_debug_bind (get_access_replacement (access),
+ build_zero_cst (access->type),
+ gsi_stmt (*gsi));
if (insert_after)
gsi_insert_after (gsi, ds, GSI_NEW_STMT);
else
@@ -2796,7 +2797,7 @@ sra_modify_expr (tree *expr, gimple_stmt_iterator *gsi, bool write)
if (write)
{
- gimple stmt;
+ gimple_assign stmt;
if (access->grp_partial_lhs)
ref = force_gimple_operand_gsi (gsi, ref, true, NULL_TREE,
@@ -2807,7 +2808,7 @@ sra_modify_expr (tree *expr, gimple_stmt_iterator *gsi, bool write)
}
else
{
- gimple stmt;
+ gimple_assign stmt;
if (access->grp_partial_lhs)
repl = force_gimple_operand_gsi (gsi, repl, true, NULL_TREE,
@@ -2823,9 +2824,10 @@ sra_modify_expr (tree *expr, gimple_stmt_iterator *gsi, bool write)
}
else if (write && access->grp_to_be_debug_replaced)
{
- gimple ds = gimple_build_debug_bind (get_access_replacement (access),
- NULL_TREE,
- gsi_stmt (*gsi));
+ gimple_debug ds =
+ gimple_build_debug_bind (get_access_replacement (access),
+ NULL_TREE,
+ gsi_stmt (*gsi));
gsi_insert_after (gsi, ds, GSI_NEW_STMT);
}
@@ -2925,7 +2927,7 @@ load_assign_lhs_subreplacements (struct access *lacc,
if (lacc->grp_to_be_replaced)
{
struct access *racc;
- gimple stmt;
+ gimple_assign stmt;
tree rhs;
racc = find_access_in_subtree (sad->top_racc, offset, lacc->size);
@@ -2975,7 +2977,7 @@ load_assign_lhs_subreplacements (struct access *lacc,
if (lacc && lacc->grp_to_be_debug_replaced)
{
- gimple ds;
+ gimple_debug ds;
tree drhs;
struct access *racc = find_access_in_subtree (sad->top_racc,
offset,
@@ -3217,7 +3219,7 @@ sra_modify_assign (gimple stmt, gimple_stmt_iterator *gsi)
drhs = fold_build1_loc (loc, VIEW_CONVERT_EXPR,
TREE_TYPE (dlhs), drhs);
}
- gimple ds = gimple_build_debug_bind (dlhs, drhs, stmt);
+ gimple_debug ds = gimple_build_debug_bind (dlhs, drhs, stmt);
gsi_insert_before (gsi, ds, GSI_SAME_STMT);
}
@@ -4730,7 +4732,8 @@ sra_ipa_reset_debug_stmts (ipa_parm_adjustment_vec adjustments)
{
struct ipa_parm_adjustment *adj;
imm_use_iterator ui;
- gimple stmt, def_temp;
+ gimple stmt;
+ gimple_debug def_temp;
tree name, vexpr, copy = NULL_TREE;
use_operand_p use_p;
diff --git a/gcc/tree-ssa-ccp.c b/gcc/tree-ssa-ccp.c
index 19f2c32..6650d3c 100644
--- a/gcc/tree-ssa-ccp.c
+++ b/gcc/tree-ssa-ccp.c
@@ -1903,7 +1903,8 @@ static void
insert_clobber_before_stack_restore (tree saved_val, tree var,
gimple_htab **visited)
{
- gimple stmt, clobber_stmt;
+ gimple stmt;
+ gimple_assign clobber_stmt;
tree clobber;
imm_use_iterator iter;
gimple_stmt_iterator i;
diff --git a/gcc/tree-ssa-dce.c b/gcc/tree-ssa-dce.c
index 8e8cd57..5a10d18 100644
--- a/gcc/tree-ssa-dce.c
+++ b/gcc/tree-ssa-dce.c
@@ -1125,7 +1125,7 @@ remove_dead_stmt (gimple_stmt_iterator *i, basic_block bb)
&& !DECL_HAS_VALUE_EXPR_P (lhs))
{
tree rhs = gimple_assign_rhs1 (stmt);
- gimple note
+ gimple_debug note
= gimple_build_debug_bind (lhs, unshare_expr (rhs), stmt);
gsi_insert_after (i, note, GSI_SAME_STMT);
}
diff --git a/gcc/tree-ssa-dom.c b/gcc/tree-ssa-dom.c
index 81be88a..26240eb 100644
--- a/gcc/tree-ssa-dom.c
+++ b/gcc/tree-ssa-dom.c
@@ -2193,7 +2193,7 @@ record_equivalences_from_stmt (gimple stmt, int may_optimize_p)
&& !is_gimple_reg (lhs))
{
tree rhs = gimple_assign_rhs1 (stmt);
- gimple new_stmt;
+ gimple_assign new_stmt;
/* Build a new statement with the RHS and LHS exchanged. */
if (TREE_CODE (rhs) == SSA_NAME)
@@ -2409,7 +2409,7 @@ optimize_stmt (basic_block bb, gimple_stmt_iterator si)
tree lhs = gimple_assign_lhs (stmt);
tree rhs = gimple_assign_rhs1 (stmt);
tree cached_lhs;
- gimple new_stmt;
+ gimple_assign new_stmt;
if (TREE_CODE (rhs) == SSA_NAME)
{
tree tem = SSA_NAME_VALUE (rhs);
diff --git a/gcc/tree-ssa-forwprop.c b/gcc/tree-ssa-forwprop.c
index 5d17f7b..3e2ec49 100644
--- a/gcc/tree-ssa-forwprop.c
+++ b/gcc/tree-ssa-forwprop.c
@@ -1959,7 +1959,7 @@ simplify_bitwise_binary (gimple_stmt_iterator *gsi)
&& INTEGRAL_TYPE_P (TREE_TYPE (def1_arg1))
&& int_fits_type_p (arg2, TREE_TYPE (def1_arg1)))
{
- gimple newop;
+ gimple_assign newop;
tree tem = make_ssa_name (TREE_TYPE (def1_arg1), NULL);
newop =
gimple_build_assign_with_ops (code, tem, def1_arg1,
@@ -1982,7 +1982,7 @@ simplify_bitwise_binary (gimple_stmt_iterator *gsi)
&& types_compatible_p (TREE_TYPE (def1_arg1), TREE_TYPE (def2_arg1))
&& hoist_conversion_for_bitop_p (TREE_TYPE (arg1), TREE_TYPE (def1_arg1)))
{
- gimple newop;
+ gimple_assign newop;
tree tem = make_ssa_name (TREE_TYPE (def1_arg1), NULL);
newop = gimple_build_assign_with_ops (code, tem, def1_arg1, def2_arg1);
gimple_set_location (newop, gimple_location (stmt));
@@ -2024,7 +2024,7 @@ simplify_bitwise_binary (gimple_stmt_iterator *gsi)
}
else
{
- gimple newop;
+ gimple_assign newop;
tree tem;
tem = make_ssa_name (TREE_TYPE (arg2), NULL);
newop = gimple_build_assign_with_ops (code, tem, a, c);
@@ -2048,7 +2048,7 @@ simplify_bitwise_binary (gimple_stmt_iterator *gsi)
tree cst = fold_build2 (BIT_AND_EXPR, TREE_TYPE (arg2),
arg2, def1_arg2);
tree tem;
- gimple newop;
+ gimple_assign newop;
if (integer_zerop (cst))
{
gimple_assign_set_rhs1 (stmt, def1_arg1);
@@ -2256,7 +2256,7 @@ simplify_rotate (gimple_stmt_iterator *gsi)
tree lhs;
int i;
bool swapped_p = false;
- gimple g;
+ gimple_assign g;
arg[0] = gimple_assign_rhs1 (stmt);
arg[1] = gimple_assign_rhs2 (stmt);
diff --git a/gcc/tree-ssa-loop-im.c b/gcc/tree-ssa-loop-im.c
index 339e221..92b4c7c 100644
--- a/gcc/tree-ssa-loop-im.c
+++ b/gcc/tree-ssa-loop-im.c
@@ -875,12 +875,12 @@ nonpure_call_p (gimple stmt)
static gimple
rewrite_reciprocal (gimple_stmt_iterator *bsi)
{
- gimple stmt, stmt1, stmt2;
+ gimple_assign stmt, stmt1, stmt2;
tree name, lhs, type;
tree real_one;
gimple_stmt_iterator gsi;
- stmt = gsi_stmt (*bsi);
+ stmt = as_a <gimple_assign> (gsi_stmt (*bsi));
lhs = gimple_assign_lhs (stmt);
type = TREE_TYPE (lhs);
@@ -910,11 +910,14 @@ rewrite_reciprocal (gimple_stmt_iterator *bsi)
static gimple
rewrite_bittest (gimple_stmt_iterator *bsi)
{
- gimple stmt, use_stmt, stmt1, stmt2;
+ gimple_assign stmt;
+ gimple stmt1;
+ gimple_assign stmt2;
+ gimple use_stmt;
tree lhs, name, t, a, b;
use_operand_p use;
- stmt = gsi_stmt (*bsi);
+ stmt = as_a <gimple_assign> (gsi_stmt (*bsi));
lhs = gimple_assign_lhs (stmt);
/* Verify that the single use of lhs is a comparison against zero. */
@@ -1167,7 +1170,7 @@ move_computations_dom_walker::before_dom_children (basic_block bb)
for (bsi = gsi_start_phis (bb); !gsi_end_p (bsi); )
{
- gimple new_stmt;
+ gimple_assign new_stmt;
stmt = gsi_stmt (bsi);
lim_data = get_lim_data (stmt);
@@ -1939,7 +1942,7 @@ execute_sm (struct loop *loop, vec<edge> exits, mem_ref_p ref)
{
tree tmp_var, store_flag = NULL_TREE;
unsigned i;
- gimple load;
+ gimple_assign load;
struct fmt_data fmt_data;
edge ex;
struct lim_aux_data *lim_data;
@@ -1996,7 +1999,7 @@ execute_sm (struct loop *loop, vec<edge> exits, mem_ref_p ref)
FOR_EACH_VEC_ELT (exits, i, ex)
if (!multi_threaded_model_p)
{
- gimple store;
+ gimple_assign store;
store = gimple_build_assign (unshare_expr (ref->mem.ref), tmp_var);
gsi_insert_on_edge (ex, store);
}
diff --git a/gcc/tree-ssa-loop-ivcanon.c b/gcc/tree-ssa-loop-ivcanon.c
index 0a5ca59..00cbf8f 100644
--- a/gcc/tree-ssa-loop-ivcanon.c
+++ b/gcc/tree-ssa-loop-ivcanon.c
@@ -494,7 +494,7 @@ remove_exits_and_undefined_stmts (struct loop *loop, unsigned int npeeled)
&& wi::ltu_p (elt->bound, npeeled))
{
gimple_stmt_iterator gsi = gsi_for_stmt (elt->stmt);
- gimple stmt = gimple_build_call
+ gimple_call stmt = gimple_build_call
(builtin_decl_implicit (BUILT_IN_UNREACHABLE), 0);
gimple_set_location (stmt, gimple_location (elt->stmt));
@@ -613,7 +613,7 @@ unloop_loops (bitmap loop_closed_ssa_invalidated,
edge latch_edge = loop_latch_edge (loop);
int flags = latch_edge->flags;
location_t locus = latch_edge->goto_locus;
- gimple stmt;
+ gimple_call stmt;
gimple_stmt_iterator gsi;
remove_exits_and_undefined_stmts (loop, n_unroll);
diff --git a/gcc/tree-ssa-loop-ivopts.c b/gcc/tree-ssa-loop-ivopts.c
index 0e33774..57b63dc 100644
--- a/gcc/tree-ssa-loop-ivopts.c
+++ b/gcc/tree-ssa-loop-ivopts.c
@@ -6228,7 +6228,7 @@ rewrite_use_nonlinear_expr (struct ivopts_data *data,
{
tree comp;
tree op, tgt;
- gimple ass;
+ gimple_assign ass;
gimple_stmt_iterator bsi;
/* An important special case -- if we are asked to express value of
@@ -6645,7 +6645,8 @@ remove_unused_ivs (struct ivopts_data *data)
DECL_MODE (vexpr) = DECL_MODE (SSA_NAME_VAR (def));
else
DECL_MODE (vexpr) = TYPE_MODE (TREE_TYPE (vexpr));
- gimple def_temp = gimple_build_debug_bind (vexpr, comp, NULL);
+ gimple_debug def_temp =
+ gimple_build_debug_bind (vexpr, comp, NULL);
gimple_stmt_iterator gsi;
if (gimple_code (SSA_NAME_DEF_STMT (def)) == GIMPLE_PHI)
diff --git a/gcc/tree-ssa-loop-manip.c b/gcc/tree-ssa-loop-manip.c
index edc913d..b73a9a5 100644
--- a/gcc/tree-ssa-loop-manip.c
+++ b/gcc/tree-ssa-loop-manip.c
@@ -1253,7 +1253,7 @@ rewrite_phi_with_iv (loop_p loop,
tree main_iv)
{
affine_iv iv;
- gimple stmt;
+ gimple_assign stmt;
gimple_phi phi = psi->phi ();
tree atype, mtype, val, res = PHI_RESULT (phi);
diff --git a/gcc/tree-ssa-loop-prefetch.c b/gcc/tree-ssa-loop-prefetch.c
index a8127d5..bf3d56d 100644
--- a/gcc/tree-ssa-loop-prefetch.c
+++ b/gcc/tree-ssa-loop-prefetch.c
@@ -1127,7 +1127,7 @@ issue_prefetch_ref (struct mem_ref *ref, unsigned unroll_factor, unsigned ahead)
{
HOST_WIDE_INT delta;
tree addr, addr_base, write_p, local, forward;
- gimple prefetch;
+ gimple_call prefetch;
gimple_stmt_iterator bsi;
unsigned n_prefetches, ap;
bool nontemporal = ref->reuse_distance >= L2_CACHE_SIZE_BYTES;
diff --git a/gcc/tree-ssa-math-opts.c b/gcc/tree-ssa-math-opts.c
index 3495a76..1010ff0 100644
--- a/gcc/tree-ssa-math-opts.c
+++ b/gcc/tree-ssa-math-opts.c
@@ -356,7 +356,7 @@ insert_reciprocals (gimple_stmt_iterator *def_gsi, struct occurrence *occ,
tree def, tree recip_def, int threshold)
{
tree type;
- gimple new_stmt;
+ gimple_assign new_stmt;
gimple_stmt_iterator gsi;
struct occurrence *occ_child;
@@ -972,7 +972,7 @@ powi_as_mults_1 (gimple_stmt_iterator *gsi, location_t loc, tree type,
{
tree op0, op1, ssa_target;
unsigned HOST_WIDE_INT digit;
- gimple mult_stmt;
+ gimple_assign mult_stmt;
if (n < POWI_TABLE_SIZE && cache[n])
return cache[n];
@@ -1012,7 +1012,7 @@ powi_as_mults (gimple_stmt_iterator *gsi, location_t loc,
tree arg0, HOST_WIDE_INT n)
{
tree cache[POWI_TABLE_SIZE], result, type = TREE_TYPE (arg0);
- gimple div_stmt;
+ gimple_assign div_stmt;
tree target;
if (n == 0)
@@ -1088,7 +1088,7 @@ build_and_insert_binop (gimple_stmt_iterator *gsi, location_t loc,
tree arg0, tree arg1)
{
tree result = make_temp_ssa_name (TREE_TYPE (arg0), NULL, name);
- gimple stmt = gimple_build_assign_with_ops (code, result, arg0, arg1);
+ gimple_assign stmt = gimple_build_assign_with_ops (code, result, arg0, arg1);
gimple_set_location (stmt, loc);
gsi_insert_before (gsi, stmt, GSI_SAME_STMT);
return result;
@@ -1118,7 +1118,8 @@ build_and_insert_cast (gimple_stmt_iterator *gsi, location_t loc,
tree type, tree val)
{
tree result = make_ssa_name (type, NULL);
- gimple stmt = gimple_build_assign_with_ops (NOP_EXPR, result, val, NULL_TREE);
+ gimple_assign stmt =
+ gimple_build_assign_with_ops (NOP_EXPR, result, val, NULL_TREE);
gimple_set_location (stmt, loc);
gsi_insert_before (gsi, stmt, GSI_SAME_STMT);
return result;
@@ -1495,7 +1496,8 @@ pass_cse_sincos::execute (function *fun)
if (result)
{
tree lhs = gimple_get_lhs (stmt);
- gimple new_stmt = gimple_build_assign (lhs, result);
+ gimple_assign new_stmt =
+ gimple_build_assign (lhs, result);
gimple_set_location (new_stmt, loc);
unlink_stmt_vdef (stmt);
gsi_replace (&gsi, new_stmt, true);
@@ -1513,7 +1515,7 @@ pass_cse_sincos::execute (function *fun)
if (real_minus_onep (arg0))
{
tree t0, t1, cond, one, minus_one;
- gimple stmt;
+ gimple_assign stmt;
t0 = TREE_TYPE (arg0);
t1 = TREE_TYPE (arg1);
@@ -1547,7 +1549,7 @@ pass_cse_sincos::execute (function *fun)
if (result)
{
tree lhs = gimple_get_lhs (stmt);
- gimple new_stmt = gimple_build_assign (lhs, result);
+ gimple_assign new_stmt = gimple_build_assign (lhs, result);
gimple_set_location (new_stmt, loc);
unlink_stmt_vdef (stmt);
gsi_replace (&gsi, new_stmt, true);
@@ -1565,7 +1567,7 @@ pass_cse_sincos::execute (function *fun)
if (result)
{
tree lhs = gimple_get_lhs (stmt);
- gimple new_stmt = gimple_build_assign (lhs, result);
+ gimple_assign new_stmt = gimple_build_assign (lhs, result);
gimple_set_location (new_stmt, loc);
unlink_stmt_vdef (stmt);
gsi_replace (&gsi, new_stmt, true);
@@ -2928,7 +2930,8 @@ convert_mult_to_fma (gimple mul_stmt, tree op1, tree op2)
{
tree mul_result = gimple_get_lhs (mul_stmt);
tree type = TREE_TYPE (mul_result);
- gimple use_stmt, neguse_stmt, fma_stmt;
+ gimple use_stmt, neguse_stmt;
+ gimple_assign fma_stmt;
use_operand_p use_p;
imm_use_iterator imm_iter;
diff --git a/gcc/tree-ssa-phiopt.c b/gcc/tree-ssa-phiopt.c
index a767aac..dfeefbe 100644
--- a/gcc/tree-ssa-phiopt.c
+++ b/gcc/tree-ssa-phiopt.c
@@ -437,7 +437,8 @@ conditional_replacement (basic_block cond_bb, basic_block middle_bb,
tree arg0, tree arg1)
{
tree result;
- gimple stmt, new_stmt;
+ gimple stmt;
+ gimple_assign new_stmt;
tree cond;
gimple_stmt_iterator gsi;
edge true_edge, false_edge;
@@ -1158,7 +1159,8 @@ abs_replacement (basic_block cond_bb, basic_block middle_bb,
gimple phi, tree arg0, tree arg1)
{
tree result;
- gimple new_stmt, cond;
+ gimple_assign new_stmt;
+ gimple cond;
gimple_stmt_iterator gsi;
edge true_edge, false_edge;
gimple assign;
diff --git a/gcc/tree-ssa-phiprop.c b/gcc/tree-ssa-phiprop.c
index a3e53c2..b36de9c 100644
--- a/gcc/tree-ssa-phiprop.c
+++ b/gcc/tree-ssa-phiprop.c
@@ -166,7 +166,7 @@ phiprop_insert_phi (basic_block bb, gimple_phi phi, gimple use_stmt,
FOR_EACH_EDGE (e, ei, bb->preds)
{
tree old_arg, new_var;
- gimple tmp;
+ gimple_assign tmp;
source_location locus;
old_arg = PHI_ARG_DEF_FROM_EDGE (phi, e);
diff --git a/gcc/tree-ssa-pre.c b/gcc/tree-ssa-pre.c
index 327faa6..cf955b8 100644
--- a/gcc/tree-ssa-pre.c
+++ b/gcc/tree-ssa-pre.c
@@ -2784,7 +2784,7 @@ create_expression_by_pieces (basic_block block, pre_expr expr,
gimple_stmt_iterator gsi;
tree exprtype = type ? type : get_expr_type (expr);
pre_expr nameexpr;
- gimple newstmt;
+ gimple_assign newstmt;
switch (expr->kind)
{
@@ -3912,9 +3912,10 @@ eliminate_insert (gimple_stmt_iterator *gsi, tree val)
return NULL_TREE;
tree res = make_temp_ssa_name (TREE_TYPE (val), NULL, "pretmp");
- gimple tem = gimple_build_assign (res,
- fold_build1 (TREE_CODE (expr),
- TREE_TYPE (expr), leader));
+ gimple_assign tem =
+ gimple_build_assign (res,
+ fold_build1 (TREE_CODE (expr),
+ TREE_TYPE (expr), leader));
gsi_insert_before (gsi, tem, GSI_SAME_STMT);
VN_INFO_GET (res)->valnum = val;
diff --git a/gcc/tree-ssa-propagate.c b/gcc/tree-ssa-propagate.c
index 6ed41bd..20f7554 100644
--- a/gcc/tree-ssa-propagate.c
+++ b/gcc/tree-ssa-propagate.c
@@ -739,7 +739,7 @@ bool
update_gimple_call (gimple_stmt_iterator *si_p, tree fn, int nargs, ...)
{
va_list ap;
- gimple new_stmt, stmt = gsi_stmt (*si_p);
+ gimple_call new_stmt, stmt = as_a <gimple_call> (gsi_stmt (*si_p));
gcc_assert (is_gimple_call (stmt));
va_start (ap, nargs);
@@ -773,7 +773,7 @@ update_call_from_tree (gimple_stmt_iterator *si_p, tree expr)
unsigned i;
unsigned nargs = call_expr_nargs (expr);
vec<tree> args = vNULL;
- gimple new_stmt;
+ gimple_call new_stmt;
if (nargs > 0)
{
diff --git a/gcc/tree-ssa-reassoc.c b/gcc/tree-ssa-reassoc.c
index 524dc53..5b951d7 100644
--- a/gcc/tree-ssa-reassoc.c
+++ b/gcc/tree-ssa-reassoc.c
@@ -1318,7 +1318,7 @@ build_and_add_sum (tree type, tree op1, tree op2, enum tree_code opcode)
gimple op1def = NULL, op2def = NULL;
gimple_stmt_iterator gsi;
tree op;
- gimple sum;
+ gimple_assign sum;
/* Create the addition statement. */
op = make_ssa_name (type, NULL);
@@ -2706,8 +2706,9 @@ update_ops (tree var, enum tree_code code, vec<operand_entry_t> ops,
{
gimple_stmt_iterator gsi = gsi_for_stmt (stmt);
var = make_ssa_name (TREE_TYPE (var), NULL);
- gimple g = gimple_build_assign_with_ops (gimple_assign_rhs_code (stmt),
- var, rhs[2], rhs[3]);
+ gimple_assign g =
+ gimple_build_assign_with_ops (gimple_assign_rhs_code (stmt),
+ var, rhs[2], rhs[3]);
gimple_set_uid (g, gimple_uid (stmt));
gimple_set_visited (g, true);
gsi_insert_before (&gsi, g, GSI_SAME_STMT);
@@ -3005,7 +3006,7 @@ maybe_optimize_range_tests (gimple stmt)
tree new_lhs = make_ssa_name (TREE_TYPE (lhs), NULL);
enum tree_code rhs_code
= gimple_assign_rhs_code (cast_stmt);
- gimple g;
+ gimple_assign g;
if (is_gimple_min_invariant (new_op))
{
new_op = fold_convert (TREE_TYPE (lhs), new_op);
@@ -3392,7 +3393,7 @@ get_reassociation_width (int ops_num, enum tree_code opc,
parallel. */
static void
-rewrite_expr_tree_parallel (gimple stmt, int width,
+rewrite_expr_tree_parallel (gimple_assign stmt, int width,
vec<operand_entry_t> ops)
{
enum tree_code opcode = gimple_assign_rhs_code (stmt);
@@ -4533,7 +4534,8 @@ reassociate_bb (basic_block bb)
if (width > 1
&& ops.length () > 3)
- rewrite_expr_tree_parallel (stmt, width, ops);
+ rewrite_expr_tree_parallel (as_a <gimple_assign> (stmt),
+ width, ops);
else
{
/* When there are three operands left, we want
diff --git a/gcc/tree-ssa.c b/gcc/tree-ssa.c
index 6babaee..a85dff9 100644
--- a/gcc/tree-ssa.c
+++ b/gcc/tree-ssa.c
@@ -436,7 +436,7 @@ insert_debug_temp_for_var_def (gimple_stmt_iterator *gsi, tree var)
;
else
{
- gimple def_temp;
+ gimple_debug def_temp;
tree vexpr = make_node (DEBUG_EXPR_DECL);
def_temp = gimple_build_debug_bind (vexpr,
diff --git a/gcc/tree-switch-conversion.c b/gcc/tree-switch-conversion.c
index 89d4a01..692b0d1 100644
--- a/gcc/tree-switch-conversion.c
+++ b/gcc/tree-switch-conversion.c
@@ -318,7 +318,7 @@ emit_case_bit_tests (gimple_switch swtch, tree index_expr,
unsigned int branch_num = gimple_switch_num_labels (swtch);
gimple_stmt_iterator gsi;
- gimple shift_stmt;
+ gimple_assign shift_stmt;
tree idx, tmp, csui;
tree word_type_node = lang_hooks.types.type_for_mode (word_mode, 1);
diff --git a/gcc/tree-tailcall.c b/gcc/tree-tailcall.c
index ff8236d..bfe5b24 100644
--- a/gcc/tree-tailcall.c
+++ b/gcc/tree-tailcall.c
@@ -643,7 +643,7 @@ adjust_return_value_with_ops (enum tree_code code, const char *label,
tree ret_type = TREE_TYPE (DECL_RESULT (current_function_decl));
tree result = make_temp_ssa_name (ret_type, NULL, label);
- gimple stmt;
+ gimple_assign stmt;
if (POINTER_TYPE_P (ret_type))
{
@@ -680,7 +680,7 @@ static tree
update_accumulator_with_ops (enum tree_code code, tree acc, tree op1,
gimple_stmt_iterator gsi)
{
- gimple stmt;
+ gimple_assign stmt;
tree var = copy_ssa_name (acc, NULL);
if (types_compatible_p (TREE_TYPE (acc), TREE_TYPE (op1)))
stmt = gimple_build_assign_with_ops (code, var, acc, op1);
diff --git a/gcc/tree-vect-data-refs.c b/gcc/tree-vect-data-refs.c
index 4c3e161..5140992 100644
--- a/gcc/tree-vect-data-refs.c
+++ b/gcc/tree-vect-data-refs.c
@@ -4326,7 +4326,7 @@ bump_vector_ptr (tree dataref_ptr, gimple ptr_incr, gimple_stmt_iterator *gsi,
struct data_reference *dr = STMT_VINFO_DATA_REF (stmt_info);
tree vectype = STMT_VINFO_VECTYPE (stmt_info);
tree update = TYPE_SIZE_UNIT (vectype);
- gimple incr_stmt;
+ gimple_assign incr_stmt;
ssa_op_iter iter;
use_operand_p use_p;
tree new_dataref_ptr;
diff --git a/gcc/tree-vect-stmts.c b/gcc/tree-vect-stmts.c
index dd3a9b8..1797118 100644
--- a/gcc/tree-vect-stmts.c
+++ b/gcc/tree-vect-stmts.c
@@ -6794,7 +6794,7 @@ vectorizable_condition (gimple stmt, gimple_stmt_iterator *gsi,
/* Handle cond expr. */
for (j = 0; j < ncopies; j++)
{
- gimple new_stmt = NULL;
+ gimple_assign new_stmt = NULL;
if (j == 0)
{
if (slp_node)
diff --git a/gcc/tree-vrp.c b/gcc/tree-vrp.c
index 289f0ba..bd4fff6 100644
--- a/gcc/tree-vrp.c
+++ b/gcc/tree-vrp.c
@@ -4606,7 +4606,7 @@ static gimple
build_assert_expr_for (tree cond, tree v)
{
tree a;
- gimple assertion;
+ gimple_assign assertion;
gcc_assert (TREE_CODE (v) == SSA_NAME
&& COMPARISON_CLASS_P (cond));
@@ -8725,7 +8725,8 @@ simplify_truth_ops_using_ranges (gimple_stmt_iterator *gsi, gimple stmt)
else if (need_conversion)
{
tree tem = make_ssa_name (TREE_TYPE (op0), NULL);
- gimple newop = gimple_build_assign_with_ops (BIT_XOR_EXPR, tem, op0, op1);
+ gimple_assign newop =
+ gimple_build_assign_with_ops (BIT_XOR_EXPR, tem, op0, op1);
gsi_insert_before (gsi, newop, GSI_SAME_STMT);
gimple_assign_set_rhs_with_ops (gsi, NOP_EXPR, tem, NULL_TREE);
}
@@ -9404,7 +9405,7 @@ simplify_float_conversion_using_ranges (gimple_stmt_iterator *gsi, gimple stmt)
enum machine_mode fltmode = TYPE_MODE (TREE_TYPE (gimple_assign_lhs (stmt)));
enum machine_mode mode;
tree tem;
- gimple conv;
+ gimple_assign conv;
/* We can only handle constant ranges. */
if (vr->type != VR_RANGE
diff --git a/gcc/ubsan.c b/gcc/ubsan.c
index dde0418..bc4f501 100644
--- a/gcc/ubsan.c
+++ b/gcc/ubsan.c
@@ -925,7 +925,7 @@ instrument_mem_ref (tree mem, tree base, gimple_stmt_iterator *iter,
ikind = UBSAN_MEMBER_ACCESS;
tree kind = build_int_cst (TREE_TYPE (t), ikind);
tree alignt = build_int_cst (pointer_sized_int_node, align);
- gimple g = gimple_build_call_internal (IFN_UBSAN_NULL, 3, t, kind, alignt);
+ gimple_call g = gimple_build_call_internal (IFN_UBSAN_NULL, 3, t, kind, alignt);
gimple_set_location (g, gimple_location (gsi_stmt (*iter)));
gsi_insert_before (iter, g, GSI_SAME_STMT);
}
diff --git a/gcc/value-prof.c b/gcc/value-prof.c
index 0b2ec7f..e5ccf48 100644
--- a/gcc/value-prof.c
+++ b/gcc/value-prof.c
@@ -127,10 +127,11 @@ along with GCC; see the file COPYING3. If not see
and gimple_value_profile_transformations table-driven, perhaps...
*/
-static tree gimple_divmod_fixed_value (gimple, tree, int, gcov_type, gcov_type);
-static tree gimple_mod_pow2 (gimple, int, gcov_type, gcov_type);
-static tree gimple_mod_subtract (gimple, int, int, int, gcov_type, gcov_type,
- gcov_type);
+static tree gimple_divmod_fixed_value (gimple_assign, tree, int, gcov_type,
+ gcov_type);
+static tree gimple_mod_pow2 (gimple_assign, int, gcov_type, gcov_type);
+static tree gimple_mod_subtract (gimple_assign, int, int, int, gcov_type,
+ gcov_type, gcov_type);
static bool gimple_divmod_fixed_value_transform (gimple_stmt_iterator *);
static bool gimple_mod_pow2_value_transform (gimple_stmt_iterator *);
static bool gimple_mod_subtract_transform (gimple_stmt_iterator *);
@@ -726,10 +727,11 @@ gimple_value_profile_transformations (void)
alter the original STMT. */
static tree
-gimple_divmod_fixed_value (gimple stmt, tree value, int prob, gcov_type count,
- gcov_type all)
+gimple_divmod_fixed_value (gimple_assign stmt, tree value, int prob,
+ gcov_type count, gcov_type all)
{
- gimple stmt1, stmt2, stmt3;
+ gimple_assign stmt1, stmt2;
+ gimple_cond stmt3;
tree tmp0, tmp1, tmp2;
gimple bb1end, bb2end, bb3end;
basic_block bb, bb2, bb3, bb4;
@@ -813,10 +815,10 @@ gimple_divmod_fixed_value_transform (gimple_stmt_iterator *si)
gcov_type val, count, all;
tree result, value, tree_val;
gcov_type prob;
- gimple stmt;
+ gimple_assign stmt;
- stmt = gsi_stmt (*si);
- if (gimple_code (stmt) != GIMPLE_ASSIGN)
+ stmt = dyn_cast <gimple_assign> (gsi_stmt (*si));
+ if (!stmt)
return false;
if (!INTEGRAL_TYPE_P (TREE_TYPE (gimple_assign_lhs (stmt))))
@@ -889,9 +891,10 @@ gimple_divmod_fixed_value_transform (gimple_stmt_iterator *si)
within roundoff error). This generates the result into a temp and returns
the temp; it does not replace or alter the original STMT. */
static tree
-gimple_mod_pow2 (gimple stmt, int prob, gcov_type count, gcov_type all)
+gimple_mod_pow2 (gimple_assign stmt, int prob, gcov_type count, gcov_type all)
{
- gimple stmt1, stmt2, stmt3, stmt4;
+ gimple_assign stmt1, stmt2, stmt3;
+ gimple_cond stmt4;
tree tmp2, tmp3;
gimple bb1end, bb2end, bb3end;
basic_block bb, bb2, bb3, bb4;
@@ -975,10 +978,10 @@ gimple_mod_pow2_value_transform (gimple_stmt_iterator *si)
gcov_type count, wrong_values, all;
tree lhs_type, result, value;
gcov_type prob;
- gimple stmt;
+ gimple_assign stmt;
- stmt = gsi_stmt (*si);
- if (gimple_code (stmt) != GIMPLE_ASSIGN)
+ stmt = dyn_cast <gimple_assign> (gsi_stmt (*si));
+ if (!stmt)
return false;
lhs_type = TREE_TYPE (gimple_assign_lhs (stmt));
@@ -1041,10 +1044,12 @@ gimple_mod_pow2_value_transform (gimple_stmt_iterator *si)
/* FIXME: Generalize the interface to handle NCOUNTS > 1. */
static tree
-gimple_mod_subtract (gimple stmt, int prob1, int prob2, int ncounts,
+gimple_mod_subtract (gimple_assign stmt, int prob1, int prob2, int ncounts,
gcov_type count1, gcov_type count2, gcov_type all)
{
- gimple stmt1, stmt2, stmt3;
+ gimple_assign stmt1;
+ gimple stmt2;
+ gimple_cond stmt3;
tree tmp1;
gimple bb1end, bb2end = NULL, bb3end;
basic_block bb, bb2, bb3, bb4;
@@ -1147,10 +1152,10 @@ gimple_mod_subtract_transform (gimple_stmt_iterator *si)
gcov_type prob1, prob2;
unsigned int i, steps;
gcov_type count1, count2;
- gimple stmt;
+ gimple_assign stmt;
- stmt = gsi_stmt (*si);
- if (gimple_code (stmt) != GIMPLE_ASSIGN)
+ stmt = dyn_cast <gimple_assign> (gsi_stmt (*si));
+ if (!stmt)
return false;
lhs_type = TREE_TYPE (gimple_assign_lhs (stmt));
@@ -1369,7 +1374,9 @@ gimple
gimple_ic (gimple icall_stmt, struct cgraph_node *direct_call,
int prob, gcov_type count, gcov_type all)
{
- gimple dcall_stmt, load_stmt, cond_stmt;
+ gimple dcall_stmt;
+ gimple_assign load_stmt;
+ gimple_cond cond_stmt;
tree tmp0, tmp1, tmp;
basic_block cond_bb, dcall_bb, icall_bb, join_bb = NULL;
tree optype = build_pointer_type (void_type_node);
--
1.8.5.3
^ permalink raw reply [flat|nested] 93+ messages in thread
* [gimple-classes, committed 72/92] Concretize gimple_cond_set_code
2014-10-27 20:35 [gimple-classes, committed 00/92] Initial slew of commits David Malcolm
` (33 preceding siblings ...)
2014-10-27 20:38 ` [gimple-classes, committed 74/92] Concretize gimple_cond_{lhs|rhs}_ptr David Malcolm
@ 2014-10-27 20:38 ` David Malcolm
2014-10-27 20:38 ` [gimple-classes, committed 31/92] Use more concrete types for various gimple statements David Malcolm
` (56 subsequent siblings)
91 siblings, 0 replies; 93+ messages in thread
From: David Malcolm @ 2014-10-27 20:38 UTC (permalink / raw)
To: gcc-patches; +Cc: David Malcolm
This corresponds to:
[PATCH 74/89] Concretize gimple_cond_set_code
https://gcc.gnu.org/ml/gcc-patches/2014-04/msg01209.html
from the original 89-patch kit
That earlier patch was approved by Jeff:
> Fine once prerequisites go in.
in https://gcc.gnu.org/ml/gcc-patches/2014-05/msg00849.html
gcc/
* gimple.h (gimple_cond_set_code): Require a gimple_cond.
* tree-complex.c (expand_complex_comparison): Add a checked cast to
gimple_cond within "case GIMPLE_COND".
* tree-ssa-loop-ivcanon.c (create_canonical_iv): Convert local "cond"
to a gimple_cond, adding a checked cast. The existing code requires
that the last statement before the exit edge have code GIMPLE_COND,
though it's not clear to me where this is verified.
* tree-ssa-loop-ivopts.c (rewrite_use_compare): Add a checked cast
to gimple_cond on "use->stmt".
* tree-ssa-loop-manip.c (tree_transform_and_unroll_loop): Convert
local "exit_if" to gimple_cond, adding a checked cast. It's not
clear to me exactly where the GIMPLE_COND-ness of this is
established, but the existing code requires it.
(canonicalize_loop_ivs): Similarly for "stmt".
* tree-ssa-propagate.c (propagate_tree_value_into_stmt): Replace
a check against GIMPLE_COND with a dyn_cast<gimple_cond>.
---
gcc/ChangeLog.gimple-classes | 26 ++++++++++++++++++++++++++
gcc/gimple.h | 3 +--
gcc/tree-complex.c | 9 ++++++---
gcc/tree-ssa-loop-ivcanon.c | 4 ++--
gcc/tree-ssa-loop-ivopts.c | 7 ++++---
gcc/tree-ssa-loop-manip.c | 8 ++++----
gcc/tree-ssa-propagate.c | 8 ++++----
7 files changed, 47 insertions(+), 18 deletions(-)
diff --git a/gcc/ChangeLog.gimple-classes b/gcc/ChangeLog.gimple-classes
index 2bff31c..503fd44 100644
--- a/gcc/ChangeLog.gimple-classes
+++ b/gcc/ChangeLog.gimple-classes
@@ -1,5 +1,31 @@
2014-10-24 David Malcolm <dmalcolm@redhat.com>
+ Concretize gimple_cond_set_code
+
+ * gimple.h (gimple_cond_set_code): Require a gimple_cond.
+
+ * tree-complex.c (expand_complex_comparison): Add a checked cast to
+ gimple_cond within "case GIMPLE_COND".
+
+ * tree-ssa-loop-ivcanon.c (create_canonical_iv): Convert local "cond"
+ to a gimple_cond, adding a checked cast. The existing code requires
+ that the last statement before the exit edge have code GIMPLE_COND,
+ though it's not clear to me where this is verified.
+
+ * tree-ssa-loop-ivopts.c (rewrite_use_compare): Add a checked cast
+ to gimple_cond on "use->stmt".
+
+ * tree-ssa-loop-manip.c (tree_transform_and_unroll_loop): Convert
+ local "exit_if" to gimple_cond, adding a checked cast. It's not
+ clear to me exactly where the GIMPLE_COND-ness of this is
+ established, but the existing code requires it.
+ (canonicalize_loop_ivs): Similarly for "stmt".
+
+ * tree-ssa-propagate.c (propagate_tree_value_into_stmt): Replace
+ a check against GIMPLE_COND with a dyn_cast<gimple_cond>.
+
+2014-10-24 David Malcolm <dmalcolm@redhat.com>
+
Concretize gimple_cond_{true|false}_label
* gimple.h (gimple_cond_true_label): Require a const_gimple_cond
diff --git a/gcc/gimple.h b/gcc/gimple.h
index 94f3416..1639579 100644
--- a/gcc/gimple.h
+++ b/gcc/gimple.h
@@ -3008,9 +3008,8 @@ gimple_cond_code (const_gimple gs)
/* Set CODE to be the predicate code for the conditional statement GS. */
static inline void
-gimple_cond_set_code (gimple gs, enum tree_code code)
+gimple_cond_set_code (gimple_cond gs, enum tree_code code)
{
- GIMPLE_CHECK (gs, GIMPLE_COND);
gs->subcode = code;
}
diff --git a/gcc/tree-complex.c b/gcc/tree-complex.c
index a7cbceb..6f6fef5 100644
--- a/gcc/tree-complex.c
+++ b/gcc/tree-complex.c
@@ -1405,9 +1405,12 @@ expand_complex_comparison (gimple_stmt_iterator *gsi, tree ar, tree ai,
break;
case GIMPLE_COND:
- gimple_cond_set_code (stmt, EQ_EXPR);
- gimple_cond_set_lhs (stmt, cc);
- gimple_cond_set_rhs (stmt, boolean_true_node);
+ {
+ gimple_cond cond_stmt = as_a <gimple_cond> (stmt);
+ gimple_cond_set_code (cond_stmt, EQ_EXPR);
+ gimple_cond_set_lhs (cond_stmt, cc);
+ gimple_cond_set_rhs (cond_stmt, boolean_true_node);
+ }
break;
default:
diff --git a/gcc/tree-ssa-loop-ivcanon.c b/gcc/tree-ssa-loop-ivcanon.c
index 6715caa..a07d3a1 100644
--- a/gcc/tree-ssa-loop-ivcanon.c
+++ b/gcc/tree-ssa-loop-ivcanon.c
@@ -89,7 +89,7 @@ create_canonical_iv (struct loop *loop, edge exit, tree niter)
{
edge in;
tree type, var;
- gimple cond;
+ gimple_cond cond;
gimple_stmt_iterator incr_at;
enum tree_code cmp;
@@ -100,7 +100,7 @@ create_canonical_iv (struct loop *loop, edge exit, tree niter)
fprintf (dump_file, " iterations.\n");
}
- cond = last_stmt (exit->src);
+ cond = as_a <gimple_cond> (last_stmt (exit->src));
in = EDGE_SUCC (exit->src, 0);
if (in == exit)
in = EDGE_SUCC (exit->src, 1);
diff --git a/gcc/tree-ssa-loop-ivopts.c b/gcc/tree-ssa-loop-ivopts.c
index 57b63dc..76dc7d8 100644
--- a/gcc/tree-ssa-loop-ivopts.c
+++ b/gcc/tree-ssa-loop-ivopts.c
@@ -6480,9 +6480,10 @@ rewrite_use_compare (struct ivopts_data *data,
loop_preheader_edge (data->current_loop),
stmts);
- gimple_cond_set_lhs (use->stmt, var);
- gimple_cond_set_code (use->stmt, compare);
- gimple_cond_set_rhs (use->stmt, op);
+ gimple_cond cond_stmt = as_a <gimple_cond> (use->stmt);
+ gimple_cond_set_lhs (cond_stmt, var);
+ gimple_cond_set_code (cond_stmt, compare);
+ gimple_cond_set_rhs (cond_stmt, op);
return;
}
diff --git a/gcc/tree-ssa-loop-manip.c b/gcc/tree-ssa-loop-manip.c
index 9bd1a3b..bb3da81 100644
--- a/gcc/tree-ssa-loop-manip.c
+++ b/gcc/tree-ssa-loop-manip.c
@@ -1020,7 +1020,7 @@ tree_transform_and_unroll_loop (struct loop *loop, unsigned factor,
transform_callback transform,
void *data)
{
- gimple exit_if;
+ gimple_cond exit_if;
tree ctr_before, ctr_after;
tree enter_main_cond, exit_base, exit_step, exit_bound;
enum tree_code exit_cmp;
@@ -1217,7 +1217,7 @@ tree_transform_and_unroll_loop (struct loop *loop, unsigned factor,
/* Finally create the new counter for number of iterations and add the new
exit instruction. */
bsi = gsi_last_nondebug_bb (exit_bb);
- exit_if = gsi_stmt (bsi);
+ exit_if = as_a <gimple_cond> (gsi_stmt (bsi));
create_iv (exit_base, exit_step, NULL_TREE, loop,
&bsi, false, &ctr_before, &ctr_after);
gimple_cond_set_code (exit_if, exit_cmp);
@@ -1328,7 +1328,7 @@ canonicalize_loop_ivs (struct loop *loop, tree *nit, bool bump_in_latch)
tree type, var_before;
gimple_stmt_iterator gsi;
gimple_phi_iterator psi;
- gimple stmt;
+ gimple_cond stmt;
edge exit = single_dom_exit (loop);
gimple_seq stmts;
enum machine_mode mode;
@@ -1379,7 +1379,7 @@ canonicalize_loop_ivs (struct loop *loop, tree *nit, bool bump_in_latch)
rewrite_all_phi_nodes_with_iv (loop, var_before);
- stmt = last_stmt (exit->src);
+ stmt = as_a <gimple_cond> (last_stmt (exit->src));
/* Make the loop exit if the control condition is not satisfied. */
if (exit->flags & EDGE_TRUE_VALUE)
{
diff --git a/gcc/tree-ssa-propagate.c b/gcc/tree-ssa-propagate.c
index 08482fd..200ee80 100644
--- a/gcc/tree-ssa-propagate.c
+++ b/gcc/tree-ssa-propagate.c
@@ -1445,14 +1445,14 @@ propagate_tree_value_into_stmt (gimple_stmt_iterator *gsi, tree val)
propagate_tree_value (&expr, val);
gimple_assign_set_rhs_from_tree (gsi, expr);
}
- else if (gimple_code (stmt) == GIMPLE_COND)
+ else if (gimple_cond cond_stmt = dyn_cast <gimple_cond> (stmt))
{
tree lhs = NULL_TREE;
tree rhs = build_zero_cst (TREE_TYPE (val));
propagate_tree_value (&lhs, val);
- gimple_cond_set_code (stmt, NE_EXPR);
- gimple_cond_set_lhs (stmt, lhs);
- gimple_cond_set_rhs (stmt, rhs);
+ gimple_cond_set_code (cond_stmt, NE_EXPR);
+ gimple_cond_set_lhs (cond_stmt, lhs);
+ gimple_cond_set_rhs (cond_stmt, rhs);
}
else if (is_gimple_call (stmt)
&& gimple_call_lhs (stmt) != NULL_TREE)
--
1.8.5.3
^ permalink raw reply [flat|nested] 93+ messages in thread
* [gimple-classes, committed 73/92] Concretize gimple_cond_set_{lhs|rhs}
2014-10-27 20:35 [gimple-classes, committed 00/92] Initial slew of commits David Malcolm
` (27 preceding siblings ...)
2014-10-27 20:37 ` [gimple-classes, committed 83/92] Concretize gimple_assign_nontemporal_move_p David Malcolm
@ 2014-10-27 20:38 ` David Malcolm
2014-10-27 20:38 ` [gimple-classes, committed 80/92] Concretize gimple_call_set_fntype David Malcolm
` (62 subsequent siblings)
91 siblings, 0 replies; 93+ messages in thread
From: David Malcolm @ 2014-10-27 20:38 UTC (permalink / raw)
To: gcc-patches; +Cc: David Malcolm
This corresponds to:
[PATCH 75/89] Concretize gimple_cond_set_{lhs|rhs}
https://gcc.gnu.org/ml/gcc-patches/2014-04/msg01222.html
from the original 89-patch kit
That earlier patch was approved by Jeff:
> OK once prereqs go in.
in https://gcc.gnu.org/ml/gcc-patches/2014-05/msg00850.html
gcc/
* gimple.h (gimple_cond_set_lhs): Require a gimple_cond.
(gimple_cond_set_rhs): Likewise.
* tree-parloops.c (transform_to_exit_first_loop): Convert locals
"cond_stmt" and "cond_nit" to gimple_cond, adding checked casts,
since the existing code assumes that code is GIMPLE_COND. Convert
"stmt" to a gimple_assign.
(create_parallel_loop): Likewise for "cond_stmt".
* tree-ssa-loop-im.c (rewrite_bittest): Replace check for code
GIMPLE_COND with a dyn_cast, adding new local "cond_stmt".
---
gcc/ChangeLog.gimple-classes | 16 ++++++++++++++++
gcc/gimple.h | 6 ++----
gcc/tree-parloops.c | 12 +++++++-----
gcc/tree-ssa-loop-im.c | 19 ++++++++++++-------
4 files changed, 37 insertions(+), 16 deletions(-)
diff --git a/gcc/ChangeLog.gimple-classes b/gcc/ChangeLog.gimple-classes
index 503fd44..ece5b80 100644
--- a/gcc/ChangeLog.gimple-classes
+++ b/gcc/ChangeLog.gimple-classes
@@ -1,5 +1,21 @@
2014-10-24 David Malcolm <dmalcolm@redhat.com>
+ Concretize gimple_cond_set_{lhs|rhs}
+
+ * gimple.h (gimple_cond_set_lhs): Require a gimple_cond.
+ (gimple_cond_set_rhs): Likewise.
+
+ * tree-parloops.c (transform_to_exit_first_loop): Convert locals
+ "cond_stmt" and "cond_nit" to gimple_cond, adding checked casts,
+ since the existing code assumes that code is GIMPLE_COND. Convert
+ "stmt" to a gimple_assign.
+ (create_parallel_loop): Likewise for "cond_stmt".
+
+ * tree-ssa-loop-im.c (rewrite_bittest): Replace check for code
+ GIMPLE_COND with a dyn_cast, adding new local "cond_stmt".
+
+2014-10-24 David Malcolm <dmalcolm@redhat.com>
+
Concretize gimple_cond_set_code
* gimple.h (gimple_cond_set_code): Require a gimple_cond.
diff --git a/gcc/gimple.h b/gcc/gimple.h
index 1639579..eae7b60 100644
--- a/gcc/gimple.h
+++ b/gcc/gimple.h
@@ -3037,9 +3037,8 @@ gimple_cond_lhs_ptr (const_gimple gs)
conditional statement GS. */
static inline void
-gimple_cond_set_lhs (gimple gs, tree lhs)
+gimple_cond_set_lhs (gimple_cond gs, tree lhs)
{
- GIMPLE_CHECK (gs, GIMPLE_COND);
gimple_set_op (gs, 0, lhs);
}
@@ -3068,9 +3067,8 @@ gimple_cond_rhs_ptr (const_gimple gs)
conditional statement GS. */
static inline void
-gimple_cond_set_rhs (gimple gs, tree rhs)
+gimple_cond_set_rhs (gimple_cond gs, tree rhs)
{
- GIMPLE_CHECK (gs, GIMPLE_COND);
gimple_set_op (gs, 1, rhs);
}
diff --git a/gcc/tree-parloops.c b/gcc/tree-parloops.c
index f5823a6..ac37b0f 100644
--- a/gcc/tree-parloops.c
+++ b/gcc/tree-parloops.c
@@ -1499,14 +1499,15 @@ transform_to_exit_first_loop (struct loop *loop,
edge exit = single_dom_exit (loop), hpred;
tree control, control_name, res, t;
gimple_phi phi, nphi;
- gimple cond_stmt, stmt, cond_nit;
+ gimple_assign stmt;
+ gimple_cond cond_stmt, cond_nit;
tree nit_1;
split_block_after_labels (loop->header);
orig_header = single_succ (loop->header);
hpred = single_succ_edge (loop->header);
- cond_stmt = last_stmt (exit->src);
+ cond_stmt = as_a <gimple_cond> (last_stmt (exit->src));
control = gimple_cond_lhs (cond_stmt);
gcc_assert (gimple_cond_rhs (cond_stmt) == nit);
@@ -1586,7 +1587,7 @@ transform_to_exit_first_loop (struct loop *loop,
/* Initialize the control variable to number of iterations
according to the rhs of the exit condition. */
gimple_stmt_iterator gsi = gsi_after_labels (ex_bb);
- cond_nit = last_stmt (exit->src);
+ cond_nit = as_a <gimple_cond> (last_stmt (exit->src));
nit_1 = gimple_cond_rhs (cond_nit);
nit_1 = force_gimple_operand_gsi (&gsi,
fold_convert (TREE_TYPE (control_name), nit_1),
@@ -1610,7 +1611,8 @@ create_parallel_loop (struct loop *loop, tree loop_fn, tree data,
tree t, param;
gimple_omp_parallel omp_par_stmt;
gimple omp_return_stmt1, omp_return_stmt2;
- gimple phi, cond_stmt;
+ gimple phi;
+ gimple_cond cond_stmt;
gimple_omp_for for_stmt;
gimple_omp_continue omp_cont_stmt;
tree cvar, cvar_init, initvar, cvar_next, cvar_base, type;
@@ -1654,7 +1656,7 @@ create_parallel_loop (struct loop *loop, tree loop_fn, tree data,
/* Extract data for GIMPLE_OMP_FOR. */
gcc_assert (loop->header == single_dom_exit (loop)->src);
- cond_stmt = last_stmt (loop->header);
+ cond_stmt = as_a <gimple_cond> (last_stmt (loop->header));
cvar = gimple_cond_lhs (cond_stmt);
cvar_base = SSA_NAME_VAR (cvar);
diff --git a/gcc/tree-ssa-loop-im.c b/gcc/tree-ssa-loop-im.c
index 8ee47fc..07823ca 100644
--- a/gcc/tree-ssa-loop-im.c
+++ b/gcc/tree-ssa-loop-im.c
@@ -914,6 +914,7 @@ rewrite_bittest (gimple_stmt_iterator *bsi)
gimple stmt1;
gimple_assign stmt2;
gimple use_stmt;
+ gimple_cond cond_stmt;
tree lhs, name, t, a, b;
use_operand_p use;
@@ -922,13 +923,15 @@ rewrite_bittest (gimple_stmt_iterator *bsi)
/* Verify that the single use of lhs is a comparison against zero. */
if (TREE_CODE (lhs) != SSA_NAME
- || !single_imm_use (lhs, &use, &use_stmt)
- || gimple_code (use_stmt) != GIMPLE_COND)
+ || !single_imm_use (lhs, &use, &use_stmt))
return stmt;
- if (gimple_cond_lhs (use_stmt) != lhs
- || (gimple_cond_code (use_stmt) != NE_EXPR
- && gimple_cond_code (use_stmt) != EQ_EXPR)
- || !integer_zerop (gimple_cond_rhs (use_stmt)))
+ cond_stmt = dyn_cast <gimple_cond> (use_stmt);
+ if (!cond_stmt)
+ return stmt;
+ if (gimple_cond_lhs (cond_stmt) != lhs
+ || (gimple_cond_code (cond_stmt) != NE_EXPR
+ && gimple_cond_code (cond_stmt) != EQ_EXPR)
+ || !integer_zerop (gimple_cond_rhs (cond_stmt)))
return stmt;
/* Get at the operands of the shift. The rhs is TMP1 & 1. */
@@ -976,7 +979,9 @@ rewrite_bittest (gimple_stmt_iterator *bsi)
/* Replace the SSA_NAME we compare against zero. Adjust
the type of zero accordingly. */
SET_USE (use, name);
- gimple_cond_set_rhs (use_stmt, build_int_cst_type (TREE_TYPE (name), 0));
+ gimple_cond_set_rhs (cond_stmt,
+ build_int_cst_type (TREE_TYPE (name),
+ 0));
/* Don't use gsi_replace here, none of the new assignments sets
the variable originally set in stmt. Move bsi to stmt1, and
--
1.8.5.3
^ permalink raw reply [flat|nested] 93+ messages in thread
* [gimple-classes, committed 09/92] Update ssa_prop_visit_phi_fn callbacks to take a gimple_phi
2014-10-27 20:35 [gimple-classes, committed 00/92] Initial slew of commits David Malcolm
` (44 preceding siblings ...)
2014-10-27 20:38 ` [gimple-classes, committed 63/92] Concretize three gimple_try_set_ accessors David Malcolm
@ 2014-10-27 20:40 ` David Malcolm
2014-10-27 20:47 ` [gimple-classes, committed 89/92] Eliminate subclass typedefs from coretypes.h David Malcolm
` (45 subsequent siblings)
91 siblings, 0 replies; 93+ messages in thread
From: David Malcolm @ 2014-10-27 20:40 UTC (permalink / raw)
To: gcc-patches; +Cc: David Malcolm
This corresponds to:
[PATCH 10/89] Update ssa_prop_visit_phi_fn callbacks to take a gimple_phi
https://gcc.gnu.org/ml/gcc-patches/2014-04/msg01216.html
from the original 89-patch kit
That earlier patch was approved by Jeff:
> OK when prerequisites have gone in.
in https://gcc.gnu.org/ml/gcc-patches/2014-05/msg00619.html
gcc/
* tree-ssa-propagate.h (typedef ssa_prop_visit_phi_fn): Strengthen
type of parameter from gimple to gimple_phi.
* tree-complex.c (complex_visit_phi): Update signature of callback
implementation accordingly.
* tree-ssa-ccp.c (ccp_visit_phi_node): Likewise.
* tree-ssa-copy.c (copy_prop_visit_phi_node): Likewise.
* tree-vrp.c (vrp_visit_phi_node): Likewise.
* tree-ssa-propagate.c (simulate_stmt): Add a checked cast to
gimple_phi when invoking the ssa_prop_visit_phi callback.
---
gcc/ChangeLog.gimple-classes | 16 ++++++++++++++++
gcc/tree-complex.c | 2 +-
gcc/tree-ssa-ccp.c | 2 +-
gcc/tree-ssa-copy.c | 2 +-
gcc/tree-ssa-propagate.c | 2 +-
gcc/tree-ssa-propagate.h | 2 +-
gcc/tree-vrp.c | 2 +-
7 files changed, 22 insertions(+), 6 deletions(-)
diff --git a/gcc/ChangeLog.gimple-classes b/gcc/ChangeLog.gimple-classes
index 33a4f87..bd635c6 100644
--- a/gcc/ChangeLog.gimple-classes
+++ b/gcc/ChangeLog.gimple-classes
@@ -1,5 +1,21 @@
2014-10-24 David Malcolm <dmalcolm@redhat.com>
+ Update ssa_prop_visit_phi_fn callbacks to take a gimple_phi
+
+ * tree-ssa-propagate.h (typedef ssa_prop_visit_phi_fn): Strengthen
+ type of parameter from gimple to gimple_phi.
+
+ * tree-complex.c (complex_visit_phi): Update signature of callback
+ implementation accordingly.
+ * tree-ssa-ccp.c (ccp_visit_phi_node): Likewise.
+ * tree-ssa-copy.c (copy_prop_visit_phi_node): Likewise.
+ * tree-vrp.c (vrp_visit_phi_node): Likewise.
+
+ * tree-ssa-propagate.c (simulate_stmt): Add a checked cast to
+ gimple_phi when invoking the ssa_prop_visit_phi callback.
+
+2014-10-24 David Malcolm <dmalcolm@redhat.com>
+
Introduce gimple_phi_iterator
* gimple-iterator.h (struct gimple_phi_iterator): New subclass of
diff --git a/gcc/tree-complex.c b/gcc/tree-complex.c
index 9eb77e8..25dcad8 100644
--- a/gcc/tree-complex.c
+++ b/gcc/tree-complex.c
@@ -399,7 +399,7 @@ complex_visit_stmt (gimple stmt, edge *taken_edge_p ATTRIBUTE_UNUSED,
/* Evaluate a PHI node against the complex lattice defined above. */
static enum ssa_prop_result
-complex_visit_phi (gimple phi)
+complex_visit_phi (gimple_phi phi)
{
complex_lattice_t new_l, old_l;
unsigned int ver;
diff --git a/gcc/tree-ssa-ccp.c b/gcc/tree-ssa-ccp.c
index ce23019..19f2c32 100644
--- a/gcc/tree-ssa-ccp.c
+++ b/gcc/tree-ssa-ccp.c
@@ -1018,7 +1018,7 @@ ccp_lattice_meet (ccp_prop_value_t *val1, ccp_prop_value_t *val2)
of the PHI node that are incoming via executable edges. */
static enum ssa_prop_result
-ccp_visit_phi_node (gimple phi)
+ccp_visit_phi_node (gimple_phi phi)
{
unsigned i;
ccp_prop_value_t *old_val, new_val;
diff --git a/gcc/tree-ssa-copy.c b/gcc/tree-ssa-copy.c
index 3bbbb67..f7e8566 100644
--- a/gcc/tree-ssa-copy.c
+++ b/gcc/tree-ssa-copy.c
@@ -331,7 +331,7 @@ copy_prop_visit_stmt (gimple stmt, edge *taken_edge_p, tree *result_p)
set it to be the value of the LHS of PHI. */
static enum ssa_prop_result
-copy_prop_visit_phi_node (gimple phi)
+copy_prop_visit_phi_node (gimple_phi phi)
{
enum ssa_prop_result retval;
unsigned i;
diff --git a/gcc/tree-ssa-propagate.c b/gcc/tree-ssa-propagate.c
index 2e337e4..6ed41bd 100644
--- a/gcc/tree-ssa-propagate.c
+++ b/gcc/tree-ssa-propagate.c
@@ -324,7 +324,7 @@ simulate_stmt (gimple stmt)
if (gimple_code (stmt) == GIMPLE_PHI)
{
- val = ssa_prop_visit_phi (stmt);
+ val = ssa_prop_visit_phi (as_a <gimple_phi> (stmt));
output_name = gimple_phi_result (stmt);
}
else
diff --git a/gcc/tree-ssa-propagate.h b/gcc/tree-ssa-propagate.h
index 2d8d876..1e1a3a1 100644
--- a/gcc/tree-ssa-propagate.h
+++ b/gcc/tree-ssa-propagate.h
@@ -63,7 +63,7 @@ enum ssa_prop_result {
/* Call-back functions used by the value propagation engine. */
typedef enum ssa_prop_result (*ssa_prop_visit_stmt_fn) (gimple, edge *, tree *);
-typedef enum ssa_prop_result (*ssa_prop_visit_phi_fn) (gimple);
+typedef enum ssa_prop_result (*ssa_prop_visit_phi_fn) (gimple_phi);
typedef bool (*ssa_prop_fold_stmt_fn) (gimple_stmt_iterator *gsi);
typedef tree (*ssa_prop_get_value_fn) (tree);
diff --git a/gcc/tree-vrp.c b/gcc/tree-vrp.c
index 2e19273..289f0ba 100644
--- a/gcc/tree-vrp.c
+++ b/gcc/tree-vrp.c
@@ -8467,7 +8467,7 @@ vrp_meet (value_range_t *vr0, value_range_t *vr1)
value ranges, set a new range for the LHS of PHI. */
static enum ssa_prop_result
-vrp_visit_phi_node (gimple phi)
+vrp_visit_phi_node (gimple_phi phi)
{
size_t i;
tree lhs = PHI_RESULT (phi);
--
1.8.5.3
^ permalink raw reply [flat|nested] 93+ messages in thread
* [gimple-classes, committed 89/92] Eliminate subclass typedefs from coretypes.h
2014-10-27 20:35 [gimple-classes, committed 00/92] Initial slew of commits David Malcolm
` (45 preceding siblings ...)
2014-10-27 20:40 ` [gimple-classes, committed 09/92] Update ssa_prop_visit_phi_fn callbacks to take a gimple_phi David Malcolm
@ 2014-10-27 20:47 ` David Malcolm
2014-10-27 20:52 ` [gimple-classes, committed 37/92] Introduce gimple_omp_parallel David Malcolm
` (44 subsequent siblings)
91 siblings, 0 replies; 93+ messages in thread
From: David Malcolm @ 2014-10-27 20:47 UTC (permalink / raw)
To: gcc-patches; +Cc: David Malcolm
This commit requires the automated renaming that follows in order to
compile; I'm keeping it separate since the former is hand-written,
whereas the latter is autogenerated.
gcc/ChangeLog.gimple-classes:
* coretypes.h (gimple_cond): Drop this typedef.
(const_gimple_cond): Likewise.
(gimple_debug): Likewise.
(const_gimple_debug): Likewise.
(gimple_goto): Likewise.
(const_gimple_goto): Likewise.
(gimple_label): Likewise.
(const_gimple_label): Likewise.
(gimple_switch): Likewise.
(const_gimple_switch): Likewise.
(gimple_assign): Likewise.
(const_gimple_assign): Likewise.
(gimple_asm): Likewise.
(const_gimple_asm): Likewise.
(gimple_call): Likewise.
(const_gimple_call): Likewise.
(gimple_transaction): Likewise.
(const_gimple_transaction): Likewise.
(gimple_return): Likewise.
(const_gimple_return): Likewise.
(gimple_bind): Likewise.
(const_gimple_bind): Likewise.
(gimple_catch): Likewise.
(const_gimple_catch): Likewise.
(gimple_eh_filter): Likewise.
(const_gimple_eh_filter): Likewise.
(gimple_eh_must_not_throw;): Likewise.
(const_gimple_eh_must_not_throw): Likewise.
(gimple_eh_else): Likewise.
(const_gimple_eh_else): Likewise.
(gimple_resx): Likewise.
(const_gimple_resx): Likewise.
(gimple_eh_dispatch): Likewise.
(const_gimple_eh_dispatch): Likewise.
(gimple_phi): Likewise.
(const_gimple_phi): Likewise.
(gimple_try): Likewise.
(const_gimple_try): Likewise.
(gimple_omp_atomic_load): Likewise.
(const_gimple_omp_atomic_load): Likewise.
(gimple_omp_atomic_store): Likewise.
(const_gimple_omp_atomic_store): Likewise.
(gimple_omp_continue): Likewise.
(const_gimple_omp_continue): Likewise.
(gimple_omp_critical): Likewise.
(const_gimple_omp_critical): Likewise.
(gimple_omp_for): Likewise.
(const_gimple_omp_for): Likewise.
(gimple_omp_parallel): Likewise.
(const_gimple_omp_parallel): Likewise.
(gimple_omp_task): Likewise.
(const_gimple_omp_task): Likewise.
(gimple_omp_sections): Likewise.
(const_gimple_omp_sections): Likewise.
(gimple_omp_single): Likewise.
(const_gimple_omp_single): Likewise.
(gimple_omp_target): Likewise.
(const_gimple_omp_target): Likewise.
(gimple_omp_teams): Likewise.
(const_gimple_omp_teams): Likewise.
---
gcc/ChangeLog.gimple-classes | 63 ++++++++++++++++++++++++++++++
gcc/coretypes.h | 93 +-------------------------------------------
2 files changed, 64 insertions(+), 92 deletions(-)
diff --git a/gcc/ChangeLog.gimple-classes b/gcc/ChangeLog.gimple-classes
index 041342d..29abf0f 100644
--- a/gcc/ChangeLog.gimple-classes
+++ b/gcc/ChangeLog.gimple-classes
@@ -1,3 +1,66 @@
+2014-10-27 David Malcolm <dmalcolm@redhat.com>
+
+ * coretypes.h (gimple_cond): Drop this typedef.
+ (const_gimple_cond): Likewise.
+ (gimple_debug): Likewise.
+ (const_gimple_debug): Likewise.
+ (gimple_goto): Likewise.
+ (const_gimple_goto): Likewise.
+ (gimple_label): Likewise.
+ (const_gimple_label): Likewise.
+ (gimple_switch): Likewise.
+ (const_gimple_switch): Likewise.
+ (gimple_assign): Likewise.
+ (const_gimple_assign): Likewise.
+ (gimple_asm): Likewise.
+ (const_gimple_asm): Likewise.
+ (gimple_call): Likewise.
+ (const_gimple_call): Likewise.
+ (gimple_transaction): Likewise.
+ (const_gimple_transaction): Likewise.
+ (gimple_return): Likewise.
+ (const_gimple_return): Likewise.
+ (gimple_bind): Likewise.
+ (const_gimple_bind): Likewise.
+ (gimple_catch): Likewise.
+ (const_gimple_catch): Likewise.
+ (gimple_eh_filter): Likewise.
+ (const_gimple_eh_filter): Likewise.
+ (gimple_eh_must_not_throw;): Likewise.
+ (const_gimple_eh_must_not_throw): Likewise.
+ (gimple_eh_else): Likewise.
+ (const_gimple_eh_else): Likewise.
+ (gimple_resx): Likewise.
+ (const_gimple_resx): Likewise.
+ (gimple_eh_dispatch): Likewise.
+ (const_gimple_eh_dispatch): Likewise.
+ (gimple_phi): Likewise.
+ (const_gimple_phi): Likewise.
+ (gimple_try): Likewise.
+ (const_gimple_try): Likewise.
+ (gimple_omp_atomic_load): Likewise.
+ (const_gimple_omp_atomic_load): Likewise.
+ (gimple_omp_atomic_store): Likewise.
+ (const_gimple_omp_atomic_store): Likewise.
+ (gimple_omp_continue): Likewise.
+ (const_gimple_omp_continue): Likewise.
+ (gimple_omp_critical): Likewise.
+ (const_gimple_omp_critical): Likewise.
+ (gimple_omp_for): Likewise.
+ (const_gimple_omp_for): Likewise.
+ (gimple_omp_parallel): Likewise.
+ (const_gimple_omp_parallel): Likewise.
+ (gimple_omp_task): Likewise.
+ (const_gimple_omp_task): Likewise.
+ (gimple_omp_sections): Likewise.
+ (const_gimple_omp_sections): Likewise.
+ (gimple_omp_single): Likewise.
+ (const_gimple_omp_single): Likewise.
+ (gimple_omp_target): Likewise.
+ (const_gimple_omp_target): Likewise.
+ (gimple_omp_teams): Likewise.
+ (const_gimple_omp_teams): Likewise.
+
2014-10-24 David Malcolm <dmalcolm@redhat.com>
* tree-inline.h (struct copy_body_data): Rename field
diff --git a/gcc/coretypes.h b/gcc/coretypes.h
index b8417bc..7feac08 100644
--- a/gcc/coretypes.h
+++ b/gcc/coretypes.h
@@ -87,130 +87,39 @@ typedef const struct gimple_statement_base *const_gimple;
typedef gimple gimple_seq;
struct gimple_stmt_iterator;
-/* Typedefs for leaf gimple subclasses (for individual gimple codes).
+/* Forward decls for leaf gimple subclasses (for individual gimple codes).
Keep this in the same order as the corresponding codes in gimple.def. */
struct gimple_statement_cond;
-typedef struct gimple_statement_cond *gimple_cond;
-typedef const struct gimple_statement_cond *const_gimple_cond;
-
struct gimple_statement_debug;
-typedef struct gimple_statement_debug *gimple_debug;
-typedef const struct gimple_statement_debug *const_gimple_debug;
-
struct gimple_statement_goto;
-typedef struct gimple_statement_goto *gimple_goto;
-typedef const struct gimple_statement_goto *const_gimple_goto;
-
struct gimple_statement_label;
-typedef struct gimple_statement_label *gimple_label;
-typedef const struct gimple_statement_label *const_gimple_label;
-
struct gimple_statement_switch;
-typedef struct gimple_statement_switch *gimple_switch;
-typedef const struct gimple_statement_switch *const_gimple_switch;
-
struct gimple_statement_assign;
-typedef struct gimple_statement_assign *gimple_assign;
-typedef const struct gimple_statement_assign *const_gimple_assign;
-
struct gimple_statement_asm;
-typedef struct gimple_statement_asm *gimple_asm;
-typedef const struct gimple_statement_asm *const_gimple_asm;
-
struct gimple_statement_call;
-typedef struct gimple_statement_call *gimple_call;
-typedef const struct gimple_statement_call *const_gimple_call;
-
struct gimple_statement_transaction;
-typedef struct gimple_statement_transaction *gimple_transaction;
-typedef const struct gimple_statement_transaction *const_gimple_transaction;
-
struct gimple_statement_return;
-typedef struct gimple_statement_return *gimple_return;
-typedef const struct gimple_statement_return *const_gimple_return;
-
struct gimple_statement_bind;
-typedef struct gimple_statement_bind *gimple_bind;
-typedef const struct gimple_statement_bind *const_gimple_bind;
-
struct gimple_statement_catch;
-typedef struct gimple_statement_catch *gimple_catch;
-typedef const struct gimple_statement_catch *const_gimple_catch;
-
struct gimple_statement_eh_filter;
-typedef struct gimple_statement_eh_filter *gimple_eh_filter;
-typedef const struct gimple_statement_eh_filter *const_gimple_eh_filter;
-
struct gimple_statement_eh_mnt;
-typedef struct gimple_statement_eh_mnt *gimple_eh_must_not_throw;
-typedef const struct gimple_statement_eh_mnt *const_gimple_eh_must_not_throw;
-
struct gimple_statement_eh_else;
-typedef struct gimple_statement_eh_else *gimple_eh_else;
-typedef const struct gimple_statement_eh_else *const_gimple_eh_else;
-
struct gimple_statement_resx;
-typedef struct gimple_statement_resx *gimple_resx;
-typedef const struct gimple_statement_resx *const_gimple_resx;
-
struct gimple_statement_eh_dispatch;
-typedef struct gimple_statement_eh_dispatch *gimple_eh_dispatch;
-typedef const struct gimple_statement_eh_dispatch *const_gimple_eh_dispatch;
-
struct gimple_statement_phi;
-typedef struct gimple_statement_phi *gimple_phi;
-typedef const struct gimple_statement_phi *const_gimple_phi;
-
struct gimple_statement_try;
-typedef struct gimple_statement_try *gimple_try;
-typedef const struct gimple_statement_try *const_gimple_try;
-
struct gimple_statement_omp_atomic_load;
-typedef struct gimple_statement_omp_atomic_load *gimple_omp_atomic_load;
-typedef const struct gimple_statement_omp_atomic_load *
- const_gimple_omp_atomic_load;
-
struct gimple_statement_omp_atomic_store;
-typedef struct gimple_statement_omp_atomic_store *gimple_omp_atomic_store;
-typedef const struct gimple_statement_omp_atomic_store *
- const_gimple_omp_atomic_store;
-
struct gimple_statement_omp_continue;
-typedef struct gimple_statement_omp_continue *gimple_omp_continue;
-typedef const struct gimple_statement_omp_continue *const_gimple_omp_continue;
-
struct gimple_statement_omp_critical;
-typedef struct gimple_statement_omp_critical *gimple_omp_critical;
-typedef const struct gimple_statement_omp_critical *const_gimple_omp_critical;
-
struct gimple_statement_omp_for;
-typedef struct gimple_statement_omp_for *gimple_omp_for;
-typedef const struct gimple_statement_omp_for *const_gimple_omp_for;
-
struct gimple_statement_omp_parallel;
-typedef struct gimple_statement_omp_parallel *gimple_omp_parallel;
-typedef const struct gimple_statement_omp_parallel *const_gimple_omp_parallel;
-
struct gimple_statement_omp_task;
-typedef struct gimple_statement_omp_task *gimple_omp_task;
-typedef const struct gimple_statement_omp_task *const_gimple_omp_task;
-
struct gimple_statement_omp_sections;
-typedef struct gimple_statement_omp_sections *gimple_omp_sections;
-typedef const struct gimple_statement_omp_sections *const_gimple_omp_sections;
-
struct gimple_statement_omp_single;
-typedef struct gimple_statement_omp_single *gimple_omp_single;
-typedef const struct gimple_statement_omp_single *const_gimple_omp_single;
-
struct gimple_statement_omp_target;
-typedef struct gimple_statement_omp_target *gimple_omp_target;
-typedef const struct gimple_statement_omp_target *const_gimple_omp_target;
-
struct gimple_statement_omp_teams;
-typedef struct gimple_statement_omp_teams *gimple_omp_teams;
-typedef const struct gimple_statement_omp_teams *const_gimple_omp_teams;
union section;
typedef union section section;
--
1.8.5.3
^ permalink raw reply [flat|nested] 93+ messages in thread
* [gimple-classes, committed 15/92] tree-ssa-loop-ivopts.c: use gimple_phi in a few places
2014-10-27 20:35 [gimple-classes, committed 00/92] Initial slew of commits David Malcolm
` (47 preceding siblings ...)
2014-10-27 20:52 ` [gimple-classes, committed 37/92] Introduce gimple_omp_parallel David Malcolm
@ 2014-10-27 20:52 ` David Malcolm
2014-10-27 20:52 ` [gimple-classes, committed 28/92] Introduce gimple_eh_dispatch David Malcolm
` (42 subsequent siblings)
91 siblings, 0 replies; 93+ messages in thread
From: David Malcolm @ 2014-10-27 20:52 UTC (permalink / raw)
To: gcc-patches; +Cc: David Malcolm
This corresponds to:
[PATCH 16/89] tree-ssa-loop-ivopts.c: use gimple_phi in a few places
https://gcc.gnu.org/ml/gcc-patches/2014-04/msg01165.html
from the original 89-patch kit
That earlier patch was approved by Jeff:
> OK when prerequisites have gone in.
> Actually that's true for #17 & #18 as well.
in https://gcc.gnu.org/ml/gcc-patches/2014-05/msg00626.html
gcc/
* tree-ssa-loop-ivopts.c (determine_biv_step): Require a gimple_phi.
(find_bivs): Convert local "phi" into a gimple_phi.
(mark_bivs): Likewise.
---
gcc/ChangeLog.gimple-classes | 8 ++++++++
gcc/tree-ssa-loop-ivopts.c | 7 ++++---
2 files changed, 12 insertions(+), 3 deletions(-)
diff --git a/gcc/ChangeLog.gimple-classes b/gcc/ChangeLog.gimple-classes
index 1e636be..4006f14 100644
--- a/gcc/ChangeLog.gimple-classes
+++ b/gcc/ChangeLog.gimple-classes
@@ -1,5 +1,13 @@
2014-10-24 David Malcolm <dmalcolm@redhat.com>
+ tree-ssa-loop-ivopts.c: use gimple_phi in a few places
+
+ * tree-ssa-loop-ivopts.c (determine_biv_step): Require a gimple_phi.
+ (find_bivs): Convert local "phi" into a gimple_phi.
+ (mark_bivs): Likewise.
+
+2014-10-24 David Malcolm <dmalcolm@redhat.com>
+
tree-ssa-loop-manip.c: use gimple_phi in three places
* tree-ssa-loop-manip.c (add_exit_phi): Convert local "phi" to be a
diff --git a/gcc/tree-ssa-loop-ivopts.c b/gcc/tree-ssa-loop-ivopts.c
index 8d330d9..0e33774 100644
--- a/gcc/tree-ssa-loop-ivopts.c
+++ b/gcc/tree-ssa-loop-ivopts.c
@@ -1037,7 +1037,7 @@ get_iv (struct ivopts_data *data, tree var)
not define a simple affine biv with nonzero step. */
static tree
-determine_biv_step (gimple phi)
+determine_biv_step (gimple_phi phi)
{
struct loop *loop = gimple_bb (phi)->loop_father;
tree name = PHI_RESULT (phi);
@@ -1057,7 +1057,7 @@ determine_biv_step (gimple phi)
static bool
find_bivs (struct ivopts_data *data)
{
- gimple phi;
+ gimple_phi phi;
tree step, type, base;
bool found = false;
struct loop *loop = data->current_loop;
@@ -1102,7 +1102,8 @@ find_bivs (struct ivopts_data *data)
static void
mark_bivs (struct ivopts_data *data)
{
- gimple phi, def;
+ gimple_phi phi;
+ gimple def;
tree var;
struct iv *iv, *incr_iv;
struct loop *loop = data->current_loop;
--
1.8.5.3
^ permalink raw reply [flat|nested] 93+ messages in thread
* [gimple-classes, committed 28/92] Introduce gimple_eh_dispatch
2014-10-27 20:35 [gimple-classes, committed 00/92] Initial slew of commits David Malcolm
` (48 preceding siblings ...)
2014-10-27 20:52 ` [gimple-classes, committed 15/92] tree-ssa-loop-ivopts.c: use gimple_phi in a few places David Malcolm
@ 2014-10-27 20:52 ` David Malcolm
2014-10-27 20:52 ` [gimple-classes, committed 78/92] Tweak to gimplify_modify_expr David Malcolm
` (41 subsequent siblings)
91 siblings, 0 replies; 93+ messages in thread
From: David Malcolm @ 2014-10-27 20:52 UTC (permalink / raw)
To: gcc-patches; +Cc: David Malcolm
This corresponds to:
[PATCH 30/89] Introduce gimple_eh_dispatch
https://gcc.gnu.org/ml/gcc-patches/2014-04/msg01236.html
from the original 89-patch kit
That earlier patch was approved by Jeff:
> OK after fixing up the naming/const stuff as discussed for prior
> patches.
> That applies to 22-30. Make sure to take care of
> the pretty printers per Trevor's comments as well. He indicated those
> were missing in a couple of those patches.
in https://gcc.gnu.org/ml/gcc-patches/2014-05/msg00628.html
gcc/
* coretypes.h (gimple_eh_dispatch): New typedef.
(const_gimple_eh_dispatch): New typedef.
* gimple-pretty-print.c (dump_gimple_eh_dispatch): Require a
gimple_eh_dispatch rather than a plain gimple.
(pp_gimple_stmt_1): Add a checked cast to gimple_eh_dispatch
within GIMPLE_EH_DISPATCH case of switch statement.
* gimple-streamer-in.c (input_gimple_stmt): Likewise.
* gimple-streamer-out.c (output_gimple_stmt): Likewise.
* gimple.c (gimple_build_eh_dispatch): Return a gimple_eh_dispatch
rather than a plain gimple.
* gimple.h (gimple_build_eh_dispatch): Return a gimple_eh_dispatch
rather than a plain gimple.
(gimple_eh_dispatch_region): Require a const_gimple_eh_dispatch
rather than a plain const_gimple.
(gimple_eh_dispatch_set_region): Require a gimple_eh_dispatch
rather than a plain gimple.
* tree-cfg.c (make_edges): Add a checked cast to gimple_eh_dispatch
within GIMPLE_EH_DISPATCH case of switch statement.
(gimple_verify_flow_info): Likewise.
(gimple_redirect_edge_and_branch): Likewise.
(move_stmt_r): Likewise, adding a local.
* tree-eh.c (emit_eh_dispatch): Convert local from gimple to
gimple_eh_dispatch.
(make_eh_dispatch_edges): Require a gimple_eh_dispatch rather than
a plain gimple.
(redirect_eh_dispatch_edge): Likewise.
(lower_eh_dispatch): Likewise.
(execute_lower_eh_dispatch): Add a checked cast to
gimple_eh_dispatch.
(mark_reachable_handlers): Likewise.
(verify_eh_dispatch_edge): Require a gimple_eh_dispatch rather
than a plain gimple.
* tree-eh.h (make_eh_dispatch_edges): Likewise.
(redirect_eh_dispatch_edge): Likewise.
(verify_eh_dispatch_edge): Likewise.
* tree-inline.c (remap_gimple_stmt): Add a checked cast to
gimple_eh_dispatch within GIMPLE_EH_DISPATCH case of switch
statement, adding a local.
(copy_edges_for_bb): Add a checked cast to gimple_eh_dispatch.
---
gcc/ChangeLog.gimple-classes | 53 ++++++++++++++++++++++++++++++++++++++++++++
gcc/coretypes.h | 4 ++++
gcc/gimple-pretty-print.c | 5 +++--
gcc/gimple-streamer-in.c | 3 ++-
gcc/gimple-streamer-out.c | 4 +++-
gcc/gimple.c | 6 ++---
gcc/gimple.h | 15 +++++--------
gcc/tree-cfg.c | 12 +++++-----
gcc/tree-eh.c | 17 ++++++++------
gcc/tree-eh.h | 6 ++---
gcc/tree-inline.c | 7 +++---
11 files changed, 98 insertions(+), 34 deletions(-)
diff --git a/gcc/ChangeLog.gimple-classes b/gcc/ChangeLog.gimple-classes
index 6e2d2f5..a7461cd 100644
--- a/gcc/ChangeLog.gimple-classes
+++ b/gcc/ChangeLog.gimple-classes
@@ -1,5 +1,58 @@
2014-10-24 David Malcolm <dmalcolm@redhat.com>
+ Introduce gimple_eh_dispatch
+
+ * coretypes.h (gimple_eh_dispatch): New typedef.
+ (const_gimple_eh_dispatch): New typedef.
+
+ * gimple-pretty-print.c (dump_gimple_eh_dispatch): Require a
+ gimple_eh_dispatch rather than a plain gimple.
+ (pp_gimple_stmt_1): Add a checked cast to gimple_eh_dispatch
+ within GIMPLE_EH_DISPATCH case of switch statement.
+
+ * gimple-streamer-in.c (input_gimple_stmt): Likewise.
+
+ * gimple-streamer-out.c (output_gimple_stmt): Likewise.
+
+ * gimple.c (gimple_build_eh_dispatch): Return a gimple_eh_dispatch
+ rather than a plain gimple.
+
+ * gimple.h (gimple_build_eh_dispatch): Return a gimple_eh_dispatch
+ rather than a plain gimple.
+ (gimple_eh_dispatch_region): Require a const_gimple_eh_dispatch
+ rather than a plain const_gimple.
+ (gimple_eh_dispatch_set_region): Require a gimple_eh_dispatch
+ rather than a plain gimple.
+
+ * tree-cfg.c (make_edges): Add a checked cast to gimple_eh_dispatch
+ within GIMPLE_EH_DISPATCH case of switch statement.
+ (gimple_verify_flow_info): Likewise.
+ (gimple_redirect_edge_and_branch): Likewise.
+ (move_stmt_r): Likewise, adding a local.
+
+ * tree-eh.c (emit_eh_dispatch): Convert local from gimple to
+ gimple_eh_dispatch.
+ (make_eh_dispatch_edges): Require a gimple_eh_dispatch rather than
+ a plain gimple.
+ (redirect_eh_dispatch_edge): Likewise.
+ (lower_eh_dispatch): Likewise.
+ (execute_lower_eh_dispatch): Add a checked cast to
+ gimple_eh_dispatch.
+ (mark_reachable_handlers): Likewise.
+ (verify_eh_dispatch_edge): Require a gimple_eh_dispatch rather
+ than a plain gimple.
+
+ * tree-eh.h (make_eh_dispatch_edges): Likewise.
+ (redirect_eh_dispatch_edge): Likewise.
+ (verify_eh_dispatch_edge): Likewise.
+
+ * tree-inline.c (remap_gimple_stmt): Add a checked cast to
+ gimple_eh_dispatch within GIMPLE_EH_DISPATCH case of switch
+ statement, adding a local.
+ (copy_edges_for_bb): Add a checked cast to gimple_eh_dispatch.
+
+2014-10-24 David Malcolm <dmalcolm@redhat.com>
+
Introduce gimple_resx
* coretypes.h (gimple_resx): New typedef.
diff --git a/gcc/coretypes.h b/gcc/coretypes.h
index fc2dbf3..6914027 100644
--- a/gcc/coretypes.h
+++ b/gcc/coretypes.h
@@ -154,6 +154,10 @@ struct gimple_statement_resx;
typedef struct gimple_statement_resx *gimple_resx;
typedef const struct gimple_statement_resx *const_gimple_resx;
+struct gimple_statement_eh_dispatch;
+typedef struct gimple_statement_eh_dispatch *gimple_eh_dispatch;
+typedef const struct gimple_statement_eh_dispatch *const_gimple_eh_dispatch;
+
struct gimple_statement_phi;
typedef struct gimple_statement_phi *gimple_phi;
typedef const struct gimple_statement_phi *const_gimple_phi;
diff --git a/gcc/gimple-pretty-print.c b/gcc/gimple-pretty-print.c
index 81f1a35..00ff34c 100644
--- a/gcc/gimple-pretty-print.c
+++ b/gcc/gimple-pretty-print.c
@@ -1069,7 +1069,7 @@ dump_gimple_resx (pretty_printer *buffer, gimple_resx gs, int spc, int flags)
/* Dump a GIMPLE_EH_DISPATCH tuple on the pretty_printer BUFFER. */
static void
-dump_gimple_eh_dispatch (pretty_printer *buffer, gimple gs, int spc, int flags)
+dump_gimple_eh_dispatch (pretty_printer *buffer, gimple_eh_dispatch gs, int spc, int flags)
{
if (flags & TDF_RAW)
dump_gimple_fmt (buffer, spc, flags, "%G <%d>", gs,
@@ -2218,7 +2218,8 @@ pp_gimple_stmt_1 (pretty_printer *buffer, gimple gs, int spc, int flags)
break;
case GIMPLE_EH_DISPATCH:
- dump_gimple_eh_dispatch (buffer, gs, spc, flags);
+ dump_gimple_eh_dispatch (buffer, as_a <gimple_eh_dispatch> (gs), spc,
+ flags);
break;
case GIMPLE_DEBUG:
diff --git a/gcc/gimple-streamer-in.c b/gcc/gimple-streamer-in.c
index 55f939c..202ecac 100644
--- a/gcc/gimple-streamer-in.c
+++ b/gcc/gimple-streamer-in.c
@@ -134,7 +134,8 @@ input_gimple_stmt (struct lto_input_block *ib, struct data_in *data_in,
break;
case GIMPLE_EH_DISPATCH:
- gimple_eh_dispatch_set_region (stmt, streamer_read_hwi (ib));
+ gimple_eh_dispatch_set_region (as_a <gimple_eh_dispatch> (stmt),
+ streamer_read_hwi (ib));
break;
case GIMPLE_ASM:
diff --git a/gcc/gimple-streamer-out.c b/gcc/gimple-streamer-out.c
index b23dfb7..2bc605f 100644
--- a/gcc/gimple-streamer-out.c
+++ b/gcc/gimple-streamer-out.c
@@ -108,7 +108,9 @@ output_gimple_stmt (struct output_block *ob, gimple stmt)
break;
case GIMPLE_EH_DISPATCH:
- streamer_write_hwi (ob, gimple_eh_dispatch_region (stmt));
+ streamer_write_hwi (ob,
+ gimple_eh_dispatch_region (
+ as_a <gimple_eh_dispatch> (stmt)));
break;
case GIMPLE_ASM:
diff --git a/gcc/gimple.c b/gcc/gimple.c
index c94611a..2b00869 100644
--- a/gcc/gimple.c
+++ b/gcc/gimple.c
@@ -760,11 +760,11 @@ gimple_build_switch (tree index, tree default_label, vec<tree> args)
/* Build a GIMPLE_EH_DISPATCH statement. */
-gimple
+gimple_eh_dispatch
gimple_build_eh_dispatch (int region)
{
- gimple_statement_eh_dispatch *p =
- as_a <gimple_statement_eh_dispatch *> (
+ gimple_eh_dispatch p =
+ as_a <gimple_eh_dispatch> (
gimple_build_with_ops (GIMPLE_EH_DISPATCH, ERROR_MARK, 0));
p->region = region;
return p;
diff --git a/gcc/gimple.h b/gcc/gimple.h
index f15693b..f1af63a 100644
--- a/gcc/gimple.h
+++ b/gcc/gimple.h
@@ -1335,7 +1335,7 @@ gimple gimple_build_wce (gimple_seq);
gimple_resx gimple_build_resx (int);
gimple_switch gimple_build_switch_nlabels (unsigned, tree, tree);
gimple_switch gimple_build_switch (tree, tree, vec<tree> );
-gimple gimple_build_eh_dispatch (int);
+gimple_eh_dispatch gimple_build_eh_dispatch (int);
gimple_debug gimple_build_debug_bind_stat (tree, tree, gimple MEM_STAT_DECL);
#define gimple_build_debug_bind(var,val,stmt) \
gimple_build_debug_bind_stat ((var), (val), (stmt) MEM_STAT_INFO)
@@ -4035,23 +4035,20 @@ gimple_resx_set_region (gimple_resx resx_stmt, int region)
resx_stmt->region = region;
}
-/* Return the region number for GIMPLE_EH_DISPATCH GS. */
+/* Return the region number for GIMPLE_EH_DISPATCH EH_DISPATCH_STMT. */
static inline int
-gimple_eh_dispatch_region (const_gimple gs)
+gimple_eh_dispatch_region (const_gimple_eh_dispatch eh_dispatch_stmt)
{
- const gimple_statement_eh_dispatch *eh_dispatch_stmt =
- as_a <const gimple_statement_eh_dispatch *> (gs);
return eh_dispatch_stmt->region;
}
-/* Set REGION to be the region number for GIMPLE_EH_DISPATCH GS. */
+/* Set REGION to be the region number for GIMPLE_EH_DISPATCH
+ EH_DISPATCH_STMT. */
static inline void
-gimple_eh_dispatch_set_region (gimple gs, int region)
+gimple_eh_dispatch_set_region (gimple_eh_dispatch eh_dispatch_stmt, int region)
{
- gimple_statement_eh_dispatch *eh_dispatch_stmt =
- as_a <gimple_statement_eh_dispatch *> (gs);
eh_dispatch_stmt->region = region;
}
diff --git a/gcc/tree-cfg.c b/gcc/tree-cfg.c
index 3ac05cb..feeefea 100644
--- a/gcc/tree-cfg.c
+++ b/gcc/tree-cfg.c
@@ -812,7 +812,8 @@ make_edges (void)
fallthru = false;
break;
case GIMPLE_EH_DISPATCH:
- fallthru = make_eh_dispatch_edges (last);
+ fallthru =
+ make_eh_dispatch_edges (as_a <gimple_eh_dispatch> (last));
break;
case GIMPLE_CALL:
@@ -5324,7 +5325,7 @@ gimple_verify_flow_info (void)
break;
case GIMPLE_EH_DISPATCH:
- err |= verify_eh_dispatch_edge (stmt);
+ err |= verify_eh_dispatch_edge (as_a <gimple_eh_dispatch> (stmt));
break;
default:
@@ -5578,7 +5579,7 @@ gimple_redirect_edge_and_branch (edge e, basic_block dest)
case GIMPLE_EH_DISPATCH:
if (!(e->flags & EDGE_FALLTHRU))
- redirect_eh_dispatch_edge (stmt, e, dest);
+ redirect_eh_dispatch_edge (as_a <gimple_eh_dispatch> (stmt), e, dest);
break;
case GIMPLE_TRANSACTION:
@@ -6533,9 +6534,10 @@ move_stmt_r (gimple_stmt_iterator *gsi_p, bool *handled_ops_p,
case GIMPLE_EH_DISPATCH:
{
- int r = gimple_eh_dispatch_region (stmt);
+ gimple_eh_dispatch eh_dispatch_stmt = as_a <gimple_eh_dispatch> (stmt);
+ int r = gimple_eh_dispatch_region (eh_dispatch_stmt);
r = move_stmt_eh_region_nr (r, p);
- gimple_eh_dispatch_set_region (stmt, r);
+ gimple_eh_dispatch_set_region (eh_dispatch_stmt, r);
}
break;
diff --git a/gcc/tree-eh.c b/gcc/tree-eh.c
index f58e518..5a83f3f 100644
--- a/gcc/tree-eh.c
+++ b/gcc/tree-eh.c
@@ -816,7 +816,7 @@ emit_resx (gimple_seq *seq, eh_region region)
static void
emit_eh_dispatch (gimple_seq *seq, eh_region region)
{
- gimple x = gimple_build_eh_dispatch (region->index);
+ gimple_eh_dispatch x = gimple_build_eh_dispatch (region->index);
gimple_seq_add_stmt (seq, x);
}
@@ -2197,7 +2197,7 @@ make_pass_lower_eh (gcc::context *ctxt)
no fallthru edge; false if there is. */
bool
-make_eh_dispatch_edges (gimple stmt)
+make_eh_dispatch_edges (gimple_eh_dispatch stmt)
{
eh_region r;
eh_catch c;
@@ -2355,7 +2355,7 @@ redirect_eh_edge (edge edge_in, basic_block new_bb)
The actual edge update will happen in the caller. */
void
-redirect_eh_dispatch_edge (gimple stmt, edge e, basic_block new_bb)
+redirect_eh_dispatch_edge (gimple_eh_dispatch stmt, edge e, basic_block new_bb)
{
tree new_lab = gimple_block_label (new_bb);
bool any_changed = false;
@@ -3544,7 +3544,7 @@ sink_clobbers (basic_block bb)
we have found some duplicate labels and removed some edges. */
static bool
-lower_eh_dispatch (basic_block src, gimple stmt)
+lower_eh_dispatch (basic_block src, gimple_eh_dispatch stmt)
{
gimple_stmt_iterator gsi;
int region_nr;
@@ -3732,7 +3732,8 @@ pass_lower_eh_dispatch::execute (function *fun)
continue;
if (gimple_code (last) == GIMPLE_EH_DISPATCH)
{
- redirected |= lower_eh_dispatch (bb, last);
+ redirected |= lower_eh_dispatch (bb,
+ as_a <gimple_eh_dispatch> (last));
flags |= TODO_update_ssa_only_virtuals;
}
else if (gimple_code (last) == GIMPLE_RESX)
@@ -3824,7 +3825,9 @@ mark_reachable_handlers (sbitmap *r_reachablep, sbitmap *lp_reachablep)
gimple_resx_region (as_a <gimple_resx> (stmt)));
break;
case GIMPLE_EH_DISPATCH:
- bitmap_set_bit (r_reachable, gimple_eh_dispatch_region (stmt));
+ bitmap_set_bit (r_reachable,
+ gimple_eh_dispatch_region (
+ as_a <gimple_eh_dispatch> (stmt)));
break;
default:
break;
@@ -4666,7 +4669,7 @@ verify_eh_edges (gimple stmt)
/* Similarly, but handle GIMPLE_EH_DISPATCH specifically. */
DEBUG_FUNCTION bool
-verify_eh_dispatch_edge (gimple stmt)
+verify_eh_dispatch_edge (gimple_eh_dispatch stmt)
{
eh_region r;
eh_catch c;
diff --git a/gcc/tree-eh.h b/gcc/tree-eh.h
index 51c2adc..78198d1 100644
--- a/gcc/tree-eh.h
+++ b/gcc/tree-eh.h
@@ -30,10 +30,10 @@ extern bool remove_stmt_from_eh_lp_fn (struct function *, gimple);
extern bool remove_stmt_from_eh_lp (gimple);
extern int lookup_stmt_eh_lp_fn (struct function *, gimple);
extern int lookup_stmt_eh_lp (gimple);
-extern bool make_eh_dispatch_edges (gimple);
+extern bool make_eh_dispatch_edges (gimple_eh_dispatch);
extern void make_eh_edges (gimple);
extern edge redirect_eh_edge (edge, basic_block);
-extern void redirect_eh_dispatch_edge (gimple, edge, basic_block);
+extern void redirect_eh_dispatch_edge (gimple_eh_dispatch, edge, basic_block);
extern bool operation_could_trap_helper_p (enum tree_code, bool, bool, bool,
bool, tree, bool *);
extern bool operation_could_trap_p (enum tree_code, bool, bool, tree);
@@ -51,6 +51,6 @@ extern bool maybe_duplicate_eh_stmt_fn (struct function *, gimple,
extern bool maybe_duplicate_eh_stmt (gimple, gimple);
extern void maybe_remove_unreachable_handlers (void);
extern bool verify_eh_edges (gimple);
-extern bool verify_eh_dispatch_edge (gimple);
+extern bool verify_eh_dispatch_edge (gimple_eh_dispatch);
#endif /* GCC_TREE_EH_H */
diff --git a/gcc/tree-inline.c b/gcc/tree-inline.c
index 60f501d..beb06a3 100644
--- a/gcc/tree-inline.c
+++ b/gcc/tree-inline.c
@@ -1593,9 +1593,10 @@ remap_gimple_stmt (gimple stmt, copy_body_data *id)
case GIMPLE_EH_DISPATCH:
{
- int r = gimple_eh_dispatch_region (copy);
+ gimple_eh_dispatch eh_dispatch = as_a <gimple_eh_dispatch> (copy);
+ int r = gimple_eh_dispatch_region (eh_dispatch);
r = remap_eh_region_nr (r, id);
- gimple_eh_dispatch_set_region (copy, r);
+ gimple_eh_dispatch_set_region (eh_dispatch, r);
}
break;
@@ -2105,7 +2106,7 @@ copy_edges_for_bb (basic_block bb, gcov_type count_scale, basic_block ret_bb,
}
if (gimple_code (copy_stmt) == GIMPLE_EH_DISPATCH)
- make_eh_dispatch_edges (copy_stmt);
+ make_eh_dispatch_edges (as_a <gimple_eh_dispatch> (copy_stmt));
else if (can_throw)
make_eh_edges (copy_stmt);
--
1.8.5.3
^ permalink raw reply [flat|nested] 93+ messages in thread
* [gimple-classes, committed 78/92] Tweak to gimplify_modify_expr
2014-10-27 20:35 [gimple-classes, committed 00/92] Initial slew of commits David Malcolm
` (49 preceding siblings ...)
2014-10-27 20:52 ` [gimple-classes, committed 28/92] Introduce gimple_eh_dispatch David Malcolm
@ 2014-10-27 20:52 ` David Malcolm
2014-10-27 20:52 ` [gimple-classes, committed 64/92] Make gimple_phi_arg_location_from_edge require a gimple_phi David Malcolm
` (40 subsequent siblings)
91 siblings, 0 replies; 93+ messages in thread
From: David Malcolm @ 2014-10-27 20:52 UTC (permalink / raw)
To: gcc-patches; +Cc: David Malcolm
This corresponds to:
[PATCH 80/89] Tweak to gimplify_modify_expr
https://gcc.gnu.org/ml/gcc-patches/2014-04/msg01189.html
from the original 89-patch kit
That earlier patch was approved by Jeff:
> OK once prerequisites have gone in.
in https://gcc.gnu.org/ml/gcc-patches/2014-05/msg00842.html
gcc/
* gimplify.c (gimplify_modify_expr): Introduce local "call_stmt".
---
gcc/ChangeLog.gimple-classes | 6 ++++++
gcc/gimplify.c | 20 +++++++++++---------
2 files changed, 17 insertions(+), 9 deletions(-)
diff --git a/gcc/ChangeLog.gimple-classes b/gcc/ChangeLog.gimple-classes
index 503fff5..37e3955 100644
--- a/gcc/ChangeLog.gimple-classes
+++ b/gcc/ChangeLog.gimple-classes
@@ -1,5 +1,11 @@
2014-10-24 David Malcolm <dmalcolm@redhat.com>
+ Tweak to gimplify_modify_expr
+
+ * gimplify.c (gimplify_modify_expr): Introduce local "call_stmt".
+
+2014-10-24 David Malcolm <dmalcolm@redhat.com>
+
Concretize gimple_call_nothrow_p
* gimple.h (gimple_call_nothrow_p): Require a gimple_call.
diff --git a/gcc/gimplify.c b/gcc/gimplify.c
index b49aab7..037fb2b 100644
--- a/gcc/gimplify.c
+++ b/gcc/gimplify.c
@@ -4624,22 +4624,24 @@ gimplify_modify_expr (tree *expr_p, gimple_seq *pre_p, gimple_seq *post_p,
CALL_EXPR_FN (*from_p) = TREE_OPERAND (CALL_EXPR_FN (*from_p), 0);
STRIP_USELESS_TYPE_CONVERSION (CALL_EXPR_FN (*from_p));
tree fndecl = get_callee_fndecl (*from_p);
+ gimple_call call_stmt;
if (fndecl
&& DECL_BUILT_IN_CLASS (fndecl) == BUILT_IN_NORMAL
&& DECL_FUNCTION_CODE (fndecl) == BUILT_IN_EXPECT
&& call_expr_nargs (*from_p) == 3)
- assign = gimple_build_call_internal (IFN_BUILTIN_EXPECT, 3,
- CALL_EXPR_ARG (*from_p, 0),
- CALL_EXPR_ARG (*from_p, 1),
- CALL_EXPR_ARG (*from_p, 2));
+ call_stmt = gimple_build_call_internal (IFN_BUILTIN_EXPECT, 3,
+ CALL_EXPR_ARG (*from_p, 0),
+ CALL_EXPR_ARG (*from_p, 1),
+ CALL_EXPR_ARG (*from_p, 2));
else
{
- assign = gimple_build_call_from_tree (*from_p);
- gimple_call_set_fntype (assign, TREE_TYPE (fnptrtype));
+ call_stmt = gimple_build_call_from_tree (*from_p);
+ gimple_call_set_fntype (call_stmt, TREE_TYPE (fnptrtype));
}
- notice_special_calls (as_a <gimple_call> (assign));
- if (!gimple_call_noreturn_p (assign))
- gimple_call_set_lhs (assign, *to_p);
+ notice_special_calls (call_stmt);
+ if (!gimple_call_noreturn_p (call_stmt))
+ gimple_call_set_lhs (call_stmt, *to_p);
+ assign = call_stmt;
}
else
{
--
1.8.5.3
^ permalink raw reply [flat|nested] 93+ messages in thread
* [gimple-classes, committed 64/92] Make gimple_phi_arg_location_from_edge require a gimple_phi
2014-10-27 20:35 [gimple-classes, committed 00/92] Initial slew of commits David Malcolm
` (50 preceding siblings ...)
2014-10-27 20:52 ` [gimple-classes, committed 78/92] Tweak to gimplify_modify_expr David Malcolm
@ 2014-10-27 20:52 ` David Malcolm
2014-10-27 20:52 ` [gimple-classes, committed 10/92] tree-parloops.c: use gimple_phi in various places David Malcolm
` (39 subsequent siblings)
91 siblings, 0 replies; 93+ messages in thread
From: David Malcolm @ 2014-10-27 20:52 UTC (permalink / raw)
To: gcc-patches; +Cc: David Malcolm
This corresponds to:
[PATCH 66/89] Make gimple_phi_arg_location_from_edge require a gimple_phi
https://gcc.gnu.org/ml/gcc-patches/2014-04/msg01199.html
from the original 89-patch kit
That earlier patch was approved by Jeff:
> OK once prerequisites have gone in
in https://gcc.gnu.org/ml/gcc-patches/2014-05/msg00833.html
gcc/
* gimple.h (gimple_phi_arg_location_from_edge): Require a
gimple_phi.
* tree-parloops.c (create_parallel_loop): Split up local variable
"stmt", introducing other locals for the various statements created
by this function. Reuse "stmt" within the phi-handling code, and
change to type gimple_phi, since this is the only remaining
"non-phi" user of gimple_phi_arg_location_from_edge.
---
gcc/ChangeLog.gimple-classes | 13 +++++++++++++
gcc/gimple.h | 6 +++---
gcc/tree-parloops.c | 46 ++++++++++++++++++++++++++------------------
3 files changed, 43 insertions(+), 22 deletions(-)
diff --git a/gcc/ChangeLog.gimple-classes b/gcc/ChangeLog.gimple-classes
index af8a440..5a271ca 100644
--- a/gcc/ChangeLog.gimple-classes
+++ b/gcc/ChangeLog.gimple-classes
@@ -1,5 +1,18 @@
2014-10-24 David Malcolm <dmalcolm@redhat.com>
+ Make gimple_phi_arg_location_from_edge require a gimple_phi
+
+ * gimple.h (gimple_phi_arg_location_from_edge): Require a
+ gimple_phi.
+
+ * tree-parloops.c (create_parallel_loop): Split up local variable
+ "stmt", introducing other locals for the various statements created
+ by this function. Reuse "stmt" within the phi-handling code, and
+ change to type gimple_phi, since this is the only remaining
+ "non-phi" user of gimple_phi_arg_location_from_edge.
+
+2014-10-24 David Malcolm <dmalcolm@redhat.com>
+
Concretize three gimple_try_set_ accessors
* gimple.c (gimple_copy): Add checked casts to gimple_try.
diff --git a/gcc/gimple.h b/gcc/gimple.h
index 3c11a4a..0c8db97 100644
--- a/gcc/gimple.h
+++ b/gcc/gimple.h
@@ -3980,12 +3980,12 @@ gimple_phi_arg_location (gimple gs, size_t i)
return gimple_phi_arg (gs, i)->locus;
}
-/* Return the source location of the argument on edge E of phi node GS. */
+/* Return the source location of the argument on edge E of phi node PHI. */
static inline source_location
-gimple_phi_arg_location_from_edge (gimple gs, edge e)
+gimple_phi_arg_location_from_edge (gimple_phi phi, edge e)
{
- return gimple_phi_arg (gs, e->dest_idx)->locus;
+ return gimple_phi_arg (phi, e->dest_idx)->locus;
}
/* Set the source location of gimple argument I of phi node PHI to LOC. */
diff --git a/gcc/tree-parloops.c b/gcc/tree-parloops.c
index dcfd7fe..f5823a6 100644
--- a/gcc/tree-parloops.c
+++ b/gcc/tree-parloops.c
@@ -1608,8 +1608,11 @@ create_parallel_loop (struct loop *loop, tree loop_fn, tree data,
gimple_stmt_iterator gsi;
basic_block bb, paral_bb, for_bb, ex_bb;
tree t, param;
- gimple stmt, phi, cond_stmt;
+ gimple_omp_parallel omp_par_stmt;
+ gimple omp_return_stmt1, omp_return_stmt2;
+ gimple phi, cond_stmt;
gimple_omp_for for_stmt;
+ gimple_omp_continue omp_cont_stmt;
tree cvar, cvar_init, initvar, cvar_next, cvar_base, type;
edge exit, nexit, guard, end, e;
@@ -1621,31 +1624,33 @@ create_parallel_loop (struct loop *loop, tree loop_fn, tree data,
t = build_omp_clause (loc, OMP_CLAUSE_NUM_THREADS);
OMP_CLAUSE_NUM_THREADS_EXPR (t)
= build_int_cst (integer_type_node, n_threads);
- stmt = gimple_build_omp_parallel (NULL, t, loop_fn, data);
- gimple_set_location (stmt, loc);
+ omp_par_stmt = gimple_build_omp_parallel (NULL, t, loop_fn, data);
+ gimple_set_location (omp_par_stmt, loc);
- gsi_insert_after (&gsi, stmt, GSI_NEW_STMT);
+ gsi_insert_after (&gsi, omp_par_stmt, GSI_NEW_STMT);
/* Initialize NEW_DATA. */
if (data)
{
+ gimple_assign assign_stmt;
+
gsi = gsi_after_labels (bb);
param = make_ssa_name (DECL_ARGUMENTS (loop_fn), NULL);
- stmt = gimple_build_assign (param, build_fold_addr_expr (data));
- gsi_insert_before (&gsi, stmt, GSI_SAME_STMT);
+ assign_stmt = gimple_build_assign (param, build_fold_addr_expr (data));
+ gsi_insert_before (&gsi, assign_stmt, GSI_SAME_STMT);
- stmt = gimple_build_assign (new_data,
+ assign_stmt = gimple_build_assign (new_data,
fold_convert (TREE_TYPE (new_data), param));
- gsi_insert_before (&gsi, stmt, GSI_SAME_STMT);
+ gsi_insert_before (&gsi, assign_stmt, GSI_SAME_STMT);
}
/* Emit GIMPLE_OMP_RETURN for GIMPLE_OMP_PARALLEL. */
bb = split_loop_exit_edge (single_dom_exit (loop));
gsi = gsi_last_bb (bb);
- stmt = gimple_build_omp_return (false);
- gimple_set_location (stmt, loc);
- gsi_insert_after (&gsi, stmt, GSI_NEW_STMT);
+ omp_return_stmt1 = gimple_build_omp_return (false);
+ gimple_set_location (omp_return_stmt1, loc);
+ gsi_insert_after (&gsi, omp_return_stmt1, GSI_NEW_STMT);
/* Extract data for GIMPLE_OMP_FOR. */
gcc_assert (loop->header == single_dom_exit (loop)->src);
@@ -1679,7 +1684,10 @@ create_parallel_loop (struct loop *loop, tree loop_fn, tree data,
source_location locus;
tree def;
gimple_phi phi = gpi.phi ();
- stmt = SSA_NAME_DEF_STMT (PHI_ARG_DEF_FROM_EDGE (phi, exit));
+ gimple_phi stmt;
+
+ stmt = as_a <gimple_phi> (
+ SSA_NAME_DEF_STMT (PHI_ARG_DEF_FROM_EDGE (phi, exit)));
def = PHI_ARG_DEF_FROM_EDGE (stmt, loop_preheader_edge (loop));
locus = gimple_phi_arg_location_from_edge (stmt,
@@ -1715,16 +1723,16 @@ create_parallel_loop (struct loop *loop, tree loop_fn, tree data,
/* Emit GIMPLE_OMP_CONTINUE. */
gsi = gsi_last_bb (loop->latch);
- stmt = gimple_build_omp_continue (cvar_next, cvar);
- gimple_set_location (stmt, loc);
- gsi_insert_after (&gsi, stmt, GSI_NEW_STMT);
- SSA_NAME_DEF_STMT (cvar_next) = stmt;
+ omp_cont_stmt = gimple_build_omp_continue (cvar_next, cvar);
+ gimple_set_location (omp_cont_stmt, loc);
+ gsi_insert_after (&gsi, omp_cont_stmt, GSI_NEW_STMT);
+ SSA_NAME_DEF_STMT (cvar_next) = omp_cont_stmt;
/* Emit GIMPLE_OMP_RETURN for GIMPLE_OMP_FOR. */
gsi = gsi_last_bb (ex_bb);
- stmt = gimple_build_omp_return (true);
- gimple_set_location (stmt, loc);
- gsi_insert_after (&gsi, stmt, GSI_NEW_STMT);
+ omp_return_stmt2 = gimple_build_omp_return (true);
+ gimple_set_location (omp_return_stmt2, loc);
+ gsi_insert_after (&gsi, omp_return_stmt2, GSI_NEW_STMT);
/* After the above dom info is hosed. Re-compute it. */
free_dominance_info (CDI_DOMINATORS);
--
1.8.5.3
^ permalink raw reply [flat|nested] 93+ messages in thread
* [gimple-classes, committed 10/92] tree-parloops.c: use gimple_phi in various places
2014-10-27 20:35 [gimple-classes, committed 00/92] Initial slew of commits David Malcolm
` (51 preceding siblings ...)
2014-10-27 20:52 ` [gimple-classes, committed 64/92] Make gimple_phi_arg_location_from_edge require a gimple_phi David Malcolm
@ 2014-10-27 20:52 ` David Malcolm
2014-10-27 20:53 ` [gimple-classes, committed 58/92] Concretize gimple_catch_types David Malcolm
` (38 subsequent siblings)
91 siblings, 0 replies; 93+ messages in thread
From: David Malcolm @ 2014-10-27 20:52 UTC (permalink / raw)
To: gcc-patches; +Cc: David Malcolm
This corresponds to:
[PATCH 11/89] tree-parloops.c: use gimple_phi in various places
https://gcc.gnu.org/ml/gcc-patches/2014-04/msg01149.html
from the original 89-patch kit
That earlier patch was approved by Jeff:
> OK when prerequisites have gone in.
in https://gcc.gnu.org/ml/gcc-patches/2014-05/msg00620.html
gcc/
* tree-parloops.c (struct reduction_info): Strengthen field "new_phi"
from gimple to gimple_phi.
(create_phi_for_local_result): Convert local "new_phi" to gimple_phi.
(loop_has_vector_phi_nodes): Require a gimple_phi rather than a gimple.
(gather_scalar_reductions): Convert to a gimple_phi_iterator and
gimple_phi.
(try_create_reduction_list): Likewise.
---
gcc/ChangeLog.gimple-classes | 12 ++++++++++++
gcc/tree-parloops.c | 16 ++++++++--------
2 files changed, 20 insertions(+), 8 deletions(-)
diff --git a/gcc/ChangeLog.gimple-classes b/gcc/ChangeLog.gimple-classes
index bd635c6..fb4c222 100644
--- a/gcc/ChangeLog.gimple-classes
+++ b/gcc/ChangeLog.gimple-classes
@@ -1,5 +1,17 @@
2014-10-24 David Malcolm <dmalcolm@redhat.com>
+ tree-parloops.c: use gimple_phi in various places
+
+ * tree-parloops.c (struct reduction_info): Strengthen field "new_phi"
+ from gimple to gimple_phi.
+ (create_phi_for_local_result): Convert local "new_phi" to gimple_phi.
+ (loop_has_vector_phi_nodes): Require a gimple_phi rather than a gimple.
+ (gather_scalar_reductions): Convert to a gimple_phi_iterator and
+ gimple_phi.
+ (try_create_reduction_list): Likewise.
+
+2014-10-24 David Malcolm <dmalcolm@redhat.com>
+
Update ssa_prop_visit_phi_fn callbacks to take a gimple_phi
* tree-ssa-propagate.h (typedef ssa_prop_visit_phi_fn): Strengthen
diff --git a/gcc/tree-parloops.c b/gcc/tree-parloops.c
index 112c295..341b749 100644
--- a/gcc/tree-parloops.c
+++ b/gcc/tree-parloops.c
@@ -197,7 +197,7 @@ struct reduction_info
tree initial_value; /* The initial value of the reduction var before entering the loop. */
tree field; /* the name of the field in the parloop data structure intended for reduction. */
tree init; /* reduction initialization value. */
- gimple new_phi; /* (helper field) Newly created phi node whose result
+ gimple_phi new_phi; /* (helper field) Newly created phi node whose result
will be passed to the atomic operation. Represents
the local result each thread computed for the reduction
operation. */
@@ -1027,7 +1027,7 @@ create_phi_for_local_result (reduction_info **slot, struct loop *loop)
{
struct reduction_info *const reduc = *slot;
edge e;
- gimple new_phi;
+ gimple_phi new_phi;
basic_block store_bb;
tree local_res;
source_location locus;
@@ -1930,7 +1930,7 @@ loop_has_vector_phi_nodes (struct loop *loop ATTRIBUTE_UNUSED)
static void
build_new_reduction (reduction_info_table_type *reduction_list,
- gimple reduc_stmt, gimple phi)
+ gimple reduc_stmt, gimple_phi phi)
{
reduction_info **slot;
struct reduction_info *new_reduction;
@@ -1970,14 +1970,14 @@ set_reduc_phi_uids (reduction_info **slot, void *data ATTRIBUTE_UNUSED)
static void
gather_scalar_reductions (loop_p loop, reduction_info_table_type *reduction_list)
{
- gimple_stmt_iterator gsi;
+ gimple_phi_iterator gsi;
loop_vec_info simple_loop_info;
simple_loop_info = vect_analyze_loop_form (loop);
for (gsi = gsi_start_phis (loop->header); !gsi_end_p (gsi); gsi_next (&gsi))
{
- gimple phi = gsi_stmt (gsi);
+ gimple_phi phi = gsi.phi ();
affine_iv iv;
tree res = PHI_RESULT (phi);
bool double_reduc;
@@ -2033,7 +2033,7 @@ try_create_reduction_list (loop_p loop,
reduction_info_table_type *reduction_list)
{
edge exit = single_dom_exit (loop);
- gimple_stmt_iterator gsi;
+ gimple_phi_iterator gsi;
gcc_assert (exit);
@@ -2042,7 +2042,7 @@ try_create_reduction_list (loop_p loop,
for (gsi = gsi_start_phis (exit->dest); !gsi_end_p (gsi); gsi_next (&gsi))
{
- gimple phi = gsi_stmt (gsi);
+ gimple_phi phi = gsi.phi ();
struct reduction_info *red;
imm_use_iterator imm_iter;
use_operand_p use_p;
@@ -2100,7 +2100,7 @@ try_create_reduction_list (loop_p loop,
iteration space can be distributed efficiently. */
for (gsi = gsi_start_phis (loop->header); !gsi_end_p (gsi); gsi_next (&gsi))
{
- gimple phi = gsi_stmt (gsi);
+ gimple_phi phi = gsi.phi ();
tree def = PHI_RESULT (phi);
affine_iv iv;
--
1.8.5.3
^ permalink raw reply [flat|nested] 93+ messages in thread
* [gimple-classes, committed 37/92] Introduce gimple_omp_parallel
2014-10-27 20:35 [gimple-classes, committed 00/92] Initial slew of commits David Malcolm
` (46 preceding siblings ...)
2014-10-27 20:47 ` [gimple-classes, committed 89/92] Eliminate subclass typedefs from coretypes.h David Malcolm
@ 2014-10-27 20:52 ` David Malcolm
2014-10-27 20:52 ` [gimple-classes, committed 15/92] tree-ssa-loop-ivopts.c: use gimple_phi in a few places David Malcolm
` (43 subsequent siblings)
91 siblings, 0 replies; 93+ messages in thread
From: David Malcolm @ 2014-10-27 20:52 UTC (permalink / raw)
To: gcc-patches; +Cc: David Malcolm
This corresponds to:
[PATCH 39/89] Introduce gimple_omp_parallel
https://gcc.gnu.org/ml/gcc-patches/2014-04/msg01159.html
from the original 89-patch kit
That earlier patch was approved by Jeff:
> OK with expected changes due to renaming/updates to const handling.
> Please repost the final patch for archival purposes.
in https://gcc.gnu.org/ml/gcc-patches/2014-05/msg00827.html
gcc/
* coretypes.h (gimple_omp_parallel): New typedef.
(const_gimple_omp_parallel): New typedef.
* cgraphbuild.c (build_cgraph_edges): Convert check of code
against GIMPLE_OMP_PARALLEL to a dyn_cast <gimple_omp_parallel>
and new local.
* gimple-pretty-print.c (dump_gimple_omp_parallel): Require a
gimple_omp_parallel rather than a plain gimple.
(pp_gimple_stmt_1): Add a checked cast to gimple_omp_parallel
within GIMPLE_OMP_PARALLEL case of switch statement.
* gimple-walk.c (walk_gimple_op): Likewise, introducing a local.
* gimple.c (gimple_build_omp_parallel): Return a
gimple_omp_parallel rather than a plain gimple.
(gimple_copy): Add checked casts to gimple_omp_parallel within
GIMPLE_OMP_PARALLEL case of switch statement, introducing locals.
* gimple.h (gimple_build_omp_parallel): Return a
gimple_omp_parallel rather than a plain gimple.
(gimple_omp_parallel_clauses_ptr): Require a gimple_omp_parallel
rather than a plain gimple.
(gimple_omp_parallel_set_clauses): Likewise.
(gimple_omp_parallel_data_arg_ptr): Likewise.
(gimple_omp_parallel_set_data_arg): Likewise.
(gimple_omp_parallel_child_fn_ptr): Likewise.
(gimple_omp_parallel_set_child_fn): Likewise.
(gimple_omp_parallel_child_fn): Require a
const_gimple_omp_parallel rather than a plain const_gimple.
(gimple_omp_parallel_data_arg): Likewise.
* omp-low.c (scan_omp_parallel): Strengthen local "stmt" from
gimple to gimple_omp_parallel.
(expand_parallel_call): Require a gimple_omp_parallel for
"entry_stmt" rather than a plain gimple.
(remove_exit_barrier): Strengthen local "parallel_stmt" from
gimple to gimple_omp_parallel.
(expand_omp_taskreg): Add checked casts to gimple_omp_parallel.
* tree-inline.c (remap_gimple_stmt): Add a checked cast to
gimple_omp_parallel within GIMPLE_OMP_PARALLEL case of switch
statement, introducing local.
---
gcc/ChangeLog.gimple-classes | 48 +++++++++++++++++++++++++++++++++++++++
gcc/cgraphbuild.c | 6 ++---
gcc/coretypes.h | 4 ++++
gcc/gimple-pretty-print.c | 7 +++---
gcc/gimple-walk.c | 27 ++++++++++++----------
gcc/gimple.c | 23 ++++++++++++-------
gcc/gimple.h | 54 ++++++++++++++++----------------------------
gcc/omp-low.c | 19 ++++++++++------
gcc/tree-inline.c | 16 ++++++++-----
9 files changed, 131 insertions(+), 73 deletions(-)
diff --git a/gcc/ChangeLog.gimple-classes b/gcc/ChangeLog.gimple-classes
index 7ad116a..b0ddcd3 100644
--- a/gcc/ChangeLog.gimple-classes
+++ b/gcc/ChangeLog.gimple-classes
@@ -1,5 +1,53 @@
2014-10-24 David Malcolm <dmalcolm@redhat.com>
+ Introduce gimple_omp_parallel
+
+ * coretypes.h (gimple_omp_parallel): New typedef.
+ (const_gimple_omp_parallel): New typedef.
+
+ * cgraphbuild.c (build_cgraph_edges): Convert check of code
+ against GIMPLE_OMP_PARALLEL to a dyn_cast <gimple_omp_parallel>
+ and new local.
+
+ * gimple-pretty-print.c (dump_gimple_omp_parallel): Require a
+ gimple_omp_parallel rather than a plain gimple.
+ (pp_gimple_stmt_1): Add a checked cast to gimple_omp_parallel
+ within GIMPLE_OMP_PARALLEL case of switch statement.
+
+ * gimple-walk.c (walk_gimple_op): Likewise, introducing a local.
+
+ * gimple.c (gimple_build_omp_parallel): Return a
+ gimple_omp_parallel rather than a plain gimple.
+ (gimple_copy): Add checked casts to gimple_omp_parallel within
+ GIMPLE_OMP_PARALLEL case of switch statement, introducing locals.
+
+ * gimple.h (gimple_build_omp_parallel): Return a
+ gimple_omp_parallel rather than a plain gimple.
+ (gimple_omp_parallel_clauses_ptr): Require a gimple_omp_parallel
+ rather than a plain gimple.
+ (gimple_omp_parallel_set_clauses): Likewise.
+ (gimple_omp_parallel_data_arg_ptr): Likewise.
+ (gimple_omp_parallel_set_data_arg): Likewise.
+ (gimple_omp_parallel_child_fn_ptr): Likewise.
+ (gimple_omp_parallel_set_child_fn): Likewise.
+ (gimple_omp_parallel_child_fn): Require a
+ const_gimple_omp_parallel rather than a plain const_gimple.
+ (gimple_omp_parallel_data_arg): Likewise.
+
+ * omp-low.c (scan_omp_parallel): Strengthen local "stmt" from
+ gimple to gimple_omp_parallel.
+ (expand_parallel_call): Require a gimple_omp_parallel for
+ "entry_stmt" rather than a plain gimple.
+ (remove_exit_barrier): Strengthen local "parallel_stmt" from
+ gimple to gimple_omp_parallel.
+ (expand_omp_taskreg): Add checked casts to gimple_omp_parallel.
+
+ * tree-inline.c (remap_gimple_stmt): Add a checked cast to
+ gimple_omp_parallel within GIMPLE_OMP_PARALLEL case of switch
+ statement, introducing local.
+
+2014-10-24 David Malcolm <dmalcolm@redhat.com>
+
Introduce gimple_omp_for
* coretypes.h (gimple_omp_for): New.
diff --git a/gcc/cgraphbuild.c b/gcc/cgraphbuild.c
index 96d7015..be3e866 100644
--- a/gcc/cgraphbuild.c
+++ b/gcc/cgraphbuild.c
@@ -352,10 +352,10 @@ pass_build_cgraph_edges::execute (function *fun)
bb->count, freq);
}
node->record_stmt_references (stmt);
- if (gimple_code (stmt) == GIMPLE_OMP_PARALLEL
- && gimple_omp_parallel_child_fn (stmt))
+ if (gimple_omp_parallel omp_par_stmt =
+ dyn_cast <gimple_omp_parallel> (stmt))
{
- tree fn = gimple_omp_parallel_child_fn (stmt);
+ tree fn = gimple_omp_parallel_child_fn (omp_par_stmt);
node->create_reference (cgraph_node::get_create (fn),
IPA_REF_ADDR, stmt);
}
diff --git a/gcc/coretypes.h b/gcc/coretypes.h
index 273ba7e..641658f 100644
--- a/gcc/coretypes.h
+++ b/gcc/coretypes.h
@@ -188,6 +188,10 @@ struct gimple_statement_omp_for;
typedef struct gimple_statement_omp_for *gimple_omp_for;
typedef const struct gimple_statement_omp_for *const_gimple_omp_for;
+struct gimple_statement_omp_parallel;
+typedef struct gimple_statement_omp_parallel *gimple_omp_parallel;
+typedef const struct gimple_statement_omp_parallel *const_gimple_omp_parallel;
+
union section;
typedef union section section;
struct gcc_options;
diff --git a/gcc/gimple-pretty-print.c b/gcc/gimple-pretty-print.c
index 69a4b4c..ea788c2 100644
--- a/gcc/gimple-pretty-print.c
+++ b/gcc/gimple-pretty-print.c
@@ -1857,8 +1857,8 @@ dump_gimple_phi (pretty_printer *buffer, gimple_phi phi, int spc, bool comment,
dumpfile.h). */
static void
-dump_gimple_omp_parallel (pretty_printer *buffer, gimple gs, int spc,
- int flags)
+dump_gimple_omp_parallel (pretty_printer *buffer, gimple_omp_parallel gs,
+ int spc, int flags)
{
if (flags & TDF_RAW)
{
@@ -2137,7 +2137,8 @@ pp_gimple_stmt_1 (pretty_printer *buffer, gimple gs, int spc, int flags)
break;
case GIMPLE_OMP_PARALLEL:
- dump_gimple_omp_parallel (buffer, gs, spc, flags);
+ dump_gimple_omp_parallel (buffer, as_a <gimple_omp_parallel> (gs), spc,
+ flags);
break;
case GIMPLE_OMP_TASK:
diff --git a/gcc/gimple-walk.c b/gcc/gimple-walk.c
index 8293e0d..2b823ac 100644
--- a/gcc/gimple-walk.c
+++ b/gcc/gimple-walk.c
@@ -347,18 +347,21 @@ walk_gimple_op (gimple stmt, walk_tree_fn callback_op,
break;
case GIMPLE_OMP_PARALLEL:
- ret = walk_tree (gimple_omp_parallel_clauses_ptr (stmt), callback_op,
- wi, pset);
- if (ret)
- return ret;
- ret = walk_tree (gimple_omp_parallel_child_fn_ptr (stmt), callback_op,
- wi, pset);
- if (ret)
- return ret;
- ret = walk_tree (gimple_omp_parallel_data_arg_ptr (stmt), callback_op,
- wi, pset);
- if (ret)
- return ret;
+ {
+ gimple_omp_parallel omp_par_stmt = as_a <gimple_omp_parallel> (stmt);
+ ret = walk_tree (gimple_omp_parallel_clauses_ptr (omp_par_stmt),
+ callback_op, wi, pset);
+ if (ret)
+ return ret;
+ ret = walk_tree (gimple_omp_parallel_child_fn_ptr (omp_par_stmt),
+ callback_op, wi, pset);
+ if (ret)
+ return ret;
+ ret = walk_tree (gimple_omp_parallel_data_arg_ptr (omp_par_stmt),
+ callback_op, wi, pset);
+ if (ret)
+ return ret;
+ }
break;
case GIMPLE_OMP_TASK:
diff --git a/gcc/gimple.c b/gcc/gimple.c
index 3d8fd44..26bd509 100644
--- a/gcc/gimple.c
+++ b/gcc/gimple.c
@@ -865,11 +865,12 @@ gimple_build_omp_for (gimple_seq body, int kind, tree clauses, size_t collapse,
CHILD_FN is the function created for the parallel threads to execute.
DATA_ARG are the shared data argument(s). */
-gimple
+gimple_omp_parallel
gimple_build_omp_parallel (gimple_seq body, tree clauses, tree child_fn,
tree data_arg)
{
- gimple p = gimple_alloc (GIMPLE_OMP_PARALLEL, 0);
+ gimple_omp_parallel p =
+ as_a <gimple_omp_parallel> (gimple_alloc (GIMPLE_OMP_PARALLEL, 0));
if (body)
gimple_omp_set_body (p, body);
gimple_omp_parallel_set_clauses (p, clauses);
@@ -1730,12 +1731,18 @@ gimple_copy (gimple stmt)
goto copy_omp_body;
case GIMPLE_OMP_PARALLEL:
- t = unshare_expr (gimple_omp_parallel_clauses (stmt));
- gimple_omp_parallel_set_clauses (copy, t);
- t = unshare_expr (gimple_omp_parallel_child_fn (stmt));
- gimple_omp_parallel_set_child_fn (copy, t);
- t = unshare_expr (gimple_omp_parallel_data_arg (stmt));
- gimple_omp_parallel_set_data_arg (copy, t);
+ {
+ gimple_omp_parallel omp_par_stmt =
+ as_a <gimple_omp_parallel> (stmt);
+ gimple_omp_parallel omp_par_copy =
+ as_a <gimple_omp_parallel> (copy);
+ t = unshare_expr (gimple_omp_parallel_clauses (omp_par_stmt));
+ gimple_omp_parallel_set_clauses (omp_par_copy, t);
+ t = unshare_expr (gimple_omp_parallel_child_fn (omp_par_stmt));
+ gimple_omp_parallel_set_child_fn (omp_par_copy, t);
+ t = unshare_expr (gimple_omp_parallel_data_arg (omp_par_stmt));
+ gimple_omp_parallel_set_data_arg (omp_par_copy, t);
+ }
goto copy_omp_body;
case GIMPLE_OMP_TASK:
diff --git a/gcc/gimple.h b/gcc/gimple.h
index 3ed5fc9..cc460499 100644
--- a/gcc/gimple.h
+++ b/gcc/gimple.h
@@ -1344,7 +1344,7 @@ gimple_debug gimple_build_debug_source_bind_stat (tree, tree, gimple MEM_STAT_DE
gimple_build_debug_source_bind_stat ((var), (val), (stmt) MEM_STAT_INFO)
gimple_omp_critical gimple_build_omp_critical (gimple_seq, tree);
gimple_omp_for gimple_build_omp_for (gimple_seq, int, tree, size_t, gimple_seq);
-gimple gimple_build_omp_parallel (gimple_seq, tree, tree, tree);
+gimple_omp_parallel gimple_build_omp_parallel (gimple_seq, tree, tree, tree);
gimple gimple_build_omp_task (gimple_seq, tree, tree, tree, tree, tree, tree);
gimple gimple_build_omp_section (gimple_seq);
gimple gimple_build_omp_master (gimple_seq);
@@ -4682,92 +4682,78 @@ gimple_omp_parallel_clauses (const_gimple gs)
}
-/* Return a pointer to the clauses associated with OMP_PARALLEL GS. */
+/* Return a pointer to the clauses associated with OMP_PARALLEL_STMT. */
static inline tree *
-gimple_omp_parallel_clauses_ptr (gimple gs)
+gimple_omp_parallel_clauses_ptr (gimple_omp_parallel omp_parallel_stmt)
{
- gimple_statement_omp_parallel *omp_parallel_stmt =
- as_a <gimple_statement_omp_parallel *> (gs);
return &omp_parallel_stmt->clauses;
}
-/* Set CLAUSES to be the list of clauses associated with OMP_PARALLEL
- GS. */
+/* Set CLAUSES to be the list of clauses associated with OMP_PARALLEL_STMT. */
static inline void
-gimple_omp_parallel_set_clauses (gimple gs, tree clauses)
+gimple_omp_parallel_set_clauses (gimple_omp_parallel omp_parallel_stmt,
+ tree clauses)
{
- gimple_statement_omp_parallel *omp_parallel_stmt =
- as_a <gimple_statement_omp_parallel *> (gs);
omp_parallel_stmt->clauses = clauses;
}
-/* Return the child function used to hold the body of OMP_PARALLEL GS. */
+/* Return the child function used to hold the body of OMP_PARALLEL_STMT. */
static inline tree
-gimple_omp_parallel_child_fn (const_gimple gs)
+gimple_omp_parallel_child_fn (const_gimple_omp_parallel omp_parallel_stmt)
{
- const gimple_statement_omp_parallel *omp_parallel_stmt =
- as_a <const gimple_statement_omp_parallel *> (gs);
return omp_parallel_stmt->child_fn;
}
/* Return a pointer to the child function used to hold the body of
- OMP_PARALLEL GS. */
+ OMP_PARALLEL_STMT. */
static inline tree *
-gimple_omp_parallel_child_fn_ptr (gimple gs)
+gimple_omp_parallel_child_fn_ptr (gimple_omp_parallel omp_parallel_stmt)
{
- gimple_statement_omp_parallel *omp_parallel_stmt =
- as_a <gimple_statement_omp_parallel *> (gs);
return &omp_parallel_stmt->child_fn;
}
-/* Set CHILD_FN to be the child function for OMP_PARALLEL GS. */
+/* Set CHILD_FN to be the child function for OMP_PARALLEL_STMT. */
static inline void
-gimple_omp_parallel_set_child_fn (gimple gs, tree child_fn)
+gimple_omp_parallel_set_child_fn (gimple_omp_parallel omp_parallel_stmt,
+ tree child_fn)
{
- gimple_statement_omp_parallel *omp_parallel_stmt =
- as_a <gimple_statement_omp_parallel *> (gs);
omp_parallel_stmt->child_fn = child_fn;
}
/* Return the artificial argument used to send variables and values
- from the parent to the children threads in OMP_PARALLEL GS. */
+ from the parent to the children threads in OMP_PARALLEL_STMT. */
static inline tree
-gimple_omp_parallel_data_arg (const_gimple gs)
+gimple_omp_parallel_data_arg (const_gimple_omp_parallel omp_parallel_stmt)
{
- const gimple_statement_omp_parallel *omp_parallel_stmt =
- as_a <const gimple_statement_omp_parallel *> (gs);
return omp_parallel_stmt->data_arg;
}
-/* Return a pointer to the data argument for OMP_PARALLEL GS. */
+/* Return a pointer to the data argument for OMP_PARALLEL_STMT. */
static inline tree *
-gimple_omp_parallel_data_arg_ptr (gimple gs)
+gimple_omp_parallel_data_arg_ptr (gimple_omp_parallel omp_parallel_stmt)
{
- gimple_statement_omp_parallel *omp_parallel_stmt =
- as_a <gimple_statement_omp_parallel *> (gs);
return &omp_parallel_stmt->data_arg;
}
-/* Set DATA_ARG to be the data argument for OMP_PARALLEL GS. */
+/* Set DATA_ARG to be the data argument for OMP_PARALLEL_STMT. */
static inline void
-gimple_omp_parallel_set_data_arg (gimple gs, tree data_arg)
+gimple_omp_parallel_set_data_arg (gimple_omp_parallel omp_parallel_stmt,
+ tree data_arg)
{
- gimple_statement_omp_parallel *omp_parallel_stmt =
- as_a <gimple_statement_omp_parallel *> (gs);
omp_parallel_stmt->data_arg = data_arg;
}
diff --git a/gcc/omp-low.c b/gcc/omp-low.c
index a40a405..46155d6 100644
--- a/gcc/omp-low.c
+++ b/gcc/omp-low.c
@@ -2049,7 +2049,7 @@ scan_omp_parallel (gimple_stmt_iterator *gsi, omp_context *outer_ctx)
{
omp_context *ctx;
tree name;
- gimple stmt = gsi_stmt (*gsi);
+ gimple_omp_parallel stmt = as_a <gimple_omp_parallel> (gsi_stmt (*gsi));
/* Ignore parallel directives with empty bodies, unless there
are copyin clauses. */
@@ -4363,7 +4363,8 @@ gimple_build_cond_empty (tree cond)
static void
expand_parallel_call (struct omp_region *region, basic_block bb,
- gimple entry_stmt, vec<tree, va_gc> *ws_args)
+ gimple_omp_parallel entry_stmt,
+ vec<tree, va_gc> *ws_args)
{
tree t, t1, t2, val, cond, c, clauses, flags;
gimple_stmt_iterator gsi;
@@ -4526,7 +4527,7 @@ expand_parallel_call (struct omp_region *region, basic_block bb,
ENTRY_STMT into the basic_block BB. */
static void
-expand_cilk_for_call (basic_block bb, gimple entry_stmt,
+expand_cilk_for_call (basic_block bb, gimple_omp_parallel entry_stmt,
vec <tree, va_gc> *ws_args)
{
tree t, t1, t2;
@@ -4719,7 +4720,8 @@ remove_exit_barrier (struct omp_region *region)
of such a variable. */
if (any_addressable_vars < 0)
{
- gimple parallel_stmt = last_stmt (region->entry);
+ gimple_omp_parallel parallel_stmt =
+ as_a <gimple_omp_parallel> (last_stmt (region->entry));
tree child_fun = gimple_omp_parallel_child_fn (parallel_stmt);
tree local_decls, block, decl;
unsigned ix;
@@ -5119,9 +5121,11 @@ expand_omp_taskreg (struct omp_region *region)
/* Emit a library call to launch the children threads. */
if (is_cilk_for)
- expand_cilk_for_call (new_bb, entry_stmt, ws_args);
+ expand_cilk_for_call (new_bb,
+ as_a <gimple_omp_parallel> (entry_stmt), ws_args);
else if (gimple_code (entry_stmt) == GIMPLE_OMP_PARALLEL)
- expand_parallel_call (region, new_bb, entry_stmt, ws_args);
+ expand_parallel_call (region, new_bb,
+ as_a <gimple_omp_parallel> (entry_stmt), ws_args);
else
expand_task_call (new_bb, entry_stmt);
if (gimple_in_ssa_p (cfun))
@@ -6877,7 +6881,8 @@ expand_cilk_for (struct omp_region *region, struct omp_for_data *fd)
comment). */
tree child_fndecl
- = gimple_omp_parallel_child_fn (last_stmt (region->outer->entry));
+ = gimple_omp_parallel_child_fn (
+ as_a <gimple_omp_parallel> (last_stmt (region->outer->entry)));
tree t, low_val = NULL_TREE, high_val = NULL_TREE;
for (t = DECL_ARGUMENTS (child_fndecl); t; t = TREE_CHAIN (t))
{
diff --git a/gcc/tree-inline.c b/gcc/tree-inline.c
index b3254e5..a4d5809 100644
--- a/gcc/tree-inline.c
+++ b/gcc/tree-inline.c
@@ -1362,12 +1362,16 @@ remap_gimple_stmt (gimple stmt, copy_body_data *id)
break;
case GIMPLE_OMP_PARALLEL:
- s1 = remap_gimple_seq (gimple_omp_body (stmt), id);
- copy = gimple_build_omp_parallel
- (s1,
- gimple_omp_parallel_clauses (stmt),
- gimple_omp_parallel_child_fn (stmt),
- gimple_omp_parallel_data_arg (stmt));
+ {
+ gimple_omp_parallel omp_par_stmt =
+ as_a <gimple_omp_parallel> (stmt);
+ s1 = remap_gimple_seq (gimple_omp_body (omp_par_stmt), id);
+ copy = gimple_build_omp_parallel
+ (s1,
+ gimple_omp_parallel_clauses (omp_par_stmt),
+ gimple_omp_parallel_child_fn (omp_par_stmt),
+ gimple_omp_parallel_data_arg (omp_par_stmt));
+ }
break;
case GIMPLE_OMP_TASK:
--
1.8.5.3
^ permalink raw reply [flat|nested] 93+ messages in thread
* [gimple-classes, committed 60/92] Concretize gimple_label_label
2014-10-27 20:35 [gimple-classes, committed 00/92] Initial slew of commits David Malcolm
` (58 preceding siblings ...)
2014-10-27 20:53 ` [gimple-classes, committed 42/92] Introduce gimple_omp_teams David Malcolm
@ 2014-10-27 20:53 ` David Malcolm
2014-10-27 20:54 ` [gimple-classes, committed 21/92] Introduce gimple_asm David Malcolm
` (31 subsequent siblings)
91 siblings, 0 replies; 93+ messages in thread
From: David Malcolm @ 2014-10-27 20:53 UTC (permalink / raw)
To: gcc-patches; +Cc: David Malcolm
This corresponds to:
[PATCH 62/89] Concretize gimple_label_label
https://gcc.gnu.org/ml/gcc-patches/2014-04/msg01210.html
from the original 89-patch kit
That earlier patch was approved by Jeff:
> OK once prereqs go in.
in https://gcc.gnu.org/ml/gcc-patches/2014-05/msg00878.html
gcc/
* gimple.h (gimple_label_label): Require a const_gimple_label
rather than just a const_gimple.
* cfgexpand.c (label_rtx_for_bb): Convert local from gimple to
gimple_label, replacing a check against GIMPLE_LABEL with a
dyn_cast<gimple_label>.
* predict.c (tree_estimate_probability_bb): Likewise.
* tree-cfg.c (make_edges): Likewise.
(cleanup_dead_labels): Likewise (twice).
(gimple_can_merge_blocks_p): Likewise.
(gimple_block_label): Likewise.
* tree-eh.c (unsplit_eh): Likewise.
(cleanup_empty_eh_unsplit): Likewise.
* tree-inline.c (mark_local_labels_stmt): Likewise.
* tree-nested.c (convert_nl_goto_receiver): Likewise.
* cfgexpand.c (expand_gimple_stmt_1): Add a checked cast to
gimple_label when invoking gimple_label_label in a region where
we've checked the code is GIMPLE_LABEL.
* gimple-pretty-print.c (pp_cfg_jump): Likewise.
* gimple.c (gimple_set_bb): Likewise.
* ipa-pure-const.c (check_stmt): Likewise.
* omp-low.c (diagnose_sb_1): Likewise.
* tree-cfg.c (gimple_verify_flow_info): Likewise.
* tree-cfgcleanup.c (tree_forwarder_block_p): Likewise.
(remove_forwarder_block): Likewise.
* tree-eh.c (collect_finally_tree): Likewise.
* ipa-split.c (verify_non_ssa_vars): Replace a check against
GIMPLE_LABEL with a dyn_cast<gimple_label>, introducing a
gimple_label local.
* tree-cfg.c (gimple_can_merge_blocks_p): Likewise.
(gimple_merge_blocks): Likewise.
(remove_bb): Likewise.
(stmt_starts_bb_p): Likewise.
(gimple_verify_flow_info): Likewise.
(move_block_to_fn): Likewise.
* tree-cfgcleanup.c (remove_forwarder_block): Likewise.
(remove_forwarder_block_with_phi): Likewise.
* tree-ssa-ccp.c (optimize_unreachable): Likewise.
---
gcc/ChangeLog.gimple-classes | 45 +++++++++++++++++++++++++++
gcc/cfgexpand.c | 9 +++---
gcc/gimple-pretty-print.c | 4 ++-
gcc/gimple.c | 2 +-
gcc/gimple.h | 3 +-
gcc/ipa-pure-const.c | 2 +-
gcc/ipa-split.c | 31 ++++++++++---------
gcc/omp-low.c | 4 ++-
gcc/predict.c | 7 +++--
gcc/tree-cfg.c | 73 +++++++++++++++++++++++---------------------
gcc/tree-cfgcleanup.c | 22 ++++++-------
gcc/tree-eh.c | 12 ++++----
gcc/tree-inline.c | 4 +--
gcc/tree-nested.c | 4 +--
gcc/tree-ssa-ccp.c | 4 +--
15 files changed, 141 insertions(+), 85 deletions(-)
diff --git a/gcc/ChangeLog.gimple-classes b/gcc/ChangeLog.gimple-classes
index 5cf1049..20deecf 100644
--- a/gcc/ChangeLog.gimple-classes
+++ b/gcc/ChangeLog.gimple-classes
@@ -1,5 +1,50 @@
2014-10-24 David Malcolm <dmalcolm@redhat.com>
+ Concretize gimple_label_label
+
+ * gimple.h (gimple_label_label): Require a const_gimple_label
+ rather than just a const_gimple.
+
+ * cfgexpand.c (label_rtx_for_bb): Convert local from gimple to
+ gimple_label, replacing a check against GIMPLE_LABEL with a
+ dyn_cast<gimple_label>.
+ * predict.c (tree_estimate_probability_bb): Likewise.
+ * tree-cfg.c (make_edges): Likewise.
+ (cleanup_dead_labels): Likewise (twice).
+ (gimple_can_merge_blocks_p): Likewise.
+ (gimple_block_label): Likewise.
+ * tree-eh.c (unsplit_eh): Likewise.
+ (cleanup_empty_eh_unsplit): Likewise.
+ * tree-inline.c (mark_local_labels_stmt): Likewise.
+ * tree-nested.c (convert_nl_goto_receiver): Likewise.
+
+ * cfgexpand.c (expand_gimple_stmt_1): Add a checked cast to
+ gimple_label when invoking gimple_label_label in a region where
+ we've checked the code is GIMPLE_LABEL.
+ * gimple-pretty-print.c (pp_cfg_jump): Likewise.
+ * gimple.c (gimple_set_bb): Likewise.
+ * ipa-pure-const.c (check_stmt): Likewise.
+ * omp-low.c (diagnose_sb_1): Likewise.
+ * tree-cfg.c (gimple_verify_flow_info): Likewise.
+ * tree-cfgcleanup.c (tree_forwarder_block_p): Likewise.
+ (remove_forwarder_block): Likewise.
+ * tree-eh.c (collect_finally_tree): Likewise.
+
+ * ipa-split.c (verify_non_ssa_vars): Replace a check against
+ GIMPLE_LABEL with a dyn_cast<gimple_label>, introducing a
+ gimple_label local.
+ * tree-cfg.c (gimple_can_merge_blocks_p): Likewise.
+ (gimple_merge_blocks): Likewise.
+ (remove_bb): Likewise.
+ (stmt_starts_bb_p): Likewise.
+ (gimple_verify_flow_info): Likewise.
+ (move_block_to_fn): Likewise.
+ * tree-cfgcleanup.c (remove_forwarder_block): Likewise.
+ (remove_forwarder_block_with_phi): Likewise.
+ * tree-ssa-ccp.c (optimize_unreachable): Likewise.
+
+2014-10-24 David Malcolm <dmalcolm@redhat.com>
+
Concretize gimple_call_use_set and gimple_call_clobber_set
* gimple.h (gimple_call_use_set): Require a gimple_call.
diff --git a/gcc/cfgexpand.c b/gcc/cfgexpand.c
index d93c888..4287232 100644
--- a/gcc/cfgexpand.c
+++ b/gcc/cfgexpand.c
@@ -1983,7 +1983,6 @@ label_rtx_for_bb (basic_block bb ATTRIBUTE_UNUSED)
{
gimple_stmt_iterator gsi;
tree lab;
- gimple lab_stmt;
if (bb->flags & BB_RTL)
return block_label (bb);
@@ -1996,8 +1995,10 @@ label_rtx_for_bb (basic_block bb ATTRIBUTE_UNUSED)
for (gsi = gsi_start_bb (bb); !gsi_end_p (gsi); gsi_next (&gsi))
{
- lab_stmt = gsi_stmt (gsi);
- if (gimple_code (lab_stmt) != GIMPLE_LABEL)
+ gimple_label lab_stmt;
+
+ lab_stmt = dyn_cast <gimple_label> (gsi_stmt (gsi));
+ if (!lab_stmt)
break;
lab = gimple_label_label (lab_stmt);
@@ -3203,7 +3204,7 @@ expand_gimple_stmt_1 (gimple stmt)
expand_computed_goto (op0);
break;
case GIMPLE_LABEL:
- expand_label (gimple_label_label (stmt));
+ expand_label (gimple_label_label (as_a <gimple_label> (stmt)));
break;
case GIMPLE_NOP:
case GIMPLE_PREDICT:
diff --git a/gcc/gimple-pretty-print.c b/gcc/gimple-pretty-print.c
index a90d2ef..40e79b1 100644
--- a/gcc/gimple-pretty-print.c
+++ b/gcc/gimple-pretty-print.c
@@ -2348,7 +2348,9 @@ pp_cfg_jump (pretty_printer *buffer, basic_block bb)
if (stmt && gimple_code (stmt) == GIMPLE_LABEL)
{
pp_string (buffer, " (");
- dump_generic_node (buffer, gimple_label_label (stmt), 0, 0, false);
+ dump_generic_node (buffer,
+ gimple_label_label (as_a <gimple_label> (stmt)),
+ 0, 0, false);
pp_right_paren (buffer);
pp_semicolon (buffer);
}
diff --git a/gcc/gimple.c b/gcc/gimple.c
index f99ee0f..8721316 100644
--- a/gcc/gimple.c
+++ b/gcc/gimple.c
@@ -1514,7 +1514,7 @@ gimple_set_bb (gimple stmt, basic_block bb)
tree t;
int uid;
- t = gimple_label_label (stmt);
+ t = gimple_label_label (as_a <gimple_label> (stmt));
uid = LABEL_DECL_UID (t);
if (uid == -1)
{
diff --git a/gcc/gimple.h b/gcc/gimple.h
index 6055e33..1a017ca 100644
--- a/gcc/gimple.h
+++ b/gcc/gimple.h
@@ -3205,9 +3205,8 @@ gimple_cond_set_condition (gimple_cond stmt, enum tree_code code, tree lhs,
/* Return the LABEL_DECL node used by GIMPLE_LABEL statement GS. */
static inline tree
-gimple_label_label (const_gimple gs)
+gimple_label_label (const_gimple_label gs)
{
- GIMPLE_CHECK (gs, GIMPLE_LABEL);
return gimple_op (gs, 0);
}
diff --git a/gcc/ipa-pure-const.c b/gcc/ipa-pure-const.c
index 8375381..ebf53dd 100644
--- a/gcc/ipa-pure-const.c
+++ b/gcc/ipa-pure-const.c
@@ -689,7 +689,7 @@ check_stmt (gimple_stmt_iterator *gsip, funct_state local, bool ipa)
check_call (local, as_a <gimple_call> (stmt), ipa);
break;
case GIMPLE_LABEL:
- if (DECL_NONLOCAL (gimple_label_label (stmt)))
+ if (DECL_NONLOCAL (gimple_label_label (as_a <gimple_label> (stmt))))
/* Target of long jump. */
{
if (dump_file)
diff --git a/gcc/ipa-split.c b/gcc/ipa-split.c
index 5678251..59901dc 100644
--- a/gcc/ipa-split.c
+++ b/gcc/ipa-split.c
@@ -252,13 +252,13 @@ verify_non_ssa_vars (struct split_point *current, bitmap non_ssa_vars,
ok = false;
goto done;
}
- if (gimple_code (stmt) == GIMPLE_LABEL
- && test_nonssa_use (stmt, gimple_label_label (stmt),
- NULL_TREE, non_ssa_vars))
- {
- ok = false;
- goto done;
- }
+ if (gimple_label label_stmt = dyn_cast <gimple_label> (stmt))
+ if (test_nonssa_use (stmt, gimple_label_label (label_stmt),
+ NULL_TREE, non_ssa_vars))
+ {
+ ok = false;
+ goto done;
+ }
}
for (bsi = gsi_start_phis (bb); !gsi_end_p (bsi); gsi_next (&bsi))
{
@@ -300,15 +300,18 @@ verify_non_ssa_vars (struct split_point *current, bitmap non_ssa_vars,
{
gimple_stmt_iterator bsi;
for (bsi = gsi_start_bb (bb); !gsi_end_p (bsi); gsi_next (&bsi))
- if (gimple_code (gsi_stmt (bsi)) == GIMPLE_LABEL
- && test_nonssa_use (gsi_stmt (bsi),
- gimple_label_label (gsi_stmt (bsi)),
- NULL_TREE, non_ssa_vars))
+ if (gimple_label label_stmt =
+ dyn_cast <gimple_label> (gsi_stmt (bsi)))
{
- ok = false;
- goto done;
+ if (test_nonssa_use (label_stmt,
+ gimple_label_label (label_stmt),
+ NULL_TREE, non_ssa_vars))
+ {
+ ok = false;
+ goto done;
+ }
}
- else if (gimple_code (gsi_stmt (bsi)) != GIMPLE_LABEL)
+ else
break;
}
diff --git a/gcc/omp-low.c b/gcc/omp-low.c
index 7b4e325..6174c3f 100644
--- a/gcc/omp-low.c
+++ b/gcc/omp-low.c
@@ -10860,7 +10860,9 @@ diagnose_sb_1 (gimple_stmt_iterator *gsi_p, bool *handled_ops_p,
break;
case GIMPLE_LABEL:
- splay_tree_insert (all_labels, (splay_tree_key) gimple_label_label (stmt),
+ splay_tree_insert (all_labels,
+ (splay_tree_key) gimple_label_label (
+ as_a <gimple_label> (stmt)),
(splay_tree_value) context);
break;
diff --git a/gcc/predict.c b/gcc/predict.c
index bd3f138..5e8a0e9 100644
--- a/gcc/predict.c
+++ b/gcc/predict.c
@@ -2275,12 +2275,13 @@ tree_estimate_probability_bb (basic_block bb)
gimple_stmt_iterator gi;
for (gi = gsi_start_bb (e->dest); !gsi_end_p (gi); gsi_next (&gi))
{
- gimple stmt = gsi_stmt (gi);
+ gimple_label label_stmt =
+ dyn_cast <gimple_label> (gsi_stmt (gi));
tree decl;
- if (gimple_code (stmt) != GIMPLE_LABEL)
+ if (!label_stmt)
break;
- decl = gimple_label_label (stmt);
+ decl = gimple_label_label (label_stmt);
if (DECL_ARTIFICIAL (decl))
continue;
diff --git a/gcc/tree-cfg.c b/gcc/tree-cfg.c
index be4c00e..b0d94ee 100644
--- a/gcc/tree-cfg.c
+++ b/gcc/tree-cfg.c
@@ -909,10 +909,11 @@ make_edges (void)
{
for (gsi = gsi_start_bb (bb); !gsi_end_p (gsi); gsi_next (&gsi))
{
- gimple label_stmt = gsi_stmt (gsi);
+ gimple_label label_stmt =
+ dyn_cast <gimple_label> (gsi_stmt (gsi));
tree target;
- if (gimple_code (label_stmt) != GIMPLE_LABEL)
+ if (!label_stmt)
break;
target = gimple_label_label (label_stmt);
@@ -1373,12 +1374,12 @@ cleanup_dead_labels (void)
for (i = gsi_start_bb (bb); !gsi_end_p (i); gsi_next (&i))
{
tree label;
- gimple stmt = gsi_stmt (i);
+ gimple_label label_stmt = dyn_cast <gimple_label> (gsi_stmt (i));
- if (gimple_code (stmt) != GIMPLE_LABEL)
+ if (!label_stmt)
break;
- label = gimple_label_label (stmt);
+ label = gimple_label_label (label_stmt);
/* If we have not yet seen a label for the current block,
remember this one and see if there are more labels. */
@@ -1513,12 +1514,12 @@ cleanup_dead_labels (void)
for (i = gsi_start_bb (bb); !gsi_end_p (i); )
{
tree label;
- gimple stmt = gsi_stmt (i);
+ gimple_label label_stmt = dyn_cast <gimple_label> (gsi_stmt (i));
- if (gimple_code (stmt) != GIMPLE_LABEL)
+ if (!label_stmt)
break;
- label = gimple_label_label (stmt);
+ label = gimple_label_label (label_stmt);
if (label == label_for_this_bb
|| !DECL_ARTIFICIAL (label)
@@ -1660,19 +1661,19 @@ gimple_can_merge_blocks_p (basic_block a, basic_block b)
return false;
/* Do not allow a block with only a non-local label to be merged. */
- if (stmt
- && gimple_code (stmt) == GIMPLE_LABEL
- && DECL_NONLOCAL (gimple_label_label (stmt)))
- return false;
+ if (stmt)
+ if (gimple_label label_stmt = dyn_cast <gimple_label> (stmt))
+ if (DECL_NONLOCAL (gimple_label_label (label_stmt)))
+ return false;
/* Examine the labels at the beginning of B. */
for (gsi = gsi_start_bb (b); !gsi_end_p (gsi); gsi_next (&gsi))
{
tree lab;
- stmt = gsi_stmt (gsi);
- if (gimple_code (stmt) != GIMPLE_LABEL)
+ gimple_label label_stmt = dyn_cast <gimple_label> (gsi_stmt (gsi));
+ if (!label_stmt)
break;
- lab = gimple_label_label (stmt);
+ lab = gimple_label_label (label_stmt);
/* Do not remove user forced labels or for -O0 any user labels. */
if (!DECL_ARTIFICIAL (lab) && (!optimize || FORCED_LABEL (lab)))
@@ -1872,9 +1873,9 @@ gimple_merge_blocks (basic_block a, basic_block b)
for (gsi = gsi_start_bb (b); !gsi_end_p (gsi);)
{
gimple stmt = gsi_stmt (gsi);
- if (gimple_code (stmt) == GIMPLE_LABEL)
+ if (gimple_label label_stmt = dyn_cast <gimple_label> (stmt))
{
- tree label = gimple_label_label (stmt);
+ tree label = gimple_label_label (label_stmt);
int lp_nr;
gsi_remove (&gsi, false);
@@ -2032,9 +2033,10 @@ remove_bb (basic_block bb)
for (i = gsi_last_bb (bb); !gsi_end_p (i);)
{
gimple stmt = gsi_stmt (i);
- if (gimple_code (stmt) == GIMPLE_LABEL
- && (FORCED_LABEL (gimple_label_label (stmt))
- || DECL_NONLOCAL (gimple_label_label (stmt))))
+ gimple_label label_stmt = dyn_cast <gimple_label> (stmt);
+ if (label_stmt
+ && (FORCED_LABEL (gimple_label_label (label_stmt))
+ || DECL_NONLOCAL (gimple_label_label (label_stmt))))
{
basic_block new_bb;
gimple_stmt_iterator new_gsi;
@@ -2042,10 +2044,10 @@ remove_bb (basic_block bb)
/* A non-reachable non-local label may still be referenced.
But it no longer needs to carry the extra semantics of
non-locality. */
- if (DECL_NONLOCAL (gimple_label_label (stmt)))
+ if (DECL_NONLOCAL (gimple_label_label (label_stmt)))
{
- DECL_NONLOCAL (gimple_label_label (stmt)) = 0;
- FORCED_LABEL (gimple_label_label (stmt)) = 1;
+ DECL_NONLOCAL (gimple_label_label (label_stmt)) = 0;
+ FORCED_LABEL (gimple_label_label (label_stmt)) = 1;
}
new_bb = bb->prev_bb;
@@ -2467,16 +2469,17 @@ stmt_starts_bb_p (gimple stmt, gimple prev_stmt)
/* Labels start a new basic block only if the preceding statement
wasn't a label of the same type. This prevents the creation of
consecutive blocks that have nothing but a single label. */
- if (gimple_code (stmt) == GIMPLE_LABEL)
+ if (gimple_label label_stmt = dyn_cast <gimple_label> (stmt))
{
/* Nonlocal and computed GOTO targets always start a new block. */
- if (DECL_NONLOCAL (gimple_label_label (stmt))
- || FORCED_LABEL (gimple_label_label (stmt)))
+ if (DECL_NONLOCAL (gimple_label_label (label_stmt))
+ || FORCED_LABEL (gimple_label_label (label_stmt)))
return true;
if (prev_stmt && gimple_code (prev_stmt) == GIMPLE_LABEL)
{
- if (DECL_NONLOCAL (gimple_label_label (prev_stmt)))
+ if (DECL_NONLOCAL (gimple_label_label (
+ as_a <gimple_label> (prev_stmt))))
return true;
cfg_stats.num_merged_labels++;
@@ -5081,7 +5084,7 @@ gimple_verify_flow_info (void)
if (gimple_code (stmt) != GIMPLE_LABEL)
break;
- label = gimple_label_label (stmt);
+ label = gimple_label_label (as_a <gimple_label> (stmt));
if (prev_stmt && DECL_NONLOCAL (label))
{
error ("nonlocal label ");
@@ -5134,10 +5137,10 @@ gimple_verify_flow_info (void)
if (stmt_ends_bb_p (stmt))
found_ctrl_stmt = true;
- if (gimple_code (stmt) == GIMPLE_LABEL)
+ if (gimple_label label_stmt = dyn_cast <gimple_label> (stmt))
{
error ("label ");
- print_generic_expr (stderr, gimple_label_label (stmt), 0);
+ print_generic_expr (stderr, gimple_label_label (label_stmt), 0);
fprintf (stderr, " in the middle of basic block %d", bb->index);
err = 1;
}
@@ -5396,12 +5399,12 @@ gimple_block_label (basic_block bb)
gimple_stmt_iterator i, s = gsi_start_bb (bb);
bool first = true;
tree label;
- gimple stmt;
+ gimple_label stmt;
for (i = s; !gsi_end_p (i); first = false, gsi_next (&i))
{
- stmt = gsi_stmt (i);
- if (gimple_code (stmt) != GIMPLE_LABEL)
+ stmt = dyn_cast <gimple_label> (gsi_stmt (i));
+ if (!stmt)
break;
label = gimple_label_label (stmt);
if (!DECL_NONLOCAL (label))
@@ -6692,9 +6695,9 @@ move_block_to_fn (struct function *dest_cfun, basic_block bb,
wi.info = d;
walk_gimple_stmt (&si, move_stmt_r, move_stmt_op, &wi);
- if (gimple_code (stmt) == GIMPLE_LABEL)
+ if (gimple_label label_stmt = dyn_cast <gimple_label> (stmt))
{
- tree label = gimple_label_label (stmt);
+ tree label = gimple_label_label (label_stmt);
int uid = LABEL_DECL_UID (label);
gcc_assert (uid > -1);
diff --git a/gcc/tree-cfgcleanup.c b/gcc/tree-cfgcleanup.c
index f4abe53..7ec9145 100644
--- a/gcc/tree-cfgcleanup.c
+++ b/gcc/tree-cfgcleanup.c
@@ -309,7 +309,7 @@ tree_forwarder_block_p (basic_block bb, bool phi_wanted)
switch (gimple_code (stmt))
{
case GIMPLE_LABEL:
- if (DECL_NONLOCAL (gimple_label_label (stmt)))
+ if (DECL_NONLOCAL (gimple_label_label (as_a <gimple_label> (stmt))))
return false;
if (optimize == 0 && gimple_location (stmt) != locus)
return false;
@@ -406,11 +406,11 @@ remove_forwarder_block (basic_block bb)
/* If the destination block consists of a nonlocal label or is a
EH landing pad, do not merge it. */
label = first_stmt (dest);
- if (label
- && gimple_code (label) == GIMPLE_LABEL
- && (DECL_NONLOCAL (gimple_label_label (label))
- || EH_LANDING_PAD_NR (gimple_label_label (label)) != 0))
- return false;
+ if (label)
+ if (gimple_label label_stmt = dyn_cast <gimple_label> (label))
+ if (DECL_NONLOCAL (gimple_label_label (label_stmt))
+ || EH_LANDING_PAD_NR (gimple_label_label (label_stmt)) != 0)
+ return false;
/* If there is an abnormal edge to basic block BB, but not into
dest, problems might occur during removal of the phi node at out
@@ -492,7 +492,7 @@ remove_forwarder_block (basic_block bb)
label = gsi_stmt (gsi);
if (is_gimple_debug (label))
break;
- decl = gimple_label_label (label);
+ decl = gimple_label_label (as_a <gimple_label> (label));
if (EH_LANDING_PAD_NR (decl) != 0
|| DECL_NONLOCAL (decl)
|| FORCED_LABEL (decl)
@@ -840,10 +840,10 @@ remove_forwarder_block_with_phi (basic_block bb)
/* If the destination block consists of a nonlocal label, do not
merge it. */
label = first_stmt (dest);
- if (label
- && gimple_code (label) == GIMPLE_LABEL
- && DECL_NONLOCAL (gimple_label_label (label)))
- return false;
+ if (label)
+ if (gimple_label label_stmt = dyn_cast <gimple_label> (label))
+ if (DECL_NONLOCAL (gimple_label_label (label_stmt)))
+ return false;
/* Record BB's single pred in case we need to update the father
loop's latch information later. */
diff --git a/gcc/tree-eh.c b/gcc/tree-eh.c
index 1138696..b496c08 100644
--- a/gcc/tree-eh.c
+++ b/gcc/tree-eh.c
@@ -243,7 +243,7 @@ collect_finally_tree (gimple stmt, gimple_try region)
switch (gimple_code (stmt))
{
case GIMPLE_LABEL:
- temp.t = gimple_label_label (stmt);
+ temp.t = gimple_label_label (as_a <gimple_label> (stmt));
record_in_finally_tree (temp, region);
break;
@@ -4004,13 +4004,13 @@ unsplit_eh (eh_landing_pad lp)
for a different region. */
for (gsi = gsi_start_bb (e_out->dest); !gsi_end_p (gsi); gsi_next (&gsi))
{
- gimple stmt = gsi_stmt (gsi);
+ gimple_label label_stmt = dyn_cast <gimple_label> (gsi_stmt (gsi));
tree lab;
int lp_nr;
- if (gimple_code (stmt) != GIMPLE_LABEL)
+ if (!label_stmt)
break;
- lab = gimple_label_label (stmt);
+ lab = gimple_label_label (label_stmt);
lp_nr = EH_LANDING_PAD_NR (lab);
if (lp_nr && get_eh_region_from_lp_number (lp_nr) != lp->region)
return false;
@@ -4275,10 +4275,10 @@ cleanup_empty_eh_unsplit (basic_block bb, edge e_out, eh_landing_pad lp)
lab = NULL;
for (gsi = gsi_start_bb (e_out->dest); !gsi_end_p (gsi); gsi_next (&gsi))
{
- gimple stmt = gsi_stmt (gsi);
+ gimple_label stmt = dyn_cast <gimple_label> (gsi_stmt (gsi));
int lp_nr;
- if (gimple_code (stmt) != GIMPLE_LABEL)
+ if (!stmt)
break;
lab = gimple_label_label (stmt);
lp_nr = EH_LANDING_PAD_NR (lab);
diff --git a/gcc/tree-inline.c b/gcc/tree-inline.c
index a95aa09..945614a 100644
--- a/gcc/tree-inline.c
+++ b/gcc/tree-inline.c
@@ -4839,9 +4839,9 @@ mark_local_labels_stmt (gimple_stmt_iterator *gsip,
struct walk_stmt_info *wi)
{
copy_body_data *id = (copy_body_data *) wi->info;
- gimple stmt = gsi_stmt (*gsip);
+ gimple_label stmt = dyn_cast <gimple_label> (gsi_stmt (*gsip));
- if (gimple_code (stmt) == GIMPLE_LABEL)
+ if (stmt)
{
tree decl = gimple_label_label (stmt);
diff --git a/gcc/tree-nested.c b/gcc/tree-nested.c
index e6f5c1a..3957e11 100644
--- a/gcc/tree-nested.c
+++ b/gcc/tree-nested.c
@@ -2136,9 +2136,9 @@ convert_nl_goto_receiver (gimple_stmt_iterator *gsi, bool *handled_ops_p,
struct nesting_info *const info = (struct nesting_info *) wi->info;
tree label, new_label;
gimple_stmt_iterator tmp_gsi;
- gimple stmt = gsi_stmt (*gsi);
+ gimple_label stmt = dyn_cast <gimple_label> (gsi_stmt (*gsi));
- if (gimple_code (stmt) != GIMPLE_LABEL)
+ if (!stmt)
{
*handled_ops_p = false;
return NULL_TREE;
diff --git a/gcc/tree-ssa-ccp.c b/gcc/tree-ssa-ccp.c
index 6650d3c..3a5632f 100644
--- a/gcc/tree-ssa-ccp.c
+++ b/gcc/tree-ssa-ccp.c
@@ -2564,10 +2564,10 @@ optimize_unreachable (gimple_stmt_iterator i)
if (is_gimple_debug (stmt))
continue;
- if (gimple_code (stmt) == GIMPLE_LABEL)
+ if (gimple_label label_stmt = dyn_cast <gimple_label> (stmt))
{
/* Verify we do not need to preserve the label. */
- if (FORCED_LABEL (gimple_label_label (stmt)))
+ if (FORCED_LABEL (gimple_label_label (label_stmt)))
return false;
continue;
--
1.8.5.3
^ permalink raw reply [flat|nested] 93+ messages in thread
* [gimple-classes, committed 34/92] Introduce gimple_omp_continue
2014-10-27 20:35 [gimple-classes, committed 00/92] Initial slew of commits David Malcolm
` (56 preceding siblings ...)
2014-10-27 20:53 ` [gimple-classes, committed 13/92] tree-ssa-loop-niter.c: use gimple_phi in a few places David Malcolm
@ 2014-10-27 20:53 ` David Malcolm
2014-10-27 20:53 ` [gimple-classes, committed 42/92] Introduce gimple_omp_teams David Malcolm
` (33 subsequent siblings)
91 siblings, 0 replies; 93+ messages in thread
From: David Malcolm @ 2014-10-27 20:53 UTC (permalink / raw)
To: gcc-patches; +Cc: David Malcolm
This corresponds to:
[PATCH 36/89] Introduce gimple_omp_continue
https://gcc.gnu.org/ml/gcc-patches/2014-04/msg01205.html
from the original 89-patch kit
That earlier patch was approved by Jeff:
> OK with expected changes due to renaming/updates to const handling.
> Please repost the final patch for archival purposes.
in https://gcc.gnu.org/ml/gcc-patches/2014-05/msg00826.html
gcc/
* coretypes.h (gimple_omp_continue): New typedef.
(const_gimple_omp_continue): New typedef.
* gimple.h (gimple_build_omp_continue): Return a
gimple_omp_continue rather than a plain gimple.
(gimple_omp_continue_control_def): Require a
const_gimple_omp_continue rather than a plain const_gimple.
(gimple_omp_continue_control_use): Likewise.
(gimple_omp_continue_control_def_ptr): Require a gimple_omp_continue
rather than a plain gimple.
(gimple_omp_continue_set_control_def): Likewise.
(gimple_omp_continue_control_use_ptr): Likewise.
(gimple_omp_continue_set_control_use): Likewise.
* gimple-pretty-print.c (dump_gimple_omp_continue): Require a
gimple_omp_continue rather than a plain gimple.
(pp_gimple_stmt_1): Add a checked cast to gimple_omp_continue
within GIMPLE_OMP_CONTINUE case of switch statement.
* gimple-walk.c (walk_gimple_op): Likewise, adding a new local.
* gimple.c (gimple_build_omp_continue): Return a
gimple_omp_continue rather than a plain gimple.
* omp-low.c (gimple_build_cond_empty): Return a gimple_cond
rather than a plain gimple.
(expand_omp_for_generic): Split local "stmt" into "assign_stmt",
"cont_stmt", "cond_stmt", "call_stmt" of types gimple_assign,
gimple_omp_continue, gimple_cond, gimple_call respectively.
(expand_omp_for_static_nochunk): Likewise, splitting into two
"cond_stmt" decls. "assign_stmt", "cont_stmt"
(expand_omp_for_static_chunk): Likewise, splitting into
"cond_stmt", "assign_stmt", "cont_stmt".
(expand_omp_sections): Strengthen local "cont" from gimple to
gimple_omp_continue.
---
gcc/ChangeLog.gimple-classes | 40 +++++++++++
gcc/coretypes.h | 4 ++
gcc/gimple-pretty-print.c | 6 +-
gcc/gimple-walk.c | 19 ++---
gcc/gimple.c | 5 +-
gcc/gimple.h | 38 ++++------
gcc/omp-low.c | 163 ++++++++++++++++++++++---------------------
7 files changed, 158 insertions(+), 117 deletions(-)
diff --git a/gcc/ChangeLog.gimple-classes b/gcc/ChangeLog.gimple-classes
index 0073b05..5a87159 100644
--- a/gcc/ChangeLog.gimple-classes
+++ b/gcc/ChangeLog.gimple-classes
@@ -1,5 +1,45 @@
2014-10-24 David Malcolm <dmalcolm@redhat.com>
+ Introduce gimple_omp_continue
+
+ * coretypes.h (gimple_omp_continue): New typedef.
+ (const_gimple_omp_continue): New typedef.
+
+ * gimple.h (gimple_build_omp_continue): Return a
+ gimple_omp_continue rather than a plain gimple.
+ (gimple_omp_continue_control_def): Require a
+ const_gimple_omp_continue rather than a plain const_gimple.
+ (gimple_omp_continue_control_use): Likewise.
+ (gimple_omp_continue_control_def_ptr): Require a gimple_omp_continue
+ rather than a plain gimple.
+ (gimple_omp_continue_set_control_def): Likewise.
+ (gimple_omp_continue_control_use_ptr): Likewise.
+ (gimple_omp_continue_set_control_use): Likewise.
+
+ * gimple-pretty-print.c (dump_gimple_omp_continue): Require a
+ gimple_omp_continue rather than a plain gimple.
+ (pp_gimple_stmt_1): Add a checked cast to gimple_omp_continue
+ within GIMPLE_OMP_CONTINUE case of switch statement.
+
+ * gimple-walk.c (walk_gimple_op): Likewise, adding a new local.
+
+ * gimple.c (gimple_build_omp_continue): Return a
+ gimple_omp_continue rather than a plain gimple.
+
+ * omp-low.c (gimple_build_cond_empty): Return a gimple_cond
+ rather than a plain gimple.
+ (expand_omp_for_generic): Split local "stmt" into "assign_stmt",
+ "cont_stmt", "cond_stmt", "call_stmt" of types gimple_assign,
+ gimple_omp_continue, gimple_cond, gimple_call respectively.
+ (expand_omp_for_static_nochunk): Likewise, splitting into two
+ "cond_stmt" decls. "assign_stmt", "cont_stmt"
+ (expand_omp_for_static_chunk): Likewise, splitting into
+ "cond_stmt", "assign_stmt", "cont_stmt".
+ (expand_omp_sections): Strengthen local "cont" from gimple to
+ gimple_omp_continue.
+
+2014-10-24 David Malcolm <dmalcolm@redhat.com>
+
Introduce gimple_omp_atomic_store
* coretypes.h (gimple_omp_atomic_store): New typedef.
diff --git a/gcc/coretypes.h b/gcc/coretypes.h
index 78647b2..197bbf6 100644
--- a/gcc/coretypes.h
+++ b/gcc/coretypes.h
@@ -176,6 +176,10 @@ typedef struct gimple_statement_omp_atomic_store *gimple_omp_atomic_store;
typedef const struct gimple_statement_omp_atomic_store *
const_gimple_omp_atomic_store;
+struct gimple_statement_omp_continue;
+typedef struct gimple_statement_omp_continue *gimple_omp_continue;
+typedef const struct gimple_statement_omp_continue *const_gimple_omp_continue;
+
union section;
typedef union section section;
struct gcc_options;
diff --git a/gcc/gimple-pretty-print.c b/gcc/gimple-pretty-print.c
index 62e4bf8..9af7f24 100644
--- a/gcc/gimple-pretty-print.c
+++ b/gcc/gimple-pretty-print.c
@@ -1253,7 +1253,8 @@ dump_gimple_omp_for (pretty_printer *buffer, gimple gs, int spc, int flags)
/* Dump a GIMPLE_OMP_CONTINUE tuple on the pretty_printer BUFFER. */
static void
-dump_gimple_omp_continue (pretty_printer *buffer, gimple gs, int spc, int flags)
+dump_gimple_omp_continue (pretty_printer *buffer, gimple_omp_continue gs,
+ int spc, int flags)
{
if (flags & TDF_RAW)
{
@@ -2159,7 +2160,8 @@ pp_gimple_stmt_1 (pretty_printer *buffer, gimple gs, int spc, int flags)
break;
case GIMPLE_OMP_CONTINUE:
- dump_gimple_omp_continue (buffer, gs, spc, flags);
+ dump_gimple_omp_continue (buffer, as_a <gimple_omp_continue> (gs), spc,
+ flags);
break;
case GIMPLE_OMP_SINGLE:
diff --git a/gcc/gimple-walk.c b/gcc/gimple-walk.c
index 987b856..39ffc55 100644
--- a/gcc/gimple-walk.c
+++ b/gcc/gimple-walk.c
@@ -298,15 +298,18 @@ walk_gimple_op (gimple stmt, walk_tree_fn callback_op,
break;
case GIMPLE_OMP_CONTINUE:
- ret = walk_tree (gimple_omp_continue_control_def_ptr (stmt),
- callback_op, wi, pset);
- if (ret)
- return ret;
+ {
+ gimple_omp_continue cont_stmt = as_a <gimple_omp_continue> (stmt);
+ ret = walk_tree (gimple_omp_continue_control_def_ptr (cont_stmt),
+ callback_op, wi, pset);
+ if (ret)
+ return ret;
- ret = walk_tree (gimple_omp_continue_control_use_ptr (stmt),
- callback_op, wi, pset);
- if (ret)
- return ret;
+ ret = walk_tree (gimple_omp_continue_control_use_ptr (cont_stmt),
+ callback_op, wi, pset);
+ if (ret)
+ return ret;
+ }
break;
case GIMPLE_OMP_CRITICAL:
diff --git a/gcc/gimple.c b/gcc/gimple.c
index 1bc176c..115b84e 100644
--- a/gcc/gimple.c
+++ b/gcc/gimple.c
@@ -959,10 +959,11 @@ gimple_build_omp_taskgroup (gimple_seq body)
CONTROL_DEF is the definition of the control variable.
CONTROL_USE is the use of the control variable. */
-gimple
+gimple_omp_continue
gimple_build_omp_continue (tree control_def, tree control_use)
{
- gimple p = gimple_alloc (GIMPLE_OMP_CONTINUE, 0);
+ gimple_omp_continue p =
+ as_a <gimple_omp_continue> (gimple_alloc (GIMPLE_OMP_CONTINUE, 0));
gimple_omp_continue_set_control_def (p, control_def);
gimple_omp_continue_set_control_use (p, control_use);
return p;
diff --git a/gcc/gimple.h b/gcc/gimple.h
index 4513fcb..5377da3 100644
--- a/gcc/gimple.h
+++ b/gcc/gimple.h
@@ -1349,7 +1349,7 @@ gimple gimple_build_omp_task (gimple_seq, tree, tree, tree, tree, tree, tree);
gimple gimple_build_omp_section (gimple_seq);
gimple gimple_build_omp_master (gimple_seq);
gimple gimple_build_omp_taskgroup (gimple_seq);
-gimple gimple_build_omp_continue (tree, tree);
+gimple_omp_continue gimple_build_omp_continue (tree, tree);
gimple gimple_build_omp_ordered (gimple_seq);
gimple gimple_build_omp_return (bool);
gimple gimple_build_omp_sections (gimple_seq, tree);
@@ -5448,64 +5448,52 @@ gimple_omp_atomic_load_rhs_ptr (gimple_omp_atomic_load load_stmt)
/* Get the definition of the control variable in a GIMPLE_OMP_CONTINUE. */
static inline tree
-gimple_omp_continue_control_def (const_gimple g)
+gimple_omp_continue_control_def (const_gimple_omp_continue cont_stmt)
{
- const gimple_statement_omp_continue *omp_continue_stmt =
- as_a <const gimple_statement_omp_continue *> (g);
- return omp_continue_stmt->control_def;
+ return cont_stmt->control_def;
}
/* The same as above, but return the address. */
static inline tree *
-gimple_omp_continue_control_def_ptr (gimple g)
+gimple_omp_continue_control_def_ptr (gimple_omp_continue cont_stmt)
{
- gimple_statement_omp_continue *omp_continue_stmt =
- as_a <gimple_statement_omp_continue *> (g);
- return &omp_continue_stmt->control_def;
+ return &cont_stmt->control_def;
}
/* Set the definition of the control variable in a GIMPLE_OMP_CONTINUE. */
static inline void
-gimple_omp_continue_set_control_def (gimple g, tree def)
+gimple_omp_continue_set_control_def (gimple_omp_continue cont_stmt, tree def)
{
- gimple_statement_omp_continue *omp_continue_stmt =
- as_a <gimple_statement_omp_continue *> (g);
- omp_continue_stmt->control_def = def;
+ cont_stmt->control_def = def;
}
/* Get the use of the control variable in a GIMPLE_OMP_CONTINUE. */
static inline tree
-gimple_omp_continue_control_use (const_gimple g)
+gimple_omp_continue_control_use (const_gimple_omp_continue cont_stmt)
{
- const gimple_statement_omp_continue *omp_continue_stmt =
- as_a <const gimple_statement_omp_continue *> (g);
- return omp_continue_stmt->control_use;
+ return cont_stmt->control_use;
}
/* The same as above, but return the address. */
static inline tree *
-gimple_omp_continue_control_use_ptr (gimple g)
+gimple_omp_continue_control_use_ptr (gimple_omp_continue cont_stmt)
{
- gimple_statement_omp_continue *omp_continue_stmt =
- as_a <gimple_statement_omp_continue *> (g);
- return &omp_continue_stmt->control_use;
+ return &cont_stmt->control_use;
}
/* Set the use of the control variable in a GIMPLE_OMP_CONTINUE. */
static inline void
-gimple_omp_continue_set_control_use (gimple g, tree use)
+gimple_omp_continue_set_control_use (gimple_omp_continue cont_stmt, tree use)
{
- gimple_statement_omp_continue *omp_continue_stmt =
- as_a <gimple_statement_omp_continue *> (g);
- omp_continue_stmt->control_use = use;
+ cont_stmt->control_use = use;
}
/* Return a pointer to the body for the GIMPLE_TRANSACTION statement
diff --git a/gcc/omp-low.c b/gcc/omp-low.c
index 78ec43f..6f3b906 100644
--- a/gcc/omp-low.c
+++ b/gcc/omp-low.c
@@ -4340,7 +4340,7 @@ lower_send_shared_vars (gimple_seq *ilist, gimple_seq *olist, omp_context *ctx)
/* A convenience function to build an empty GIMPLE_COND with just the
condition. */
-static gimple
+static gimple_cond
gimple_build_cond_empty (tree cond)
{
enum tree_code pred_code;
@@ -5592,7 +5592,7 @@ expand_omp_for_generic (struct omp_region *region,
basic_block entry_bb, cont_bb, exit_bb, l0_bb, l1_bb, collapse_bb;
basic_block l2_bb = NULL, l3_bb = NULL;
gimple_stmt_iterator gsi;
- gimple stmt;
+ gimple_assign assign_stmt;
bool in_combined_parallel = is_combined_parallel (region);
bool broken_loop = region->cont == NULL;
edge e, ne;
@@ -5807,8 +5807,8 @@ expand_omp_for_generic (struct omp_region *region,
DECL_P (startvar)
&& TREE_ADDRESSABLE (startvar),
NULL_TREE, false, GSI_CONTINUE_LINKING);
- stmt = gimple_build_assign (startvar, t);
- gsi_insert_after (&gsi, stmt, GSI_CONTINUE_LINKING);
+ assign_stmt = gimple_build_assign (startvar, t);
+ gsi_insert_after (&gsi, assign_stmt, GSI_CONTINUE_LINKING);
t = iend0;
if (bias)
@@ -5820,14 +5820,14 @@ expand_omp_for_generic (struct omp_region *region,
false, GSI_CONTINUE_LINKING);
if (endvar)
{
- stmt = gimple_build_assign (endvar, iend);
- gsi_insert_after (&gsi, stmt, GSI_CONTINUE_LINKING);
+ assign_stmt = gimple_build_assign (endvar, iend);
+ gsi_insert_after (&gsi, assign_stmt, GSI_CONTINUE_LINKING);
if (useless_type_conversion_p (TREE_TYPE (fd->loop.v), TREE_TYPE (iend)))
- stmt = gimple_build_assign (fd->loop.v, iend);
+ assign_stmt = gimple_build_assign (fd->loop.v, iend);
else
- stmt = gimple_build_assign_with_ops (NOP_EXPR, fd->loop.v, iend,
+ assign_stmt = gimple_build_assign_with_ops (NOP_EXPR, fd->loop.v, iend,
NULL_TREE);
- gsi_insert_after (&gsi, stmt, GSI_CONTINUE_LINKING);
+ gsi_insert_after (&gsi, assign_stmt, GSI_CONTINUE_LINKING);
}
if (fd->collapse > 1)
expand_omp_for_init_vars (fd, &gsi, counts, inner_stmt, startvar);
@@ -5837,10 +5837,11 @@ expand_omp_for_generic (struct omp_region *region,
/* Code to control the increment and predicate for the sequential
loop goes in the CONT_BB. */
gsi = gsi_last_bb (cont_bb);
- stmt = gsi_stmt (gsi);
- gcc_assert (gimple_code (stmt) == GIMPLE_OMP_CONTINUE);
- vmain = gimple_omp_continue_control_use (stmt);
- vback = gimple_omp_continue_control_def (stmt);
+ gimple_omp_continue cont_stmt =
+ as_a <gimple_omp_continue> (gsi_stmt (gsi));
+ gcc_assert (gimple_code (cont_stmt) == GIMPLE_OMP_CONTINUE);
+ vmain = gimple_omp_continue_control_use (cont_stmt);
+ vback = gimple_omp_continue_control_def (cont_stmt);
if (!gimple_omp_for_combined_p (fd->for_stmt))
{
@@ -5852,14 +5853,14 @@ expand_omp_for_generic (struct omp_region *region,
DECL_P (vback)
&& TREE_ADDRESSABLE (vback),
NULL_TREE, true, GSI_SAME_STMT);
- stmt = gimple_build_assign (vback, t);
- gsi_insert_before (&gsi, stmt, GSI_SAME_STMT);
+ assign_stmt = gimple_build_assign (vback, t);
+ gsi_insert_before (&gsi, assign_stmt, GSI_SAME_STMT);
t = build2 (fd->loop.cond_code, boolean_type_node,
DECL_P (vback) && TREE_ADDRESSABLE (vback) ? t : vback,
iend);
- stmt = gimple_build_cond_empty (t);
- gsi_insert_before (&gsi, stmt, GSI_SAME_STMT);
+ gimple_cond cond_stmt = gimple_build_cond_empty (t);
+ gsi_insert_before (&gsi, cond_stmt, GSI_SAME_STMT);
}
/* Remove GIMPLE_OMP_CONTINUE. */
@@ -5879,8 +5880,8 @@ expand_omp_for_generic (struct omp_region *region,
if (TREE_TYPE (t) != boolean_type_node)
t = fold_build2 (NE_EXPR, boolean_type_node,
t, build_int_cst (TREE_TYPE (t), 0));
- stmt = gimple_build_cond_empty (t);
- gsi_insert_after (&gsi, stmt, GSI_CONTINUE_LINKING);
+ gimple_cond cond_stmt = gimple_build_cond_empty (t);
+ gsi_insert_after (&gsi, cond_stmt, GSI_CONTINUE_LINKING);
}
/* Add the loop cleanup function. */
@@ -5891,10 +5892,10 @@ expand_omp_for_generic (struct omp_region *region,
t = builtin_decl_explicit (BUILT_IN_GOMP_LOOP_END_CANCEL);
else
t = builtin_decl_explicit (BUILT_IN_GOMP_LOOP_END);
- stmt = gimple_build_call (t, 0);
+ gimple_call call_stmt = gimple_build_call (t, 0);
if (gimple_omp_return_lhs (gsi_stmt (gsi)))
- gimple_call_set_lhs (stmt, gimple_omp_return_lhs (gsi_stmt (gsi)));
- gsi_insert_after (&gsi, stmt, GSI_SAME_STMT);
+ gimple_call_set_lhs (call_stmt, gimple_omp_return_lhs (gsi_stmt (gsi)));
+ gsi_insert_after (&gsi, call_stmt, GSI_SAME_STMT);
gsi_remove (&gsi, true);
/* Connect the new blocks. */
@@ -6017,7 +6018,6 @@ expand_omp_for_static_nochunk (struct omp_region *region,
basic_block body_bb, cont_bb, collapse_bb = NULL;
basic_block fin_bb;
gimple_stmt_iterator gsi;
- gimple stmt;
edge ep;
enum built_in_function get_num_threads = BUILT_IN_OMP_GET_NUM_THREADS;
enum built_in_function get_thread_num = BUILT_IN_OMP_GET_THREAD_NUM;
@@ -6081,18 +6081,18 @@ expand_omp_for_static_nochunk (struct omp_region *region,
n2 = fold_convert (type, unshare_expr (fd->loop.n2));
n2 = force_gimple_operand_gsi (&gsi, n2, true, NULL_TREE,
true, GSI_SAME_STMT);
- stmt = gimple_build_cond (fd->loop.cond_code, n1, n2,
- NULL_TREE, NULL_TREE);
- gsi_insert_before (&gsi, stmt, GSI_SAME_STMT);
- if (walk_tree (gimple_cond_lhs_ptr (stmt),
+ gimple_cond cond_stmt = gimple_build_cond (fd->loop.cond_code, n1, n2,
+ NULL_TREE, NULL_TREE);
+ gsi_insert_before (&gsi, cond_stmt, GSI_SAME_STMT);
+ if (walk_tree (gimple_cond_lhs_ptr (cond_stmt),
expand_omp_regimplify_p, NULL, NULL)
- || walk_tree (gimple_cond_rhs_ptr (stmt),
+ || walk_tree (gimple_cond_rhs_ptr (cond_stmt),
expand_omp_regimplify_p, NULL, NULL))
{
- gsi = gsi_for_stmt (stmt);
- gimple_regimplify_operands (stmt, &gsi);
+ gsi = gsi_for_stmt (cond_stmt);
+ gimple_regimplify_operands (cond_stmt, &gsi);
}
- ep = split_block (entry_bb, stmt);
+ ep = split_block (entry_bb, cond_stmt);
ep->flags = EDGE_TRUE_VALUE;
entry_bb = ep->dest;
ep->probability = REG_BR_PROB_BASE - (REG_BR_PROB_BASE / 2000 - 1);
@@ -6167,20 +6167,21 @@ expand_omp_for_static_nochunk (struct omp_region *region,
gsi_insert_before (&gsi, gimple_build_assign (tt, t), GSI_SAME_STMT);
t = build2 (LT_EXPR, boolean_type_node, threadid, tt);
- stmt = gimple_build_cond_empty (t);
- gsi_insert_before (&gsi, stmt, GSI_SAME_STMT);
+ gimple_cond cond_stmt = gimple_build_cond_empty (t);
+ gsi_insert_before (&gsi, cond_stmt, GSI_SAME_STMT);
- second_bb = split_block (entry_bb, stmt)->dest;
+ second_bb = split_block (entry_bb, cond_stmt)->dest;
gsi = gsi_last_bb (second_bb);
gcc_assert (gimple_code (gsi_stmt (gsi)) == GIMPLE_OMP_FOR);
gsi_insert_before (&gsi, gimple_build_assign (tt, build_int_cst (itype, 0)),
GSI_SAME_STMT);
- stmt = gimple_build_assign_with_ops (PLUS_EXPR, q, q,
- build_int_cst (itype, 1));
- gsi_insert_before (&gsi, stmt, GSI_SAME_STMT);
+ gimple_assign assign_stmt =
+ gimple_build_assign_with_ops (PLUS_EXPR, q, q,
+ build_int_cst (itype, 1));
+ gsi_insert_before (&gsi, assign_stmt, GSI_SAME_STMT);
- third_bb = split_block (second_bb, stmt)->dest;
+ third_bb = split_block (second_bb, assign_stmt)->dest;
gsi = gsi_last_bb (third_bb);
gcc_assert (gimple_code (gsi_stmt (gsi)) == GIMPLE_OMP_FOR);
@@ -6227,8 +6228,8 @@ expand_omp_for_static_nochunk (struct omp_region *region,
DECL_P (startvar)
&& TREE_ADDRESSABLE (startvar),
NULL_TREE, false, GSI_CONTINUE_LINKING);
- stmt = gimple_build_assign (startvar, t);
- gsi_insert_after (&gsi, stmt, GSI_CONTINUE_LINKING);
+ assign_stmt = gimple_build_assign (startvar, t);
+ gsi_insert_after (&gsi, assign_stmt, GSI_CONTINUE_LINKING);
t = fold_convert (itype, e0);
t = fold_build2 (MULT_EXPR, itype, t, step);
@@ -6241,14 +6242,14 @@ expand_omp_for_static_nochunk (struct omp_region *region,
false, GSI_CONTINUE_LINKING);
if (endvar)
{
- stmt = gimple_build_assign (endvar, e);
- gsi_insert_after (&gsi, stmt, GSI_CONTINUE_LINKING);
+ assign_stmt = gimple_build_assign (endvar, e);
+ gsi_insert_after (&gsi, assign_stmt, GSI_CONTINUE_LINKING);
if (useless_type_conversion_p (TREE_TYPE (fd->loop.v), TREE_TYPE (e)))
- stmt = gimple_build_assign (fd->loop.v, e);
+ assign_stmt = gimple_build_assign (fd->loop.v, e);
else
- stmt = gimple_build_assign_with_ops (NOP_EXPR, fd->loop.v, e,
+ assign_stmt = gimple_build_assign_with_ops (NOP_EXPR, fd->loop.v, e,
NULL_TREE);
- gsi_insert_after (&gsi, stmt, GSI_CONTINUE_LINKING);
+ gsi_insert_after (&gsi, assign_stmt, GSI_CONTINUE_LINKING);
}
if (fd->collapse > 1)
expand_omp_for_init_vars (fd, &gsi, counts, inner_stmt, startvar);
@@ -6258,10 +6259,11 @@ expand_omp_for_static_nochunk (struct omp_region *region,
/* The code controlling the sequential loop replaces the
GIMPLE_OMP_CONTINUE. */
gsi = gsi_last_bb (cont_bb);
- stmt = gsi_stmt (gsi);
- gcc_assert (gimple_code (stmt) == GIMPLE_OMP_CONTINUE);
- vmain = gimple_omp_continue_control_use (stmt);
- vback = gimple_omp_continue_control_def (stmt);
+ gimple_omp_continue cont_stmt =
+ as_a <gimple_omp_continue> (gsi_stmt (gsi));
+ gcc_assert (gimple_code (cont_stmt) == GIMPLE_OMP_CONTINUE);
+ vmain = gimple_omp_continue_control_use (cont_stmt);
+ vback = gimple_omp_continue_control_def (cont_stmt);
if (!gimple_omp_for_combined_p (fd->for_stmt))
{
@@ -6273,8 +6275,8 @@ expand_omp_for_static_nochunk (struct omp_region *region,
DECL_P (vback)
&& TREE_ADDRESSABLE (vback),
NULL_TREE, true, GSI_SAME_STMT);
- stmt = gimple_build_assign (vback, t);
- gsi_insert_before (&gsi, stmt, GSI_SAME_STMT);
+ assign_stmt = gimple_build_assign (vback, t);
+ gsi_insert_before (&gsi, assign_stmt, GSI_SAME_STMT);
t = build2 (fd->loop.cond_code, boolean_type_node,
DECL_P (vback) && TREE_ADDRESSABLE (vback)
@@ -6394,7 +6396,6 @@ expand_omp_for_static_chunk (struct omp_region *region,
basic_block entry_bb, exit_bb, body_bb, seq_start_bb, iter_part_bb;
basic_block trip_update_bb = NULL, cont_bb, collapse_bb = NULL, fin_bb;
gimple_stmt_iterator gsi;
- gimple stmt;
edge se;
enum built_in_function get_num_threads = BUILT_IN_OMP_GET_NUM_THREADS;
enum built_in_function get_thread_num = BUILT_IN_OMP_GET_THREAD_NUM;
@@ -6462,18 +6463,18 @@ expand_omp_for_static_chunk (struct omp_region *region,
n2 = fold_convert (type, unshare_expr (fd->loop.n2));
n2 = force_gimple_operand_gsi (&gsi, n2, true, NULL_TREE,
true, GSI_SAME_STMT);
- stmt = gimple_build_cond (fd->loop.cond_code, n1, n2,
- NULL_TREE, NULL_TREE);
- gsi_insert_before (&gsi, stmt, GSI_SAME_STMT);
- if (walk_tree (gimple_cond_lhs_ptr (stmt),
+ gimple_cond cond_stmt = gimple_build_cond (fd->loop.cond_code, n1, n2,
+ NULL_TREE, NULL_TREE);
+ gsi_insert_before (&gsi, cond_stmt, GSI_SAME_STMT);
+ if (walk_tree (gimple_cond_lhs_ptr (cond_stmt),
expand_omp_regimplify_p, NULL, NULL)
- || walk_tree (gimple_cond_rhs_ptr (stmt),
+ || walk_tree (gimple_cond_rhs_ptr (cond_stmt),
expand_omp_regimplify_p, NULL, NULL))
{
- gsi = gsi_for_stmt (stmt);
- gimple_regimplify_operands (stmt, &gsi);
+ gsi = gsi_for_stmt (cond_stmt);
+ gimple_regimplify_operands (cond_stmt, &gsi);
}
- se = split_block (entry_bb, stmt);
+ se = split_block (entry_bb, cond_stmt);
se->flags = EDGE_TRUE_VALUE;
entry_bb = se->dest;
se->probability = REG_BR_PROB_BASE - (REG_BR_PROB_BASE / 2000 - 1);
@@ -6555,8 +6556,9 @@ expand_omp_for_static_chunk (struct omp_region *region,
trip_back = trip_var;
}
- stmt = gimple_build_assign (trip_init, build_int_cst (itype, 0));
- gsi_insert_before (&gsi, stmt, GSI_SAME_STMT);
+ gimple_assign assign_stmt =
+ gimple_build_assign (trip_init, build_int_cst (itype, 0));
+ gsi_insert_before (&gsi, assign_stmt, GSI_SAME_STMT);
t = fold_build2 (MULT_EXPR, itype, threadid, fd->chunk_size);
t = fold_build2 (MULT_EXPR, itype, t, step);
@@ -6618,8 +6620,8 @@ expand_omp_for_static_chunk (struct omp_region *region,
DECL_P (startvar)
&& TREE_ADDRESSABLE (startvar),
NULL_TREE, false, GSI_CONTINUE_LINKING);
- stmt = gimple_build_assign (startvar, t);
- gsi_insert_after (&gsi, stmt, GSI_CONTINUE_LINKING);
+ assign_stmt = gimple_build_assign (startvar, t);
+ gsi_insert_after (&gsi, assign_stmt, GSI_CONTINUE_LINKING);
t = fold_convert (itype, e0);
t = fold_build2 (MULT_EXPR, itype, t, step);
@@ -6632,14 +6634,14 @@ expand_omp_for_static_chunk (struct omp_region *region,
false, GSI_CONTINUE_LINKING);
if (endvar)
{
- stmt = gimple_build_assign (endvar, e);
- gsi_insert_after (&gsi, stmt, GSI_CONTINUE_LINKING);
+ assign_stmt = gimple_build_assign (endvar, e);
+ gsi_insert_after (&gsi, assign_stmt, GSI_CONTINUE_LINKING);
if (useless_type_conversion_p (TREE_TYPE (fd->loop.v), TREE_TYPE (e)))
- stmt = gimple_build_assign (fd->loop.v, e);
+ assign_stmt = gimple_build_assign (fd->loop.v, e);
else
- stmt = gimple_build_assign_with_ops (NOP_EXPR, fd->loop.v, e,
- NULL_TREE);
- gsi_insert_after (&gsi, stmt, GSI_CONTINUE_LINKING);
+ assign_stmt = gimple_build_assign_with_ops (NOP_EXPR, fd->loop.v, e,
+ NULL_TREE);
+ gsi_insert_after (&gsi, assign_stmt, GSI_CONTINUE_LINKING);
}
if (fd->collapse > 1)
expand_omp_for_init_vars (fd, &gsi, counts, inner_stmt, startvar);
@@ -6649,10 +6651,10 @@ expand_omp_for_static_chunk (struct omp_region *region,
/* The code controlling the sequential loop goes in CONT_BB,
replacing the GIMPLE_OMP_CONTINUE. */
gsi = gsi_last_bb (cont_bb);
- stmt = gsi_stmt (gsi);
- gcc_assert (gimple_code (stmt) == GIMPLE_OMP_CONTINUE);
- vmain = gimple_omp_continue_control_use (stmt);
- vback = gimple_omp_continue_control_def (stmt);
+ gimple_omp_continue cont_stmt =
+ as_a <gimple_omp_continue> (gsi_stmt (gsi));
+ vmain = gimple_omp_continue_control_use (cont_stmt);
+ vback = gimple_omp_continue_control_def (cont_stmt);
if (!gimple_omp_for_combined_p (fd->for_stmt))
{
@@ -6663,8 +6665,8 @@ expand_omp_for_static_chunk (struct omp_region *region,
if (DECL_P (vback) && TREE_ADDRESSABLE (vback))
t = force_gimple_operand_gsi (&gsi, t, true, NULL_TREE,
true, GSI_SAME_STMT);
- stmt = gimple_build_assign (vback, t);
- gsi_insert_before (&gsi, stmt, GSI_SAME_STMT);
+ assign_stmt = gimple_build_assign (vback, t);
+ gsi_insert_before (&gsi, assign_stmt, GSI_SAME_STMT);
t = build2 (fd->loop.cond_code, boolean_type_node,
DECL_P (vback) && TREE_ADDRESSABLE (vback)
@@ -6683,8 +6685,8 @@ expand_omp_for_static_chunk (struct omp_region *region,
t = build_int_cst (itype, 1);
t = build2 (PLUS_EXPR, itype, trip_main, t);
- stmt = gimple_build_assign (trip_back, t);
- gsi_insert_after (&gsi, stmt, GSI_CONTINUE_LINKING);
+ assign_stmt = gimple_build_assign (trip_back, t);
+ gsi_insert_after (&gsi, assign_stmt, GSI_CONTINUE_LINKING);
}
/* Replace the GIMPLE_OMP_RETURN with a barrier, or nothing. */
@@ -7412,7 +7414,8 @@ expand_omp_sections (struct omp_region *region)
unsigned len;
basic_block entry_bb, l0_bb, l1_bb, l2_bb, default_bb;
gimple_stmt_iterator si, switch_si;
- gimple sections_stmt, stmt, cont;
+ gimple sections_stmt, stmt;
+ gimple_omp_continue cont;
edge_iterator ei;
edge e;
struct omp_region *inner;
@@ -7493,7 +7496,7 @@ expand_omp_sections (struct omp_region *region)
gcc_assert (gimple_code (gsi_stmt (switch_si)) == GIMPLE_OMP_SECTIONS_SWITCH);
if (exit_reachable)
{
- cont = last_stmt (l1_bb);
+ cont = as_a <gimple_omp_continue> (last_stmt (l1_bb));
gcc_assert (gimple_code (cont) == GIMPLE_OMP_CONTINUE);
vmain = gimple_omp_continue_control_use (cont);
vnext = gimple_omp_continue_control_def (cont);
--
1.8.5.3
^ permalink raw reply [flat|nested] 93+ messages in thread
* [gimple-classes, committed 42/92] Introduce gimple_omp_teams
2014-10-27 20:35 [gimple-classes, committed 00/92] Initial slew of commits David Malcolm
` (57 preceding siblings ...)
2014-10-27 20:53 ` [gimple-classes, committed 34/92] Introduce gimple_omp_continue David Malcolm
@ 2014-10-27 20:53 ` David Malcolm
2014-10-27 20:53 ` [gimple-classes, committed 60/92] Concretize gimple_label_label David Malcolm
` (32 subsequent siblings)
91 siblings, 0 replies; 93+ messages in thread
From: David Malcolm @ 2014-10-27 20:53 UTC (permalink / raw)
To: gcc-patches; +Cc: David Malcolm
This corresponds to:
[PATCH 44/89] Introduce gimple_omp_teams
https://gcc.gnu.org/ml/gcc-patches/2014-04/msg01231.html
from the original 89-patch kit
That earlier patch was approved by Jeff:
> OK with expected changes due to renaming/updates to const handling.
> Please repost the final patch for archival purposes.
in https://gcc.gnu.org/ml/gcc-patches/2014-05/msg00808.html
gcc/
* coretypes.h (gimple_omp_teams): New typedef.
(const_gimple_omp_teams): New typedef.
* gimple.h (gimple_build_omp_teams): Return a gimple_omp_teams
rather than a plain gimple.
(gimple_omp_teams_set_clauses): Require a gimple_omp_teams rather
than a plain gimple.
* gimple-pretty-print.c (dump_gimple_omp_teams): Require a
gimple_omp_teams rather than a plain gimple.
(pp_gimple_stmt_1): Add checked cast to gimple_omp_teams within
GIMPLE_OMP_TEAMS case of switch statement.
* gimple.c (gimple_build_omp_teams): Return a gimple_omp_teams
rather than a plain gimple.
* omp-low.c (scan_omp_teams): Likewise.
(scan_omp_1_stmt): Add checked cast to gimple_omp_teams within
GIMPLE_OMP_TEAMS case of switch statement.
(lower_omp_teams): Strengthen local "teams_stmt" from gimple to
gimple_omp_teams.
---
gcc/ChangeLog.gimple-classes | 26 ++++++++++++++++++++++++++
gcc/coretypes.h | 4 ++++
gcc/gimple-pretty-print.c | 6 ++++--
gcc/gimple.c | 5 +++--
gcc/gimple.h | 8 +++-----
gcc/omp-low.c | 6 +++---
6 files changed, 43 insertions(+), 12 deletions(-)
diff --git a/gcc/ChangeLog.gimple-classes b/gcc/ChangeLog.gimple-classes
index e576b5e..65c7986 100644
--- a/gcc/ChangeLog.gimple-classes
+++ b/gcc/ChangeLog.gimple-classes
@@ -1,5 +1,31 @@
2014-10-24 David Malcolm <dmalcolm@redhat.com>
+ Introduce gimple_omp_teams
+
+ * coretypes.h (gimple_omp_teams): New typedef.
+ (const_gimple_omp_teams): New typedef.
+
+ * gimple.h (gimple_build_omp_teams): Return a gimple_omp_teams
+ rather than a plain gimple.
+ (gimple_omp_teams_set_clauses): Require a gimple_omp_teams rather
+ than a plain gimple.
+
+ * gimple-pretty-print.c (dump_gimple_omp_teams): Require a
+ gimple_omp_teams rather than a plain gimple.
+ (pp_gimple_stmt_1): Add checked cast to gimple_omp_teams within
+ GIMPLE_OMP_TEAMS case of switch statement.
+
+ * gimple.c (gimple_build_omp_teams): Return a gimple_omp_teams
+ rather than a plain gimple.
+
+ * omp-low.c (scan_omp_teams): Likewise.
+ (scan_omp_1_stmt): Add checked cast to gimple_omp_teams within
+ GIMPLE_OMP_TEAMS case of switch statement.
+ (lower_omp_teams): Strengthen local "teams_stmt" from gimple to
+ gimple_omp_teams.
+
+2014-10-24 David Malcolm <dmalcolm@redhat.com>
+
Introduce gimple_omp_target
* coretypes.h (gimple_omp_target): New typedef.
diff --git a/gcc/coretypes.h b/gcc/coretypes.h
index 6996373..2cd33e5 100644
--- a/gcc/coretypes.h
+++ b/gcc/coretypes.h
@@ -204,6 +204,10 @@ struct gimple_statement_omp_target;
typedef struct gimple_statement_omp_target *gimple_omp_target;
typedef const struct gimple_statement_omp_target *const_gimple_omp_target;
+struct gimple_statement_omp_teams;
+typedef struct gimple_statement_omp_teams *gimple_omp_teams;
+typedef const struct gimple_statement_omp_teams *const_gimple_omp_teams;
+
union section;
typedef union section section;
struct gcc_options;
diff --git a/gcc/gimple-pretty-print.c b/gcc/gimple-pretty-print.c
index 6491c55..d5e3639 100644
--- a/gcc/gimple-pretty-print.c
+++ b/gcc/gimple-pretty-print.c
@@ -1359,7 +1359,8 @@ dump_gimple_omp_target (pretty_printer *buffer, gimple_omp_target gs,
/* Dump a GIMPLE_OMP_TEAMS tuple on the pretty_printer BUFFER. */
static void
-dump_gimple_omp_teams (pretty_printer *buffer, gimple gs, int spc, int flags)
+dump_gimple_omp_teams (pretty_printer *buffer, gimple_omp_teams gs, int spc,
+ int flags)
{
if (flags & TDF_RAW)
{
@@ -2178,7 +2179,8 @@ pp_gimple_stmt_1 (pretty_printer *buffer, gimple gs, int spc, int flags)
break;
case GIMPLE_OMP_TEAMS:
- dump_gimple_omp_teams (buffer, gs, spc, flags);
+ dump_gimple_omp_teams (buffer, as_a <gimple_omp_teams> (gs), spc,
+ flags);
break;
case GIMPLE_OMP_RETURN:
diff --git a/gcc/gimple.c b/gcc/gimple.c
index afeaa5b..b4b76f3 100644
--- a/gcc/gimple.c
+++ b/gcc/gimple.c
@@ -1071,10 +1071,11 @@ gimple_build_omp_target (gimple_seq body, int kind, tree clauses)
BODY is the sequence of statements that will be executed.
CLAUSES are any of the OMP teams construct's clauses. */
-gimple
+gimple_omp_teams
gimple_build_omp_teams (gimple_seq body, tree clauses)
{
- gimple p = gimple_alloc (GIMPLE_OMP_TEAMS, 0);
+ gimple_omp_teams p =
+ as_a <gimple_omp_teams> (gimple_alloc (GIMPLE_OMP_TEAMS, 0));
if (body)
gimple_omp_set_body (p, body);
gimple_omp_teams_set_clauses (p, clauses);
diff --git a/gcc/gimple.h b/gcc/gimple.h
index 6bad165..462495e 100644
--- a/gcc/gimple.h
+++ b/gcc/gimple.h
@@ -1357,7 +1357,7 @@ gimple gimple_build_omp_sections (gimple_seq, tree);
gimple gimple_build_omp_sections_switch (void);
gimple_omp_single gimple_build_omp_single (gimple_seq, tree);
gimple_omp_target gimple_build_omp_target (gimple_seq, int, tree);
-gimple gimple_build_omp_teams (gimple_seq, tree);
+gimple_omp_teams gimple_build_omp_teams (gimple_seq, tree);
gimple_omp_atomic_load gimple_build_omp_atomic_load (tree, tree);
gimple_omp_atomic_store gimple_build_omp_atomic_store (tree);
gimple_transaction gimple_build_transaction (gimple_seq, tree);
@@ -5222,13 +5222,11 @@ gimple_omp_teams_clauses_ptr (gimple gs)
}
-/* Set CLAUSES to be the clauses associated with OMP_TEAMS GS. */
+/* Set CLAUSES to be the clauses associated with OMP_TEAMS_STMT. */
static inline void
-gimple_omp_teams_set_clauses (gimple gs, tree clauses)
+gimple_omp_teams_set_clauses (gimple_omp_teams omp_teams_stmt, tree clauses)
{
- gimple_statement_omp_teams *omp_teams_stmt =
- as_a <gimple_statement_omp_teams *> (gs);
omp_teams_stmt->clauses = clauses;
}
diff --git a/gcc/omp-low.c b/gcc/omp-low.c
index 4b4ae4b..ce71618 100644
--- a/gcc/omp-low.c
+++ b/gcc/omp-low.c
@@ -2380,7 +2380,7 @@ scan_omp_target (gimple_omp_target stmt, omp_context *outer_ctx)
/* Scan an OpenMP teams directive. */
static void
-scan_omp_teams (gimple stmt, omp_context *outer_ctx)
+scan_omp_teams (gimple_omp_teams stmt, omp_context *outer_ctx)
{
omp_context *ctx = new_omp_context (stmt, outer_ctx);
scan_sharing_clauses (gimple_omp_teams_clauses (stmt), ctx);
@@ -2835,7 +2835,7 @@ scan_omp_1_stmt (gimple_stmt_iterator *gsi, bool *handled_ops_p,
break;
case GIMPLE_OMP_TEAMS:
- scan_omp_teams (stmt, ctx);
+ scan_omp_teams (as_a <gimple_omp_teams> (stmt), ctx);
break;
case GIMPLE_BIND:
@@ -10356,7 +10356,7 @@ lower_omp_target (gimple_stmt_iterator *gsi_p, omp_context *ctx)
static void
lower_omp_teams (gimple_stmt_iterator *gsi_p, omp_context *ctx)
{
- gimple teams_stmt = gsi_stmt (*gsi_p);
+ gimple_omp_teams teams_stmt = as_a <gimple_omp_teams> (gsi_stmt (*gsi_p));
push_gimplify_context ();
tree block = make_node (BLOCK);
--
1.8.5.3
^ permalink raw reply [flat|nested] 93+ messages in thread
* [gimple-classes, committed 58/92] Concretize gimple_catch_types
2014-10-27 20:35 [gimple-classes, committed 00/92] Initial slew of commits David Malcolm
` (52 preceding siblings ...)
2014-10-27 20:52 ` [gimple-classes, committed 10/92] tree-parloops.c: use gimple_phi in various places David Malcolm
@ 2014-10-27 20:53 ` David Malcolm
2014-10-27 20:53 ` [gimple-classes, committed 23/92] Introduce gimple_catch David Malcolm
` (37 subsequent siblings)
91 siblings, 0 replies; 93+ messages in thread
From: David Malcolm @ 2014-10-27 20:53 UTC (permalink / raw)
To: gcc-patches; +Cc: David Malcolm
This corresponds to:
[PATCH 60/89] Concretize gimple_catch_types
https://gcc.gnu.org/ml/gcc-patches/2014-04/msg01195.html
from the original 89-patch kit
That earlier patch was approved by Jeff:
> OK once prerequisites have gone in.
in https://gcc.gnu.org/ml/gcc-patches/2014-05/msg00816.html
gcc/
* gimple.h (gimple_catch_types): Require a const_gimple_catch
rather than a const_gimple.
---
gcc/ChangeLog.gimple-classes | 7 +++++++
gcc/gimple.h | 6 ++----
2 files changed, 9 insertions(+), 4 deletions(-)
diff --git a/gcc/ChangeLog.gimple-classes b/gcc/ChangeLog.gimple-classes
index dd735af..d2bc077 100644
--- a/gcc/ChangeLog.gimple-classes
+++ b/gcc/ChangeLog.gimple-classes
@@ -1,5 +1,12 @@
2014-10-24 David Malcolm <dmalcolm@redhat.com>
+ Concretize gimple_catch_types
+
+ * gimple.h (gimple_catch_types): Require a const_gimple_catch
+ rather than a const_gimple.
+
+2014-10-24 David Malcolm <dmalcolm@redhat.com>
+
Make gimple_goto_set_dest require a gimple_goto
* gimple.h (gimple_goto_set_dest): Require a gimple_goto.
diff --git a/gcc/gimple.h b/gcc/gimple.h
index fc80407..18cfcec 100644
--- a/gcc/gimple.h
+++ b/gcc/gimple.h
@@ -3522,13 +3522,11 @@ gimple_asm_input_p (const_gimple_asm asm_stmt)
}
-/* Return the types handled by GIMPLE_CATCH statement GS. */
+/* Return the types handled by GIMPLE_CATCH statement CATCH_STMT. */
static inline tree
-gimple_catch_types (const_gimple gs)
+gimple_catch_types (const_gimple_catch catch_stmt)
{
- const gimple_statement_catch *catch_stmt =
- as_a <const gimple_statement_catch *> (gs);
return catch_stmt->types;
}
--
1.8.5.3
^ permalink raw reply [flat|nested] 93+ messages in thread
* [gimple-classes, committed 13/92] tree-ssa-loop-niter.c: use gimple_phi in a few places
2014-10-27 20:35 [gimple-classes, committed 00/92] Initial slew of commits David Malcolm
` (55 preceding siblings ...)
2014-10-27 20:53 ` [gimple-classes, committed 35/92] Introduce gimple_omp_critical David Malcolm
@ 2014-10-27 20:53 ` David Malcolm
2014-10-27 20:53 ` [gimple-classes, committed 34/92] Introduce gimple_omp_continue David Malcolm
` (34 subsequent siblings)
91 siblings, 0 replies; 93+ messages in thread
From: David Malcolm @ 2014-10-27 20:53 UTC (permalink / raw)
To: gcc-patches; +Cc: David Malcolm
This corresponds to:
[PATCH 14/89] tree-ssa-loop-niter.c: use gimple_phi in a few places
https://gcc.gnu.org/ml/gcc-patches/2014-04/msg01191.html
from the original 89-patch kit
That earlier patch was approved by Jeff:
> OK when prerequisites have gone in.
in https://gcc.gnu.org/ml/gcc-patches/2014-05/msg00623.html
gcc/
* tree-ssa-loop-niter.c (chain_of_csts_start): Return a gimple_phi
rather than a gimple.
(get_base_for): Likewise; convert local "phi" to be a gimple_phi.
(loop_niter_by_eval): Convert local "phi" to be a gimple_phi.
---
gcc/ChangeLog.gimple-classes | 9 +++++++++
gcc/tree-ssa-loop-niter.c | 11 ++++++-----
2 files changed, 15 insertions(+), 5 deletions(-)
diff --git a/gcc/ChangeLog.gimple-classes b/gcc/ChangeLog.gimple-classes
index 7be584b..533002f 100644
--- a/gcc/ChangeLog.gimple-classes
+++ b/gcc/ChangeLog.gimple-classes
@@ -1,5 +1,14 @@
2014-10-24 David Malcolm <dmalcolm@redhat.com>
+ tree-ssa-loop-niter.c: use gimple_phi in a few places
+
+ * tree-ssa-loop-niter.c (chain_of_csts_start): Return a gimple_phi
+ rather than a gimple.
+ (get_base_for): Likewise; convert local "phi" to be a gimple_phi.
+ (loop_niter_by_eval): Convert local "phi" to be a gimple_phi.
+
+2014-10-24 David Malcolm <dmalcolm@redhat.com>
+
tree-ssa-phiprop.c: use gimple_phi
* tree-ssa-phiprop.c (phiprop_insert_phi): Strengthen types of
diff --git a/gcc/tree-ssa-loop-niter.c b/gcc/tree-ssa-loop-niter.c
index 6313fc8..025c1f9 100644
--- a/gcc/tree-ssa-loop-niter.c
+++ b/gcc/tree-ssa-loop-niter.c
@@ -2155,7 +2155,7 @@ finite_loop_p (struct loop *loop)
result by a chain of operations such that all but exactly one of their
operands are constants. */
-static gimple
+static gimple_phi
chain_of_csts_start (struct loop *loop, tree x)
{
gimple stmt = SSA_NAME_DEF_STMT (x);
@@ -2170,7 +2170,7 @@ chain_of_csts_start (struct loop *loop, tree x)
if (gimple_code (stmt) == GIMPLE_PHI)
{
if (bb == loop->header)
- return stmt;
+ return as_a <gimple_phi> (stmt);
return NULL;
}
@@ -2203,10 +2203,10 @@ chain_of_csts_start (struct loop *loop, tree x)
If such phi node exists, it is returned, otherwise NULL is returned. */
-static gimple
+static gimple_phi
get_base_for (struct loop *loop, tree x)
{
- gimple phi;
+ gimple_phi phi;
tree init, next;
if (is_gimple_min_invariant (x))
@@ -2297,7 +2297,8 @@ loop_niter_by_eval (struct loop *loop, edge exit)
{
tree acnd;
tree op[2], val[2], next[2], aval[2];
- gimple phi, cond;
+ gimple_phi phi;
+ gimple cond;
unsigned i, j;
enum tree_code cmp;
--
1.8.5.3
^ permalink raw reply [flat|nested] 93+ messages in thread
* [gimple-classes, committed 23/92] Introduce gimple_catch
2014-10-27 20:35 [gimple-classes, committed 00/92] Initial slew of commits David Malcolm
` (53 preceding siblings ...)
2014-10-27 20:53 ` [gimple-classes, committed 58/92] Concretize gimple_catch_types David Malcolm
@ 2014-10-27 20:53 ` David Malcolm
2014-10-27 20:53 ` [gimple-classes, committed 35/92] Introduce gimple_omp_critical David Malcolm
` (36 subsequent siblings)
91 siblings, 0 replies; 93+ messages in thread
From: David Malcolm @ 2014-10-27 20:53 UTC (permalink / raw)
To: gcc-patches; +Cc: David Malcolm
This corresponds to:
[PATCH 25/89] Introduce gimple_catch
https://gcc.gnu.org/ml/gcc-patches/2014-04/msg01178.html
from the original 89-patch kit
That earlier patch was approved by Jeff:
> OK after fixing up the naming/const stuff as discussed for prior
> patches.
> That applies to 22-30. Make sure to take care of
> the pretty printers per Trevor's comments as well. He indicated those
> were missing in a couple of those patches.
in https://gcc.gnu.org/ml/gcc-patches/2014-05/msg00628.html
gcc/
* coretypes.h (gimple_catch): New typedef.
(const_gimple_catch): New typedef.
* gimple-low.c (lower_try_catch): Add checked cast to gimple_catch.
(gimple_try_catch_may_fallthru): Likewise.
* gimple-pretty-print.c (dump_gimple_catch): Require a gimple_catch
rather than a plain gimple.
(pp_gimple_stmt_1): Add checked cast to gimple_catch within
GIMPLE_CATCH case of switch statement.
* gimple-walk.c (walk_gimple_op): Likewise.
(walk_gimple_stmt): Likewise.
* gimple.c (gimple_build_catch): Return a gimple_catch rather than
a plain gimple.
(gimple_copy): Add checked casts to gimple_catch within
GIMPLE_CATCH case of switch statement, introducing new locals.
* gimple.h (gimple_build_catch): Return a gimple_catch rather than
a plain gimple.
(gimple_catch_types_ptr): Require a gimple_catch rather than a
plain gimple.
(gimple_catch_handler_ptr): Likewise.
(gimple_catch_handler): Likewise.
(gimple_catch_set_types): Likewise.
(gimple_catch_set_handler): Likewise.
* omp-low.c (lower_omp_1): Add checked cast to gimple_catch within
GIMPLE_CATCH case of switch statement.
* tree-cfg.c (verify_gimple_in_seq_2): Likewise.
(do_warn_unused_result): Likewise.
* tree-eh.c (collect_finally_tree): Likewise.
(replace_goto_queue_1): Likewise.
(lower_catch): Convert local from gimple to gimple_catch.
(refactor_eh_r): Add checked cast to gimple_catch within
GIMPLE_CATCH case of switch statement.
* tree-inline.c (remap_gimple_stmt): Likewise.
(estimate_num_insns): Add checked cast to gimple_catch within
GIMPLE_CATCH case of switch statement, introducing new local.
---
gcc/ChangeLog.gimple-classes | 48 ++++++++++++++++++++++++++++++++++++++++++++
gcc/coretypes.h | 4 ++++
gcc/gimple-low.c | 7 +++++--
gcc/gimple-pretty-print.c | 4 ++--
gcc/gimple-walk.c | 9 +++++----
gcc/gimple.c | 16 +++++++++------
gcc/gimple.h | 28 +++++++++++---------------
gcc/omp-low.c | 2 +-
gcc/tree-cfg.c | 6 ++++--
gcc/tree-eh.c | 14 ++++++++-----
gcc/tree-inline.c | 11 +++++++---
11 files changed, 108 insertions(+), 41 deletions(-)
diff --git a/gcc/ChangeLog.gimple-classes b/gcc/ChangeLog.gimple-classes
index b3a475e..04b611e 100644
--- a/gcc/ChangeLog.gimple-classes
+++ b/gcc/ChangeLog.gimple-classes
@@ -1,5 +1,53 @@
2014-10-24 David Malcolm <dmalcolm@redhat.com>
+ Introduce gimple_catch
+
+ * coretypes.h (gimple_catch): New typedef.
+ (const_gimple_catch): New typedef.
+
+ * gimple-low.c (lower_try_catch): Add checked cast to gimple_catch.
+ (gimple_try_catch_may_fallthru): Likewise.
+
+ * gimple-pretty-print.c (dump_gimple_catch): Require a gimple_catch
+ rather than a plain gimple.
+ (pp_gimple_stmt_1): Add checked cast to gimple_catch within
+ GIMPLE_CATCH case of switch statement.
+
+ * gimple-walk.c (walk_gimple_op): Likewise.
+ (walk_gimple_stmt): Likewise.
+
+ * gimple.c (gimple_build_catch): Return a gimple_catch rather than
+ a plain gimple.
+ (gimple_copy): Add checked casts to gimple_catch within
+ GIMPLE_CATCH case of switch statement, introducing new locals.
+
+ * gimple.h (gimple_build_catch): Return a gimple_catch rather than
+ a plain gimple.
+ (gimple_catch_types_ptr): Require a gimple_catch rather than a
+ plain gimple.
+ (gimple_catch_handler_ptr): Likewise.
+ (gimple_catch_handler): Likewise.
+ (gimple_catch_set_types): Likewise.
+ (gimple_catch_set_handler): Likewise.
+
+ * omp-low.c (lower_omp_1): Add checked cast to gimple_catch within
+ GIMPLE_CATCH case of switch statement.
+
+ * tree-cfg.c (verify_gimple_in_seq_2): Likewise.
+ (do_warn_unused_result): Likewise.
+
+ * tree-eh.c (collect_finally_tree): Likewise.
+ (replace_goto_queue_1): Likewise.
+ (lower_catch): Convert local from gimple to gimple_catch.
+ (refactor_eh_r): Add checked cast to gimple_catch within
+ GIMPLE_CATCH case of switch statement.
+
+ * tree-inline.c (remap_gimple_stmt): Likewise.
+ (estimate_num_insns): Add checked cast to gimple_catch within
+ GIMPLE_CATCH case of switch statement, introducing new local.
+
+2014-10-24 David Malcolm <dmalcolm@redhat.com>
+
Introduce gimple_transaction
* coretypes.h (gimple_transaction): New typedef.
diff --git a/gcc/coretypes.h b/gcc/coretypes.h
index a38d7bd..bff57cc 100644
--- a/gcc/coretypes.h
+++ b/gcc/coretypes.h
@@ -134,6 +134,10 @@ struct gimple_statement_bind;
typedef struct gimple_statement_bind *gimple_bind;
typedef const struct gimple_statement_bind *const_gimple_bind;
+struct gimple_statement_catch;
+typedef struct gimple_statement_catch *gimple_catch;
+typedef const struct gimple_statement_catch *const_gimple_catch;
+
struct gimple_statement_phi;
typedef struct gimple_statement_phi *gimple_phi;
typedef const struct gimple_statement_phi *const_gimple_phi;
diff --git a/gcc/gimple-low.c b/gcc/gimple-low.c
index 4a4ad8a..9ac984e 100644
--- a/gcc/gimple-low.c
+++ b/gcc/gimple-low.c
@@ -453,7 +453,9 @@ lower_try_catch (gimple_stmt_iterator *gsi, struct lower_data *data)
for (; !gsi_end_p (i); gsi_next (&i))
{
data->cannot_fallthru = false;
- lower_sequence (gimple_catch_handler_ptr (gsi_stmt (i)), data);
+ lower_sequence (gimple_catch_handler_ptr (
+ as_a <gimple_catch> (gsi_stmt (i))),
+ data);
if (!data->cannot_fallthru)
cannot_fallthru = false;
}
@@ -515,7 +517,8 @@ gimple_try_catch_may_fallthru (gimple stmt)
through iff any of the catch bodies falls through. */
for (; !gsi_end_p (i); gsi_next (&i))
{
- if (gimple_seq_may_fallthru (gimple_catch_handler (gsi_stmt (i))))
+ if (gimple_seq_may_fallthru (gimple_catch_handler (
+ as_a <gimple_catch> (gsi_stmt (i)))))
return true;
}
return false;
diff --git a/gcc/gimple-pretty-print.c b/gcc/gimple-pretty-print.c
index a188759..f7287f6 100644
--- a/gcc/gimple-pretty-print.c
+++ b/gcc/gimple-pretty-print.c
@@ -988,7 +988,7 @@ dump_gimple_try (pretty_printer *buffer, gimple gs, int spc, int flags)
dumpfile.h). */
static void
-dump_gimple_catch (pretty_printer *buffer, gimple gs, int spc, int flags)
+dump_gimple_catch (pretty_printer *buffer, gimple_catch gs, int spc, int flags)
{
if (flags & TDF_RAW)
dump_gimple_fmt (buffer, spc, flags, "%G <%T, %+CATCH <%S>%->", gs,
@@ -2194,7 +2194,7 @@ pp_gimple_stmt_1 (pretty_printer *buffer, gimple gs, int spc, int flags)
break;
case GIMPLE_CATCH:
- dump_gimple_catch (buffer, gs, spc, flags);
+ dump_gimple_catch (buffer, as_a <gimple_catch> (gs), spc, flags);
break;
case GIMPLE_EH_FILTER:
diff --git a/gcc/gimple-walk.c b/gcc/gimple-walk.c
index e41a9a5..fc74f49 100644
--- a/gcc/gimple-walk.c
+++ b/gcc/gimple-walk.c
@@ -278,8 +278,8 @@ walk_gimple_op (gimple stmt, walk_tree_fn callback_op,
break;
case GIMPLE_CATCH:
- ret = walk_tree (gimple_catch_types_ptr (stmt), callback_op, wi,
- pset);
+ ret = walk_tree (gimple_catch_types_ptr (as_a <gimple_catch> (stmt)),
+ callback_op, wi, pset);
if (ret)
return ret;
break;
@@ -551,8 +551,9 @@ walk_gimple_stmt (gimple_stmt_iterator *gsi, walk_stmt_fn callback_stmt,
break;
case GIMPLE_CATCH:
- ret = walk_gimple_seq_mod (gimple_catch_handler_ptr (stmt), callback_stmt,
- callback_op, wi);
+ ret = walk_gimple_seq_mod (gimple_catch_handler_ptr (
+ as_a <gimple_catch> (stmt)),
+ callback_stmt, callback_op, wi);
if (ret)
return wi->callback_result;
break;
diff --git a/gcc/gimple.c b/gcc/gimple.c
index 68ede1f..61a9c83 100644
--- a/gcc/gimple.c
+++ b/gcc/gimple.c
@@ -614,10 +614,10 @@ gimple_build_asm_vec (const char *string, vec<tree, va_gc> *inputs,
TYPES are the catch types.
HANDLER is the exception handler. */
-gimple
+gimple_catch
gimple_build_catch (tree types, gimple_seq handler)
{
- gimple p = gimple_alloc (GIMPLE_CATCH, 0);
+ gimple_catch p = as_a <gimple_catch> (gimple_alloc (GIMPLE_CATCH, 0));
gimple_catch_set_types (p, types);
if (handler)
gimple_catch_set_handler (p, handler);
@@ -1664,10 +1664,14 @@ gimple_copy (gimple stmt)
break;
case GIMPLE_CATCH:
- new_seq = gimple_seq_copy (gimple_catch_handler (stmt));
- gimple_catch_set_handler (copy, new_seq);
- t = unshare_expr (gimple_catch_types (stmt));
- gimple_catch_set_types (copy, t);
+ {
+ gimple_catch catch_stmt = as_a <gimple_catch> (stmt);
+ gimple_catch catch_copy = as_a <gimple_catch> (copy);
+ new_seq = gimple_seq_copy (gimple_catch_handler (catch_stmt));
+ gimple_catch_set_handler (catch_copy, new_seq);
+ t = unshare_expr (gimple_catch_types (catch_stmt));
+ gimple_catch_set_types (catch_copy, t);
+ }
break;
case GIMPLE_EH_FILTER:
diff --git a/gcc/gimple.h b/gcc/gimple.h
index 4ddcb24..23e6861 100644
--- a/gcc/gimple.h
+++ b/gcc/gimple.h
@@ -1325,7 +1325,7 @@ gimple_bind gimple_build_bind (tree, gimple_seq, tree);
gimple_asm gimple_build_asm_vec (const char *, vec<tree, va_gc> *,
vec<tree, va_gc> *, vec<tree, va_gc> *,
vec<tree, va_gc> *);
-gimple gimple_build_catch (tree, gimple_seq);
+gimple_catch gimple_build_catch (tree, gimple_seq);
gimple gimple_build_eh_filter (tree, gimple_seq);
gimple gimple_build_eh_must_not_throw (tree);
gimple gimple_build_eh_else (gimple_seq, gimple_seq);
@@ -3535,53 +3535,49 @@ gimple_catch_types (const_gimple gs)
}
-/* Return a pointer to the types handled by GIMPLE_CATCH statement GS. */
+/* Return a pointer to the types handled by GIMPLE_CATCH statement CATCH_STMT. */
static inline tree *
-gimple_catch_types_ptr (gimple gs)
+gimple_catch_types_ptr (gimple_catch catch_stmt)
{
- gimple_statement_catch *catch_stmt = as_a <gimple_statement_catch *> (gs);
return &catch_stmt->types;
}
/* Return a pointer to the GIMPLE sequence representing the body of
- the handler of GIMPLE_CATCH statement GS. */
+ the handler of GIMPLE_CATCH statement CATCH_STMT. */
static inline gimple_seq *
-gimple_catch_handler_ptr (gimple gs)
+gimple_catch_handler_ptr (gimple_catch catch_stmt)
{
- gimple_statement_catch *catch_stmt = as_a <gimple_statement_catch *> (gs);
return &catch_stmt->handler;
}
/* Return the GIMPLE sequence representing the body of the handler of
- GIMPLE_CATCH statement GS. */
+ GIMPLE_CATCH statement CATCH_STMT. */
static inline gimple_seq
-gimple_catch_handler (gimple gs)
+gimple_catch_handler (gimple_catch catch_stmt)
{
- return *gimple_catch_handler_ptr (gs);
+ return *gimple_catch_handler_ptr (catch_stmt);
}
-/* Set T to be the set of types handled by GIMPLE_CATCH GS. */
+/* Set T to be the set of types handled by GIMPLE_CATCH CATCH_STMT. */
static inline void
-gimple_catch_set_types (gimple gs, tree t)
+gimple_catch_set_types (gimple_catch catch_stmt, tree t)
{
- gimple_statement_catch *catch_stmt = as_a <gimple_statement_catch *> (gs);
catch_stmt->types = t;
}
-/* Set HANDLER to be the body of GIMPLE_CATCH GS. */
+/* Set HANDLER to be the body of GIMPLE_CATCH CATCH_STMT. */
static inline void
-gimple_catch_set_handler (gimple gs, gimple_seq handler)
+gimple_catch_set_handler (gimple_catch catch_stmt, gimple_seq handler)
{
- gimple_statement_catch *catch_stmt = as_a <gimple_statement_catch *> (gs);
catch_stmt->handler = handler;
}
diff --git a/gcc/omp-low.c b/gcc/omp-low.c
index b8a131b..2c4e992 100644
--- a/gcc/omp-low.c
+++ b/gcc/omp-low.c
@@ -10458,7 +10458,7 @@ lower_omp_1 (gimple_stmt_iterator *gsi_p, omp_context *ctx)
gimple_regimplify_operands (stmt, gsi_p);
break;
case GIMPLE_CATCH:
- lower_omp (gimple_catch_handler_ptr (stmt), ctx);
+ lower_omp (gimple_catch_handler_ptr (as_a <gimple_catch> (stmt)), ctx);
break;
case GIMPLE_EH_FILTER:
lower_omp (gimple_eh_filter_failure_ptr (stmt), ctx);
diff --git a/gcc/tree-cfg.c b/gcc/tree-cfg.c
index 1662d49..d459228 100644
--- a/gcc/tree-cfg.c
+++ b/gcc/tree-cfg.c
@@ -4644,7 +4644,8 @@ verify_gimple_in_seq_2 (gimple_seq stmts)
break;
case GIMPLE_CATCH:
- err |= verify_gimple_in_seq_2 (gimple_catch_handler (stmt));
+ err |= verify_gimple_in_seq_2 (gimple_catch_handler (
+ as_a <gimple_catch> (stmt)));
break;
case GIMPLE_TRANSACTION:
@@ -8364,7 +8365,8 @@ do_warn_unused_result (gimple_seq seq)
do_warn_unused_result (gimple_try_cleanup (g));
break;
case GIMPLE_CATCH:
- do_warn_unused_result (gimple_catch_handler (g));
+ do_warn_unused_result (gimple_catch_handler (
+ as_a <gimple_catch> (g)));
break;
case GIMPLE_EH_FILTER:
do_warn_unused_result (gimple_eh_filter_failure (g));
diff --git a/gcc/tree-eh.c b/gcc/tree-eh.c
index 9769225..15dcf51 100644
--- a/gcc/tree-eh.c
+++ b/gcc/tree-eh.c
@@ -263,7 +263,9 @@ collect_finally_tree (gimple stmt, gimple region)
break;
case GIMPLE_CATCH:
- collect_finally_tree_1 (gimple_catch_handler (stmt), region);
+ collect_finally_tree_1 (gimple_catch_handler (
+ as_a <gimple_catch> (stmt)),
+ region);
break;
case GIMPLE_EH_FILTER:
@@ -519,7 +521,9 @@ replace_goto_queue_1 (gimple stmt, struct leh_tf_state *tf,
replace_goto_queue_stmt_list (gimple_try_cleanup_ptr (stmt), tf);
break;
case GIMPLE_CATCH:
- replace_goto_queue_stmt_list (gimple_catch_handler_ptr (stmt), tf);
+ replace_goto_queue_stmt_list (gimple_catch_handler_ptr (
+ as_a <gimple_catch> (stmt)),
+ tf);
break;
case GIMPLE_EH_FILTER:
replace_goto_queue_stmt_list (gimple_eh_filter_failure_ptr (stmt), tf);
@@ -1764,10 +1768,10 @@ lower_catch (struct leh_state *state, gimple tp)
gsi_next (&gsi))
{
eh_catch c;
- gimple gcatch;
+ gimple_catch gcatch;
gimple_seq handler;
- gcatch = gsi_stmt (gsi);
+ gcatch = as_a <gimple_catch> (gsi_stmt (gsi));
c = gen_eh_region_catch (try_region, gimple_catch_types (gcatch));
handler = gimple_catch_handler (gcatch);
@@ -3061,7 +3065,7 @@ refactor_eh_r (gimple_seq seq)
refactor_eh_r (gimple_try_cleanup (one));
break;
case GIMPLE_CATCH:
- refactor_eh_r (gimple_catch_handler (one));
+ refactor_eh_r (gimple_catch_handler (as_a <gimple_catch> (one)));
break;
case GIMPLE_EH_FILTER:
refactor_eh_r (gimple_eh_filter_failure (one));
diff --git a/gcc/tree-inline.c b/gcc/tree-inline.c
index 44a2ba0..b6f2a5c 100644
--- a/gcc/tree-inline.c
+++ b/gcc/tree-inline.c
@@ -1338,8 +1338,11 @@ remap_gimple_stmt (gimple stmt, copy_body_data *id)
break;
case GIMPLE_CATCH:
- s1 = remap_gimple_seq (gimple_catch_handler (stmt), id);
- copy = gimple_build_catch (gimple_catch_types (stmt), s1);
+ {
+ gimple_catch catch_stmt = as_a <gimple_catch> (stmt);
+ s1 = remap_gimple_seq (gimple_catch_handler (catch_stmt), id);
+ copy = gimple_build_catch (gimple_catch_types (catch_stmt), s1);
+ }
break;
case GIMPLE_EH_FILTER:
@@ -3983,7 +3986,9 @@ estimate_num_insns (gimple stmt, eni_weights *weights)
return estimate_num_insns_seq (gimple_eh_filter_failure (stmt), weights);
case GIMPLE_CATCH:
- return estimate_num_insns_seq (gimple_catch_handler (stmt), weights);
+ return estimate_num_insns_seq (gimple_catch_handler (
+ as_a <gimple_catch> (stmt)),
+ weights);
case GIMPLE_TRY:
return (estimate_num_insns_seq (gimple_try_eval (stmt), weights)
--
1.8.5.3
^ permalink raw reply [flat|nested] 93+ messages in thread
* [gimple-classes, committed 35/92] Introduce gimple_omp_critical
2014-10-27 20:35 [gimple-classes, committed 00/92] Initial slew of commits David Malcolm
` (54 preceding siblings ...)
2014-10-27 20:53 ` [gimple-classes, committed 23/92] Introduce gimple_catch David Malcolm
@ 2014-10-27 20:53 ` David Malcolm
2014-10-27 20:53 ` [gimple-classes, committed 13/92] tree-ssa-loop-niter.c: use gimple_phi in a few places David Malcolm
` (35 subsequent siblings)
91 siblings, 0 replies; 93+ messages in thread
From: David Malcolm @ 2014-10-27 20:53 UTC (permalink / raw)
To: gcc-patches; +Cc: David Malcolm
This corresponds to:
[PATCH 37/89] Introduce gimple_omp_critical
https://gcc.gnu.org/ml/gcc-patches/2014-04/msg01158.html
from the original 89-patch kit
That earlier patch was approved by Jeff:
> OK with expected changes due to renaming/updates to const handling.
> Please repost the final patch for archival purposes.
in https://gcc.gnu.org/ml/gcc-patches/2014-05/msg00809.html
gcc/
* coretypes.h (gimple_omp_critical): New typedef.
(const_gimple_omp_critical): New typedef.
* gimple-pretty-print.c (dump_gimple_omp_critical): Require a
gimple_omp_critical rather than a plain gimple.
(pp_gimple_stmt_1): Add a checked cast to gimple_omp_critical
within GIMPLE_OMP_CRITICAL case of switch statement.
* gimple-walk.c (walk_gimple_op): Likewise.
* gimple.c (gimple_build_omp_critical): Return a gimple_omp_critical
rather than a plain gimple.
(gimple_copy): Add checked casts to gimple_omp_critical
within GIMPLE_OMP_CRITICAL case of switch statement.
* gimple.h (gimple_debug): Likewise.
(gimple_build_omp_critical): Return a gimple_omp_critical rather
than a plain gimple.
(gimple_omp_critical_name): Require a const_gimple_omp_critical
rather than a plain const_gimple.
(gimple_omp_critical_name_ptr): Require a gimple_omp_critical
rather than a plain gimple.
(gimple_omp_critical_set_name): Likewise.
* omp-low.c (check_omp_nesting_restrictions): Add a checked cast
to gimple_omp_critical within GIMPLE_OMP_CRITICAL case of switch
statement, introducing a new local "other_crit" for type-safety.
(lower_omp_critical): Strengthen local "stmt" to
gimple_omp_critical.
* tree-inline.c (remap_gimple_stmt): Add a checked cast to
gimple_omp_critical within GIMPLE_OMP_CRITICAL case of switch
statement.
---
gcc/ChangeLog.gimple-classes | 38 ++++++++++++++++++++++++++++++++++++++
gcc/coretypes.h | 4 ++++
gcc/gimple-pretty-print.c | 7 ++++---
gcc/gimple-walk.c | 5 +++--
gcc/gimple.c | 10 ++++++----
gcc/gimple.h | 22 ++++++++--------------
gcc/omp-low.c | 26 +++++++++++++++-----------
gcc/tree-inline.c | 6 ++++--
8 files changed, 82 insertions(+), 36 deletions(-)
diff --git a/gcc/ChangeLog.gimple-classes b/gcc/ChangeLog.gimple-classes
index 5a87159..4f87c87 100644
--- a/gcc/ChangeLog.gimple-classes
+++ b/gcc/ChangeLog.gimple-classes
@@ -1,5 +1,43 @@
2014-10-24 David Malcolm <dmalcolm@redhat.com>
+ Introduce gimple_omp_critical
+
+ * coretypes.h (gimple_omp_critical): New typedef.
+ (const_gimple_omp_critical): New typedef.
+
+ * gimple-pretty-print.c (dump_gimple_omp_critical): Require a
+ gimple_omp_critical rather than a plain gimple.
+ (pp_gimple_stmt_1): Add a checked cast to gimple_omp_critical
+ within GIMPLE_OMP_CRITICAL case of switch statement.
+
+ * gimple-walk.c (walk_gimple_op): Likewise.
+
+ * gimple.c (gimple_build_omp_critical): Return a gimple_omp_critical
+ rather than a plain gimple.
+ (gimple_copy): Add checked casts to gimple_omp_critical
+ within GIMPLE_OMP_CRITICAL case of switch statement.
+
+ * gimple.h (gimple_debug): Likewise.
+ (gimple_build_omp_critical): Return a gimple_omp_critical rather
+ than a plain gimple.
+ (gimple_omp_critical_name): Require a const_gimple_omp_critical
+ rather than a plain const_gimple.
+ (gimple_omp_critical_name_ptr): Require a gimple_omp_critical
+ rather than a plain gimple.
+ (gimple_omp_critical_set_name): Likewise.
+
+ * omp-low.c (check_omp_nesting_restrictions): Add a checked cast
+ to gimple_omp_critical within GIMPLE_OMP_CRITICAL case of switch
+ statement, introducing a new local "other_crit" for type-safety.
+ (lower_omp_critical): Strengthen local "stmt" to
+ gimple_omp_critical.
+
+ * tree-inline.c (remap_gimple_stmt): Add a checked cast to
+ gimple_omp_critical within GIMPLE_OMP_CRITICAL case of switch
+ statement.
+
+2014-10-24 David Malcolm <dmalcolm@redhat.com>
+
Introduce gimple_omp_continue
* coretypes.h (gimple_omp_continue): New typedef.
diff --git a/gcc/coretypes.h b/gcc/coretypes.h
index 197bbf6..0fd3db5 100644
--- a/gcc/coretypes.h
+++ b/gcc/coretypes.h
@@ -180,6 +180,10 @@ struct gimple_statement_omp_continue;
typedef struct gimple_statement_omp_continue *gimple_omp_continue;
typedef const struct gimple_statement_omp_continue *const_gimple_omp_continue;
+struct gimple_statement_omp_critical;
+typedef struct gimple_statement_omp_critical *gimple_omp_critical;
+typedef const struct gimple_statement_omp_critical *const_gimple_omp_critical;
+
union section;
typedef union section section;
struct gcc_options;
diff --git a/gcc/gimple-pretty-print.c b/gcc/gimple-pretty-print.c
index 9af7f24..51ca587 100644
--- a/gcc/gimple-pretty-print.c
+++ b/gcc/gimple-pretty-print.c
@@ -1461,8 +1461,8 @@ dump_gimple_omp_block (pretty_printer *buffer, gimple gs, int spc, int flags)
/* Dump a GIMPLE_OMP_CRITICAL tuple on the pretty_printer BUFFER. */
static void
-dump_gimple_omp_critical (pretty_printer *buffer, gimple gs, int spc,
- int flags)
+dump_gimple_omp_critical (pretty_printer *buffer, gimple_omp_critical gs,
+ int spc, int flags)
{
if (flags & TDF_RAW)
dump_gimple_fmt (buffer, spc, flags, "%G <%+BODY <%S> >", gs,
@@ -2196,7 +2196,8 @@ pp_gimple_stmt_1 (pretty_printer *buffer, gimple gs, int spc, int flags)
break;
case GIMPLE_OMP_CRITICAL:
- dump_gimple_omp_critical (buffer, gs, spc, flags);
+ dump_gimple_omp_critical (buffer, as_a <gimple_omp_critical> (gs), spc,
+ flags);
break;
case GIMPLE_CATCH:
diff --git a/gcc/gimple-walk.c b/gcc/gimple-walk.c
index 39ffc55..8293e0d 100644
--- a/gcc/gimple-walk.c
+++ b/gcc/gimple-walk.c
@@ -313,8 +313,9 @@ walk_gimple_op (gimple stmt, walk_tree_fn callback_op,
break;
case GIMPLE_OMP_CRITICAL:
- ret = walk_tree (gimple_omp_critical_name_ptr (stmt), callback_op, wi,
- pset);
+ ret = walk_tree (gimple_omp_critical_name_ptr (
+ as_a <gimple_omp_critical> (stmt)),
+ callback_op, wi, pset);
if (ret)
return ret;
break;
diff --git a/gcc/gimple.c b/gcc/gimple.c
index 115b84e..b3bfe14 100644
--- a/gcc/gimple.c
+++ b/gcc/gimple.c
@@ -818,10 +818,11 @@ gimple_build_debug_source_bind_stat (tree var, tree value,
BODY is the sequence of statements for which only one thread can execute.
NAME is optional identifier for this critical block. */
-gimple
+gimple_omp_critical
gimple_build_omp_critical (gimple_seq body, tree name)
{
- gimple p = gimple_alloc (GIMPLE_OMP_CRITICAL, 0);
+ gimple_omp_critical p =
+ as_a <gimple_omp_critical> (gimple_alloc (GIMPLE_OMP_CRITICAL, 0));
gimple_omp_critical_set_name (p, name);
if (body)
gimple_omp_set_body (p, body);
@@ -1755,8 +1756,9 @@ gimple_copy (gimple stmt)
goto copy_omp_body;
case GIMPLE_OMP_CRITICAL:
- t = unshare_expr (gimple_omp_critical_name (stmt));
- gimple_omp_critical_set_name (copy, t);
+ t = unshare_expr (gimple_omp_critical_name (
+ as_a <gimple_omp_critical> (stmt)));
+ gimple_omp_critical_set_name (as_a <gimple_omp_critical> (copy), t);
goto copy_omp_body;
case GIMPLE_OMP_SECTIONS:
diff --git a/gcc/gimple.h b/gcc/gimple.h
index 5377da3..8252b75 100644
--- a/gcc/gimple.h
+++ b/gcc/gimple.h
@@ -1342,7 +1342,7 @@ gimple_debug gimple_build_debug_bind_stat (tree, tree, gimple MEM_STAT_DECL);
gimple_debug gimple_build_debug_source_bind_stat (tree, tree, gimple MEM_STAT_DECL);
#define gimple_build_debug_source_bind(var,val,stmt) \
gimple_build_debug_source_bind_stat ((var), (val), (stmt) MEM_STAT_INFO)
-gimple gimple_build_omp_critical (gimple_seq, tree);
+gimple_omp_critical gimple_build_omp_critical (gimple_seq, tree);
gimple gimple_build_omp_for (gimple_seq, int, tree, size_t, gimple_seq);
gimple gimple_build_omp_parallel (gimple_seq, tree, tree, tree);
gimple gimple_build_omp_task (gimple_seq, tree, tree, tree, tree, tree, tree);
@@ -4354,36 +4354,30 @@ gimple_omp_set_body (gimple gs, gimple_seq body)
}
-/* Return the name associated with OMP_CRITICAL statement GS. */
+/* Return the name associated with OMP_CRITICAL statement CRIT_STMT. */
static inline tree
-gimple_omp_critical_name (const_gimple gs)
+gimple_omp_critical_name (const_gimple_omp_critical crit_stmt)
{
- const gimple_statement_omp_critical *omp_critical_stmt =
- as_a <const gimple_statement_omp_critical *> (gs);
- return omp_critical_stmt->name;
+ return crit_stmt->name;
}
/* Return a pointer to the name associated with OMP critical statement GS. */
static inline tree *
-gimple_omp_critical_name_ptr (gimple gs)
+gimple_omp_critical_name_ptr (gimple_omp_critical crit_stmt)
{
- gimple_statement_omp_critical *omp_critical_stmt =
- as_a <gimple_statement_omp_critical *> (gs);
- return &omp_critical_stmt->name;
+ return &crit_stmt->name;
}
/* Set NAME to be the name associated with OMP critical statement GS. */
static inline void
-gimple_omp_critical_set_name (gimple gs, tree name)
+gimple_omp_critical_set_name (gimple_omp_critical crit_stmt, tree name)
{
- gimple_statement_omp_critical *omp_critical_stmt =
- as_a <gimple_statement_omp_critical *> (gs);
- omp_critical_stmt->name = name;
+ crit_stmt->name = name;
}
diff --git a/gcc/omp-low.c b/gcc/omp-low.c
index 6f3b906..57dfa65 100644
--- a/gcc/omp-low.c
+++ b/gcc/omp-low.c
@@ -2624,16 +2624,20 @@ check_omp_nesting_restrictions (gimple stmt, omp_context *ctx)
}
break;
case GIMPLE_OMP_CRITICAL:
- for (; ctx != NULL; ctx = ctx->outer)
- if (gimple_code (ctx->stmt) == GIMPLE_OMP_CRITICAL
- && (gimple_omp_critical_name (stmt)
- == gimple_omp_critical_name (ctx->stmt)))
- {
- error_at (gimple_location (stmt),
- "critical region may not be nested inside a critical "
- "region with the same name");
- return false;
- }
+ {
+ tree this_stmt_name =
+ gimple_omp_critical_name (as_a <gimple_omp_critical> (stmt));
+ for (; ctx != NULL; ctx = ctx->outer)
+ if (gimple_omp_critical other_crit =
+ dyn_cast <gimple_omp_critical> (ctx->stmt))
+ if (this_stmt_name == gimple_omp_critical_name (other_crit))
+ {
+ error_at (gimple_location (stmt),
+ "critical region may not be nested inside a critical "
+ "region with the same name");
+ return false;
+ }
+ }
break;
case GIMPLE_OMP_TEAMS:
if (ctx == NULL
@@ -9249,7 +9253,7 @@ lower_omp_critical (gimple_stmt_iterator *gsi_p, omp_context *ctx)
{
tree block;
tree name, lock, unlock;
- gimple stmt = gsi_stmt (*gsi_p);
+ gimple_omp_critical stmt = as_a <gimple_omp_critical> (gsi_stmt (*gsi_p));
gimple_bind bind;
location_t loc = gimple_location (stmt);
gimple_seq tbody;
diff --git a/gcc/tree-inline.c b/gcc/tree-inline.c
index beb06a3..b3254e5 100644
--- a/gcc/tree-inline.c
+++ b/gcc/tree-inline.c
@@ -1453,8 +1453,10 @@ remap_gimple_stmt (gimple stmt, copy_body_data *id)
case GIMPLE_OMP_CRITICAL:
s1 = remap_gimple_seq (gimple_omp_body (stmt), id);
- copy
- = gimple_build_omp_critical (s1, gimple_omp_critical_name (stmt));
+ copy =
+ gimple_build_omp_critical (s1,
+ gimple_omp_critical_name (
+ as_a <gimple_omp_critical> (stmt)));
break;
case GIMPLE_TRANSACTION:
--
1.8.5.3
^ permalink raw reply [flat|nested] 93+ messages in thread
* [gimple-classes, committed 56/92] Make gimple_label_set_label require a gimple_label
2014-10-27 20:35 [gimple-classes, committed 00/92] Initial slew of commits David Malcolm
` (65 preceding siblings ...)
2014-10-27 20:54 ` [gimple-classes, committed 47/92] Make add_phi_arg require a gimple_phi David Malcolm
@ 2014-10-27 20:54 ` David Malcolm
2014-10-27 20:55 ` [gimple-classes, committed 46/92] Make gimple_phi_arg_def_ptr and gimple_phi_arg_has_location require a gimple_phi David Malcolm
` (24 subsequent siblings)
91 siblings, 0 replies; 93+ messages in thread
From: David Malcolm @ 2014-10-27 20:54 UTC (permalink / raw)
To: gcc-patches; +Cc: David Malcolm
This corresponds to:
[PATCH 58/89] Make gimple_label_set_label require a gimple_label
https://gcc.gnu.org/ml/gcc-patches/2014-04/msg01164.html
from the original 89-patch kit
That earlier patch was approved by Jeff:
> OK once prerequisites have gone in.
in https://gcc.gnu.org/ml/gcc-patches/2014-05/msg00814.html
gcc/
* gimple.h (gimple_label_set_label): Require a gimple_label.
---
gcc/ChangeLog.gimple-classes | 6 ++++++
gcc/gimple.h | 3 +--
2 files changed, 7 insertions(+), 2 deletions(-)
diff --git a/gcc/ChangeLog.gimple-classes b/gcc/ChangeLog.gimple-classes
index 63e5a8c..2e1ea10 100644
--- a/gcc/ChangeLog.gimple-classes
+++ b/gcc/ChangeLog.gimple-classes
@@ -1,5 +1,11 @@
2014-10-24 David Malcolm <dmalcolm@redhat.com>
+ Make gimple_label_set_label require a gimple_label
+
+ * gimple.h (gimple_label_set_label): Require a gimple_label.
+
+2014-10-24 David Malcolm <dmalcolm@redhat.com>
+
Concretize parameter to gimple_call_copy_skip_args
* gimple.c (gimple_call_copy_skip_args): Require a gimple_call.
diff --git a/gcc/gimple.h b/gcc/gimple.h
index c457bc2..e195dd4 100644
--- a/gcc/gimple.h
+++ b/gcc/gimple.h
@@ -3218,9 +3218,8 @@ gimple_label_label (const_gimple gs)
GS. */
static inline void
-gimple_label_set_label (gimple gs, tree label)
+gimple_label_set_label (gimple_label gs, tree label)
{
- GIMPLE_CHECK (gs, GIMPLE_LABEL);
gimple_set_op (gs, 0, label);
}
--
1.8.5.3
^ permalink raw reply [flat|nested] 93+ messages in thread
* [gimple-classes, committed 12/92] tree-ssa-phiprop.c: use gimple_phi
2014-10-27 20:35 [gimple-classes, committed 00/92] Initial slew of commits David Malcolm
` (63 preceding siblings ...)
2014-10-27 20:54 ` [gimple-classes, committed 11/92] tree-predcom.c: use gimple_phi in various places David Malcolm
@ 2014-10-27 20:54 ` David Malcolm
2014-10-27 20:54 ` [gimple-classes, committed 47/92] Make add_phi_arg require a gimple_phi David Malcolm
` (26 subsequent siblings)
91 siblings, 0 replies; 93+ messages in thread
From: David Malcolm @ 2014-10-27 20:54 UTC (permalink / raw)
To: gcc-patches; +Cc: David Malcolm
This corresponds to:
[PATCH 13/89] tree-ssa-phiprop.c: use gimple_phi
https://gcc.gnu.org/ml/gcc-patches/2014-04/msg01235.html
from the original 89-patch kit
That earlier patch was approved by Jeff:
> OK when prerequisites have gone in.
in https://gcc.gnu.org/ml/gcc-patches/2014-05/msg00622.html
gcc/
* tree-ssa-phiprop.c (phiprop_insert_phi): Strengthen types of
parameter "phi" and local "new_phi" from gimple to gimple_phi.
---
gcc/ChangeLog.gimple-classes | 7 +++++++
gcc/tree-ssa-phiprop.c | 4 ++--
2 files changed, 9 insertions(+), 2 deletions(-)
diff --git a/gcc/ChangeLog.gimple-classes b/gcc/ChangeLog.gimple-classes
index 0e6a5d9..7be584b 100644
--- a/gcc/ChangeLog.gimple-classes
+++ b/gcc/ChangeLog.gimple-classes
@@ -1,5 +1,12 @@
2014-10-24 David Malcolm <dmalcolm@redhat.com>
+ tree-ssa-phiprop.c: use gimple_phi
+
+ * tree-ssa-phiprop.c (phiprop_insert_phi): Strengthen types of
+ parameter "phi" and local "new_phi" from gimple to gimple_phi.
+
+2014-10-24 David Malcolm <dmalcolm@redhat.com>
+
tree-predcom.c: use gimple_phi in various places
* tree-predcom.c (find_looparound_phi): Return a gimple_phi rather
diff --git a/gcc/tree-ssa-phiprop.c b/gcc/tree-ssa-phiprop.c
index 2105c87..a3e53c2 100644
--- a/gcc/tree-ssa-phiprop.c
+++ b/gcc/tree-ssa-phiprop.c
@@ -139,11 +139,11 @@ phivn_valid_p (struct phiprop_d *phivn, tree name, basic_block bb)
BB with the virtual operands from USE_STMT. */
static tree
-phiprop_insert_phi (basic_block bb, gimple phi, gimple use_stmt,
+phiprop_insert_phi (basic_block bb, gimple_phi phi, gimple use_stmt,
struct phiprop_d *phivn, size_t n)
{
tree res;
- gimple new_phi;
+ gimple_phi new_phi;
edge_iterator ei;
edge e;
--
1.8.5.3
^ permalink raw reply [flat|nested] 93+ messages in thread
* [gimple-classes, committed 47/92] Make add_phi_arg require a gimple_phi
2014-10-27 20:35 [gimple-classes, committed 00/92] Initial slew of commits David Malcolm
` (64 preceding siblings ...)
2014-10-27 20:54 ` [gimple-classes, committed 12/92] tree-ssa-phiprop.c: use gimple_phi David Malcolm
@ 2014-10-27 20:54 ` David Malcolm
2014-10-27 20:54 ` [gimple-classes, committed 56/92] Make gimple_label_set_label require a gimple_label David Malcolm
` (25 subsequent siblings)
91 siblings, 0 replies; 93+ messages in thread
From: David Malcolm @ 2014-10-27 20:54 UTC (permalink / raw)
To: gcc-patches; +Cc: David Malcolm
This corresponds to:
[PATCH 49/89] Make add_phi_arg require a gimple_phi
https://gcc.gnu.org/ml/gcc-patches/2014-04/msg01162.html
from the original 89-patch kit
That earlier patch was approved by Jeff:
> Fine once prereqs go in.
in https://gcc.gnu.org/ml/gcc-patches/2014-05/msg00876.html
gcc/
* tree-phinodes.h (add_phi_arg): Require a gimple_phi rather than
a plain gimple.
* tree-phinodes.c (add_phi_arg): Likewise.
* gimple-ssa-strength-reduction.c (create_phi_basis): Strengthen
local "phi" from plain gimple to gimple_phi.
* graphite-scop-detection.c (canonicalize_loop_closed_ssa):
Likewise for "close_phi".
* ipa-split.c (split_function): Convert "psi" to
gimple_phi_iterator.
* omp-low.c (expand_omp_for_static_nochunk): Introduce
gimple_phi_iterator gpi, using it to strengthen "phi" to be a
gimple_phi.
(expand_omp_for_static_chunk): Likewise.
* tree-cfg.c (gimple_duplicate_bb): Make topmost "gsi" decl more
tightly-scoped, and eliminate decls "phis", "phi", "stmt", "copy"
in favor of more tightly-scoped gimple_phi_iterator gpi and
gimple_phi decls "phi" and "copy", and gimple decls "stmt" and
"copy".
* tree-parloops.c (create_parallel_loop): Introduce
gimple_phi_iterator gpi, using it to strengthen "phi" to be a
gimple_phi.
* tree-ssa-loop-im.c (execute_sm_if_changed): Likewise.
* tree-ssa-loop-manip.c (create_iv): Split out new gimple_phi
local "phi" from "stmt", and convert the latter into being a
gimple_assign.
* tree-ssa-pre.c (insert_into_preds_of_block): Strengthen local
"phi" to be a gimple_phi.
* tree-ssa-tail-merge.c (vop_phi): Require a gimple_phi rather
than a plain gimple.
(replace_block_by): Strengthen local "bb2_phi" to be a gimple_phi.
* tree-tailcall.c (add_successor_phi_arg): Use gsi.phi when
invoking add_phi_arg.
(eliminate_tail_call): Introduce gimple_phi_iterator gpi, using it
to strengthen "phi" to be a gimple_phi.
(create_tailcall_accumulator): Strengthen local "phi" to be a
gimple_phi.
(tree_optimize_tail_calls_1): Likewise.
* tree-vect-data-refs.c (vect_setup_realignment): Strengthen
local "phi_stmt" to be a gimple_phi.
* tree-vect-loop-manip.c (slpeel_tree_duplicate_loop_to_edge_cfg):
Strengthen "gsi", "gsi_orig", "gsi_new" to be
gimple_phi_iterators, and "phi" "orig_phi", "new_phi" to be
gimple_phi instances.
(slpeel_tree_peel_loop_to_edge): Strengthen local "new_phi" to be
a gimple_phi.
* tree-vect-loop.c (get_initial_def_for_induction): Likewise for
"induction_phi".
(vect_create_epilog_for_reduction): Add checked casts to
gimple_phi; strengthen local "outer_phi" to gimple_phi and
"new_vec_stmt" to gimple_assign.
(vect_finalize_reduction): Strengthen local "vect_phi" to
gimple_phi.
(vectorizable_reduction): Likewise for "new_phi".
* tree-vect-stmts.c (vectorizable_simd_clone_call): Likewise.
(vectorizable_load): Likewise for "phi".
---
gcc/ChangeLog.gimple-classes | 75 +++++++++++++++++++++++++++++++++++++
gcc/gimple-ssa-strength-reduction.c | 2 +-
gcc/graphite-scop-detection.c | 2 +-
gcc/ipa-split.c | 6 +--
gcc/omp-low.c | 12 +++---
gcc/tree-cfg.c | 16 +++++---
gcc/tree-parloops.c | 5 ++-
gcc/tree-phinodes.c | 2 +-
gcc/tree-phinodes.h | 2 +-
gcc/tree-ssa-loop-im.c | 5 ++-
gcc/tree-ssa-loop-manip.c | 9 +++--
gcc/tree-ssa-pre.c | 2 +-
gcc/tree-ssa-tail-merge.c | 6 +--
gcc/tree-tailcall.c | 15 ++++----
gcc/tree-vect-data-refs.c | 2 +-
gcc/tree-vect-loop-manip.c | 12 +++---
gcc/tree-vect-loop.c | 18 +++++----
gcc/tree-vect-stmts.c | 6 +--
18 files changed, 141 insertions(+), 56 deletions(-)
diff --git a/gcc/ChangeLog.gimple-classes b/gcc/ChangeLog.gimple-classes
index b2ca765..a162b12 100644
--- a/gcc/ChangeLog.gimple-classes
+++ b/gcc/ChangeLog.gimple-classes
@@ -1,5 +1,80 @@
2014-10-24 David Malcolm <dmalcolm@redhat.com>
+ Make add_phi_arg require a gimple_phi
+
+ * tree-phinodes.h (add_phi_arg): Require a gimple_phi rather than
+ a plain gimple.
+ * tree-phinodes.c (add_phi_arg): Likewise.
+
+ * gimple-ssa-strength-reduction.c (create_phi_basis): Strengthen
+ local "phi" from plain gimple to gimple_phi.
+
+ * graphite-scop-detection.c (canonicalize_loop_closed_ssa):
+ Likewise for "close_phi".
+
+ * ipa-split.c (split_function): Convert "psi" to
+ gimple_phi_iterator.
+
+ * omp-low.c (expand_omp_for_static_nochunk): Introduce
+ gimple_phi_iterator gpi, using it to strengthen "phi" to be a
+ gimple_phi.
+ (expand_omp_for_static_chunk): Likewise.
+
+ * tree-cfg.c (gimple_duplicate_bb): Make topmost "gsi" decl more
+ tightly-scoped, and eliminate decls "phis", "phi", "stmt", "copy"
+ in favor of more tightly-scoped gimple_phi_iterator gpi and
+ gimple_phi decls "phi" and "copy", and gimple decls "stmt" and
+ "copy".
+
+ * tree-parloops.c (create_parallel_loop): Introduce
+ gimple_phi_iterator gpi, using it to strengthen "phi" to be a
+ gimple_phi.
+
+ * tree-ssa-loop-im.c (execute_sm_if_changed): Likewise.
+
+ * tree-ssa-loop-manip.c (create_iv): Split out new gimple_phi
+ local "phi" from "stmt", and convert the latter into being a
+ gimple_assign.
+
+ * tree-ssa-pre.c (insert_into_preds_of_block): Strengthen local
+ "phi" to be a gimple_phi.
+
+ * tree-ssa-tail-merge.c (vop_phi): Require a gimple_phi rather
+ than a plain gimple.
+ (replace_block_by): Strengthen local "bb2_phi" to be a gimple_phi.
+
+ * tree-tailcall.c (add_successor_phi_arg): Use gsi.phi when
+ invoking add_phi_arg.
+ (eliminate_tail_call): Introduce gimple_phi_iterator gpi, using it
+ to strengthen "phi" to be a gimple_phi.
+ (create_tailcall_accumulator): Strengthen local "phi" to be a
+ gimple_phi.
+ (tree_optimize_tail_calls_1): Likewise.
+
+ * tree-vect-data-refs.c (vect_setup_realignment): Strengthen
+ local "phi_stmt" to be a gimple_phi.
+
+ * tree-vect-loop-manip.c (slpeel_tree_duplicate_loop_to_edge_cfg):
+ Strengthen "gsi", "gsi_orig", "gsi_new" to be
+ gimple_phi_iterators, and "phi" "orig_phi", "new_phi" to be
+ gimple_phi instances.
+ (slpeel_tree_peel_loop_to_edge): Strengthen local "new_phi" to be
+ a gimple_phi.
+
+ * tree-vect-loop.c (get_initial_def_for_induction): Likewise for
+ "induction_phi".
+ (vect_create_epilog_for_reduction): Add checked casts to
+ gimple_phi; strengthen local "outer_phi" to gimple_phi and
+ "new_vec_stmt" to gimple_assign.
+ (vect_finalize_reduction): Strengthen local "vect_phi" to
+ gimple_phi.
+ (vectorizable_reduction): Likewise for "new_phi".
+
+ * tree-vect-stmts.c (vectorizable_simd_clone_call): Likewise.
+ (vectorizable_load): Likewise for "phi".
+
+2014-10-24 David Malcolm <dmalcolm@redhat.com>
+
Make gimple_phi_arg_def_ptr and gimple_phi_arg_has_location require a gimple_phi
* gimple.h (gimple_phi_arg_def_ptr): Require a gimple_phi rather
diff --git a/gcc/gimple-ssa-strength-reduction.c b/gcc/gimple-ssa-strength-reduction.c
index 2358bda..4b4c213 100644
--- a/gcc/gimple-ssa-strength-reduction.c
+++ b/gcc/gimple-ssa-strength-reduction.c
@@ -2235,7 +2235,7 @@ create_phi_basis (slsr_cand_t c, gimple from_phi, tree basis_name,
{
int i;
tree name, phi_arg;
- gimple phi;
+ gimple_phi phi;
vec<tree> phi_args;
slsr_cand_t basis = lookup_cand (c->basis);
int nargs = gimple_phi_num_args (from_phi);
diff --git a/gcc/graphite-scop-detection.c b/gcc/graphite-scop-detection.c
index 53823b8..40ccad0 100644
--- a/gcc/graphite-scop-detection.c
+++ b/gcc/graphite-scop-detection.c
@@ -1353,7 +1353,7 @@ canonicalize_loop_closed_ssa (loop_p loop)
{
tree res, arg = gimple_phi_arg_def (phi, i);
use_operand_p use_p;
- gimple close_phi;
+ gimple_phi close_phi;
if (TREE_CODE (arg) != SSA_NAME)
continue;
diff --git a/gcc/ipa-split.c b/gcc/ipa-split.c
index 9c02f96..94a0337 100644
--- a/gcc/ipa-split.c
+++ b/gcc/ipa-split.c
@@ -1415,7 +1415,7 @@ split_function (struct split_point *split_point)
if (real_retval && split_point->split_part_set_retval)
{
- gimple_stmt_iterator psi;
+ gimple_phi_iterator psi;
/* See if we need new SSA_NAME for the result.
When DECL_BY_REFERENCE is true, retval is actually pointer to
@@ -1428,13 +1428,13 @@ split_function (struct split_point *split_point)
/* See if there is PHI defining return value. */
for (psi = gsi_start_phis (return_bb);
!gsi_end_p (psi); gsi_next (&psi))
- if (!virtual_operand_p (gimple_phi_result (gsi_stmt (psi))))
+ if (!virtual_operand_p (gimple_phi_result (psi.phi ())))
break;
/* When there is PHI, just update its value. */
if (TREE_CODE (retval) == SSA_NAME
&& !gsi_end_p (psi))
- add_phi_arg (gsi_stmt (psi), retval, e, UNKNOWN_LOCATION);
+ add_phi_arg (psi.phi (), retval, e, UNKNOWN_LOCATION);
/* Otherwise update the return BB itself.
find_return_bb allows at most one assignment to return value,
so update first statement. */
diff --git a/gcc/omp-low.c b/gcc/omp-low.c
index 720a885..327c6e1 100644
--- a/gcc/omp-low.c
+++ b/gcc/omp-low.c
@@ -6108,10 +6108,10 @@ expand_omp_for_static_nochunk (struct omp_region *region,
if (gimple_in_ssa_p (cfun))
{
int dest_idx = find_edge (entry_bb, fin_bb)->dest_idx;
- for (gsi = gsi_start_phis (fin_bb);
- !gsi_end_p (gsi); gsi_next (&gsi))
+ for (gimple_phi_iterator gpi = gsi_start_phis (fin_bb);
+ !gsi_end_p (gpi); gsi_next (&gpi))
{
- gimple phi = gsi_stmt (gsi);
+ gimple_phi phi = gpi.phi ();
add_phi_arg (phi, gimple_phi_arg_def (phi, dest_idx),
ep, UNKNOWN_LOCATION);
}
@@ -6490,10 +6490,10 @@ expand_omp_for_static_chunk (struct omp_region *region,
if (gimple_in_ssa_p (cfun))
{
int dest_idx = find_edge (entry_bb, fin_bb)->dest_idx;
- for (gsi = gsi_start_phis (fin_bb);
- !gsi_end_p (gsi); gsi_next (&gsi))
+ for (gimple_phi_iterator gpi = gsi_start_phis (fin_bb);
+ !gsi_end_p (gpi); gsi_next (&gpi))
{
- gimple phi = gsi_stmt (gsi);
+ gimple_phi phi = gpi.phi ();
add_phi_arg (phi, gimple_phi_arg_def (phi, dest_idx),
se, UNKNOWN_LOCATION);
}
diff --git a/gcc/tree-cfg.c b/gcc/tree-cfg.c
index 479989f..038e3ef 100644
--- a/gcc/tree-cfg.c
+++ b/gcc/tree-cfg.c
@@ -5756,17 +5756,18 @@ static basic_block
gimple_duplicate_bb (basic_block bb)
{
basic_block new_bb;
- gimple_stmt_iterator gsi, gsi_tgt;
- gimple_seq phis = phi_nodes (bb);
- gimple phi, stmt, copy;
+ gimple_stmt_iterator gsi_tgt;
new_bb = create_empty_bb (EXIT_BLOCK_PTR_FOR_FN (cfun)->prev_bb);
/* Copy the PHI nodes. We ignore PHI node arguments here because
the incoming edges have not been setup yet. */
- for (gsi = gsi_start (phis); !gsi_end_p (gsi); gsi_next (&gsi))
+ for (gimple_phi_iterator gpi = gsi_start_phis (bb);
+ !gsi_end_p (gpi);
+ gsi_next (&gpi))
{
- phi = gsi_stmt (gsi);
+ gimple_phi phi, copy;
+ phi = gpi.phi ();
copy = create_phi_node (NULL_TREE, new_bb);
create_new_def_for (gimple_phi_result (phi), copy,
gimple_phi_result_ptr (copy));
@@ -5774,11 +5775,14 @@ gimple_duplicate_bb (basic_block bb)
}
gsi_tgt = gsi_start_bb (new_bb);
- for (gsi = gsi_start_bb (bb); !gsi_end_p (gsi); gsi_next (&gsi))
+ for (gimple_stmt_iterator gsi = gsi_start_bb (bb);
+ !gsi_end_p (gsi);
+ gsi_next (&gsi))
{
def_operand_p def_p;
ssa_op_iter op_iter;
tree lhs;
+ gimple stmt, copy;
stmt = gsi_stmt (gsi);
if (gimple_code (stmt) == GIMPLE_LABEL)
diff --git a/gcc/tree-parloops.c b/gcc/tree-parloops.c
index fbb74a9..dcfd7fe 100644
--- a/gcc/tree-parloops.c
+++ b/gcc/tree-parloops.c
@@ -1673,11 +1673,12 @@ create_parallel_loop (struct loop *loop, tree loop_fn, tree data,
guard = make_edge (for_bb, ex_bb, 0);
single_succ_edge (loop->latch)->flags = 0;
end = make_edge (loop->latch, ex_bb, EDGE_FALLTHRU);
- for (gsi = gsi_start_phis (ex_bb); !gsi_end_p (gsi); gsi_next (&gsi))
+ for (gimple_phi_iterator gpi = gsi_start_phis (ex_bb);
+ !gsi_end_p (gpi); gsi_next (&gpi))
{
source_location locus;
tree def;
- phi = gsi_stmt (gsi);
+ gimple_phi phi = gpi.phi ();
stmt = SSA_NAME_DEF_STMT (PHI_ARG_DEF_FROM_EDGE (phi, exit));
def = PHI_ARG_DEF_FROM_EDGE (stmt, loop_preheader_edge (loop));
diff --git a/gcc/tree-phinodes.c b/gcc/tree-phinodes.c
index d15d3b4..4f86090 100644
--- a/gcc/tree-phinodes.c
+++ b/gcc/tree-phinodes.c
@@ -362,7 +362,7 @@ create_phi_node (tree var, basic_block bb)
PHI points to the reallocated phi node when we return. */
void
-add_phi_arg (gimple phi, tree def, edge e, source_location locus)
+add_phi_arg (gimple_phi phi, tree def, edge e, source_location locus)
{
basic_block bb = e->dest;
diff --git a/gcc/tree-phinodes.h b/gcc/tree-phinodes.h
index fe8b32d..dcde99e 100644
--- a/gcc/tree-phinodes.h
+++ b/gcc/tree-phinodes.h
@@ -25,7 +25,7 @@ extern void release_phi_node (gimple);
extern void reserve_phi_args_for_new_edge (basic_block);
extern void add_phi_node_to_bb (gimple_phi phi, basic_block bb);
extern gimple_phi create_phi_node (tree, basic_block);
-extern void add_phi_arg (gimple, tree, edge, source_location);
+extern void add_phi_arg (gimple_phi, tree, edge, source_location);
extern void remove_phi_args (edge);
extern void remove_phi_node (gimple_stmt_iterator *, bool);
extern void remove_phi_nodes (basic_block);
diff --git a/gcc/tree-ssa-loop-im.c b/gcc/tree-ssa-loop-im.c
index 92b4c7c..8ee47fc 100644
--- a/gcc/tree-ssa-loop-im.c
+++ b/gcc/tree-ssa-loop-im.c
@@ -1878,9 +1878,10 @@ execute_sm_if_changed (edge ex, tree mem, tree tmp_var, tree flag)
}
if (!loop_has_only_one_exit)
- for (gsi = gsi_start_phis (old_dest); !gsi_end_p (gsi); gsi_next (&gsi))
+ for (gimple_phi_iterator gpi = gsi_start_phis (old_dest);
+ !gsi_end_p (gpi); gsi_next (&gpi))
{
- gimple phi = gsi_stmt (gsi);
+ gimple_phi phi = gpi.phi ();
unsigned i;
for (i = 0; i < gimple_phi_num_args (phi); i++)
diff --git a/gcc/tree-ssa-loop-manip.c b/gcc/tree-ssa-loop-manip.c
index b73a9a5..9bd1a3b 100644
--- a/gcc/tree-ssa-loop-manip.c
+++ b/gcc/tree-ssa-loop-manip.c
@@ -71,7 +71,8 @@ create_iv (tree base, tree step, tree var, struct loop *loop,
gimple_stmt_iterator *incr_pos, bool after,
tree *var_before, tree *var_after)
{
- gimple stmt;
+ gimple_assign stmt;
+ gimple_phi phi;
tree initial, step1;
gimple_seq stmts;
tree vb, va;
@@ -143,9 +144,9 @@ create_iv (tree base, tree step, tree var, struct loop *loop,
if (stmts)
gsi_insert_seq_on_edge_immediate (pe, stmts);
- stmt = create_phi_node (vb, loop->header);
- add_phi_arg (stmt, initial, loop_preheader_edge (loop), UNKNOWN_LOCATION);
- add_phi_arg (stmt, va, loop_latch_edge (loop), UNKNOWN_LOCATION);
+ phi = create_phi_node (vb, loop->header);
+ add_phi_arg (phi, initial, loop_preheader_edge (loop), UNKNOWN_LOCATION);
+ add_phi_arg (phi, va, loop_latch_edge (loop), UNKNOWN_LOCATION);
}
/* Return the innermost superloop LOOP of USE_LOOP that is a superloop of
diff --git a/gcc/tree-ssa-pre.c b/gcc/tree-ssa-pre.c
index cf955b8..a9bacff 100644
--- a/gcc/tree-ssa-pre.c
+++ b/gcc/tree-ssa-pre.c
@@ -2964,7 +2964,7 @@ insert_into_preds_of_block (basic_block block, unsigned int exprnum,
edge_iterator ei;
tree type = get_expr_type (expr);
tree temp;
- gimple phi;
+ gimple_phi phi;
/* Make sure we aren't creating an induction variable. */
if (bb_loop_depth (block) > 0 && EDGE_COUNT (block->preds) == 2)
diff --git a/gcc/tree-ssa-tail-merge.c b/gcc/tree-ssa-tail-merge.c
index 521378e..a98fc90 100644
--- a/gcc/tree-ssa-tail-merge.c
+++ b/gcc/tree-ssa-tail-merge.c
@@ -1466,10 +1466,10 @@ find_clusters (void)
/* Returns the vop phi of BB, if any. */
-static gimple
+static gimple_phi
vop_phi (basic_block bb)
{
- gimple stmt;
+ gimple_phi stmt;
gimple_phi_iterator gsi;
for (gsi = gsi_start_phis (bb); !gsi_end_p (gsi); gsi_next (&gsi))
{
@@ -1490,7 +1490,7 @@ replace_block_by (basic_block bb1, basic_block bb2)
edge e1, e2;
edge_iterator ei;
unsigned int i;
- gimple bb2_phi;
+ gimple_phi bb2_phi;
bb2_phi = vop_phi (bb2);
diff --git a/gcc/tree-tailcall.c b/gcc/tree-tailcall.c
index bfe5b24..5a1763c 100644
--- a/gcc/tree-tailcall.c
+++ b/gcc/tree-tailcall.c
@@ -628,7 +628,7 @@ add_successor_phi_arg (edge e, tree var, tree phi_arg)
break;
gcc_assert (!gsi_end_p (gsi));
- add_phi_arg (gsi_stmt (gsi), phi_arg, e, UNKNOWN_LOCATION);
+ add_phi_arg (gsi.phi (), phi_arg, e, UNKNOWN_LOCATION);
}
/* Creates a GIMPLE statement which computes the operation specified by
@@ -821,7 +821,8 @@ eliminate_tail_call (struct tailcall *t)
size_t idx;
basic_block bb, first;
edge e;
- gimple phi;
+ gimple_phi phi;
+ gimple_phi_iterator gpi;
gimple_stmt_iterator gsi;
gimple orig_stmt;
@@ -874,7 +875,7 @@ eliminate_tail_call (struct tailcall *t)
/* Add phi node entries for arguments. The ordering of the phi nodes should
be the same as the ordering of the arguments. */
for (param = DECL_ARGUMENTS (current_function_decl),
- idx = 0, gsi = gsi_start_phis (first);
+ idx = 0, gpi = gsi_start_phis (first);
param;
param = DECL_CHAIN (param), idx++)
{
@@ -882,11 +883,11 @@ eliminate_tail_call (struct tailcall *t)
continue;
arg = gimple_call_arg (stmt, idx);
- phi = gsi_stmt (gsi);
+ phi = gpi.phi ();
gcc_assert (param == SSA_NAME_VAR (PHI_RESULT (phi)));
add_phi_arg (phi, arg, e, gimple_location (stmt));
- gsi_next (&gsi);
+ gsi_next (&gpi);
}
/* Update the values of accumulators. */
@@ -948,7 +949,7 @@ create_tailcall_accumulator (const char *label, basic_block bb, tree init)
ret_type = sizetype;
tree tmp = make_temp_ssa_name (ret_type, NULL, label);
- gimple phi;
+ gimple_phi phi;
phi = create_phi_node (tmp, bb);
/* RET_TYPE can be a float when -ffast-maths is enabled. */
@@ -1012,7 +1013,7 @@ tree_optimize_tail_calls_1 (bool opt_tailcalls)
{
tree name = ssa_default_def (cfun, param);
tree new_name = make_ssa_name (param, SSA_NAME_DEF_STMT (name));
- gimple phi;
+ gimple_phi phi;
set_ssa_default_def (cfun, param, new_name);
phi = create_phi_node (name, first);
diff --git a/gcc/tree-vect-data-refs.c b/gcc/tree-vect-data-refs.c
index 5140992..5982487 100644
--- a/gcc/tree-vect-data-refs.c
+++ b/gcc/tree-vect-data-refs.c
@@ -4772,7 +4772,7 @@ vect_setup_realignment (gimple stmt, gimple_stmt_iterator *gsi,
basic_block new_bb;
tree msq_init = NULL_TREE;
tree new_temp;
- gimple phi_stmt;
+ gimple_phi phi_stmt;
tree msq = NULL_TREE;
gimple_seq stmts = NULL;
bool inv_p;
diff --git a/gcc/tree-vect-loop-manip.c b/gcc/tree-vect-loop-manip.c
index 2aa3720..95c00fa 100644
--- a/gcc/tree-vect-loop-manip.c
+++ b/gcc/tree-vect-loop-manip.c
@@ -820,13 +820,13 @@ slpeel_tree_duplicate_loop_to_edge_cfg (struct loop *loop,
{
if (scalar_loop != loop)
{
- gimple_stmt_iterator gsi;
+ gimple_phi_iterator gsi;
new_exit = redirect_edge_and_branch (new_exit, exit_dest);
for (gsi = gsi_start_phis (exit_dest); !gsi_end_p (gsi);
gsi_next (&gsi))
{
- gimple phi = gsi_stmt (gsi);
+ gimple_phi phi = gsi.phi ();
tree orig_arg = PHI_ARG_DEF_FROM_EDGE (phi, e);
location_t orig_locus
= gimple_phi_arg_location_from_edge (phi, e);
@@ -886,7 +886,7 @@ slpeel_tree_duplicate_loop_to_edge_cfg (struct loop *loop,
{
/* Update new_loop->header PHIs, so that on the preheader
edge they are the ones from loop rather than scalar_loop. */
- gimple_stmt_iterator gsi_orig, gsi_new;
+ gimple_phi_iterator gsi_orig, gsi_new;
edge orig_e = loop_preheader_edge (loop);
edge new_e = loop_preheader_edge (new_loop);
@@ -895,8 +895,8 @@ slpeel_tree_duplicate_loop_to_edge_cfg (struct loop *loop,
!gsi_end_p (gsi_orig) && !gsi_end_p (gsi_new);
gsi_next (&gsi_orig), gsi_next (&gsi_new))
{
- gimple orig_phi = gsi_stmt (gsi_orig);
- gimple new_phi = gsi_stmt (gsi_new);
+ gimple_phi orig_phi = gsi_orig.phi ();
+ gimple_phi new_phi = gsi_new.phi ();
tree orig_arg = PHI_ARG_DEF_FROM_EDGE (orig_phi, orig_e);
location_t orig_locus
= gimple_phi_arg_location_from_edge (orig_phi, orig_e);
@@ -1213,7 +1213,7 @@ slpeel_tree_peel_loop_to_edge (struct loop *loop, struct loop *scalar_loop,
if (gsi_end_p (gsi))
{
tree new_vop = copy_ssa_name (PHI_RESULT (phi), NULL);
- gimple new_phi = create_phi_node (new_vop, exit_e->dest);
+ gimple_phi new_phi = create_phi_node (new_vop, exit_e->dest);
tree vop = PHI_ARG_DEF_FROM_EDGE (phi, EDGE_SUCC (loop->latch, 0));
imm_use_iterator imm_iter;
gimple stmt;
diff --git a/gcc/tree-vect-loop.c b/gcc/tree-vect-loop.c
index 560143e..19535b3 100644
--- a/gcc/tree-vect-loop.c
+++ b/gcc/tree-vect-loop.c
@@ -3258,7 +3258,8 @@ get_initial_def_for_induction (gimple iv_phi)
tree new_vec, vec_init, vec_step, t;
tree new_var;
tree new_name;
- gimple init_stmt, induction_phi, new_stmt;
+ gimple init_stmt, new_stmt;
+ gimple_phi induction_phi;
tree induc_def, vec_def, vec_dest;
tree init_expr, step_expr;
int vf = LOOP_VINFO_VECT_FACTOR (loop_vinfo);
@@ -3964,14 +3965,15 @@ vect_create_epilog_for_reduction (vec<tree> vect_defs, gimple stmt,
for (j = 0; j < ncopies; j++)
{
/* Set the loop-entry arg of the reduction-phi. */
- add_phi_arg (phi, vec_init_def, loop_preheader_edge (loop),
- UNKNOWN_LOCATION);
+ add_phi_arg (as_a <gimple_phi> (phi), vec_init_def,
+ loop_preheader_edge (loop), UNKNOWN_LOCATION);
/* Set the loop-latch arg for the reduction-phi. */
if (j > 0)
def = vect_get_vec_def_for_stmt_copy (vect_unknown_def_type, def);
- add_phi_arg (phi, def, loop_latch_edge (loop), UNKNOWN_LOCATION);
+ add_phi_arg (as_a <gimple_phi> (phi), def, loop_latch_edge (loop),
+ UNKNOWN_LOCATION);
if (dump_enabled_p ())
{
@@ -4051,7 +4053,7 @@ vect_create_epilog_for_reduction (vec<tree> vect_defs, gimple stmt,
FOR_EACH_VEC_ELT (new_phis, i, phi)
{
tree new_result = copy_ssa_name (PHI_RESULT (phi), NULL);
- gimple outer_phi = create_phi_node (new_result, exit_bb);
+ gimple_phi outer_phi = create_phi_node (new_result, exit_bb);
SET_PHI_ARG_DEF (outer_phi, single_exit (loop)->dest_idx,
PHI_RESULT (phi));
set_vinfo_for_stmt (outer_phi, new_stmt_vec_info (outer_phi,
@@ -4138,7 +4140,7 @@ vect_create_epilog_for_reduction (vec<tree> vect_defs, gimple stmt,
{
tree first_vect = PHI_RESULT (new_phis[0]);
tree tmp;
- gimple new_vec_stmt = NULL;
+ gimple_assign new_vec_stmt = NULL;
vec_dest = vect_create_destination_var (scalar_dest, vectype);
for (k = 1; k < new_phis.length (); k++)
@@ -4514,7 +4516,7 @@ vect_finalize_reduction:
if (outer_loop)
{
stmt_vec_info exit_phi_vinfo = vinfo_for_stmt (exit_phi);
- gimple vect_phi;
+ gimple_phi vect_phi;
/* FORNOW. Currently not supporting the case that an inner-loop
reduction is not used in the outer-loop (but only outside the
@@ -4729,7 +4731,7 @@ vectorizable_reduction (gimple stmt, gimple_stmt_iterator *gsi,
tree def;
gimple def_stmt;
enum vect_def_type dt;
- gimple new_phi = NULL;
+ gimple_phi new_phi = NULL;
tree scalar_type;
bool is_simple_use;
gimple orig_stmt;
diff --git a/gcc/tree-vect-stmts.c b/gcc/tree-vect-stmts.c
index 1797118..a301775 100644
--- a/gcc/tree-vect-stmts.c
+++ b/gcc/tree-vect-stmts.c
@@ -2985,7 +2985,7 @@ vectorizable_simd_clone_call (gimple stmt, gimple_stmt_iterator *gsi,
gcc_assert (!new_bb);
}
tree phi_res = copy_ssa_name (op, NULL);
- gimple new_phi = create_phi_node (phi_res, loop->header);
+ gimple_phi new_phi = create_phi_node (phi_res, loop->header);
set_vinfo_for_stmt (new_phi,
new_stmt_vec_info (new_phi, loop_vinfo,
NULL));
@@ -5604,7 +5604,7 @@ vectorizable_load (gimple stmt, gimple_stmt_iterator *gsi, gimple *vec_stmt,
tree offset = NULL_TREE;
tree byte_offset = NULL_TREE;
tree realignment_token = NULL_TREE;
- gimple phi = NULL;
+ gimple_phi phi = NULL;
vec<tree> dr_chain = vNULL;
bool grouped_load = false;
bool load_lanes_p = false;
@@ -6263,7 +6263,7 @@ vectorizable_load (gimple stmt, gimple_stmt_iterator *gsi, gimple *vec_stmt,
&at_loop);
if (alignment_support_scheme == dr_explicit_realign_optimized)
{
- phi = SSA_NAME_DEF_STMT (msq);
+ phi = as_a <gimple_phi> (SSA_NAME_DEF_STMT (msq));
byte_offset = size_binop (MINUS_EXPR, TYPE_SIZE_UNIT (vectype),
size_one_node);
}
--
1.8.5.3
^ permalink raw reply [flat|nested] 93+ messages in thread
* [gimple-classes, committed 21/92] Introduce gimple_asm
2014-10-27 20:35 [gimple-classes, committed 00/92] Initial slew of commits David Malcolm
` (59 preceding siblings ...)
2014-10-27 20:53 ` [gimple-classes, committed 60/92] Concretize gimple_label_label David Malcolm
@ 2014-10-27 20:54 ` David Malcolm
2014-10-27 20:54 ` [gimple-classes, committed 67/92] Make gimple_cond_set_{true|false}_label require gimple_cond David Malcolm
` (30 subsequent siblings)
91 siblings, 0 replies; 93+ messages in thread
From: David Malcolm @ 2014-10-27 20:54 UTC (permalink / raw)
To: gcc-patches; +Cc: David Malcolm
This corresponds to:
[PATCH 23/89] Introduce gimple_asm
https://gcc.gnu.org/ml/gcc-patches/2014-04/msg01234.html
from the original 89-patch kit
That earlier patch was approved by Jeff:
> OK after fixing up the naming/const stuff as discussed for prior
> patches.
> That applies to 22-30. Make sure to take care of
> the pretty printers per Trevor's comments as well. He indicated those
> were missing in a couple of those patches.
in https://gcc.gnu.org/ml/gcc-patches/2014-05/msg00628.html
gcc/
* coretypes.h (gimple_asm): New typedef.
(const_gimple_asm): New typedef.
* gimple.h (gimple_build_asm_vec): Return a gimple_asm rather than
just a gimple.
(gimple_asm_clobbers_memory_p): Require a const_gimple_asm rather
than just a const_gimple.
(gimple_asm_ninputs): Likewise.
(gimple_asm_noutputs): Likewise.
(gimple_asm_nclobbers): Likewise.
(gimple_asm_nlabels): Likewise.
(gimple_asm_input_op): Likewise.
(gimple_asm_input_op_ptr): Likewise.
(gimple_asm_output_op): Likewise.
(gimple_asm_output_op_ptr): Likewise.
(gimple_asm_clobber_op): Likewise.
(gimple_asm_label_op): Likewise.
(gimple_asm_string): Likewise.
(gimple_asm_volatile_p): Likewise.
(gimple_asm_input_p): Likewise.
(gimple_asm_set_input_op): Require a gimple_asm rather than a plain
gimple.
(gimple_asm_set_output_op): Likewise.
(gimple_asm_set_clobber_op): Likewise.
(gimple_asm_set_label_op): Likewise.
(gimple_asm_set_volatile): Likewise.
(gimple_asm_set_input): Likewise.
* cfgexpand.c (expand_asm_stmt): Require a gimple_asm rather than
a plain gimple.
(expand_gimple_stmt_1): Add checked cast to gimple_asm within
GIMPLE_ASM case of switch statement.
* gimple-fold.c (fold_stmt_1): Add new local from checked cast to
gimple_asm within case GIMPLE_ASM.
* gimple-pretty-print.c (dump_gimple_asm): Require a gimple_asm
rather than a plain gimple.
(pp_gimple_stmt_1): Add checked cast to gimple_asm within
GIMPLE_ASM case of switch statement.
* gimple-streamer-in.c (input_gimple_stmt): Rework existing
checked cast to gimple_asm; add a new one.
* gimple-streamer-out.c (output_gimple_stmt): Add new local from
checked cast to gimple_asm within case GIMPLE_ASM.
* gimple-walk.c (walk_gimple_asm): Require a gimple_asm rather
than a plain gimple.
(walk_gimple_op): Add checked cast to gimple_asm within GIMPLE_ASM
case of switch statement.
(walk_stmt_load_store_addr_ops): Use dyn_cast<gimple_asm> in place
of a code check against GIMPLE_ASM to introduce a new gimple_asm
local.
* gimple.c (gimple_build_asm_1): Return a gimple_asm rather than
a plain gimple.
(gimple_build_asm_vec): Likewise.
(gimple_has_side_effects): Add a checked cast to gimple_asm.
(gimple_could_trap_p_1): Likewise.
(gimple_call_builtin_p): Require a const_gimple_asm rather then
a const_gimple.
* gimplify-me.c (gimple_regimplify_operands): Add a checked cast
and a new local of type gimple_asm within GIMPLE_ASM case.
* gimplify.c (gimplify_asm_expr): Convert a local from gimple to
gimple_asm.
* ipa-pure-const.c (check_stmt): Add checked casts within
GIMPLE_ASM case.
* ssa-iterators.h (op_iter_init): Likewise.
* tree-cfg.c (make_goto_expr_edges): Convert a local from gimple
to gimple_asm.
(cleanup_dead_labels): Add a checked cast and a new local of type
gimple_asm within GIMPLE_ASM case.
(gimple_redirect_edge_and_branch): Likewise.
(is_ctrl_altering_stmt): Add a checked cast.
(need_fake_edge_p): Replace a code check against GIMPLE_ASM with a
dyn_cast<gimple_asm>.
* tree-complex.c (expand_complex_comparison): Convert a local from
gimple to gimple_asm.
* tree-data-ref.c (get_references_in_stmt): Add a checked cast to
gimple_asm.
* tree-eh.c (stmt_could_throw_p): Likewise.
* tree-inline.c (estimate_num_insns): Likewise.
* tree-sra.c (scan_function): Add a checked cast and a new local
of type gimple_asm within GIMPLE_ASM case.
(sra_modify_function_body): Likewise.
(ipa_sra_modify_function_body): Likewise.
* tree-ssa-coalesce.c (create_outofssa_var_map): Likewise.
* tree-ssa-dce.c (propagate_necessity): Replace a code check
against GIMPLE_ASM with a dyn_cast<gimple_asm>.
* tree-ssa-operands.c (maybe_add_call_vops): Require a gimple_asm
rather than a plain gimple.
(parse_ssa_operands): Add a checked cast to gimple_asm.
* tree-ssa-structalias.c (find_func_aliases): Replace a check for
GIMPLE_ASM with a dyn_cast<gimple_asm>, introducing a new local
"asm_stmt", using it in place of "t" for typesafety.
* tree-ssa-threadedge.c
(record_temporary_equivalences_from_stmts_at_dest): Add a checked
cast to gimple_asm.
* tree-ssa.c (execute_update_addresses_taken): Add checked casts
and new locals of type gimple_asm within clauses guarded by code
check.
---
gcc/ChangeLog.gimple-classes | 123 ++++++++++++++++++++++++++++++++++++
gcc/cfgexpand.c | 4 +-
gcc/coretypes.h | 4 ++
gcc/gimple-fold.c | 20 +++---
gcc/gimple-pretty-print.c | 4 +-
gcc/gimple-streamer-in.c | 5 +-
gcc/gimple-streamer-out.c | 15 +++--
gcc/gimple-walk.c | 16 ++---
gcc/gimple.c | 14 ++---
gcc/gimple.h | 146 +++++++++++++++++--------------------------
gcc/gimplify-me.c | 9 +--
gcc/gimplify.c | 2 +-
gcc/ipa-pure-const.c | 4 +-
gcc/ssa-iterators.h | 2 +-
gcc/tree-cfg.c | 20 +++---
gcc/tree-complex.c | 2 +-
gcc/tree-data-ref.c | 3 +-
gcc/tree-eh.c | 2 +-
gcc/tree-inline.c | 3 +-
gcc/tree-sra.c | 77 +++++++++++++----------
gcc/tree-ssa-coalesce.c | 9 +--
gcc/tree-ssa-dce.c | 6 +-
gcc/tree-ssa-operands.c | 4 +-
gcc/tree-ssa-structalias.c | 10 +--
gcc/tree-ssa-threadedge.c | 3 +-
gcc/tree-ssa.c | 18 +++---
26 files changed, 323 insertions(+), 202 deletions(-)
diff --git a/gcc/ChangeLog.gimple-classes b/gcc/ChangeLog.gimple-classes
index bba6c7d..bd88371 100644
--- a/gcc/ChangeLog.gimple-classes
+++ b/gcc/ChangeLog.gimple-classes
@@ -1,5 +1,128 @@
2014-10-24 David Malcolm <dmalcolm@redhat.com>
+ Introduce gimple_asm
+
+ * coretypes.h (gimple_asm): New typedef.
+ (const_gimple_asm): New typedef.
+
+ * gimple.h (gimple_build_asm_vec): Return a gimple_asm rather than
+ just a gimple.
+ (gimple_asm_clobbers_memory_p): Require a const_gimple_asm rather
+ than just a const_gimple.
+ (gimple_asm_ninputs): Likewise.
+ (gimple_asm_noutputs): Likewise.
+ (gimple_asm_nclobbers): Likewise.
+ (gimple_asm_nlabels): Likewise.
+ (gimple_asm_input_op): Likewise.
+ (gimple_asm_input_op_ptr): Likewise.
+ (gimple_asm_output_op): Likewise.
+ (gimple_asm_output_op_ptr): Likewise.
+ (gimple_asm_clobber_op): Likewise.
+ (gimple_asm_label_op): Likewise.
+ (gimple_asm_string): Likewise.
+ (gimple_asm_volatile_p): Likewise.
+ (gimple_asm_input_p): Likewise.
+ (gimple_asm_set_input_op): Require a gimple_asm rather than a plain
+ gimple.
+ (gimple_asm_set_output_op): Likewise.
+ (gimple_asm_set_clobber_op): Likewise.
+ (gimple_asm_set_label_op): Likewise.
+ (gimple_asm_set_volatile): Likewise.
+ (gimple_asm_set_input): Likewise.
+
+ * cfgexpand.c (expand_asm_stmt): Require a gimple_asm rather than
+ a plain gimple.
+ (expand_gimple_stmt_1): Add checked cast to gimple_asm within
+ GIMPLE_ASM case of switch statement.
+
+ * gimple-fold.c (fold_stmt_1): Add new local from checked cast to
+ gimple_asm within case GIMPLE_ASM.
+
+ * gimple-pretty-print.c (dump_gimple_asm): Require a gimple_asm
+ rather than a plain gimple.
+ (pp_gimple_stmt_1): Add checked cast to gimple_asm within
+ GIMPLE_ASM case of switch statement.
+
+ * gimple-streamer-in.c (input_gimple_stmt): Rework existing
+ checked cast to gimple_asm; add a new one.
+
+ * gimple-streamer-out.c (output_gimple_stmt): Add new local from
+ checked cast to gimple_asm within case GIMPLE_ASM.
+
+ * gimple-walk.c (walk_gimple_asm): Require a gimple_asm rather
+ than a plain gimple.
+ (walk_gimple_op): Add checked cast to gimple_asm within GIMPLE_ASM
+ case of switch statement.
+ (walk_stmt_load_store_addr_ops): Use dyn_cast<gimple_asm> in place
+ of a code check against GIMPLE_ASM to introduce a new gimple_asm
+ local.
+
+ * gimple.c (gimple_build_asm_1): Return a gimple_asm rather than
+ a plain gimple.
+ (gimple_build_asm_vec): Likewise.
+ (gimple_has_side_effects): Add a checked cast to gimple_asm.
+ (gimple_could_trap_p_1): Likewise.
+ (gimple_call_builtin_p): Require a const_gimple_asm rather then
+ a const_gimple.
+
+ * gimplify-me.c (gimple_regimplify_operands): Add a checked cast
+ and a new local of type gimple_asm within GIMPLE_ASM case.
+
+ * gimplify.c (gimplify_asm_expr): Convert a local from gimple to
+ gimple_asm.
+
+ * ipa-pure-const.c (check_stmt): Add checked casts within
+ GIMPLE_ASM case.
+
+ * ssa-iterators.h (op_iter_init): Likewise.
+
+ * tree-cfg.c (make_goto_expr_edges): Convert a local from gimple
+ to gimple_asm.
+ (cleanup_dead_labels): Add a checked cast and a new local of type
+ gimple_asm within GIMPLE_ASM case.
+ (gimple_redirect_edge_and_branch): Likewise.
+ (is_ctrl_altering_stmt): Add a checked cast.
+ (need_fake_edge_p): Replace a code check against GIMPLE_ASM with a
+ dyn_cast<gimple_asm>.
+
+ * tree-complex.c (expand_complex_comparison): Convert a local from
+ gimple to gimple_asm.
+
+ * tree-data-ref.c (get_references_in_stmt): Add a checked cast to
+ gimple_asm.
+
+ * tree-eh.c (stmt_could_throw_p): Likewise.
+
+ * tree-inline.c (estimate_num_insns): Likewise.
+
+ * tree-sra.c (scan_function): Add a checked cast and a new local
+ of type gimple_asm within GIMPLE_ASM case.
+ (sra_modify_function_body): Likewise.
+ (ipa_sra_modify_function_body): Likewise.
+
+ * tree-ssa-coalesce.c (create_outofssa_var_map): Likewise.
+
+ * tree-ssa-dce.c (propagate_necessity): Replace a code check
+ against GIMPLE_ASM with a dyn_cast<gimple_asm>.
+
+ * tree-ssa-operands.c (maybe_add_call_vops): Require a gimple_asm
+ rather than a plain gimple.
+ (parse_ssa_operands): Add a checked cast to gimple_asm.
+
+ * tree-ssa-structalias.c (find_func_aliases): Replace a check for
+ GIMPLE_ASM with a dyn_cast<gimple_asm>, introducing a new local
+ "asm_stmt", using it in place of "t" for typesafety.
+
+ * tree-ssa-threadedge.c
+ (record_temporary_equivalences_from_stmts_at_dest): Add a checked
+ cast to gimple_asm.
+
+ * tree-ssa.c (execute_update_addresses_taken): Add checked casts
+ and new locals of type gimple_asm within clauses guarded by code
+ check.
+
+2014-10-24 David Malcolm <dmalcolm@redhat.com>
+
Introduce gimple_goto
* coretypes.h (gimple_goto): New typedef.
diff --git a/gcc/cfgexpand.c b/gcc/cfgexpand.c
index e656ed5..d93c888 100644
--- a/gcc/cfgexpand.c
+++ b/gcc/cfgexpand.c
@@ -2927,7 +2927,7 @@ expand_asm_operands (tree string, tree outputs, tree inputs,
static void
-expand_asm_stmt (gimple stmt)
+expand_asm_stmt (gimple_asm stmt)
{
int noutputs;
tree outputs, tail, t;
@@ -3212,7 +3212,7 @@ expand_gimple_stmt_1 (gimple stmt)
expand_case (as_a <gimple_switch> (stmt));
break;
case GIMPLE_ASM:
- expand_asm_stmt (stmt);
+ expand_asm_stmt (as_a <gimple_asm> (stmt));
break;
case GIMPLE_CALL:
expand_call_stmt (as_a <gimple_call> (stmt));
diff --git a/gcc/coretypes.h b/gcc/coretypes.h
index 653343a..98636bb 100644
--- a/gcc/coretypes.h
+++ b/gcc/coretypes.h
@@ -114,6 +114,10 @@ struct gimple_statement_assign;
typedef struct gimple_statement_assign *gimple_assign;
typedef const struct gimple_statement_assign *const_gimple_assign;
+struct gimple_statement_asm;
+typedef struct gimple_statement_asm *gimple_asm;
+typedef const struct gimple_statement_asm *const_gimple_asm;
+
struct gimple_statement_call;
typedef struct gimple_statement_call *gimple_call;
typedef const struct gimple_statement_call *const_gimple_call;
diff --git a/gcc/gimple-fold.c b/gcc/gimple-fold.c
index 56b1e5b..c6ba019 100644
--- a/gcc/gimple-fold.c
+++ b/gcc/gimple-fold.c
@@ -2855,17 +2855,18 @@ fold_stmt_1 (gimple_stmt_iterator *gsi, bool inplace)
}
case GIMPLE_ASM:
{
- for (i = 0; i < gimple_asm_noutputs (stmt); ++i)
+ gimple_asm asm_stmt = as_a <gimple_asm> (stmt);
+ for (i = 0; i < gimple_asm_noutputs (asm_stmt); ++i)
{
- tree link = gimple_asm_output_op (stmt, i);
+ tree link = gimple_asm_output_op (asm_stmt, i);
tree op = TREE_VALUE (link);
if (REFERENCE_CLASS_P (op)
&& maybe_canonicalize_mem_ref_addr (&TREE_VALUE (link)))
changed = true;
}
- for (i = 0; i < gimple_asm_ninputs (stmt); ++i)
+ for (i = 0; i < gimple_asm_ninputs (asm_stmt); ++i)
{
- tree link = gimple_asm_input_op (stmt, i);
+ tree link = gimple_asm_input_op (asm_stmt, i);
tree op = TREE_VALUE (link);
if ((REFERENCE_CLASS_P (op)
|| TREE_CODE (op) == ADDR_EXPR)
@@ -2935,17 +2936,18 @@ fold_stmt_1 (gimple_stmt_iterator *gsi, bool inplace)
case GIMPLE_ASM:
/* Fold *& in asm operands. */
{
+ gimple_asm asm_stmt = as_a <gimple_asm> (stmt);
size_t noutputs;
const char **oconstraints;
const char *constraint;
bool allows_mem, allows_reg;
- noutputs = gimple_asm_noutputs (stmt);
+ noutputs = gimple_asm_noutputs (asm_stmt);
oconstraints = XALLOCAVEC (const char *, noutputs);
- for (i = 0; i < gimple_asm_noutputs (stmt); ++i)
+ for (i = 0; i < gimple_asm_noutputs (asm_stmt); ++i)
{
- tree link = gimple_asm_output_op (stmt, i);
+ tree link = gimple_asm_output_op (asm_stmt, i);
tree op = TREE_VALUE (link);
oconstraints[i]
= TREE_STRING_POINTER (TREE_VALUE (TREE_PURPOSE (link)));
@@ -2956,9 +2958,9 @@ fold_stmt_1 (gimple_stmt_iterator *gsi, bool inplace)
changed = true;
}
}
- for (i = 0; i < gimple_asm_ninputs (stmt); ++i)
+ for (i = 0; i < gimple_asm_ninputs (asm_stmt); ++i)
{
- tree link = gimple_asm_input_op (stmt, i);
+ tree link = gimple_asm_input_op (asm_stmt, i);
tree op = TREE_VALUE (link);
constraint
= TREE_STRING_POINTER (TREE_VALUE (TREE_PURPOSE (link)));
diff --git a/gcc/gimple-pretty-print.c b/gcc/gimple-pretty-print.c
index 47772d6..d8d7703 100644
--- a/gcc/gimple-pretty-print.c
+++ b/gcc/gimple-pretty-print.c
@@ -1606,7 +1606,7 @@ dump_gimple_transaction (pretty_printer *buffer, gimple gs, int spc, int flags)
dumpfile.h). */
static void
-dump_gimple_asm (pretty_printer *buffer, gimple gs, int spc, int flags)
+dump_gimple_asm (pretty_printer *buffer, gimple_asm gs, int spc, int flags)
{
unsigned int i, n, f, fields;
@@ -2085,7 +2085,7 @@ pp_gimple_stmt_1 (pretty_printer *buffer, gimple gs, int spc, int flags)
switch (gimple_code (gs))
{
case GIMPLE_ASM:
- dump_gimple_asm (buffer, gs, spc, flags);
+ dump_gimple_asm (buffer, as_a <gimple_asm> (gs), spc, flags);
break;
case GIMPLE_ASSIGN:
diff --git a/gcc/gimple-streamer-in.c b/gcc/gimple-streamer-in.c
index 2741ea7..c297ec3 100644
--- a/gcc/gimple-streamer-in.c
+++ b/gcc/gimple-streamer-in.c
@@ -218,11 +218,12 @@ input_gimple_stmt (struct lto_input_block *ib, struct data_in *data_in,
}
else if (code == GIMPLE_ASM)
{
+ gimple_asm asm_stmt = as_a <gimple_asm> (stmt);
unsigned i;
- for (i = 0; i < gimple_asm_noutputs (stmt); i++)
+ for (i = 0; i < gimple_asm_noutputs (asm_stmt); i++)
{
- tree op = TREE_VALUE (gimple_asm_output_op (stmt, i));
+ tree op = TREE_VALUE (gimple_asm_output_op (asm_stmt, i));
if (TREE_CODE (op) == SSA_NAME)
SSA_NAME_DEF_STMT (op) = stmt;
}
diff --git a/gcc/gimple-streamer-out.c b/gcc/gimple-streamer-out.c
index 85a7966..77fc3fa 100644
--- a/gcc/gimple-streamer-out.c
+++ b/gcc/gimple-streamer-out.c
@@ -109,12 +109,15 @@ output_gimple_stmt (struct output_block *ob, gimple stmt)
break;
case GIMPLE_ASM:
- streamer_write_uhwi (ob, gimple_asm_ninputs (stmt));
- streamer_write_uhwi (ob, gimple_asm_noutputs (stmt));
- streamer_write_uhwi (ob, gimple_asm_nclobbers (stmt));
- streamer_write_uhwi (ob, gimple_asm_nlabels (stmt));
- streamer_write_string (ob, ob->main_stream, gimple_asm_string (stmt),
- true);
+ {
+ gimple_asm asm_stmt = as_a <gimple_asm> (stmt);
+ streamer_write_uhwi (ob, gimple_asm_ninputs (asm_stmt));
+ streamer_write_uhwi (ob, gimple_asm_noutputs (asm_stmt));
+ streamer_write_uhwi (ob, gimple_asm_nclobbers (asm_stmt));
+ streamer_write_uhwi (ob, gimple_asm_nlabels (asm_stmt));
+ streamer_write_string (ob, ob->main_stream,
+ gimple_asm_string (asm_stmt), true);
+ }
/* Fallthru */
case GIMPLE_ASSIGN:
diff --git a/gcc/gimple-walk.c b/gcc/gimple-walk.c
index 661a69e..40d2145 100644
--- a/gcc/gimple-walk.c
+++ b/gcc/gimple-walk.c
@@ -94,7 +94,7 @@ walk_gimple_seq (gimple_seq seq, walk_stmt_fn callback_stmt,
/* Helper function for walk_gimple_stmt. Walk operands of a GIMPLE_ASM. */
static tree
-walk_gimple_asm (gimple stmt, walk_tree_fn callback_op,
+walk_gimple_asm (gimple_asm stmt, walk_tree_fn callback_op,
struct walk_stmt_info *wi)
{
tree ret, op;
@@ -292,7 +292,7 @@ walk_gimple_op (gimple stmt, walk_tree_fn callback_op,
break;
case GIMPLE_ASM:
- ret = walk_gimple_asm (stmt, callback_op, wi);
+ ret = walk_gimple_asm (as_a <gimple_asm> (stmt), callback_op, wi);
if (ret)
return ret;
break;
@@ -779,18 +779,18 @@ walk_stmt_load_store_addr_ops (gimple stmt, void *data,
ret |= visit_addr (stmt, gimple_call_lhs (stmt),
gimple_call_lhs (stmt), data);
}
- else if (gimple_code (stmt) == GIMPLE_ASM)
+ else if (gimple_asm asm_stmt = dyn_cast <gimple_asm> (stmt))
{
unsigned noutputs;
const char *constraint;
const char **oconstraints;
bool allows_mem, allows_reg, is_inout;
- noutputs = gimple_asm_noutputs (stmt);
+ noutputs = gimple_asm_noutputs (asm_stmt);
oconstraints = XALLOCAVEC (const char *, noutputs);
if (visit_store || visit_addr)
- for (i = 0; i < gimple_asm_noutputs (stmt); ++i)
+ for (i = 0; i < gimple_asm_noutputs (asm_stmt); ++i)
{
- tree link = gimple_asm_output_op (stmt, i);
+ tree link = gimple_asm_output_op (asm_stmt, i);
tree op = get_base_loadstore (TREE_VALUE (link));
if (op && visit_store)
ret |= visit_store (stmt, op, TREE_VALUE (link), data);
@@ -806,9 +806,9 @@ walk_stmt_load_store_addr_ops (gimple stmt, void *data,
}
}
if (visit_load || visit_addr)
- for (i = 0; i < gimple_asm_ninputs (stmt); ++i)
+ for (i = 0; i < gimple_asm_ninputs (asm_stmt); ++i)
{
- tree link = gimple_asm_input_op (stmt, i);
+ tree link = gimple_asm_input_op (asm_stmt, i);
tree op = TREE_VALUE (link);
if (visit_addr
&& TREE_CODE (op) == ADDR_EXPR)
diff --git a/gcc/gimple.c b/gcc/gimple.c
index 0e5e473..2d86191 100644
--- a/gcc/gimple.c
+++ b/gcc/gimple.c
@@ -542,11 +542,11 @@ gimple_build_bind (tree vars, gimple_seq body, tree block)
NCLOBBERS is the number of clobbered registers.
*/
-static inline gimple
+static inline gimple_asm
gimple_build_asm_1 (const char *string, unsigned ninputs, unsigned noutputs,
unsigned nclobbers, unsigned nlabels)
{
- gimple_statement_asm *p;
+ gimple_asm p;
int size = strlen (string);
/* ASMs with labels cannot have outputs. This should have been
@@ -580,12 +580,12 @@ gimple_build_asm_1 (const char *string, unsigned ninputs, unsigned noutputs,
CLOBBERS is a vector of the clobbered register parameters.
LABELS is a vector of destination labels. */
-gimple
+gimple_asm
gimple_build_asm_vec (const char *string, vec<tree, va_gc> *inputs,
vec<tree, va_gc> *outputs, vec<tree, va_gc> *clobbers,
vec<tree, va_gc> *labels)
{
- gimple p;
+ gimple_asm p;
unsigned i;
p = gimple_build_asm_1 (string,
@@ -1821,7 +1821,7 @@ gimple_has_side_effects (const_gimple s)
return true;
if (gimple_code (s) == GIMPLE_ASM
- && gimple_asm_volatile_p (s))
+ && gimple_asm_volatile_p (as_a <const_gimple_asm> (s)))
return true;
if (is_gimple_call (s))
@@ -1862,7 +1862,7 @@ gimple_could_trap_p_1 (gimple s, bool include_mem, bool include_stores)
switch (gimple_code (s))
{
case GIMPLE_ASM:
- return gimple_asm_volatile_p (s);
+ return gimple_asm_volatile_p (as_a <gimple_asm> (s));
case GIMPLE_CALL:
t = gimple_call_fndecl (s);
@@ -2477,7 +2477,7 @@ gimple_call_builtin_p (const_gimple stmt, enum built_in_function code)
GIMPLE_ASM. */
bool
-gimple_asm_clobbers_memory_p (const_gimple stmt)
+gimple_asm_clobbers_memory_p (const_gimple_asm stmt)
{
unsigned i;
diff --git a/gcc/gimple.h b/gcc/gimple.h
index 128baf5..d2dc7ce 100644
--- a/gcc/gimple.h
+++ b/gcc/gimple.h
@@ -1322,9 +1322,9 @@ gimple_label gimple_build_label (tree label);
gimple_goto gimple_build_goto (tree dest);
gimple gimple_build_nop (void);
gimple_bind gimple_build_bind (tree, gimple_seq, tree);
-gimple gimple_build_asm_vec (const char *, vec<tree, va_gc> *,
- vec<tree, va_gc> *, vec<tree, va_gc> *,
- vec<tree, va_gc> *);
+gimple_asm gimple_build_asm_vec (const char *, vec<tree, va_gc> *,
+ vec<tree, va_gc> *, vec<tree, va_gc> *,
+ vec<tree, va_gc> *);
gimple gimple_build_catch (tree, gimple_seq);
gimple gimple_build_eh_filter (tree, gimple_seq);
gimple gimple_build_eh_must_not_throw (tree);
@@ -1401,7 +1401,7 @@ extern bool gimple_builtin_call_types_compatible_p (const_gimple, tree);
extern bool gimple_call_builtin_p (const_gimple);
extern bool gimple_call_builtin_p (const_gimple, enum built_in_class);
extern bool gimple_call_builtin_p (const_gimple, enum built_in_function);
-extern bool gimple_asm_clobbers_memory_p (const_gimple);
+extern bool gimple_asm_clobbers_memory_p (const_gimple_asm);
extern void dump_decl_set (FILE *, bitmap);
extern bool nonfreeing_call_p (gimple);
extern bool infer_nonnull_range (gimple, tree, bool, bool);
@@ -3339,218 +3339,188 @@ gimple_bind_set_block (gimple_bind bind_stmt, tree block)
}
-/* Return the number of input operands for GIMPLE_ASM GS. */
+/* Return the number of input operands for GIMPLE_ASM ASM_STMT. */
static inline unsigned
-gimple_asm_ninputs (const_gimple gs)
+gimple_asm_ninputs (const_gimple_asm asm_stmt)
{
- const gimple_statement_asm *asm_stmt =
- as_a <const gimple_statement_asm *> (gs);
return asm_stmt->ni;
}
-/* Return the number of output operands for GIMPLE_ASM GS. */
+/* Return the number of output operands for GIMPLE_ASM ASM_STMT. */
static inline unsigned
-gimple_asm_noutputs (const_gimple gs)
+gimple_asm_noutputs (const_gimple_asm asm_stmt)
{
- const gimple_statement_asm *asm_stmt =
- as_a <const gimple_statement_asm *> (gs);
return asm_stmt->no;
}
-/* Return the number of clobber operands for GIMPLE_ASM GS. */
+/* Return the number of clobber operands for GIMPLE_ASM ASM_STMT. */
static inline unsigned
-gimple_asm_nclobbers (const_gimple gs)
+gimple_asm_nclobbers (const_gimple_asm asm_stmt)
{
- const gimple_statement_asm *asm_stmt =
- as_a <const gimple_statement_asm *> (gs);
return asm_stmt->nc;
}
-/* Return the number of label operands for GIMPLE_ASM GS. */
+/* Return the number of label operands for GIMPLE_ASM ASM_STMT. */
static inline unsigned
-gimple_asm_nlabels (const_gimple gs)
+gimple_asm_nlabels (const_gimple_asm asm_stmt)
{
- const gimple_statement_asm *asm_stmt =
- as_a <const gimple_statement_asm *> (gs);
return asm_stmt->nl;
}
-/* Return input operand INDEX of GIMPLE_ASM GS. */
+/* Return input operand INDEX of GIMPLE_ASM ASM_STMT. */
static inline tree
-gimple_asm_input_op (const_gimple gs, unsigned index)
+gimple_asm_input_op (const_gimple_asm asm_stmt, unsigned index)
{
- const gimple_statement_asm *asm_stmt =
- as_a <const gimple_statement_asm *> (gs);
gcc_gimple_checking_assert (index < asm_stmt->ni);
- return gimple_op (gs, index + asm_stmt->no);
+ return gimple_op (asm_stmt, index + asm_stmt->no);
}
-/* Return a pointer to input operand INDEX of GIMPLE_ASM GS. */
+/* Return a pointer to input operand INDEX of GIMPLE_ASM ASM_STMT. */
static inline tree *
-gimple_asm_input_op_ptr (const_gimple gs, unsigned index)
+gimple_asm_input_op_ptr (const_gimple_asm asm_stmt, unsigned index)
{
- const gimple_statement_asm *asm_stmt =
- as_a <const gimple_statement_asm *> (gs);
gcc_gimple_checking_assert (index < asm_stmt->ni);
- return gimple_op_ptr (gs, index + asm_stmt->no);
+ return gimple_op_ptr (asm_stmt, index + asm_stmt->no);
}
-/* Set IN_OP to be input operand INDEX in GIMPLE_ASM GS. */
+/* Set IN_OP to be input operand INDEX in GIMPLE_ASM ASM_STMT. */
static inline void
-gimple_asm_set_input_op (gimple gs, unsigned index, tree in_op)
+gimple_asm_set_input_op (gimple_asm asm_stmt, unsigned index, tree in_op)
{
- gimple_statement_asm *asm_stmt = as_a <gimple_statement_asm *> (gs);
gcc_gimple_checking_assert (index < asm_stmt->ni
&& TREE_CODE (in_op) == TREE_LIST);
- gimple_set_op (gs, index + asm_stmt->no, in_op);
+ gimple_set_op (asm_stmt, index + asm_stmt->no, in_op);
}
-/* Return output operand INDEX of GIMPLE_ASM GS. */
+/* Return output operand INDEX of GIMPLE_ASM ASM_STMT. */
static inline tree
-gimple_asm_output_op (const_gimple gs, unsigned index)
+gimple_asm_output_op (const_gimple_asm asm_stmt, unsigned index)
{
- const gimple_statement_asm *asm_stmt =
- as_a <const gimple_statement_asm *> (gs);
gcc_gimple_checking_assert (index < asm_stmt->no);
- return gimple_op (gs, index);
+ return gimple_op (asm_stmt, index);
}
-/* Return a pointer to output operand INDEX of GIMPLE_ASM GS. */
+/* Return a pointer to output operand INDEX of GIMPLE_ASM ASM_STMT. */
static inline tree *
-gimple_asm_output_op_ptr (const_gimple gs, unsigned index)
+gimple_asm_output_op_ptr (const_gimple_asm asm_stmt, unsigned index)
{
- const gimple_statement_asm *asm_stmt =
- as_a <const gimple_statement_asm *> (gs);
gcc_gimple_checking_assert (index < asm_stmt->no);
- return gimple_op_ptr (gs, index);
+ return gimple_op_ptr (asm_stmt, index);
}
-/* Set OUT_OP to be output operand INDEX in GIMPLE_ASM GS. */
+/* Set OUT_OP to be output operand INDEX in GIMPLE_ASM ASM_STMT. */
static inline void
-gimple_asm_set_output_op (gimple gs, unsigned index, tree out_op)
+gimple_asm_set_output_op (gimple_asm asm_stmt, unsigned index, tree out_op)
{
- gimple_statement_asm *asm_stmt = as_a <gimple_statement_asm *> (gs);
gcc_gimple_checking_assert (index < asm_stmt->no
&& TREE_CODE (out_op) == TREE_LIST);
- gimple_set_op (gs, index, out_op);
+ gimple_set_op (asm_stmt, index, out_op);
}
-/* Return clobber operand INDEX of GIMPLE_ASM GS. */
+/* Return clobber operand INDEX of GIMPLE_ASM ASM_STMT. */
static inline tree
-gimple_asm_clobber_op (const_gimple gs, unsigned index)
+gimple_asm_clobber_op (const_gimple_asm asm_stmt, unsigned index)
{
- const gimple_statement_asm *asm_stmt =
- as_a <const gimple_statement_asm *> (gs);
gcc_gimple_checking_assert (index < asm_stmt->nc);
- return gimple_op (gs, index + asm_stmt->ni + asm_stmt->no);
+ return gimple_op (asm_stmt, index + asm_stmt->ni + asm_stmt->no);
}
-/* Set CLOBBER_OP to be clobber operand INDEX in GIMPLE_ASM GS. */
+/* Set CLOBBER_OP to be clobber operand INDEX in GIMPLE_ASM ASM_STMT. */
static inline void
-gimple_asm_set_clobber_op (gimple gs, unsigned index, tree clobber_op)
+gimple_asm_set_clobber_op (gimple_asm asm_stmt, unsigned index, tree clobber_op)
{
- gimple_statement_asm *asm_stmt = as_a <gimple_statement_asm *> (gs);
gcc_gimple_checking_assert (index < asm_stmt->nc
&& TREE_CODE (clobber_op) == TREE_LIST);
- gimple_set_op (gs, index + asm_stmt->ni + asm_stmt->no, clobber_op);
+ gimple_set_op (asm_stmt, index + asm_stmt->ni + asm_stmt->no, clobber_op);
}
-/* Return label operand INDEX of GIMPLE_ASM GS. */
+/* Return label operand INDEX of GIMPLE_ASM ASM_STMT. */
static inline tree
-gimple_asm_label_op (const_gimple gs, unsigned index)
+gimple_asm_label_op (const_gimple_asm asm_stmt, unsigned index)
{
- const gimple_statement_asm *asm_stmt =
- as_a <const gimple_statement_asm *> (gs);
gcc_gimple_checking_assert (index < asm_stmt->nl);
- return gimple_op (gs, index + asm_stmt->ni + asm_stmt->nc);
+ return gimple_op (asm_stmt, index + asm_stmt->ni + asm_stmt->nc);
}
-/* Set LABEL_OP to be label operand INDEX in GIMPLE_ASM GS. */
+/* Set LABEL_OP to be label operand INDEX in GIMPLE_ASM ASM_STMT. */
static inline void
-gimple_asm_set_label_op (gimple gs, unsigned index, tree label_op)
+gimple_asm_set_label_op (gimple_asm asm_stmt, unsigned index, tree label_op)
{
- gimple_statement_asm *asm_stmt = as_a <gimple_statement_asm *> (gs);
gcc_gimple_checking_assert (index < asm_stmt->nl
&& TREE_CODE (label_op) == TREE_LIST);
- gimple_set_op (gs, index + asm_stmt->ni + asm_stmt->nc, label_op);
+ gimple_set_op (asm_stmt, index + asm_stmt->ni + asm_stmt->nc, label_op);
}
/* Return the string representing the assembly instruction in
- GIMPLE_ASM GS. */
+ GIMPLE_ASM ASM_STMT. */
static inline const char *
-gimple_asm_string (const_gimple gs)
+gimple_asm_string (const_gimple_asm asm_stmt)
{
- const gimple_statement_asm *asm_stmt =
- as_a <const gimple_statement_asm *> (gs);
return asm_stmt->string;
}
-/* Return true if GS is an asm statement marked volatile. */
+/* Return true ASM_STMT ASM_STMT is an asm statement marked volatile. */
static inline bool
-gimple_asm_volatile_p (const_gimple gs)
+gimple_asm_volatile_p (const_gimple_asm asm_stmt)
{
- GIMPLE_CHECK (gs, GIMPLE_ASM);
- return (gs->subcode & GF_ASM_VOLATILE) != 0;
+ return (asm_stmt->subcode & GF_ASM_VOLATILE) != 0;
}
-/* If VOLATLE_P is true, mark asm statement GS as volatile. */
+/* If VOLATLE_P is true, mark asm statement ASM_STMT as volatile. */
static inline void
-gimple_asm_set_volatile (gimple gs, bool volatile_p)
+gimple_asm_set_volatile (gimple_asm asm_stmt, bool volatile_p)
{
- GIMPLE_CHECK (gs, GIMPLE_ASM);
if (volatile_p)
- gs->subcode |= GF_ASM_VOLATILE;
+ asm_stmt->subcode |= GF_ASM_VOLATILE;
else
- gs->subcode &= ~GF_ASM_VOLATILE;
+ asm_stmt->subcode &= ~GF_ASM_VOLATILE;
}
-/* If INPUT_P is true, mark asm GS as an ASM_INPUT. */
+/* If INPUT_P is true, mark asm ASM_STMT as an ASM_INPUT. */
static inline void
-gimple_asm_set_input (gimple gs, bool input_p)
+gimple_asm_set_input (gimple_asm asm_stmt, bool input_p)
{
- GIMPLE_CHECK (gs, GIMPLE_ASM);
if (input_p)
- gs->subcode |= GF_ASM_INPUT;
+ asm_stmt->subcode |= GF_ASM_INPUT;
else
- gs->subcode &= ~GF_ASM_INPUT;
+ asm_stmt->subcode &= ~GF_ASM_INPUT;
}
-/* Return true if asm GS is an ASM_INPUT. */
+/* Return true if asm ASM_STMT is an ASM_INPUT. */
static inline bool
-gimple_asm_input_p (const_gimple gs)
+gimple_asm_input_p (const_gimple_asm asm_stmt)
{
- GIMPLE_CHECK (gs, GIMPLE_ASM);
- return (gs->subcode & GF_ASM_INPUT) != 0;
+ return (asm_stmt->subcode & GF_ASM_INPUT) != 0;
}
diff --git a/gcc/gimplify-me.c b/gcc/gimplify-me.c
index 05e986a..08d2b9c 100644
--- a/gcc/gimplify-me.c
+++ b/gcc/gimplify-me.c
@@ -183,7 +183,8 @@ gimple_regimplify_operands (gimple stmt, gimple_stmt_iterator *gsi_p)
break;
case GIMPLE_ASM:
{
- size_t i, noutputs = gimple_asm_noutputs (stmt);
+ gimple_asm asm_stmt = as_a <gimple_asm> (stmt);
+ size_t i, noutputs = gimple_asm_noutputs (asm_stmt);
const char *constraint, **oconstraints;
bool allows_mem, allows_reg, is_inout;
@@ -191,7 +192,7 @@ gimple_regimplify_operands (gimple stmt, gimple_stmt_iterator *gsi_p)
= (const char **) alloca ((noutputs) * sizeof (const char *));
for (i = 0; i < noutputs; i++)
{
- tree op = gimple_asm_output_op (stmt, i);
+ tree op = gimple_asm_output_op (asm_stmt, i);
constraint = TREE_STRING_POINTER (TREE_VALUE (TREE_PURPOSE (op)));
oconstraints[i] = constraint;
parse_output_constraint (&constraint, i, 0, 0, &allows_mem,
@@ -200,9 +201,9 @@ gimple_regimplify_operands (gimple stmt, gimple_stmt_iterator *gsi_p)
is_inout ? is_gimple_min_lval : is_gimple_lvalue,
fb_lvalue | fb_mayfail);
}
- for (i = 0; i < gimple_asm_ninputs (stmt); i++)
+ for (i = 0; i < gimple_asm_ninputs (asm_stmt); i++)
{
- tree op = gimple_asm_input_op (stmt, i);
+ tree op = gimple_asm_input_op (asm_stmt, i);
constraint = TREE_STRING_POINTER (TREE_VALUE (TREE_PURPOSE (op)));
parse_input_constraint (&constraint, 0, 0, noutputs, 0,
oconstraints, &allows_mem, &allows_reg);
diff --git a/gcc/gimplify.c b/gcc/gimplify.c
index af64e45..bed3606 100644
--- a/gcc/gimplify.c
+++ b/gcc/gimplify.c
@@ -4918,7 +4918,7 @@ gimplify_asm_expr (tree *expr_p, gimple_seq *pre_p, gimple_seq *post_p)
const char *constraint;
bool allows_mem, allows_reg, is_inout;
enum gimplify_status ret, tret;
- gimple stmt;
+ gimple_asm stmt;
vec<tree, va_gc> *inputs;
vec<tree, va_gc> *outputs;
vec<tree, va_gc> *clobbers;
diff --git a/gcc/ipa-pure-const.c b/gcc/ipa-pure-const.c
index 6beca09..8375381 100644
--- a/gcc/ipa-pure-const.c
+++ b/gcc/ipa-pure-const.c
@@ -698,14 +698,14 @@ check_stmt (gimple_stmt_iterator *gsip, funct_state local, bool ipa)
}
break;
case GIMPLE_ASM:
- if (gimple_asm_clobbers_memory_p (stmt))
+ if (gimple_asm_clobbers_memory_p (as_a <gimple_asm> (stmt)))
{
if (dump_file)
fprintf (dump_file, " memory asm clobber is not const/pure\n");
/* Abandon all hope, ye who enter here. */
local->pure_const_state = IPA_NEITHER;
}
- if (gimple_asm_volatile_p (stmt))
+ if (gimple_asm_volatile_p (as_a <gimple_asm> (stmt)))
{
if (dump_file)
fprintf (dump_file, " volatile is not const/pure\n");
diff --git a/gcc/ssa-iterators.h b/gcc/ssa-iterators.h
index 2c75e4a..f332b7c 100644
--- a/gcc/ssa-iterators.h
+++ b/gcc/ssa-iterators.h
@@ -610,7 +610,7 @@ op_iter_init (ssa_op_iter *ptr, gimple stmt, int flags)
ptr->numops = 1;
break;
case GIMPLE_ASM:
- ptr->numops = gimple_asm_noutputs (stmt);
+ ptr->numops = gimple_asm_noutputs (as_a <gimple_asm> (stmt));
break;
default:
ptr->numops = 0;
diff --git a/gcc/tree-cfg.c b/gcc/tree-cfg.c
index 1652075..8e9262f 100644
--- a/gcc/tree-cfg.c
+++ b/gcc/tree-cfg.c
@@ -1247,7 +1247,7 @@ make_goto_expr_edges (basic_block bb)
static void
make_gimple_asm_edges (basic_block bb)
{
- gimple stmt = last_stmt (bb);
+ gimple_asm stmt = as_a <gimple_asm> (last_stmt (bb));
int i, n = gimple_asm_nlabels (stmt);
for (i = 0; i < n; ++i)
@@ -1447,11 +1447,12 @@ cleanup_dead_labels (void)
case GIMPLE_ASM:
{
- int i, n = gimple_asm_nlabels (stmt);
+ gimple_asm asm_stmt = as_a <gimple_asm> (stmt);
+ int i, n = gimple_asm_nlabels (asm_stmt);
for (i = 0; i < n; ++i)
{
- tree cons = gimple_asm_label_op (stmt, i);
+ tree cons = gimple_asm_label_op (asm_stmt, i);
tree label = main_block_label (TREE_VALUE (cons));
TREE_VALUE (cons) = label;
}
@@ -2414,7 +2415,7 @@ is_ctrl_altering_stmt (gimple t)
return true;
case GIMPLE_ASM:
- if (gimple_asm_nlabels (t) > 0)
+ if (gimple_asm_nlabels (as_a <gimple_asm> (t)) > 0)
return true;
break;
@@ -5535,12 +5536,13 @@ gimple_redirect_edge_and_branch (edge e, basic_block dest)
case GIMPLE_ASM:
{
- int i, n = gimple_asm_nlabels (stmt);
+ gimple_asm asm_stmt = as_a <gimple_asm> (stmt);
+ int i, n = gimple_asm_nlabels (asm_stmt);
tree label = NULL;
for (i = 0; i < n; ++i)
{
- tree cons = gimple_asm_label_op (stmt, i);
+ tree cons = gimple_asm_label_op (asm_stmt, i);
if (label_to_block (TREE_VALUE (cons)) == e->dest)
{
if (!label)
@@ -7567,9 +7569,9 @@ need_fake_edge_p (gimple t)
return true;
}
- if (gimple_code (t) == GIMPLE_ASM
- && (gimple_asm_volatile_p (t) || gimple_asm_input_p (t)))
- return true;
+ if (gimple_asm asm_stmt = dyn_cast <gimple_asm> (t))
+ if (gimple_asm_volatile_p (asm_stmt) || gimple_asm_input_p (asm_stmt))
+ return true;
return false;
}
diff --git a/gcc/tree-complex.c b/gcc/tree-complex.c
index c259504..d2b4f01 100644
--- a/gcc/tree-complex.c
+++ b/gcc/tree-complex.c
@@ -1419,7 +1419,7 @@ expand_complex_comparison (gimple_stmt_iterator *gsi, tree ar, tree ai,
static void
expand_complex_asm (gimple_stmt_iterator *gsi)
{
- gimple stmt = gsi_stmt (*gsi);
+ gimple_asm stmt = as_a <gimple_asm> (gsi_stmt (*gsi));
unsigned int i;
for (i = 0; i < gimple_asm_noutputs (stmt); ++i)
diff --git a/gcc/tree-data-ref.c b/gcc/tree-data-ref.c
index 89aeb30..9bd3c17 100644
--- a/gcc/tree-data-ref.c
+++ b/gcc/tree-data-ref.c
@@ -4388,7 +4388,8 @@ get_references_in_stmt (gimple stmt, vec<data_ref_loc, va_heap> *references)
clobbers_memory = true;
}
else if (stmt_code == GIMPLE_ASM
- && (gimple_asm_volatile_p (stmt) || gimple_vuse (stmt)))
+ && (gimple_asm_volatile_p (as_a <gimple_asm> (stmt))
+ || gimple_vuse (stmt)))
clobbers_memory = true;
if (!gimple_vuse (stmt))
diff --git a/gcc/tree-eh.c b/gcc/tree-eh.c
index df3f613..9769225 100644
--- a/gcc/tree-eh.c
+++ b/gcc/tree-eh.c
@@ -2773,7 +2773,7 @@ stmt_could_throw_p (gimple stmt)
case GIMPLE_ASM:
if (!cfun->can_throw_non_call_exceptions)
return false;
- return gimple_asm_volatile_p (stmt);
+ return gimple_asm_volatile_p (as_a <gimple_asm> (stmt));
default:
return false;
diff --git a/gcc/tree-inline.c b/gcc/tree-inline.c
index 15b2cdd..2c7d6b7 100644
--- a/gcc/tree-inline.c
+++ b/gcc/tree-inline.c
@@ -3944,7 +3944,8 @@ estimate_num_insns (gimple stmt, eni_weights *weights)
case GIMPLE_ASM:
{
- int count = asm_str_count (gimple_asm_string (stmt));
+ int count =
+ asm_str_count (gimple_asm_string (as_a <gimple_asm> (stmt)));
/* 1000 means infinity. This avoids overflows later
with very long asm statements. */
if (count > 1000)
diff --git a/gcc/tree-sra.c b/gcc/tree-sra.c
index fb24114..67c4247 100644
--- a/gcc/tree-sra.c
+++ b/gcc/tree-sra.c
@@ -1325,21 +1325,24 @@ scan_function (void)
break;
case GIMPLE_ASM:
- walk_stmt_load_store_addr_ops (stmt, NULL, NULL, NULL,
- asm_visit_addr);
- if (final_bbs)
- bitmap_set_bit (final_bbs, bb->index);
+ {
+ gimple_asm asm_stmt = as_a <gimple_asm> (stmt);
+ walk_stmt_load_store_addr_ops (asm_stmt, NULL, NULL, NULL,
+ asm_visit_addr);
+ if (final_bbs)
+ bitmap_set_bit (final_bbs, bb->index);
- for (i = 0; i < gimple_asm_ninputs (stmt); i++)
- {
- t = TREE_VALUE (gimple_asm_input_op (stmt, i));
- ret |= build_access_from_expr (t, stmt, false);
- }
- for (i = 0; i < gimple_asm_noutputs (stmt); i++)
- {
- t = TREE_VALUE (gimple_asm_output_op (stmt, i));
- ret |= build_access_from_expr (t, stmt, true);
- }
+ for (i = 0; i < gimple_asm_ninputs (asm_stmt); i++)
+ {
+ t = TREE_VALUE (gimple_asm_input_op (asm_stmt, i));
+ ret |= build_access_from_expr (t, asm_stmt, false);
+ }
+ for (i = 0; i < gimple_asm_noutputs (asm_stmt); i++)
+ {
+ t = TREE_VALUE (gimple_asm_output_op (asm_stmt, i));
+ ret |= build_access_from_expr (t, asm_stmt, true);
+ }
+ }
break;
default:
@@ -3411,16 +3414,19 @@ sra_modify_function_body (void)
break;
case GIMPLE_ASM:
- for (i = 0; i < gimple_asm_ninputs (stmt); i++)
- {
- t = &TREE_VALUE (gimple_asm_input_op (stmt, i));
- modified |= sra_modify_expr (t, &gsi, false);
- }
- for (i = 0; i < gimple_asm_noutputs (stmt); i++)
- {
- t = &TREE_VALUE (gimple_asm_output_op (stmt, i));
- modified |= sra_modify_expr (t, &gsi, true);
- }
+ {
+ gimple_asm asm_stmt = as_a <gimple_asm> (stmt);
+ for (i = 0; i < gimple_asm_ninputs (asm_stmt); i++)
+ {
+ t = &TREE_VALUE (gimple_asm_input_op (asm_stmt, i));
+ modified |= sra_modify_expr (t, &gsi, false);
+ }
+ for (i = 0; i < gimple_asm_noutputs (asm_stmt); i++)
+ {
+ t = &TREE_VALUE (gimple_asm_output_op (asm_stmt, i));
+ modified |= sra_modify_expr (t, &gsi, true);
+ }
+ }
break;
default:
@@ -4672,16 +4678,19 @@ ipa_sra_modify_function_body (ipa_parm_adjustment_vec adjustments)
break;
case GIMPLE_ASM:
- for (i = 0; i < gimple_asm_ninputs (stmt); i++)
- {
- t = &TREE_VALUE (gimple_asm_input_op (stmt, i));
- modified |= ipa_modify_expr (t, true, adjustments);
- }
- for (i = 0; i < gimple_asm_noutputs (stmt); i++)
- {
- t = &TREE_VALUE (gimple_asm_output_op (stmt, i));
- modified |= ipa_modify_expr (t, false, adjustments);
- }
+ {
+ gimple_asm asm_stmt = as_a <gimple_asm> (stmt);
+ for (i = 0; i < gimple_asm_ninputs (asm_stmt); i++)
+ {
+ t = &TREE_VALUE (gimple_asm_input_op (asm_stmt, i));
+ modified |= ipa_modify_expr (t, true, adjustments);
+ }
+ for (i = 0; i < gimple_asm_noutputs (asm_stmt); i++)
+ {
+ t = &TREE_VALUE (gimple_asm_output_op (asm_stmt, i));
+ modified |= ipa_modify_expr (t, false, adjustments);
+ }
+ }
break;
default:
diff --git a/gcc/tree-ssa-coalesce.c b/gcc/tree-ssa-coalesce.c
index e4e2201..f043096 100644
--- a/gcc/tree-ssa-coalesce.c
+++ b/gcc/tree-ssa-coalesce.c
@@ -1008,15 +1008,16 @@ create_outofssa_var_map (coalesce_list_p cl, bitmap used_in_copy)
case GIMPLE_ASM:
{
+ gimple_asm asm_stmt = as_a <gimple_asm> (stmt);
unsigned long noutputs, i;
unsigned long ninputs;
tree *outputs, link;
- noutputs = gimple_asm_noutputs (stmt);
- ninputs = gimple_asm_ninputs (stmt);
+ noutputs = gimple_asm_noutputs (asm_stmt);
+ ninputs = gimple_asm_ninputs (asm_stmt);
outputs = (tree *) alloca (noutputs * sizeof (tree));
for (i = 0; i < noutputs; ++i)
{
- link = gimple_asm_output_op (stmt, i);
+ link = gimple_asm_output_op (asm_stmt, i);
outputs[i] = TREE_VALUE (link);
}
@@ -1027,7 +1028,7 @@ create_outofssa_var_map (coalesce_list_p cl, bitmap used_in_copy)
char *end;
unsigned long match;
- link = gimple_asm_input_op (stmt, i);
+ link = gimple_asm_input_op (asm_stmt, i);
constraint
= TREE_STRING_POINTER (TREE_VALUE (TREE_PURPOSE (link)));
input = TREE_VALUE (link);
diff --git a/gcc/tree-ssa-dce.c b/gcc/tree-ssa-dce.c
index f95c0ea..8e8cd57 100644
--- a/gcc/tree-ssa-dce.c
+++ b/gcc/tree-ssa-dce.c
@@ -882,14 +882,14 @@ propagate_necessity (bool aggressive)
mark_all_reaching_defs_necessary (stmt);
}
}
- else if (gimple_code (stmt) == GIMPLE_ASM)
+ else if (gimple_asm asm_stmt = dyn_cast <gimple_asm> (stmt))
{
unsigned i;
mark_all_reaching_defs_necessary (stmt);
/* Inputs may perform loads. */
- for (i = 0; i < gimple_asm_ninputs (stmt); ++i)
+ for (i = 0; i < gimple_asm_ninputs (asm_stmt); ++i)
{
- tree op = TREE_VALUE (gimple_asm_input_op (stmt, i));
+ tree op = TREE_VALUE (gimple_asm_input_op (asm_stmt, i));
if (TREE_CODE (op) != SSA_NAME
&& !is_gimple_min_invariant (op)
&& TREE_CODE (op) != CONSTRUCTOR
diff --git a/gcc/tree-ssa-operands.c b/gcc/tree-ssa-operands.c
index 1e59b76..5f20c66 100644
--- a/gcc/tree-ssa-operands.c
+++ b/gcc/tree-ssa-operands.c
@@ -655,7 +655,7 @@ maybe_add_call_vops (struct function *fn, gimple_call stmt)
/* Scan operands in the ASM_EXPR stmt referred to in INFO. */
static void
-get_asm_stmt_operands (struct function *fn, gimple stmt)
+get_asm_stmt_operands (struct function *fn, gimple_asm stmt)
{
size_t i, noutputs;
const char **oconstraints;
@@ -909,7 +909,7 @@ parse_ssa_operands (struct function *fn, gimple stmt)
switch (code)
{
case GIMPLE_ASM:
- get_asm_stmt_operands (fn, stmt);
+ get_asm_stmt_operands (fn, as_a <gimple_asm> (stmt));
break;
case GIMPLE_TRANSACTION:
diff --git a/gcc/tree-ssa-structalias.c b/gcc/tree-ssa-structalias.c
index 4bde124..a130268 100644
--- a/gcc/tree-ssa-structalias.c
+++ b/gcc/tree-ssa-structalias.c
@@ -4752,19 +4752,19 @@ find_func_aliases (struct function *fn, gimple origt)
}
}
/* Handle asms conservatively by adding escape constraints to everything. */
- else if (gimple_code (t) == GIMPLE_ASM)
+ else if (gimple_asm asm_stmt = dyn_cast <gimple_asm> (t))
{
unsigned i, noutputs;
const char **oconstraints;
const char *constraint;
bool allows_mem, allows_reg, is_inout;
- noutputs = gimple_asm_noutputs (t);
+ noutputs = gimple_asm_noutputs (asm_stmt);
oconstraints = XALLOCAVEC (const char *, noutputs);
for (i = 0; i < noutputs; ++i)
{
- tree link = gimple_asm_output_op (t, i);
+ tree link = gimple_asm_output_op (asm_stmt, i);
tree op = TREE_VALUE (link);
constraint = TREE_STRING_POINTER (TREE_VALUE (TREE_PURPOSE (link)));
@@ -4791,9 +4791,9 @@ find_func_aliases (struct function *fn, gimple origt)
process_constraint (new_constraint (*lhsp, rhsc));
}
}
- for (i = 0; i < gimple_asm_ninputs (t); ++i)
+ for (i = 0; i < gimple_asm_ninputs (asm_stmt); ++i)
{
- tree link = gimple_asm_input_op (t, i);
+ tree link = gimple_asm_input_op (asm_stmt, i);
tree op = TREE_VALUE (link);
constraint = TREE_STRING_POINTER (TREE_VALUE (TREE_PURPOSE (link)));
diff --git a/gcc/tree-ssa-threadedge.c b/gcc/tree-ssa-threadedge.c
index 45083df..50cc729 100644
--- a/gcc/tree-ssa-threadedge.c
+++ b/gcc/tree-ssa-threadedge.c
@@ -345,7 +345,8 @@ record_temporary_equivalences_from_stmts_at_dest (edge e,
/* If the statement has volatile operands, then we assume we
can not thread through this block. This is overly
conservative in some ways. */
- if (gimple_code (stmt) == GIMPLE_ASM && gimple_asm_volatile_p (stmt))
+ if (gimple_code (stmt) == GIMPLE_ASM
+ && gimple_asm_volatile_p (as_a <gimple_asm> (stmt)))
return NULL;
/* If duplicating this block is going to cause too much code
diff --git a/gcc/tree-ssa.c b/gcc/tree-ssa.c
index a907426..6babaee 100644
--- a/gcc/tree-ssa.c
+++ b/gcc/tree-ssa.c
@@ -1454,9 +1454,10 @@ execute_update_addresses_taken (void)
else if (code == GIMPLE_ASM)
{
- for (i = 0; i < gimple_asm_noutputs (stmt); ++i)
+ gimple_asm asm_stmt = as_a <gimple_asm> (stmt);
+ for (i = 0; i < gimple_asm_noutputs (asm_stmt); ++i)
{
- tree link = gimple_asm_output_op (stmt, i);
+ tree link = gimple_asm_output_op (asm_stmt, i);
tree lhs = TREE_VALUE (link);
if (TREE_CODE (lhs) != SSA_NAME)
{
@@ -1471,9 +1472,9 @@ execute_update_addresses_taken (void)
bitmap_set_bit (not_reg_needs, DECL_UID (decl));
}
}
- for (i = 0; i < gimple_asm_ninputs (stmt); ++i)
+ for (i = 0; i < gimple_asm_ninputs (asm_stmt); ++i)
{
- tree link = gimple_asm_input_op (stmt, i);
+ tree link = gimple_asm_input_op (asm_stmt, i);
if ((decl = non_rewritable_mem_ref_base (TREE_VALUE (link))))
bitmap_set_bit (not_reg_needs, DECL_UID (decl));
}
@@ -1584,16 +1585,17 @@ execute_update_addresses_taken (void)
else if (gimple_code (stmt) == GIMPLE_ASM)
{
+ gimple_asm asm_stmt = as_a <gimple_asm> (stmt);
unsigned i;
- for (i = 0; i < gimple_asm_noutputs (stmt); ++i)
+ for (i = 0; i < gimple_asm_noutputs (asm_stmt); ++i)
{
- tree link = gimple_asm_output_op (stmt, i);
+ tree link = gimple_asm_output_op (asm_stmt, i);
maybe_rewrite_mem_ref_base (&TREE_VALUE (link),
suitable_for_renaming);
}
- for (i = 0; i < gimple_asm_ninputs (stmt); ++i)
+ for (i = 0; i < gimple_asm_ninputs (asm_stmt); ++i)
{
- tree link = gimple_asm_input_op (stmt, i);
+ tree link = gimple_asm_input_op (asm_stmt, i);
maybe_rewrite_mem_ref_base (&TREE_VALUE (link),
suitable_for_renaming);
}
--
1.8.5.3
^ permalink raw reply [flat|nested] 93+ messages in thread
* [gimple-classes, committed 67/92] Make gimple_cond_set_{true|false}_label require gimple_cond.
2014-10-27 20:35 [gimple-classes, committed 00/92] Initial slew of commits David Malcolm
` (60 preceding siblings ...)
2014-10-27 20:54 ` [gimple-classes, committed 21/92] Introduce gimple_asm David Malcolm
@ 2014-10-27 20:54 ` David Malcolm
2014-10-27 20:54 ` [gimple-classes, committed 79/92] Concretize gimple_call_set_fn David Malcolm
` (29 subsequent siblings)
91 siblings, 0 replies; 93+ messages in thread
From: David Malcolm @ 2014-10-27 20:54 UTC (permalink / raw)
To: gcc-patches; +Cc: David Malcolm
This corresponds to:
[PATCH 69/89] Make gimple_cond_set_{true|false}_label require gimple_cond.
https://gcc.gnu.org/ml/gcc-patches/2014-04/msg01198.html
from the original 89-patch kit
That earlier patch was approved by Jeff:
> OK once prerequisites have gone in.
in https://gcc.gnu.org/ml/gcc-patches/2014-05/msg00835.html
gcc/
* gimple.h (gimple_cond_set_true_label): Require a gimple_cond.
(gimple_cond_set_false_label): Likewise.
* tree-cfg.c (make_cond_expr_edges): Convert "entry" from gimple to
a gimple_cond.
(cleanup_dead_labels): Introduce a checked cast to a gimple_cond within
the GIMPLE_COND case.
---
gcc/ChangeLog.gimple-classes | 12 ++++++++++++
gcc/gimple.h | 6 ++----
gcc/tree-cfg.c | 33 ++++++++++++++++++---------------
3 files changed, 32 insertions(+), 19 deletions(-)
diff --git a/gcc/ChangeLog.gimple-classes b/gcc/ChangeLog.gimple-classes
index c024a2b..2bfebca 100644
--- a/gcc/ChangeLog.gimple-classes
+++ b/gcc/ChangeLog.gimple-classes
@@ -1,5 +1,17 @@
2014-10-24 David Malcolm <dmalcolm@redhat.com>
+ Make gimple_cond_set_{true|false}_label require gimple_cond.
+
+ * gimple.h (gimple_cond_set_true_label): Require a gimple_cond.
+ (gimple_cond_set_false_label): Likewise.
+
+ * tree-cfg.c (make_cond_expr_edges): Convert "entry" from gimple to
+ a gimple_cond.
+ (cleanup_dead_labels): Introduce a checked cast to a gimple_cond within
+ the GIMPLE_COND case.
+
+2014-10-24 David Malcolm <dmalcolm@redhat.com>
+
Concretize three gimple_return_ accessors
* gimple.h (gimple_return_retval_ptr): Require a const_gimple_return
diff --git a/gcc/gimple.h b/gcc/gimple.h
index e1afe99..6a09975 100644
--- a/gcc/gimple.h
+++ b/gcc/gimple.h
@@ -3091,9 +3091,8 @@ gimple_cond_true_label (const_gimple gs)
predicate evaluates to true. */
static inline void
-gimple_cond_set_true_label (gimple gs, tree label)
+gimple_cond_set_true_label (gimple_cond gs, tree label)
{
- GIMPLE_CHECK (gs, GIMPLE_COND);
gimple_set_op (gs, 2, label);
}
@@ -3102,9 +3101,8 @@ gimple_cond_set_true_label (gimple gs, tree label)
predicate evaluates to false. */
static inline void
-gimple_cond_set_false_label (gimple gs, tree label)
+gimple_cond_set_false_label (gimple_cond gs, tree label)
{
- GIMPLE_CHECK (gs, GIMPLE_COND);
gimple_set_op (gs, 3, label);
}
diff --git a/gcc/tree-cfg.c b/gcc/tree-cfg.c
index 4aaeb6d..4de42a8 100644
--- a/gcc/tree-cfg.c
+++ b/gcc/tree-cfg.c
@@ -1045,7 +1045,7 @@ assign_discriminators (void)
static void
make_cond_expr_edges (basic_block bb)
{
- gimple entry = last_stmt (bb);
+ gimple_cond entry = as_a <gimple_cond> (last_stmt (bb));
gimple then_stmt, else_stmt;
basic_block then_bb, else_bb;
tree then_label, else_label;
@@ -1414,21 +1414,24 @@ cleanup_dead_labels (void)
switch (gimple_code (stmt))
{
case GIMPLE_COND:
- label = gimple_cond_true_label (stmt);
- if (label)
- {
- new_label = main_block_label (label);
- if (new_label != label)
- gimple_cond_set_true_label (stmt, new_label);
- }
+ {
+ gimple_cond cond_stmt = as_a <gimple_cond> (stmt);
+ label = gimple_cond_true_label (cond_stmt);
+ if (label)
+ {
+ new_label = main_block_label (label);
+ if (new_label != label)
+ gimple_cond_set_true_label (cond_stmt, new_label);
+ }
- label = gimple_cond_false_label (stmt);
- if (label)
- {
- new_label = main_block_label (label);
- if (new_label != label)
- gimple_cond_set_false_label (stmt, new_label);
- }
+ label = gimple_cond_false_label (cond_stmt);
+ if (label)
+ {
+ new_label = main_block_label (label);
+ if (new_label != label)
+ gimple_cond_set_false_label (cond_stmt, new_label);
+ }
+ }
break;
case GIMPLE_SWITCH:
--
1.8.5.3
^ permalink raw reply [flat|nested] 93+ messages in thread
* [gimple-classes, committed 11/92] tree-predcom.c: use gimple_phi in various places
2014-10-27 20:35 [gimple-classes, committed 00/92] Initial slew of commits David Malcolm
` (62 preceding siblings ...)
2014-10-27 20:54 ` [gimple-classes, committed 79/92] Concretize gimple_call_set_fn David Malcolm
@ 2014-10-27 20:54 ` David Malcolm
2014-10-27 20:54 ` [gimple-classes, committed 12/92] tree-ssa-phiprop.c: use gimple_phi David Malcolm
` (27 subsequent siblings)
91 siblings, 0 replies; 93+ messages in thread
From: David Malcolm @ 2014-10-27 20:54 UTC (permalink / raw)
To: gcc-patches; +Cc: David Malcolm
This corresponds to:
[PATCH 12/89] tree-predcom.c: use gimple_phi in various places
https://gcc.gnu.org/ml/gcc-patches/2014-04/msg01229.html
from the original 89-patch kit
That earlier patch was approved by Jeff:
> OK when prerequisites have gone in.
in https://gcc.gnu.org/ml/gcc-patches/2014-05/msg00621.html
gcc/
* tree-predcom.c (find_looparound_phi): Return a gimple_phi rather
than just a gimple.
(insert_looparound_copy): Require a gimple_phi rather than just a
gimple.
(add_looparound_copies): Convert local "phi" to be a gimple_phi.
(initialize_root_vars): Likewise.
(initialize_root_vars_lm): Likewise.
---
gcc/ChangeLog.gimple-classes | 12 ++++++++++++
gcc/tree-predcom.c | 10 +++++-----
2 files changed, 17 insertions(+), 5 deletions(-)
diff --git a/gcc/ChangeLog.gimple-classes b/gcc/ChangeLog.gimple-classes
index fb4c222..0e6a5d9 100644
--- a/gcc/ChangeLog.gimple-classes
+++ b/gcc/ChangeLog.gimple-classes
@@ -1,5 +1,17 @@
2014-10-24 David Malcolm <dmalcolm@redhat.com>
+ tree-predcom.c: use gimple_phi in various places
+
+ * tree-predcom.c (find_looparound_phi): Return a gimple_phi rather
+ than just a gimple.
+ (insert_looparound_copy): Require a gimple_phi rather than just a
+ gimple.
+ (add_looparound_copies): Convert local "phi" to be a gimple_phi.
+ (initialize_root_vars): Likewise.
+ (initialize_root_vars_lm): Likewise.
+
+2014-10-24 David Malcolm <dmalcolm@redhat.com>
+
tree-parloops.c: use gimple_phi in various places
* tree-parloops.c (struct reduction_info): Strengthen field "new_phi"
diff --git a/gcc/tree-predcom.c b/gcc/tree-predcom.c
index 0ce81aa..dfda10e 100644
--- a/gcc/tree-predcom.c
+++ b/gcc/tree-predcom.c
@@ -1112,7 +1112,7 @@ valid_initializer_p (struct data_reference *ref,
iteration), returns the phi node. Otherwise, NULL_TREE is returned. ROOT
is the root of the current chain. */
-static gimple
+static gimple_phi
find_looparound_phi (struct loop *loop, dref ref, dref root)
{
tree name, init, init_ref;
@@ -1174,7 +1174,7 @@ find_looparound_phi (struct loop *loop, dref ref, dref root)
/* Adds a reference for the looparound copy of REF in PHI to CHAIN. */
static void
-insert_looparound_copy (chain_p chain, dref ref, gimple phi)
+insert_looparound_copy (chain_p chain, dref ref, gimple_phi phi)
{
dref nw = XCNEW (struct dref_d), aref;
unsigned i;
@@ -1205,7 +1205,7 @@ add_looparound_copies (struct loop *loop, chain_p chain)
{
unsigned i;
dref ref, root = get_chain_root (chain);
- gimple phi;
+ gimple_phi phi;
FOR_EACH_VEC_ELT (chain->refs, i, ref)
{
@@ -1457,7 +1457,7 @@ initialize_root_vars (struct loop *loop, chain_p chain, bitmap tmp_vars)
dref root = get_chain_root (chain);
bool reuse_first = !chain->has_max_use_after;
tree ref, init, var, next;
- gimple phi;
+ gimple_phi phi;
gimple_seq stmts;
edge entry = loop_preheader_edge (loop), latch = loop_latch_edge (loop);
@@ -1531,7 +1531,7 @@ initialize_root_vars_lm (struct loop *loop, dref root, bool written,
unsigned i;
tree ref = DR_REF (root->ref), init, var, next;
gimple_seq stmts;
- gimple phi;
+ gimple_phi phi;
edge entry = loop_preheader_edge (loop), latch = loop_latch_edge (loop);
/* Find the initializer for the variable, and check that it cannot
--
1.8.5.3
^ permalink raw reply [flat|nested] 93+ messages in thread
* [gimple-classes, committed 79/92] Concretize gimple_call_set_fn
2014-10-27 20:35 [gimple-classes, committed 00/92] Initial slew of commits David Malcolm
` (61 preceding siblings ...)
2014-10-27 20:54 ` [gimple-classes, committed 67/92] Make gimple_cond_set_{true|false}_label require gimple_cond David Malcolm
@ 2014-10-27 20:54 ` David Malcolm
2014-10-27 20:54 ` [gimple-classes, committed 11/92] tree-predcom.c: use gimple_phi in various places David Malcolm
` (28 subsequent siblings)
91 siblings, 0 replies; 93+ messages in thread
From: David Malcolm @ 2014-10-27 20:54 UTC (permalink / raw)
To: gcc-patches; +Cc: David Malcolm
This corresponds to:
[PATCH 82/89] Concretize gimple_call_set_fntype
https://gcc.gnu.org/ml/gcc-patches/2014-04/msg01187.html
from the original 89-patch kit
That earlier patch was approved by Jeff:
> This is fine once prerequisites have gone in.
in https://gcc.gnu.org/ml/gcc-patches/2014-05/msg00840.html
gcc/
* gimple.h (gimple_call_set_fn): Require a gimple_call.
* trans-mem.c (dump_tm_memopt_transform): Likewise.
(tm_memopt_transform_blocks): Add checked casts to gimple_call in
suites guarded by is_tm_simple_{load|store}, which enforce that
the statement must be a GIMPLE_CALL; use this when invoking
dump_tm_memopt_transform.
---
gcc/ChangeLog.gimple-classes | 12 ++++++++++++
gcc/gimple.h | 3 +--
gcc/trans-mem.c | 14 ++++++++------
3 files changed, 21 insertions(+), 8 deletions(-)
diff --git a/gcc/ChangeLog.gimple-classes b/gcc/ChangeLog.gimple-classes
index 37e3955..ae57d57 100644
--- a/gcc/ChangeLog.gimple-classes
+++ b/gcc/ChangeLog.gimple-classes
@@ -1,5 +1,17 @@
2014-10-24 David Malcolm <dmalcolm@redhat.com>
+ Concretize gimple_call_set_fn
+
+ * gimple.h (gimple_call_set_fn): Require a gimple_call.
+
+ * trans-mem.c (dump_tm_memopt_transform): Likewise.
+ (tm_memopt_transform_blocks): Add checked casts to gimple_call in
+ suites guarded by is_tm_simple_{load|store}, which enforce that
+ the statement must be a GIMPLE_CALL; use this when invoking
+ dump_tm_memopt_transform.
+
+2014-10-24 David Malcolm <dmalcolm@redhat.com>
+
Tweak to gimplify_modify_expr
* gimplify.c (gimplify_modify_expr): Introduce local "call_stmt".
diff --git a/gcc/gimple.h b/gcc/gimple.h
index ac6d664..a7ec1d5 100644
--- a/gcc/gimple.h
+++ b/gcc/gimple.h
@@ -2679,9 +2679,8 @@ gimple_call_fn_ptr (const_gimple gs)
/* Set FN to be the function called by call statement GS. */
static inline void
-gimple_call_set_fn (gimple gs, tree fn)
+gimple_call_set_fn (gimple_call gs, tree fn)
{
- GIMPLE_CHECK (gs, GIMPLE_CALL);
gcc_gimple_checking_assert (!gimple_call_internal_p (gs));
gimple_set_op (gs, 1, fn);
}
diff --git a/gcc/trans-mem.c b/gcc/trans-mem.c
index 98fd3a2..bdd4a77 100644
--- a/gcc/trans-mem.c
+++ b/gcc/trans-mem.c
@@ -3778,7 +3778,7 @@ dump_tm_memopt_transform (gimple stmt)
static void
tm_memopt_transform_stmt (unsigned int offset,
- gimple stmt,
+ gimple_call stmt,
gimple_stmt_iterator *gsi)
{
tree fn = gimple_call_fn (stmt);
@@ -3814,28 +3814,30 @@ tm_memopt_transform_blocks (vec<basic_block> blocks)
if (is_tm_simple_load (stmt))
{
+ gimple_call call_stmt = as_a <gimple_call> (stmt);
loc = tm_memopt_value_number (stmt, NO_INSERT);
if (store_avail && bitmap_bit_p (store_avail, loc))
- tm_memopt_transform_stmt (TRANSFORM_RAW, stmt, &gsi);
+ tm_memopt_transform_stmt (TRANSFORM_RAW, call_stmt, &gsi);
else if (store_antic && bitmap_bit_p (store_antic, loc))
{
- tm_memopt_transform_stmt (TRANSFORM_RFW, stmt, &gsi);
+ tm_memopt_transform_stmt (TRANSFORM_RFW, call_stmt, &gsi);
bitmap_set_bit (store_avail, loc);
}
else if (read_avail && bitmap_bit_p (read_avail, loc))
- tm_memopt_transform_stmt (TRANSFORM_RAR, stmt, &gsi);
+ tm_memopt_transform_stmt (TRANSFORM_RAR, call_stmt, &gsi);
else
bitmap_set_bit (read_avail, loc);
}
else if (is_tm_simple_store (stmt))
{
+ gimple_call call_stmt = as_a <gimple_call> (stmt);
loc = tm_memopt_value_number (stmt, NO_INSERT);
if (store_avail && bitmap_bit_p (store_avail, loc))
- tm_memopt_transform_stmt (TRANSFORM_WAW, stmt, &gsi);
+ tm_memopt_transform_stmt (TRANSFORM_WAW, call_stmt, &gsi);
else
{
if (read_avail && bitmap_bit_p (read_avail, loc))
- tm_memopt_transform_stmt (TRANSFORM_WAR, stmt, &gsi);
+ tm_memopt_transform_stmt (TRANSFORM_WAR, call_stmt, &gsi);
bitmap_set_bit (store_avail, loc);
}
}
--
1.8.5.3
^ permalink raw reply [flat|nested] 93+ messages in thread
* [gimple-classes, committed 36/92] Introduce gimple_omp_for
2014-10-27 20:35 [gimple-classes, committed 00/92] Initial slew of commits David Malcolm
` (69 preceding siblings ...)
2014-10-27 20:55 ` [gimple-classes, committed 44/92] tree-parloops.c: Use gimple_phi in various places David Malcolm
@ 2014-10-27 20:55 ` David Malcolm
2014-10-27 20:55 ` [gimple-classes, committed 48/92] Make gimple_phi_arg_set_location require a gimple_phi David Malcolm
` (20 subsequent siblings)
91 siblings, 0 replies; 93+ messages in thread
From: David Malcolm @ 2014-10-27 20:55 UTC (permalink / raw)
To: gcc-patches; +Cc: David Malcolm
This corresponds to:
[PATCH 38/89] Introduce gimple_omp_for
https://gcc.gnu.org/ml/gcc-patches/2014-04/msg01225.html
from the original 89-patch kit
That earlier patch was approved by Jeff:
> OK with expected changes due to renaming/updates to const handling.
> Please repost the final patch for archival purposes.
in https://gcc.gnu.org/ml/gcc-patches/2014-05/msg00825.html
gcc/
* coretypes.h (gimple_omp_for): New.
(const_gimple_omp_for): New.
* gimple.h (gimple_build_omp_for): Return a gimple_omp_for rather
than a plain gimple.
(gimple_omp_for_set_kind): Require a gimple_omp_for rather than a
plain gimple.
(gimple_omp_for_set_combined_p): Likewise.
(gimple_omp_for_set_combined_into_p): Likewise.
* gimple-pretty-print.c (dump_gimple_omp_for): Require a
gimple_omp_for rather than a plain gimple.
(pp_gimple_stmt_1): Add a checked cast to gimple_omp_for in
GIMPLE_OMP_FOR case of switch statement.
* gimple.c (gimple_build_omp_for): Return a gimple_omp_for rather
than a plain gimple.
(gimple_copy): Add a checked cast to gimple_omp_for and a new local.
* gimplify.c (gimplify_omp_for): Strengthen local "gfor" from
gimple to gimple_omp_for.
* omp-low.c (omp_for_data::for_stmt): Strengthen field from gimple
to gimple_omp_for.
(extract_omp_for_data): Require a gimple_omp_for rather than a
plain gimple.
(workshare_safe_to_combine_p): Add a checked cast to
gimple_omp_for.
(get_ws_args_for): Convert check of code against GIMPLE_OMP_FOR
with a dyn_cast<gimple_omp_for> and a new local.
(scan_omp_parallel): Add a checked cast to gimple_omp_for and a
new local.
(scan_omp_for): Require a gimple_omp_for rather than a plain
gimple.
(scan_omp_1_stmt): Add a checked cast to gimple_omp_for in
GIMPLE_OMP_FOR case of switch statement.
(expand_omp_for): Add a checked cast to gimple_omp_for.
(lower_omp_for): Strengthen local "stmt" from gimple to
gimple_omp_for.
* tree-nested.c (walk_gimple_omp_for): Require a gimple_omp_for
rather than a plain gimple.
(convert_nonlocal_reference_stmt): Add a checked cast to
gimple_omp_for in GIMPLE_OMP_FOR case of switch statement.
(convert_local_reference_stmt): Likewise.
* tree-parloops.c (create_parallel_loop): Strengthen local
"for_stmt" from gimple to gimple_omp_for.
---
gcc/ChangeLog.gimple-classes | 53 ++++++++++++++++++++++++++++++++++++++++++++
gcc/coretypes.h | 4 ++++
gcc/gimple-pretty-print.c | 4 ++--
gcc/gimple.c | 8 +++----
gcc/gimple.h | 11 ++++-----
gcc/gimplify.c | 2 +-
gcc/omp-low.c | 26 +++++++++++-----------
gcc/tree-nested.c | 8 ++++---
gcc/tree-parloops.c | 3 ++-
9 files changed, 87 insertions(+), 32 deletions(-)
diff --git a/gcc/ChangeLog.gimple-classes b/gcc/ChangeLog.gimple-classes
index 4f87c87..7ad116a 100644
--- a/gcc/ChangeLog.gimple-classes
+++ b/gcc/ChangeLog.gimple-classes
@@ -1,5 +1,58 @@
2014-10-24 David Malcolm <dmalcolm@redhat.com>
+ Introduce gimple_omp_for
+
+ * coretypes.h (gimple_omp_for): New.
+ (const_gimple_omp_for): New.
+
+ * gimple.h (gimple_build_omp_for): Return a gimple_omp_for rather
+ than a plain gimple.
+ (gimple_omp_for_set_kind): Require a gimple_omp_for rather than a
+ plain gimple.
+ (gimple_omp_for_set_combined_p): Likewise.
+ (gimple_omp_for_set_combined_into_p): Likewise.
+
+ * gimple-pretty-print.c (dump_gimple_omp_for): Require a
+ gimple_omp_for rather than a plain gimple.
+ (pp_gimple_stmt_1): Add a checked cast to gimple_omp_for in
+ GIMPLE_OMP_FOR case of switch statement.
+
+ * gimple.c (gimple_build_omp_for): Return a gimple_omp_for rather
+ than a plain gimple.
+ (gimple_copy): Add a checked cast to gimple_omp_for and a new local.
+
+ * gimplify.c (gimplify_omp_for): Strengthen local "gfor" from
+ gimple to gimple_omp_for.
+
+ * omp-low.c (omp_for_data::for_stmt): Strengthen field from gimple
+ to gimple_omp_for.
+ (extract_omp_for_data): Require a gimple_omp_for rather than a
+ plain gimple.
+ (workshare_safe_to_combine_p): Add a checked cast to
+ gimple_omp_for.
+ (get_ws_args_for): Convert check of code against GIMPLE_OMP_FOR
+ with a dyn_cast<gimple_omp_for> and a new local.
+ (scan_omp_parallel): Add a checked cast to gimple_omp_for and a
+ new local.
+ (scan_omp_for): Require a gimple_omp_for rather than a plain
+ gimple.
+ (scan_omp_1_stmt): Add a checked cast to gimple_omp_for in
+ GIMPLE_OMP_FOR case of switch statement.
+ (expand_omp_for): Add a checked cast to gimple_omp_for.
+ (lower_omp_for): Strengthen local "stmt" from gimple to
+ gimple_omp_for.
+
+ * tree-nested.c (walk_gimple_omp_for): Require a gimple_omp_for
+ rather than a plain gimple.
+ (convert_nonlocal_reference_stmt): Add a checked cast to
+ gimple_omp_for in GIMPLE_OMP_FOR case of switch statement.
+ (convert_local_reference_stmt): Likewise.
+
+ * tree-parloops.c (create_parallel_loop): Strengthen local
+ "for_stmt" from gimple to gimple_omp_for.
+
+2014-10-24 David Malcolm <dmalcolm@redhat.com>
+
Introduce gimple_omp_critical
* coretypes.h (gimple_omp_critical): New typedef.
diff --git a/gcc/coretypes.h b/gcc/coretypes.h
index 0fd3db5..273ba7e 100644
--- a/gcc/coretypes.h
+++ b/gcc/coretypes.h
@@ -184,6 +184,10 @@ struct gimple_statement_omp_critical;
typedef struct gimple_statement_omp_critical *gimple_omp_critical;
typedef const struct gimple_statement_omp_critical *const_gimple_omp_critical;
+struct gimple_statement_omp_for;
+typedef struct gimple_statement_omp_for *gimple_omp_for;
+typedef const struct gimple_statement_omp_for *const_gimple_omp_for;
+
union section;
typedef union section section;
struct gcc_options;
diff --git a/gcc/gimple-pretty-print.c b/gcc/gimple-pretty-print.c
index 51ca587..69a4b4c 100644
--- a/gcc/gimple-pretty-print.c
+++ b/gcc/gimple-pretty-print.c
@@ -1117,7 +1117,7 @@ dump_gimple_debug (pretty_printer *buffer, gimple_debug gs, int spc, int flags)
/* Dump a GIMPLE_OMP_FOR tuple on the pretty_printer BUFFER. */
static void
-dump_gimple_omp_for (pretty_printer *buffer, gimple gs, int spc, int flags)
+dump_gimple_omp_for (pretty_printer *buffer, gimple_omp_for gs, int spc, int flags)
{
size_t i;
@@ -2156,7 +2156,7 @@ pp_gimple_stmt_1 (pretty_printer *buffer, gimple gs, int spc, int flags)
break;
case GIMPLE_OMP_FOR:
- dump_gimple_omp_for (buffer, gs, spc, flags);
+ dump_gimple_omp_for (buffer, as_a <gimple_omp_for> (gs), spc, flags);
break;
case GIMPLE_OMP_CONTINUE:
diff --git a/gcc/gimple.c b/gcc/gimple.c
index b3bfe14..3d8fd44 100644
--- a/gcc/gimple.c
+++ b/gcc/gimple.c
@@ -839,12 +839,11 @@ gimple_build_omp_critical (gimple_seq body, tree name)
COLLAPSE is the collapse count.
PRE_BODY is the sequence of statements that are loop invariant. */
-gimple
+gimple_omp_for
gimple_build_omp_for (gimple_seq body, int kind, tree clauses, size_t collapse,
gimple_seq pre_body)
{
- gimple_statement_omp_for *p =
- as_a <gimple_statement_omp_for *> (gimple_alloc (GIMPLE_OMP_FOR, 0));
+ gimple_omp_for p = as_a <gimple_omp_for> (gimple_alloc (GIMPLE_OMP_FOR, 0));
if (body)
gimple_omp_set_body (p, body);
gimple_omp_for_set_clauses (p, clauses);
@@ -1711,8 +1710,7 @@ gimple_copy (gimple stmt)
t = unshare_expr (gimple_omp_for_clauses (stmt));
gimple_omp_for_set_clauses (copy, t);
{
- gimple_statement_omp_for *omp_for_copy =
- as_a <gimple_statement_omp_for *> (copy);
+ gimple_omp_for omp_for_copy = as_a <gimple_omp_for> (copy);
omp_for_copy->iter = ggc_vec_alloc<gimple_omp_for_iter>
( gimple_omp_for_collapse (stmt));
}
diff --git a/gcc/gimple.h b/gcc/gimple.h
index 8252b75..3ed5fc9 100644
--- a/gcc/gimple.h
+++ b/gcc/gimple.h
@@ -1343,7 +1343,7 @@ gimple_debug gimple_build_debug_source_bind_stat (tree, tree, gimple MEM_STAT_DE
#define gimple_build_debug_source_bind(var,val,stmt) \
gimple_build_debug_source_bind_stat ((var), (val), (stmt) MEM_STAT_INFO)
gimple_omp_critical gimple_build_omp_critical (gimple_seq, tree);
-gimple gimple_build_omp_for (gimple_seq, int, tree, size_t, gimple_seq);
+gimple_omp_for gimple_build_omp_for (gimple_seq, int, tree, size_t, gimple_seq);
gimple gimple_build_omp_parallel (gimple_seq, tree, tree, tree);
gimple gimple_build_omp_task (gimple_seq, tree, tree, tree, tree, tree, tree);
gimple gimple_build_omp_section (gimple_seq);
@@ -4394,9 +4394,8 @@ gimple_omp_for_kind (const_gimple g)
/* Set the OMP for kind. */
static inline void
-gimple_omp_for_set_kind (gimple g, int kind)
+gimple_omp_for_set_kind (gimple_omp_for g, int kind)
{
- GIMPLE_CHECK (g, GIMPLE_OMP_FOR);
g->subcode = (g->subcode & ~GF_OMP_FOR_KIND_MASK)
| (kind & GF_OMP_FOR_KIND_MASK);
}
@@ -4417,9 +4416,8 @@ gimple_omp_for_combined_p (const_gimple g)
value of COMBINED_P. */
static inline void
-gimple_omp_for_set_combined_p (gimple g, bool combined_p)
+gimple_omp_for_set_combined_p (gimple_omp_for g, bool combined_p)
{
- GIMPLE_CHECK (g, GIMPLE_OMP_FOR);
if (combined_p)
g->subcode |= GF_OMP_FOR_COMBINED;
else
@@ -4442,9 +4440,8 @@ gimple_omp_for_combined_into_p (const_gimple g)
value of COMBINED_P. */
static inline void
-gimple_omp_for_set_combined_into_p (gimple g, bool combined_p)
+gimple_omp_for_set_combined_into_p (gimple_omp_for g, bool combined_p)
{
- GIMPLE_CHECK (g, GIMPLE_OMP_FOR);
if (combined_p)
g->subcode |= GF_OMP_FOR_COMBINED_INTO;
else
diff --git a/gcc/gimplify.c b/gcc/gimplify.c
index a969233..8883523 100644
--- a/gcc/gimplify.c
+++ b/gcc/gimplify.c
@@ -6708,7 +6708,7 @@ gimplify_omp_for (tree *expr_p, gimple_seq *pre_p)
tree for_stmt, orig_for_stmt, decl, var, t;
enum gimplify_status ret = GS_ALL_DONE;
enum gimplify_status tret;
- gimple gfor;
+ gimple_omp_for gfor;
gimple_seq for_body, for_pre_body;
int i;
bool simd;
diff --git a/gcc/omp-low.c b/gcc/omp-low.c
index 57dfa65..a40a405 100644
--- a/gcc/omp-low.c
+++ b/gcc/omp-low.c
@@ -190,7 +190,7 @@ struct omp_for_data
{
struct omp_for_data_loop loop;
tree chunk_size;
- gimple for_stmt;
+ gimple_omp_for for_stmt;
tree pre, iter_type;
int collapse;
bool have_nowait, have_ordered;
@@ -290,7 +290,7 @@ is_combined_parallel (struct omp_region *region)
them into *FD. */
static void
-extract_omp_for_data (gimple for_stmt, struct omp_for_data *fd,
+extract_omp_for_data (gimple_omp_for for_stmt, struct omp_for_data *fd,
struct omp_for_data_loop *loops)
{
tree t, var, *collapse_iter, *collapse_count;
@@ -638,7 +638,7 @@ workshare_safe_to_combine_p (basic_block ws_entry_bb)
gcc_assert (gimple_code (ws_stmt) == GIMPLE_OMP_FOR);
- extract_omp_for_data (ws_stmt, &fd, NULL);
+ extract_omp_for_data (as_a <gimple_omp_for> (ws_stmt), &fd, NULL);
if (fd.collapse > 1 && TREE_CODE (fd.loop.n2) != INTEGER_CST)
return false;
@@ -671,16 +671,16 @@ get_ws_args_for (gimple par_stmt, gimple ws_stmt)
location_t loc = gimple_location (ws_stmt);
vec<tree, va_gc> *ws_args;
- if (gimple_code (ws_stmt) == GIMPLE_OMP_FOR)
+ if (gimple_omp_for for_stmt = dyn_cast <gimple_omp_for> (ws_stmt))
{
struct omp_for_data fd;
tree n1, n2;
- extract_omp_for_data (ws_stmt, &fd, NULL);
+ extract_omp_for_data (for_stmt, &fd, NULL);
n1 = fd.loop.n1;
n2 = fd.loop.n2;
- if (gimple_omp_for_combined_into_p (ws_stmt))
+ if (gimple_omp_for_combined_into_p (for_stmt))
{
tree innerc
= find_omp_clause (gimple_omp_parallel_clauses (par_stmt),
@@ -2064,16 +2064,15 @@ scan_omp_parallel (gimple_stmt_iterator *gsi, omp_context *outer_ctx)
if (gimple_omp_parallel_combined_p (stmt))
{
- gimple for_stmt;
struct walk_stmt_info wi;
memset (&wi, 0, sizeof (wi));
wi.val_only = true;
walk_gimple_seq (gimple_omp_body (stmt),
find_combined_for, NULL, &wi);
- for_stmt = (gimple) wi.info;
- if (for_stmt)
+ if (wi.info)
{
+ gimple_omp_for for_stmt = as_a <gimple_omp_for> ((gimple) wi.info);
struct omp_for_data fd;
extract_omp_for_data (for_stmt, &fd, NULL);
/* We need two temporaries with fd.loop.v type (istart/iend)
@@ -2273,7 +2272,7 @@ finish_taskreg_scan (omp_context *ctx)
/* Scan an OpenMP loop directive. */
static void
-scan_omp_for (gimple stmt, omp_context *outer_ctx)
+scan_omp_for (gimple_omp_for stmt, omp_context *outer_ctx)
{
omp_context *ctx;
size_t i;
@@ -2811,7 +2810,7 @@ scan_omp_1_stmt (gimple_stmt_iterator *gsi, bool *handled_ops_p,
break;
case GIMPLE_OMP_FOR:
- scan_omp_for (stmt, ctx);
+ scan_omp_for (as_a <gimple_omp_for> (stmt), ctx);
break;
case GIMPLE_OMP_SECTIONS:
@@ -7323,7 +7322,8 @@ expand_omp_for (struct omp_region *region, gimple inner_stmt)
= (struct omp_for_data_loop *)
alloca (gimple_omp_for_collapse (last_stmt (region->entry))
* sizeof (struct omp_for_data_loop));
- extract_omp_for_data (last_stmt (region->entry), &fd, loops);
+ extract_omp_for_data (as_a <gimple_omp_for> (last_stmt (region->entry)),
+ &fd, loops);
region->sched_kind = fd.sched_kind;
gcc_assert (EDGE_COUNT (region->entry->succs) == 2);
@@ -9396,7 +9396,7 @@ lower_omp_for (gimple_stmt_iterator *gsi_p, omp_context *ctx)
{
tree *rhs_p, block;
struct omp_for_data fd, *fdp = NULL;
- gimple stmt = gsi_stmt (*gsi_p);
+ gimple_omp_for stmt = as_a <gimple_omp_for> (gsi_stmt (*gsi_p));
gimple_bind new_stmt;
gimple_seq omp_for_body, body, dlist;
size_t i;
diff --git a/gcc/tree-nested.c b/gcc/tree-nested.c
index 3caa335..84401df 100644
--- a/gcc/tree-nested.c
+++ b/gcc/tree-nested.c
@@ -613,7 +613,7 @@ walk_function (walk_stmt_fn callback_stmt, walk_tree_fn callback_op,
/* Invoke CALLBACK on a GIMPLE_OMP_FOR's init, cond, incr and pre-body. */
static void
-walk_gimple_omp_for (gimple for_stmt,
+walk_gimple_omp_for (gimple_omp_for for_stmt,
walk_stmt_fn callback_stmt, walk_tree_fn callback_op,
struct nesting_info *info)
{
@@ -1345,7 +1345,8 @@ convert_nonlocal_reference_stmt (gimple_stmt_iterator *gsi, bool *handled_ops_p,
case GIMPLE_OMP_FOR:
save_suppress = info->suppress_expansion;
convert_nonlocal_omp_clauses (gimple_omp_for_clauses_ptr (stmt), wi);
- walk_gimple_omp_for (stmt, convert_nonlocal_reference_stmt,
+ walk_gimple_omp_for (as_a <gimple_omp_for> (stmt),
+ convert_nonlocal_reference_stmt,
convert_nonlocal_reference_op, info);
walk_body (convert_nonlocal_reference_stmt,
convert_nonlocal_reference_op, info, gimple_omp_body_ptr (stmt));
@@ -1913,7 +1914,8 @@ convert_local_reference_stmt (gimple_stmt_iterator *gsi, bool *handled_ops_p,
case GIMPLE_OMP_FOR:
save_suppress = info->suppress_expansion;
convert_local_omp_clauses (gimple_omp_for_clauses_ptr (stmt), wi);
- walk_gimple_omp_for (stmt, convert_local_reference_stmt,
+ walk_gimple_omp_for (as_a <gimple_omp_for> (stmt),
+ convert_local_reference_stmt,
convert_local_reference_op, info);
walk_body (convert_local_reference_stmt, convert_local_reference_op,
info, gimple_omp_body_ptr (stmt));
diff --git a/gcc/tree-parloops.c b/gcc/tree-parloops.c
index f38848c..cd290a7 100644
--- a/gcc/tree-parloops.c
+++ b/gcc/tree-parloops.c
@@ -1605,7 +1605,8 @@ create_parallel_loop (struct loop *loop, tree loop_fn, tree data,
gimple_stmt_iterator gsi;
basic_block bb, paral_bb, for_bb, ex_bb;
tree t, param;
- gimple stmt, for_stmt, phi, cond_stmt;
+ gimple stmt, phi, cond_stmt;
+ gimple_omp_for for_stmt;
tree cvar, cvar_init, initvar, cvar_next, cvar_base, type;
edge exit, nexit, guard, end, e;
--
1.8.5.3
^ permalink raw reply [flat|nested] 93+ messages in thread
* [gimple-classes, committed 48/92] Make gimple_phi_arg_set_location require a gimple_phi
2014-10-27 20:35 [gimple-classes, committed 00/92] Initial slew of commits David Malcolm
` (70 preceding siblings ...)
2014-10-27 20:55 ` [gimple-classes, committed 36/92] Introduce gimple_omp_for David Malcolm
@ 2014-10-27 20:55 ` David Malcolm
2014-10-27 20:55 ` [gimple-classes, committed 59/92] Concretize gimple_call_use_set and gimple_call_clobber_set David Malcolm
` (19 subsequent siblings)
91 siblings, 0 replies; 93+ messages in thread
From: David Malcolm @ 2014-10-27 20:55 UTC (permalink / raw)
To: gcc-patches; +Cc: David Malcolm
This corresponds to:
[PATCH 50/89] Make gimple_phi_arg_set_location require a gimple_phi
https://gcc.gnu.org/ml/gcc-patches/2014-04/msg01163.html
from the original 89-patch kit
That earlier patch was approved by Jeff:
> OK once prerequisites have gone in.
in https://gcc.gnu.org/ml/gcc-patches/2014-05/msg00811.html
gcc/
* gimple.h (gimple_phi_arg_set_location): Require a gimple_phi
rather than a plain gimple.
---
gcc/ChangeLog.gimple-classes | 7 +++++++
gcc/gimple.h | 6 +++---
2 files changed, 10 insertions(+), 3 deletions(-)
diff --git a/gcc/ChangeLog.gimple-classes b/gcc/ChangeLog.gimple-classes
index a162b12..f7d2c73 100644
--- a/gcc/ChangeLog.gimple-classes
+++ b/gcc/ChangeLog.gimple-classes
@@ -1,5 +1,12 @@
2014-10-24 David Malcolm <dmalcolm@redhat.com>
+ Make gimple_phi_arg_set_location require a gimple_phi
+
+ * gimple.h (gimple_phi_arg_set_location): Require a gimple_phi
+ rather than a plain gimple.
+
+2014-10-24 David Malcolm <dmalcolm@redhat.com>
+
Make add_phi_arg require a gimple_phi
* tree-phinodes.h (add_phi_arg): Require a gimple_phi rather than
diff --git a/gcc/gimple.h b/gcc/gimple.h
index e4ebcff..5e49d97 100644
--- a/gcc/gimple.h
+++ b/gcc/gimple.h
@@ -4003,12 +4003,12 @@ gimple_phi_arg_location_from_edge (gimple gs, edge e)
return gimple_phi_arg (gs, e->dest_idx)->locus;
}
-/* Set the source location of gimple argument I of phi node GS to LOC. */
+/* Set the source location of gimple argument I of phi node PHI to LOC. */
static inline void
-gimple_phi_arg_set_location (gimple gs, size_t i, source_location loc)
+gimple_phi_arg_set_location (gimple_phi phi, size_t i, source_location loc)
{
- gimple_phi_arg (gs, i)->locus = loc;
+ gimple_phi_arg (phi, i)->locus = loc;
}
/* Return TRUE if argument I of phi node PHI has a location record. */
--
1.8.5.3
^ permalink raw reply [flat|nested] 93+ messages in thread
* [gimple-classes, committed 59/92] Concretize gimple_call_use_set and gimple_call_clobber_set
2014-10-27 20:35 [gimple-classes, committed 00/92] Initial slew of commits David Malcolm
` (71 preceding siblings ...)
2014-10-27 20:55 ` [gimple-classes, committed 48/92] Make gimple_phi_arg_set_location require a gimple_phi David Malcolm
@ 2014-10-27 20:55 ` David Malcolm
2014-10-27 20:55 ` [gimple-classes, committed 18/92] Introduce gimple_call David Malcolm
` (18 subsequent siblings)
91 siblings, 0 replies; 93+ messages in thread
From: David Malcolm @ 2014-10-27 20:55 UTC (permalink / raw)
To: gcc-patches; +Cc: David Malcolm
This corresponds to:
[PATCH 61/89] Concretize gimple_call_use_set and gimple_call_clobber_set
https://gcc.gnu.org/ml/gcc-patches/2014-04/msg01223.html
from the original 89-patch kit
That earlier patch was approved by Jeff:
> OK once prerequisites have gone in.
in https://gcc.gnu.org/ml/gcc-patches/2014-05/msg00817.html
gcc/
* gimple.h (gimple_call_use_set): Require a gimple_call.
(gimple_call_clobber_set): Likewise.
---
gcc/ChangeLog.gimple-classes | 7 +++++++
gcc/gimple.h | 10 ++++------
2 files changed, 11 insertions(+), 6 deletions(-)
diff --git a/gcc/ChangeLog.gimple-classes b/gcc/ChangeLog.gimple-classes
index d2bc077..5cf1049 100644
--- a/gcc/ChangeLog.gimple-classes
+++ b/gcc/ChangeLog.gimple-classes
@@ -1,5 +1,12 @@
2014-10-24 David Malcolm <dmalcolm@redhat.com>
+ Concretize gimple_call_use_set and gimple_call_clobber_set
+
+ * gimple.h (gimple_call_use_set): Require a gimple_call.
+ (gimple_call_clobber_set): Likewise.
+
+2014-10-24 David Malcolm <dmalcolm@redhat.com>
+
Concretize gimple_catch_types
* gimple.h (gimple_catch_types): Require a const_gimple_catch
diff --git a/gcc/gimple.h b/gcc/gimple.h
index 18cfcec..6055e33 100644
--- a/gcc/gimple.h
+++ b/gcc/gimple.h
@@ -2964,23 +2964,21 @@ gimple_call_copy_flags (gimple dest_call, gimple orig_call)
/* Return a pointer to the points-to solution for the set of call-used
- variables of the call CALL. */
+ variables of the call CALL_STMT. */
static inline struct pt_solution *
-gimple_call_use_set (gimple call)
+gimple_call_use_set (gimple_call call_stmt)
{
- gimple_statement_call *call_stmt = as_a <gimple_statement_call *> (call);
return &call_stmt->call_used;
}
/* Return a pointer to the points-to solution for the set of call-used
- variables of the call CALL. */
+ variables of the call CALL_STMT. */
static inline struct pt_solution *
-gimple_call_clobber_set (gimple call)
+gimple_call_clobber_set (gimple_call call_stmt)
{
- gimple_statement_call *call_stmt = as_a <gimple_statement_call *> (call);
return &call_stmt->call_clobbered;
}
--
1.8.5.3
^ permalink raw reply [flat|nested] 93+ messages in thread
* [gimple-classes, committed 44/92] tree-parloops.c: Use gimple_phi in various places
2014-10-27 20:35 [gimple-classes, committed 00/92] Initial slew of commits David Malcolm
` (68 preceding siblings ...)
2014-10-27 20:55 ` [gimple-classes, committed 41/92] Introduce gimple_omp_target David Malcolm
@ 2014-10-27 20:55 ` David Malcolm
2014-10-27 20:55 ` [gimple-classes, committed 36/92] Introduce gimple_omp_for David Malcolm
` (21 subsequent siblings)
91 siblings, 0 replies; 93+ messages in thread
From: David Malcolm @ 2014-10-27 20:55 UTC (permalink / raw)
To: gcc-patches; +Cc: David Malcolm
This corresponds to:
[PATCH 46/89] tree-parloops.c: Use gimple_phi in various places
https://gcc.gnu.org/ml/gcc-patches/2014-04/msg01168.html
from the original 89-patch kit
That earlier patch was approved by Jeff:
> OK once prerequisites have gone in.
in https://gcc.gnu.org/ml/gcc-patches/2014-05/msg00819.html
gcc/
* tree-parloops.c (reduction_info::keep_res): Strengthen field
from plain gimple to gimple_phi.
(transform_to_exit_first_loop): Strengthen locals "phi", "nphi"
to gimple_phi. Eliminate early decl of gimple_stmt_iterator gsi
in favor of more tightly scoped gimple_phi_iterators, and a final
later decl as a gimple_stmt_iterator.
---
gcc/ChangeLog.gimple-classes | 11 +++++++++++
gcc/tree-parloops.c | 19 +++++++++++--------
2 files changed, 22 insertions(+), 8 deletions(-)
diff --git a/gcc/ChangeLog.gimple-classes b/gcc/ChangeLog.gimple-classes
index b0a8465..b8d2f38 100644
--- a/gcc/ChangeLog.gimple-classes
+++ b/gcc/ChangeLog.gimple-classes
@@ -1,5 +1,16 @@
2014-10-24 David Malcolm <dmalcolm@redhat.com>
+ tree-parloops.c: Use gimple_phi in various places
+
+ * tree-parloops.c (reduction_info::keep_res): Strengthen field
+ from plain gimple to gimple_phi.
+ (transform_to_exit_first_loop): Strengthen locals "phi", "nphi"
+ to gimple_phi. Eliminate early decl of gimple_stmt_iterator gsi
+ in favor of more tightly scoped gimple_phi_iterators, and a final
+ later decl as a gimple_stmt_iterator.
+
+2014-10-24 David Malcolm <dmalcolm@redhat.com>
+
Introduce gimple_omp_sections
* coretypes.h (gimple_omp_sections): New typedef.
diff --git a/gcc/tree-parloops.c b/gcc/tree-parloops.c
index cd290a7..fbb74a9 100644
--- a/gcc/tree-parloops.c
+++ b/gcc/tree-parloops.c
@@ -192,7 +192,7 @@ struct reduction_info
enum tree_code reduction_code;/* code for the reduction operation. */
unsigned reduc_version; /* SSA_NAME_VERSION of original reduc_phi
result. */
- gimple keep_res; /* The PHI_RESULT of this phi is the resulting value
+ gimple_phi keep_res; /* The PHI_RESULT of this phi is the resulting value
of the reduction variable when existing the loop. */
tree initial_value; /* The initial value of the reduction var before entering the loop. */
tree field; /* the name of the field in the parloop data structure intended for reduction. */
@@ -1498,8 +1498,8 @@ transform_to_exit_first_loop (struct loop *loop,
bool ok;
edge exit = single_dom_exit (loop), hpred;
tree control, control_name, res, t;
- gimple phi, nphi, cond_stmt, stmt, cond_nit;
- gimple_stmt_iterator gsi;
+ gimple_phi phi, nphi;
+ gimple cond_stmt, stmt, cond_nit;
tree nit_1;
split_block_after_labels (loop->header);
@@ -1512,9 +1512,11 @@ transform_to_exit_first_loop (struct loop *loop,
/* Make sure that we have phi nodes on exit for all loop header phis
(create_parallel_loop requires that). */
- for (gsi = gsi_start_phis (loop->header); !gsi_end_p (gsi); gsi_next (&gsi))
+ for (gimple_phi_iterator gsi = gsi_start_phis (loop->header);
+ !gsi_end_p (gsi);
+ gsi_next (&gsi))
{
- phi = gsi_stmt (gsi);
+ phi = gsi.phi ();
res = PHI_RESULT (phi);
t = copy_ssa_name (res, phi);
SET_PHI_RESULT (phi, t);
@@ -1545,9 +1547,10 @@ transform_to_exit_first_loop (struct loop *loop,
out of the loop is the control variable. */
exit = single_dom_exit (loop);
control_name = NULL_TREE;
- for (gsi = gsi_start_phis (ex_bb); !gsi_end_p (gsi); )
+ for (gimple_phi_iterator gsi = gsi_start_phis (ex_bb);
+ !gsi_end_p (gsi); )
{
- phi = gsi_stmt (gsi);
+ phi = gsi.phi ();
res = PHI_RESULT (phi);
if (virtual_operand_p (res))
{
@@ -1582,7 +1585,7 @@ transform_to_exit_first_loop (struct loop *loop,
/* Initialize the control variable to number of iterations
according to the rhs of the exit condition. */
- gsi = gsi_after_labels (ex_bb);
+ gimple_stmt_iterator gsi = gsi_after_labels (ex_bb);
cond_nit = last_stmt (exit->src);
nit_1 = gimple_cond_rhs (cond_nit);
nit_1 = force_gimple_operand_gsi (&gsi,
--
1.8.5.3
^ permalink raw reply [flat|nested] 93+ messages in thread
* [gimple-classes, committed 41/92] Introduce gimple_omp_target
2014-10-27 20:35 [gimple-classes, committed 00/92] Initial slew of commits David Malcolm
` (67 preceding siblings ...)
2014-10-27 20:55 ` [gimple-classes, committed 46/92] Make gimple_phi_arg_def_ptr and gimple_phi_arg_has_location require a gimple_phi David Malcolm
@ 2014-10-27 20:55 ` David Malcolm
2014-10-27 20:55 ` [gimple-classes, committed 44/92] tree-parloops.c: Use gimple_phi in various places David Malcolm
` (22 subsequent siblings)
91 siblings, 0 replies; 93+ messages in thread
From: David Malcolm @ 2014-10-27 20:55 UTC (permalink / raw)
To: gcc-patches; +Cc: David Malcolm
This corresponds to:
[PATCH 43/89] Introduce gimple_omp_target
https://gcc.gnu.org/ml/gcc-patches/2014-04/msg01201.html
from the original 89-patch kit
That earlier patch was approved by Jeff:
> OK with expected changes due to renaming/updates to const handling.
> Please repost the final patch for archival purposes.
in https://gcc.gnu.org/ml/gcc-patches/2014-05/msg00823.html
gcc/
* coretypes.h (gimple_omp_target): New typedef.
(const_gimple_omp_target): New typedef.
* gimple.h (gimple_build_omp_target): Return a gimple_omp_target
rather than a plain gimple.
(gimple_omp_target_set_clauses): Require a gimple_omp_target
rather than a plain gimple.
(gimple_omp_target_set_kind): Likewise.
(gimple_omp_target_child_fn_ptr): Likewise.
(gimple_omp_target_set_child_fn): Likewise.
(gimple_omp_target_data_arg_ptr): Likewise.
(gimple_omp_target_set_data_arg): Likewise.
(gimple_omp_target_child_fn): Require a const_gimple_omp_target
rather than a plain const_gimple.
(gimple_omp_target_data_arg): Likewise.
* gimple-pretty-print.c (dump_gimple_omp_target): Require a
gimple_omp_target rather than a plain gimple.
(pp_gimple_stmt_1): Add checked cast to gimple_omp_target within
GIMPLE_OMP_TARGET case of switch statement.
* gimple.c (gimple_build_omp_target): Return a gimple_omp_target
rather than a plain gimple.
* gimplify.c (gimplify_omp_target_update): Strengthen local "stmt"
from gimple to gimple_omp_target.
* omp-low.c (scan_omp_target): Require a gimple_omp_target rather
than a plain gimple.
(scan_omp_1_stmt): Add checked cast to gimple_omp_target within
GIMPLE_OMP_TARGET case of switch statement.
(expand_omp_target): Strengthen local "entry_stmt" from gimple to
gimple_omp_target.
(lower_omp_target): Likewise for "stmt".
* tree-nested.c (convert_nonlocal_reference_stmt): Add checked
cast to gimple_omp_target.
(convert_local_reference_stmt): Likewise.
(convert_gimple_call): Likewise.
---
gcc/ChangeLog.gimple-classes | 44 ++++++++++++++++++++++++++++++++++++++++
gcc/coretypes.h | 4 ++++
gcc/gimple-pretty-print.c | 6 ++++--
gcc/gimple.c | 5 +++--
gcc/gimple.h | 48 +++++++++++++++++---------------------------
gcc/gimplify.c | 2 +-
gcc/omp-low.c | 11 +++++-----
gcc/tree-nested.c | 7 ++++---
8 files changed, 84 insertions(+), 43 deletions(-)
diff --git a/gcc/ChangeLog.gimple-classes b/gcc/ChangeLog.gimple-classes
index 88ebaa9..e576b5e 100644
--- a/gcc/ChangeLog.gimple-classes
+++ b/gcc/ChangeLog.gimple-classes
@@ -1,5 +1,49 @@
2014-10-24 David Malcolm <dmalcolm@redhat.com>
+ Introduce gimple_omp_target
+
+ * coretypes.h (gimple_omp_target): New typedef.
+ (const_gimple_omp_target): New typedef.
+
+ * gimple.h (gimple_build_omp_target): Return a gimple_omp_target
+ rather than a plain gimple.
+ (gimple_omp_target_set_clauses): Require a gimple_omp_target
+ rather than a plain gimple.
+ (gimple_omp_target_set_kind): Likewise.
+ (gimple_omp_target_child_fn_ptr): Likewise.
+ (gimple_omp_target_set_child_fn): Likewise.
+ (gimple_omp_target_data_arg_ptr): Likewise.
+ (gimple_omp_target_set_data_arg): Likewise.
+ (gimple_omp_target_child_fn): Require a const_gimple_omp_target
+ rather than a plain const_gimple.
+ (gimple_omp_target_data_arg): Likewise.
+
+ * gimple-pretty-print.c (dump_gimple_omp_target): Require a
+ gimple_omp_target rather than a plain gimple.
+ (pp_gimple_stmt_1): Add checked cast to gimple_omp_target within
+ GIMPLE_OMP_TARGET case of switch statement.
+
+ * gimple.c (gimple_build_omp_target): Return a gimple_omp_target
+ rather than a plain gimple.
+
+ * gimplify.c (gimplify_omp_target_update): Strengthen local "stmt"
+ from gimple to gimple_omp_target.
+
+ * omp-low.c (scan_omp_target): Require a gimple_omp_target rather
+ than a plain gimple.
+ (scan_omp_1_stmt): Add checked cast to gimple_omp_target within
+ GIMPLE_OMP_TARGET case of switch statement.
+ (expand_omp_target): Strengthen local "entry_stmt" from gimple to
+ gimple_omp_target.
+ (lower_omp_target): Likewise for "stmt".
+
+ * tree-nested.c (convert_nonlocal_reference_stmt): Add checked
+ cast to gimple_omp_target.
+ (convert_local_reference_stmt): Likewise.
+ (convert_gimple_call): Likewise.
+
+2014-10-24 David Malcolm <dmalcolm@redhat.com>
+
Introduce gimple_omp_single
* coretypes.h (gimple_omp_single): New typedef.
diff --git a/gcc/coretypes.h b/gcc/coretypes.h
index ea8f8f4..6996373 100644
--- a/gcc/coretypes.h
+++ b/gcc/coretypes.h
@@ -200,6 +200,10 @@ struct gimple_statement_omp_single;
typedef struct gimple_statement_omp_single *gimple_omp_single;
typedef const struct gimple_statement_omp_single *const_gimple_omp_single;
+struct gimple_statement_omp_target;
+typedef struct gimple_statement_omp_target *gimple_omp_target;
+typedef const struct gimple_statement_omp_target *const_gimple_omp_target;
+
union section;
typedef union section section;
struct gcc_options;
diff --git a/gcc/gimple-pretty-print.c b/gcc/gimple-pretty-print.c
index 61eacd2..6491c55 100644
--- a/gcc/gimple-pretty-print.c
+++ b/gcc/gimple-pretty-print.c
@@ -1307,7 +1307,8 @@ dump_gimple_omp_single (pretty_printer *buffer, gimple_omp_single gs,
/* Dump a GIMPLE_OMP_TARGET tuple on the pretty_printer BUFFER. */
static void
-dump_gimple_omp_target (pretty_printer *buffer, gimple gs, int spc, int flags)
+dump_gimple_omp_target (pretty_printer *buffer, gimple_omp_target gs,
+ int spc, int flags)
{
const char *kind;
switch (gimple_omp_target_kind (gs))
@@ -2172,7 +2173,8 @@ pp_gimple_stmt_1 (pretty_printer *buffer, gimple gs, int spc, int flags)
break;
case GIMPLE_OMP_TARGET:
- dump_gimple_omp_target (buffer, gs, spc, flags);
+ dump_gimple_omp_target (buffer, as_a <gimple_omp_target> (gs), spc,
+ flags);
break;
case GIMPLE_OMP_TEAMS:
diff --git a/gcc/gimple.c b/gcc/gimple.c
index bf5f315..afeaa5b 100644
--- a/gcc/gimple.c
+++ b/gcc/gimple.c
@@ -1052,10 +1052,11 @@ gimple_build_omp_single (gimple_seq body, tree clauses)
BODY is the sequence of statements that will be executed.
CLAUSES are any of the OMP target construct's clauses. */
-gimple
+gimple_omp_target
gimple_build_omp_target (gimple_seq body, int kind, tree clauses)
{
- gimple p = gimple_alloc (GIMPLE_OMP_TARGET, 0);
+ gimple_omp_target p =
+ as_a <gimple_omp_target> (gimple_alloc (GIMPLE_OMP_TARGET, 0));
if (body)
gimple_omp_set_body (p, body);
gimple_omp_target_set_clauses (p, clauses);
diff --git a/gcc/gimple.h b/gcc/gimple.h
index 1caf745..6bad165 100644
--- a/gcc/gimple.h
+++ b/gcc/gimple.h
@@ -1356,7 +1356,7 @@ gimple gimple_build_omp_return (bool);
gimple gimple_build_omp_sections (gimple_seq, tree);
gimple gimple_build_omp_sections_switch (void);
gimple_omp_single gimple_build_omp_single (gimple_seq, tree);
-gimple gimple_build_omp_target (gimple_seq, int, tree);
+gimple_omp_target gimple_build_omp_target (gimple_seq, int, tree);
gimple gimple_build_omp_teams (gimple_seq, tree);
gimple_omp_atomic_load gimple_build_omp_atomic_load (tree, tree);
gimple_omp_atomic_store gimple_build_omp_atomic_store (tree);
@@ -5113,13 +5113,12 @@ gimple_omp_target_clauses_ptr (gimple gs)
}
-/* Set CLAUSES to be the clauses associated with OMP_TARGET GS. */
+/* Set CLAUSES to be the clauses associated with OMP_TARGET_STMT. */
static inline void
-gimple_omp_target_set_clauses (gimple gs, tree clauses)
+gimple_omp_target_set_clauses (gimple_omp_target omp_target_stmt,
+ tree clauses)
{
- gimple_statement_omp_target *omp_target_stmt =
- as_a <gimple_statement_omp_target *> (gs);
omp_target_stmt->clauses = clauses;
}
@@ -5137,55 +5136,47 @@ gimple_omp_target_kind (const_gimple g)
/* Set the OMP target kind. */
static inline void
-gimple_omp_target_set_kind (gimple g, int kind)
+gimple_omp_target_set_kind (gimple_omp_target g, int kind)
{
- GIMPLE_CHECK (g, GIMPLE_OMP_TARGET);
g->subcode = (g->subcode & ~GF_OMP_TARGET_KIND_MASK)
| (kind & GF_OMP_TARGET_KIND_MASK);
}
-/* Return the child function used to hold the body of OMP_TARGET GS. */
+/* Return the child function used to hold the body of OMP_TARGET_STMT. */
static inline tree
-gimple_omp_target_child_fn (const_gimple gs)
+gimple_omp_target_child_fn (const_gimple_omp_target omp_target_stmt)
{
- const gimple_statement_omp_target *omp_target_stmt =
- as_a <const gimple_statement_omp_target *> (gs);
return omp_target_stmt->child_fn;
}
/* Return a pointer to the child function used to hold the body of
- OMP_TARGET GS. */
+ OMP_TARGET_STMT. */
static inline tree *
-gimple_omp_target_child_fn_ptr (gimple gs)
+gimple_omp_target_child_fn_ptr (gimple_omp_target omp_target_stmt)
{
- gimple_statement_omp_target *omp_target_stmt =
- as_a <gimple_statement_omp_target *> (gs);
return &omp_target_stmt->child_fn;
}
-/* Set CHILD_FN to be the child function for OMP_TARGET GS. */
+/* Set CHILD_FN to be the child function for OMP_TARGET_STMT. */
static inline void
-gimple_omp_target_set_child_fn (gimple gs, tree child_fn)
+gimple_omp_target_set_child_fn (gimple_omp_target omp_target_stmt,
+ tree child_fn)
{
- gimple_statement_omp_target *omp_target_stmt =
- as_a <gimple_statement_omp_target *> (gs);
omp_target_stmt->child_fn = child_fn;
}
/* Return the artificial argument used to send variables and values
- from the parent to the children threads in OMP_TARGET GS. */
+ from the parent to the children threads in OMP_TARGET_STMT. */
static inline tree
-gimple_omp_target_data_arg (const_gimple gs)
+gimple_omp_target_data_arg (const_gimple_omp_target omp_target_stmt)
{
- const gimple_statement_omp_target *omp_target_stmt =
- as_a <const gimple_statement_omp_target *> (gs);
return omp_target_stmt->data_arg;
}
@@ -5193,21 +5184,18 @@ gimple_omp_target_data_arg (const_gimple gs)
/* Return a pointer to the data argument for OMP_TARGET GS. */
static inline tree *
-gimple_omp_target_data_arg_ptr (gimple gs)
+gimple_omp_target_data_arg_ptr (gimple_omp_target omp_target_stmt)
{
- gimple_statement_omp_target *omp_target_stmt =
- as_a <gimple_statement_omp_target *> (gs);
return &omp_target_stmt->data_arg;
}
-/* Set DATA_ARG to be the data argument for OMP_TARGET GS. */
+/* Set DATA_ARG to be the data argument for OMP_TARGET_STMT. */
static inline void
-gimple_omp_target_set_data_arg (gimple gs, tree data_arg)
+gimple_omp_target_set_data_arg (gimple_omp_target omp_target_stmt,
+ tree data_arg)
{
- gimple_statement_omp_target *omp_target_stmt =
- as_a <gimple_statement_omp_target *> (gs);
omp_target_stmt->data_arg = data_arg;
}
diff --git a/gcc/gimplify.c b/gcc/gimplify.c
index 8883523..e3da6ae 100644
--- a/gcc/gimplify.c
+++ b/gcc/gimplify.c
@@ -7180,7 +7180,7 @@ static void
gimplify_omp_target_update (tree *expr_p, gimple_seq *pre_p)
{
tree expr = *expr_p;
- gimple stmt;
+ gimple_omp_target stmt;
gimplify_scan_omp_clauses (&OMP_TARGET_UPDATE_CLAUSES (expr), pre_p,
ORT_WORKSHARE);
diff --git a/gcc/omp-low.c b/gcc/omp-low.c
index 3f68ab2..4b4ae4b 100644
--- a/gcc/omp-low.c
+++ b/gcc/omp-low.c
@@ -2332,7 +2332,7 @@ scan_omp_single (gimple_omp_single stmt, omp_context *outer_ctx)
/* Scan an OpenMP target{, data, update} directive. */
static void
-scan_omp_target (gimple stmt, omp_context *outer_ctx)
+scan_omp_target (gimple_omp_target stmt, omp_context *outer_ctx)
{
omp_context *ctx;
tree name;
@@ -2831,7 +2831,7 @@ scan_omp_1_stmt (gimple_stmt_iterator *gsi, bool *handled_ops_p,
break;
case GIMPLE_OMP_TARGET:
- scan_omp_target (stmt, ctx);
+ scan_omp_target (as_a <gimple_omp_target> (stmt), ctx);
break;
case GIMPLE_OMP_TEAMS:
@@ -8265,10 +8265,11 @@ expand_omp_target (struct omp_region *region)
struct function *child_cfun = NULL;
tree child_fn = NULL_TREE, block, t;
gimple_stmt_iterator gsi;
- gimple entry_stmt, stmt;
+ gimple_omp_target entry_stmt;
+ gimple stmt;
edge e;
- entry_stmt = last_stmt (region->entry);
+ entry_stmt = as_a <gimple_omp_target> (last_stmt (region->entry));
new_bb = region->entry;
int kind = gimple_omp_target_kind (entry_stmt);
if (kind == GF_OMP_TARGET_KIND_REGION)
@@ -10045,7 +10046,7 @@ lower_omp_target (gimple_stmt_iterator *gsi_p, omp_context *ctx)
{
tree clauses;
tree child_fn, t, c;
- gimple stmt = gsi_stmt (*gsi_p);
+ gimple_omp_target stmt = as_a <gimple_omp_target> (gsi_stmt (*gsi_p));
gimple_bind tgt_bind = NULL, bind;
gimple_seq tgt_body = NULL, olist, ilist, new_body;
location_t loc = gimple_location (stmt);
diff --git a/gcc/tree-nested.c b/gcc/tree-nested.c
index 84401df..e6f5c1a 100644
--- a/gcc/tree-nested.c
+++ b/gcc/tree-nested.c
@@ -1392,7 +1392,7 @@ convert_nonlocal_reference_stmt (gimple_stmt_iterator *gsi, bool *handled_ops_p,
OMP_CLAUSE_MAP_KIND (c) = OMP_CLAUSE_MAP_TO;
OMP_CLAUSE_SIZE (c) = DECL_SIZE_UNIT (decl);
OMP_CLAUSE_CHAIN (c) = gimple_omp_target_clauses (stmt);
- gimple_omp_target_set_clauses (stmt, c);
+ gimple_omp_target_set_clauses (as_a <gimple_omp_target> (stmt), c);
}
save_local_var_chain = info->new_local_var_chain;
@@ -1958,7 +1958,7 @@ convert_local_reference_stmt (gimple_stmt_iterator *gsi, bool *handled_ops_p,
OMP_CLAUSE_MAP_KIND (c) = OMP_CLAUSE_MAP_TOFROM;
OMP_CLAUSE_SIZE (c) = DECL_SIZE_UNIT (info->frame_decl);
OMP_CLAUSE_CHAIN (c) = gimple_omp_target_clauses (stmt);
- gimple_omp_target_set_clauses (stmt, c);
+ gimple_omp_target_set_clauses (as_a <gimple_omp_target> (stmt), c);
}
save_local_var_chain = info->new_local_var_chain;
@@ -2400,7 +2400,8 @@ convert_gimple_call (gimple_stmt_iterator *gsi, bool *handled_ops_p,
= i ? OMP_CLAUSE_MAP_TO : OMP_CLAUSE_MAP_TOFROM;
OMP_CLAUSE_SIZE (c) = DECL_SIZE_UNIT (decl);
OMP_CLAUSE_CHAIN (c) = gimple_omp_target_clauses (stmt);
- gimple_omp_target_set_clauses (stmt, c);
+ gimple_omp_target_set_clauses (as_a <gimple_omp_target> (stmt),
+ c);
}
}
info->static_chain_added |= save_static_chain_added;
--
1.8.5.3
^ permalink raw reply [flat|nested] 93+ messages in thread
* [gimple-classes, committed 18/92] Introduce gimple_call
2014-10-27 20:35 [gimple-classes, committed 00/92] Initial slew of commits David Malcolm
` (72 preceding siblings ...)
2014-10-27 20:55 ` [gimple-classes, committed 59/92] Concretize gimple_call_use_set and gimple_call_clobber_set David Malcolm
@ 2014-10-27 20:55 ` David Malcolm
2014-10-27 20:56 ` [gimple-classes, committed 52/92] Make gimple_call_return_slot_opt_p require a gimple_call David Malcolm
` (17 subsequent siblings)
91 siblings, 0 replies; 93+ messages in thread
From: David Malcolm @ 2014-10-27 20:55 UTC (permalink / raw)
To: gcc-patches; +Cc: David Malcolm
This corresponds to:
[PATCH 20/89] Introduce gimple_call
https://gcc.gnu.org/ml/gcc-patches/2014-04/msg01157.html
from the original 89-patch kit
That earlier patch was approved by Jeff:
> OK once the const/renaming changes are done.
in https://gcc.gnu.org/ml/gcc-patches/2014-05/msg00633.html
gcc/
* coretypes.h (gimple_call): New typedef.
(const_gimple_call): New typedef.
* asan.c (get_mem_refs_of_builtin_call): Require a
const_gimple_call rather than a const gimple.
(has_stmt_been_instrumented_p): Add a checked cast to
gimple_call.
(instrument_strlen_call): Likewise.
(instrument_builtin_call): Likewise.
* builtins.c (validate_gimple_arglist): Require a
const_gimple_call rather than a const gimple.
(fold_call_stmt): Require a gimple_call rather than a gimple.
* builtins.h (validate_gimple_arglist): Require a
const_gimple_call rather than a const gimple.
(fold_call_stmt): Require a gimple_call rather than a gimple.
* cfgexpand.c (expand_call_stmt): Likewise.
(expand_gimple_stmt_1): Add a checked cast to gimple_call within
GIMPLE_CALL case.
* cgraph.c (cgraph_edge::redirect_call_stmt_to_callee): Strengthen
local "new_stmt" from gimple to gimple_call, adding a checked
cast.
* cgraphunit.c (cgraph_node::expand_thunk): Likewise for local
"call".
* gimple-fold.c (gimple_fold_builtin_snprintf_chk): Likewise for
local "stmt".
(gimple_fold_builtin_snprintf): Likewise.
(gimple_fold_builtin): Likewise.
(gimple_fold_call): Likewise.
(gimple_fold_stmt_to_constant_1): Introduce local "call_stmt" via
checked cast of "stmt" to gimple_call, using it in various places
for typesafety.
* gimple-pretty-print.c (dump_gimple_call_args): Strengthen param
2 from gimple to gimple_call.
(dump_gimple_call): Likewise.
(pp_gimple_stmt_1): Add a checked cast to gimple_call within
GIMPLE_CALL case.
* gimple-streamer-in.c (input_gimple_stmt): Replace is_gimple_call
with a dyn_cast<gimple_call>, introducing local "call_stmt", and
using it in place of "stmt" for typesafety. Add a checked cast
in statement guarded by check for GIMPLE_CALL.
* gimple-walk.c (walk_gimple_op): Add a checked cast to
gimple_call.
* gimple.c (gimple_call_reset_alias_info): Strengthen param from
gimple to gimple_call.
(gimple_build_call_1): Strengthen return type and local from
gimple to gimple_call.
(gimple_build_call_vec): Likewise.
(gimple_build_call): Likewise.
(gimple_build_call_valist): Likewise.
(gimple_build_call_internal_1): Likewise.
(gimple_build_call_internal): Likewise.
(gimple_build_call_internal_vec): Likewise.
(gimple_build_call_from_tree): Likewise.
(gimple_call_return_flags): Strengthen param from
const_gimple to const_gimple_call.
(gimple_call_copy_skip_args): Strengthen return type and local from
gimple to gimple_call.
* gimple.h (gimple_call_reset_alias_info): Strengthen param from
gimple to gimple_call.
(gimple_build_call_vec): Strengthen return type from gimple to
gimple_call.
(gimple_build_call): Likewise.
(gimple_build_call_valist): Likewise.
(gimple_build_call_internal): Likewise.
(gimple_build_call_internal_vec): Likewise.
(gimple_build_call_from_tree): Likewise.
(gimple_call_return_flags): Strengthen param from const_gimple to
const_gimple_call.
(gimple_call_copy_skip_args): Strengthen return type from gimple
to gimple_call.
(gimple_call_set_internal_fn): Strengthen param "call_stmt" from
gimple to gimple_call.
(gimple_call_return_type): Strengthen param from const_gimple to
const_gimple_call.
(gimple_call_chain_ptr): Likewise.
(gimple_call_set_chain): Strengthen param from gimple to
gimple_call.
(gimple_call_set_return_slot_opt): Likewise.
(gimple_call_set_from_thunk): Likewise.
(gimple_call_from_thunk_p): Likewise.
(gimple_call_set_va_arg_pack): Likewise.
(gimple_call_va_arg_pack_p): Likewise.
(gimple_call_set_alloca_for_var): Likewise.
(gimple_call_alloca_for_var_p): Likewise.
(gimple_expr_type): Introduce local "call_stmt" via a checked cast
and use it for typesafety.
* gimplify.c (gimplify_call_expr): Strengthen local "call" from
gimple to gimple_call.
(gimplify_modify_expr_to_memcpy): Likewise for local "gs".
(gimplify_modify_expr_to_memset): Likewise.
(gimplify_modify_expr): Add a checked cast to gimple_call.
(gimplify_expr): Strengthen local "call" from gimple to
gimple_call.
(gimplify_function_tree): Likewise.
* internal-fn.c (expand_LOAD_LANES): Strengthen param from gimple
to gimple_call.
(expand_STORE_LANES): Likewise.
(expand_ANNOTATE): Likewise.
(expand_GOMP_SIMD_LANE): Likewise.
(expand_GOMP_SIMD_VF): Likewise.
(expand_GOMP_SIMD_LAST_LANE): Likewise.
(expand_UBSAN_NULL): Likewise.
(expand_UBSAN_BOUNDS): Likewise.
(expand_UBSAN_OBJECT_SIZE): Likewise.
(expand_ASAN_CHECK): Likewise.
(ubsan_expand_si_overflow_addsub_check): Likewise.
(ubsan_expand_si_overflow_neg_check): Likewise.
(ubsan_expand_si_overflow_mul_check): Likewise.
(expand_UBSAN_CHECK_ADD): Likewise.
(expand_UBSAN_CHECK_SUB): Likewise.
(expand_UBSAN_CHECK_MUL): Likewise.
(expand_LOOP_VECTORIZED): Likewise.
(expand_MASK_LOAD): Likewise.
(expand_MASK_STORE): Likewise.
(expand_ABNORMAL_DISPATCHER): Likewise.
(expand_BUILTIN_EXPECT): Likewise.
(internal_fn_expanders): Likewise for entries in this table.
(expand_internal_call): Likewise.
* internal-fn.def: Update comment to reflect strengthening of
param of expanders.
* internal-fn.h (expand_internal_call): Strengthen param from
gimple to gimple_call.
* ipa-prop.c (ipa_modify_call_arguments): Likewise for local
"new_stmt".
* ipa-pure-const.c (check_call): Likewise for param "call".
(check_stmt): Add a checked cast to gimple_call within GIMPLE_CALL
case.
* ipa-split.c (split_function): Strengthen local "call" from
gimple to gimple_call.
* omp-low.c (build_omp_barrier): Likewise for local "g".
(lower_rec_input_clauses): Likewise for local "stmt".
* trans-mem.c (build_tm_load): Likewise for return type and local
"gcall".
(build_tm_store): Likewise.
(expand_transaction): Likewise for local "call".
* tree-call-cdce.c (check_pow): Likewise for param.
(check_builtin_call): Likewise.
(is_call_dce_candidate): Likewise.
(gen_conditions_for_pow): Likewise.
(gen_shrink_wrap_conditions): Likewise.
(shrink_wrap_one_built_in_call): Likewise.
(shrink_wrap_conditional_dead_built_in_calls): Strengthen param
from vec<gimple> to vec<gimple_call>, and local "bi_call" from
gimple to gimple_call.
(pass_call_cdce::execute): Strengthen local
"cond_dead_built_in_calls" from auto_vec<gimple> to
auto_vec<gimple_call> and local "stmt" from gimple to gimple_call,
* tree-cfg.c (notice_special_calls): Strengthen param from gimple
to gimple_call.
* tree-cfg.h (notice_special_calls): Likewise.
* tree-complex.c (expand_complex_libcall): Likewise for local
"stmt".
* tree-inline.c (remap_gimple_stmt): Add checked cast to
gimple_call.
(copy_bb): Likewise. Strengthen local "new_call" from gimple to
gimple_call.
(inline_forbidden_p_stmt): Add checked cast to gimple_call.
* tree-nested.c (init_tmp_var_with_call): Strengthen param "call"
from gimple to gimple_call.
(convert_nl_goto_reference): Likewise for local "call".
(convert_tramp_reference_op): Likewise.
(convert_gimple_call): Add checked cast to gimple_call.
* tree-nrv.c (dest_safe_for_nrv_p): Strengthen param "call" from
gimple to gimple_call.
(pass_return_slot::execute): Likewise for local "stmt", using a
dyn_cast<gimple_call> rather than an is_gimple_call call.
* tree-object-size.c (alloc_object_size): Strengthen param "call"
from const_gimple to const_gimple_call.
(pass_through_call): Likewise.
(call_object_size): Strengthen param "call" from gimple to
gimple_call.
(collect_object_sizes_for): Introduce local "call_stmt" via a
checked cast, using it for typesafety.
(check_for_plus_in_loops_1): Likewise.
(pass_object_sizes::execute): Add a checked cast to gimple_call.
* tree-profile.c (gimple_gen_interval_profiler): Strengthen local
"call" from gimple to gimple_call.
(gimple_gen_pow2_profiler): Likewise.
(gimple_gen_one_value_profiler): Likewise.
(gimple_gen_time_profiler): Likewise.
(gimple_gen_average_profiler): Likewise.
(gimple_gen_ior_profiler): Likewise.
* tree-ssa-alias.c (ref_maybe_used_by_call_p_1): Likewise for
param "call".
(ref_maybe_used_by_call_p): Likewise.
(ref_maybe_used_by_stmt_p): Add a checked cast to gimple_call.
(call_may_clobber_ref_p_1): Strengthen param "call" from gimple to
gimple_call.
(call_may_clobber_ref_p): Likewise.
(stmt_may_clobber_ref_p_1): Add a checked cast to gimple_call.
* tree-ssa-alias.h (call_may_clobber_ref_p): Strengthen param 1
from gimple to gimple_call.
(call_may_clobber_ref_p_1): Likewise.
* tree-ssa-dce.c (eliminate_unnecessary_stmts): Add a checked cast
to gimple_call.
* tree-ssa-loop-prefetch.c (emit_mfence_after_loop): Strengthen
local "call" from gimple to gimple_call.
* tree-ssa-math-opts.c (build_and_insert_call): Likewise for local
"call_stmt".
* tree-ssa-operands.c (maybe_add_call_vops): Likewise for param
"stmt".
(parse_ssa_operands): Add a checked cast to gimple_call within
GIMPLE_CALL case.
* tree-ssa-pre.c (compute_avail): Add a checked cast to
gimple_call.
* tree-ssa-sccvn.c (copy_reference_ops_from_call): Strengthen
param "call" from gimple to gimple_call.
(valueize_shared_reference_ops_from_call): Likewise.
(vn_reference_lookup_3): Add a checked cast to gimple_call.
(vn_reference_lookup_call): Strengthen param "call" from gimple to
gimple_call.
(visit_reference_op_call): Likewise for param "stmt".
(visit_use): Replace is_gimple_call with a dyn_cast, introducing
local "call_stmt", using it in place of "stmt" for type-safety.
* tree-ssa-sccvn.h (vn_reference_lookup_call): Strengthen param 1
from gimple to gimple_call.
* tree-ssa-structalias.c (get_call_vi): Likewise.
(lookup_call_use_vi): Likewise.
(lookup_call_clobber_vi): Likewise.
(get_call_use_vi): Likewise.
(get_call_clobber_vi): Likewise.
(handle_rhs_call): Likewise.
(handle_lhs_call): Likewise.
(handle_const_call): Likewise.
(handle_pure_call): Likewise.
(get_fi_for_callee): Likewise.
(find_func_aliases_for_builtin_call): Likewise for param 2.
(find_func_aliases_for_call): Likewise.
(find_func_aliases): Add a checked cast to gimple_call.
(find_func_clobbers): Replace is_gimple_call with a dyn_cast,
introducing local "call_stmt", using it in place of "stmt" for
type-safety.
(compute_points_to_sets): Strengthen local "stmt" from gimple to
gimple_call, replacing is_gimple_call with a
dyn_cast <gimple_call>.
(ipa_pta_execute): Likewise.
* tree-ssa-threadedge.c
(record_temporary_equivalences_from_stmts_at_dest): Add checked
cast to gimple_call.
* tree-tailcall.c (find_tail_calls): Strengthen local "call" from
gimple to gimple_call, adding a checked cast.
* tree-vect-data-refs.c (vect_setup_realignment): Eliminate
top-level local "new_stmt" in favor of more tightly-scoped locals
"new_stmt" of type gimple_assign and gimple_call.
* tree-vect-patterns.c (vect_recog_pow_pattern): Strenghthen local
"stmt" from gimple to gimple_call.
* tree-vect-stmts.c (vectorizable_function): Likewise for param
"call".
(vectorizable_call): Rename param 1 from "stmt" to "gs",
reintroducing "stmt" as a gimple_call once we've established that
we're working with a GIMPLE_CALL.
* tree-vectorizer.h (vectorizable_function): Strengthen param 1
from gimple to gimple_call.
* value-prof.c (check_ic_target): Likewise.
(gimple_ic_transform): Likewise for local "stmt", replacing a
check for GIMPLE_CALL with a dyn_cast.
(interesting_stringop_to_profile_p): Strengthen param "call"
from gimple to gimple_call.
(gimple_stringop_fixed_value): Likewise for param "vcall_stmt".
(gimple_stringops_transform): Likewise for local "stmt",
replacing a check for GIMPLE_CALL with a dyn_cast.
(gimple_stringops_values_to_profile): Rename param 1 from "stmt"
to "gs", reintroducing "stmt" as a gimple_call once we've
established that we're working with a GIMPLE_CALL.
* vtable-verify.c (verify_bb_vtables): Strengthen local
"call_stmt" from gimple to gimple_call.
---
gcc/ChangeLog.gimple-classes | 271 +++++++++++++++++++++++++++++++++++++++++++
gcc/asan.c | 8 +-
gcc/builtins.c | 4 +-
gcc/builtins.h | 4 +-
gcc/cfgexpand.c | 4 +-
gcc/cgraph.c | 4 +-
gcc/cgraphunit.c | 2 +-
gcc/coretypes.h | 4 +
gcc/gimple-fold.c | 14 ++-
gcc/gimple-pretty-print.c | 6 +-
gcc/gimple-streamer-in.c | 10 +-
gcc/gimple-walk.c | 3 +-
gcc/gimple.c | 44 +++----
gcc/gimple.h | 72 +++++-------
gcc/gimplify.c | 12 +-
gcc/internal-fn.c | 48 ++++----
gcc/internal-fn.def | 2 +-
gcc/internal-fn.h | 2 +-
gcc/ipa-prop.c | 2 +-
gcc/ipa-pure-const.c | 4 +-
gcc/ipa-split.c | 2 +-
gcc/omp-low.c | 4 +-
gcc/trans-mem.c | 10 +-
gcc/tree-call-cdce.c | 25 ++--
gcc/tree-cfg.c | 2 +-
gcc/tree-cfg.h | 2 +-
gcc/tree-complex.c | 3 +-
gcc/tree-inline.c | 10 +-
gcc/tree-nested.c | 11 +-
gcc/tree-nrv.c | 7 +-
gcc/tree-object-size.c | 20 ++--
gcc/tree-profile.c | 12 +-
gcc/tree-ssa-alias.c | 12 +-
gcc/tree-ssa-alias.h | 4 +-
gcc/tree-ssa-dce.c | 2 +-
gcc/tree-ssa-loop-prefetch.c | 2 +-
gcc/tree-ssa-math-opts.c | 2 +-
gcc/tree-ssa-operands.c | 4 +-
gcc/tree-ssa-pre.c | 2 +-
gcc/tree-ssa-sccvn.c | 17 +--
gcc/tree-ssa-sccvn.h | 2 +-
gcc/tree-ssa-structalias.c | 45 +++----
gcc/tree-ssa-threadedge.c | 2 +-
gcc/tree-tailcall.c | 7 +-
gcc/tree-vect-data-refs.c | 3 +-
gcc/tree-vect-patterns.c | 2 +-
gcc/tree-vect-stmts.c | 14 ++-
gcc/tree-vectorizer.h | 2 +-
gcc/value-prof.c | 22 ++--
gcc/vtable-verify.c | 2 +-
50 files changed, 531 insertions(+), 243 deletions(-)
diff --git a/gcc/ChangeLog.gimple-classes b/gcc/ChangeLog.gimple-classes
index 627e6a2..ba0bde6 100644
--- a/gcc/ChangeLog.gimple-classes
+++ b/gcc/ChangeLog.gimple-classes
@@ -1,5 +1,276 @@
2014-10-24 David Malcolm <dmalcolm@redhat.com>
+ Introduce gimple_call
+
+ * coretypes.h (gimple_call): New typedef.
+ (const_gimple_call): New typedef.
+
+ * asan.c (get_mem_refs_of_builtin_call): Require a
+ const_gimple_call rather than a const gimple.
+ (has_stmt_been_instrumented_p): Add a checked cast to
+ gimple_call.
+ (instrument_strlen_call): Likewise.
+ (instrument_builtin_call): Likewise.
+ * builtins.c (validate_gimple_arglist): Require a
+ const_gimple_call rather than a const gimple.
+ (fold_call_stmt): Require a gimple_call rather than a gimple.
+ * builtins.h (validate_gimple_arglist): Require a
+ const_gimple_call rather than a const gimple.
+ (fold_call_stmt): Require a gimple_call rather than a gimple.
+ * cfgexpand.c (expand_call_stmt): Likewise.
+ (expand_gimple_stmt_1): Add a checked cast to gimple_call within
+ GIMPLE_CALL case.
+ * cgraph.c (cgraph_edge::redirect_call_stmt_to_callee): Strengthen
+ local "new_stmt" from gimple to gimple_call, adding a checked
+ cast.
+ * cgraphunit.c (cgraph_node::expand_thunk): Likewise for local
+ "call".
+ * gimple-fold.c (gimple_fold_builtin_snprintf_chk): Likewise for
+ local "stmt".
+ (gimple_fold_builtin_snprintf): Likewise.
+ (gimple_fold_builtin): Likewise.
+ (gimple_fold_call): Likewise.
+ (gimple_fold_stmt_to_constant_1): Introduce local "call_stmt" via
+ checked cast of "stmt" to gimple_call, using it in various places
+ for typesafety.
+ * gimple-pretty-print.c (dump_gimple_call_args): Strengthen param
+ 2 from gimple to gimple_call.
+ (dump_gimple_call): Likewise.
+ (pp_gimple_stmt_1): Add a checked cast to gimple_call within
+ GIMPLE_CALL case.
+ * gimple-streamer-in.c (input_gimple_stmt): Replace is_gimple_call
+ with a dyn_cast<gimple_call>, introducing local "call_stmt", and
+ using it in place of "stmt" for typesafety. Add a checked cast
+ in statement guarded by check for GIMPLE_CALL.
+ * gimple-walk.c (walk_gimple_op): Add a checked cast to
+ gimple_call.
+ * gimple.c (gimple_call_reset_alias_info): Strengthen param from
+ gimple to gimple_call.
+ (gimple_build_call_1): Strengthen return type and local from
+ gimple to gimple_call.
+ (gimple_build_call_vec): Likewise.
+ (gimple_build_call): Likewise.
+ (gimple_build_call_valist): Likewise.
+ (gimple_build_call_internal_1): Likewise.
+ (gimple_build_call_internal): Likewise.
+ (gimple_build_call_internal_vec): Likewise.
+ (gimple_build_call_from_tree): Likewise.
+ (gimple_call_return_flags): Strengthen param from
+ const_gimple to const_gimple_call.
+ (gimple_call_copy_skip_args): Strengthen return type and local from
+ gimple to gimple_call.
+ * gimple.h (gimple_call_reset_alias_info): Strengthen param from
+ gimple to gimple_call.
+ (gimple_build_call_vec): Strengthen return type from gimple to
+ gimple_call.
+ (gimple_build_call): Likewise.
+ (gimple_build_call_valist): Likewise.
+ (gimple_build_call_internal): Likewise.
+ (gimple_build_call_internal_vec): Likewise.
+ (gimple_build_call_from_tree): Likewise.
+ (gimple_call_return_flags): Strengthen param from const_gimple to
+ const_gimple_call.
+ (gimple_call_copy_skip_args): Strengthen return type from gimple
+ to gimple_call.
+ (gimple_call_set_internal_fn): Strengthen param "call_stmt" from
+ gimple to gimple_call.
+ (gimple_call_return_type): Strengthen param from const_gimple to
+ const_gimple_call.
+ (gimple_call_chain_ptr): Likewise.
+ (gimple_call_set_chain): Strengthen param from gimple to
+ gimple_call.
+ (gimple_call_set_return_slot_opt): Likewise.
+ (gimple_call_set_from_thunk): Likewise.
+ (gimple_call_from_thunk_p): Likewise.
+ (gimple_call_set_va_arg_pack): Likewise.
+ (gimple_call_va_arg_pack_p): Likewise.
+ (gimple_call_set_alloca_for_var): Likewise.
+ (gimple_call_alloca_for_var_p): Likewise.
+ (gimple_expr_type): Introduce local "call_stmt" via a checked cast
+ and use it for typesafety.
+ * gimplify.c (gimplify_call_expr): Strengthen local "call" from
+ gimple to gimple_call.
+ (gimplify_modify_expr_to_memcpy): Likewise for local "gs".
+ (gimplify_modify_expr_to_memset): Likewise.
+ (gimplify_modify_expr): Add a checked cast to gimple_call.
+ (gimplify_expr): Strengthen local "call" from gimple to
+ gimple_call.
+ (gimplify_function_tree): Likewise.
+ * internal-fn.c (expand_LOAD_LANES): Strengthen param from gimple
+ to gimple_call.
+ (expand_STORE_LANES): Likewise.
+ (expand_ANNOTATE): Likewise.
+ (expand_GOMP_SIMD_LANE): Likewise.
+ (expand_GOMP_SIMD_VF): Likewise.
+ (expand_GOMP_SIMD_LAST_LANE): Likewise.
+ (expand_UBSAN_NULL): Likewise.
+ (expand_UBSAN_BOUNDS): Likewise.
+ (expand_UBSAN_OBJECT_SIZE): Likewise.
+ (expand_ASAN_CHECK): Likewise.
+ (ubsan_expand_si_overflow_addsub_check): Likewise.
+ (ubsan_expand_si_overflow_neg_check): Likewise.
+ (ubsan_expand_si_overflow_mul_check): Likewise.
+ (expand_UBSAN_CHECK_ADD): Likewise.
+ (expand_UBSAN_CHECK_SUB): Likewise.
+ (expand_UBSAN_CHECK_MUL): Likewise.
+ (expand_LOOP_VECTORIZED): Likewise.
+ (expand_MASK_LOAD): Likewise.
+ (expand_MASK_STORE): Likewise.
+ (expand_ABNORMAL_DISPATCHER): Likewise.
+ (expand_BUILTIN_EXPECT): Likewise.
+ (internal_fn_expanders): Likewise for entries in this table.
+ (expand_internal_call): Likewise.
+ * internal-fn.def: Update comment to reflect strengthening of
+ param of expanders.
+ * internal-fn.h (expand_internal_call): Strengthen param from
+ gimple to gimple_call.
+ * ipa-prop.c (ipa_modify_call_arguments): Likewise for local
+ "new_stmt".
+ * ipa-pure-const.c (check_call): Likewise for param "call".
+ (check_stmt): Add a checked cast to gimple_call within GIMPLE_CALL
+ case.
+ * ipa-split.c (split_function): Strengthen local "call" from
+ gimple to gimple_call.
+ * omp-low.c (build_omp_barrier): Likewise for local "g".
+ (lower_rec_input_clauses): Likewise for local "stmt".
+ * trans-mem.c (build_tm_load): Likewise for return type and local
+ "gcall".
+ (build_tm_store): Likewise.
+ (expand_transaction): Likewise for local "call".
+ * tree-call-cdce.c (check_pow): Likewise for param.
+ (check_builtin_call): Likewise.
+ (is_call_dce_candidate): Likewise.
+ (gen_conditions_for_pow): Likewise.
+ (gen_shrink_wrap_conditions): Likewise.
+ (shrink_wrap_one_built_in_call): Likewise.
+ (shrink_wrap_conditional_dead_built_in_calls): Strengthen param
+ from vec<gimple> to vec<gimple_call>, and local "bi_call" from
+ gimple to gimple_call.
+ (pass_call_cdce::execute): Strengthen local
+ "cond_dead_built_in_calls" from auto_vec<gimple> to
+ auto_vec<gimple_call> and local "stmt" from gimple to gimple_call,
+ * tree-cfg.c (notice_special_calls): Strengthen param from gimple
+ to gimple_call.
+ * tree-cfg.h (notice_special_calls): Likewise.
+ * tree-complex.c (expand_complex_libcall): Likewise for local
+ "stmt".
+ * tree-inline.c (remap_gimple_stmt): Add checked cast to
+ gimple_call.
+ (copy_bb): Likewise. Strengthen local "new_call" from gimple to
+ gimple_call.
+ (inline_forbidden_p_stmt): Add checked cast to gimple_call.
+ * tree-nested.c (init_tmp_var_with_call): Strengthen param "call"
+ from gimple to gimple_call.
+ (convert_nl_goto_reference): Likewise for local "call".
+ (convert_tramp_reference_op): Likewise.
+ (convert_gimple_call): Add checked cast to gimple_call.
+ * tree-nrv.c (dest_safe_for_nrv_p): Strengthen param "call" from
+ gimple to gimple_call.
+ (pass_return_slot::execute): Likewise for local "stmt", using a
+ dyn_cast<gimple_call> rather than an is_gimple_call call.
+ * tree-object-size.c (alloc_object_size): Strengthen param "call"
+ from const_gimple to const_gimple_call.
+ (pass_through_call): Likewise.
+ (call_object_size): Strengthen param "call" from gimple to
+ gimple_call.
+ (collect_object_sizes_for): Introduce local "call_stmt" via a
+ checked cast, using it for typesafety.
+ (check_for_plus_in_loops_1): Likewise.
+ (pass_object_sizes::execute): Add a checked cast to gimple_call.
+ * tree-profile.c (gimple_gen_interval_profiler): Strengthen local
+ "call" from gimple to gimple_call.
+ (gimple_gen_pow2_profiler): Likewise.
+ (gimple_gen_one_value_profiler): Likewise.
+ (gimple_gen_time_profiler): Likewise.
+ (gimple_gen_average_profiler): Likewise.
+ (gimple_gen_ior_profiler): Likewise.
+ * tree-ssa-alias.c (ref_maybe_used_by_call_p_1): Likewise for
+ param "call".
+ (ref_maybe_used_by_call_p): Likewise.
+ (ref_maybe_used_by_stmt_p): Add a checked cast to gimple_call.
+ (call_may_clobber_ref_p_1): Strengthen param "call" from gimple to
+ gimple_call.
+ (call_may_clobber_ref_p): Likewise.
+ (stmt_may_clobber_ref_p_1): Add a checked cast to gimple_call.
+ * tree-ssa-alias.h (call_may_clobber_ref_p): Strengthen param 1
+ from gimple to gimple_call.
+ (call_may_clobber_ref_p_1): Likewise.
+ * tree-ssa-dce.c (eliminate_unnecessary_stmts): Add a checked cast
+ to gimple_call.
+ * tree-ssa-loop-prefetch.c (emit_mfence_after_loop): Strengthen
+ local "call" from gimple to gimple_call.
+ * tree-ssa-math-opts.c (build_and_insert_call): Likewise for local
+ "call_stmt".
+ * tree-ssa-operands.c (maybe_add_call_vops): Likewise for param
+ "stmt".
+ (parse_ssa_operands): Add a checked cast to gimple_call within
+ GIMPLE_CALL case.
+ * tree-ssa-pre.c (compute_avail): Add a checked cast to
+ gimple_call.
+ * tree-ssa-sccvn.c (copy_reference_ops_from_call): Strengthen
+ param "call" from gimple to gimple_call.
+ (valueize_shared_reference_ops_from_call): Likewise.
+ (vn_reference_lookup_3): Add a checked cast to gimple_call.
+ (vn_reference_lookup_call): Strengthen param "call" from gimple to
+ gimple_call.
+ (visit_reference_op_call): Likewise for param "stmt".
+ (visit_use): Replace is_gimple_call with a dyn_cast, introducing
+ local "call_stmt", using it in place of "stmt" for type-safety.
+ * tree-ssa-sccvn.h (vn_reference_lookup_call): Strengthen param 1
+ from gimple to gimple_call.
+ * tree-ssa-structalias.c (get_call_vi): Likewise.
+ (lookup_call_use_vi): Likewise.
+ (lookup_call_clobber_vi): Likewise.
+ (get_call_use_vi): Likewise.
+ (get_call_clobber_vi): Likewise.
+ (handle_rhs_call): Likewise.
+ (handle_lhs_call): Likewise.
+ (handle_const_call): Likewise.
+ (handle_pure_call): Likewise.
+ (get_fi_for_callee): Likewise.
+ (find_func_aliases_for_builtin_call): Likewise for param 2.
+ (find_func_aliases_for_call): Likewise.
+ (find_func_aliases): Add a checked cast to gimple_call.
+ (find_func_clobbers): Replace is_gimple_call with a dyn_cast,
+ introducing local "call_stmt", using it in place of "stmt" for
+ type-safety.
+ (compute_points_to_sets): Strengthen local "stmt" from gimple to
+ gimple_call, replacing is_gimple_call with a
+ dyn_cast <gimple_call>.
+ (ipa_pta_execute): Likewise.
+ * tree-ssa-threadedge.c
+ (record_temporary_equivalences_from_stmts_at_dest): Add checked
+ cast to gimple_call.
+ * tree-tailcall.c (find_tail_calls): Strengthen local "call" from
+ gimple to gimple_call, adding a checked cast.
+ * tree-vect-data-refs.c (vect_setup_realignment): Eliminate
+ top-level local "new_stmt" in favor of more tightly-scoped locals
+ "new_stmt" of type gimple_assign and gimple_call.
+ * tree-vect-patterns.c (vect_recog_pow_pattern): Strenghthen local
+ "stmt" from gimple to gimple_call.
+ * tree-vect-stmts.c (vectorizable_function): Likewise for param
+ "call".
+ (vectorizable_call): Rename param 1 from "stmt" to "gs",
+ reintroducing "stmt" as a gimple_call once we've established that
+ we're working with a GIMPLE_CALL.
+ * tree-vectorizer.h (vectorizable_function): Strengthen param 1
+ from gimple to gimple_call.
+ * value-prof.c (check_ic_target): Likewise.
+ (gimple_ic_transform): Likewise for local "stmt", replacing a
+ check for GIMPLE_CALL with a dyn_cast.
+ (interesting_stringop_to_profile_p): Strengthen param "call"
+ from gimple to gimple_call.
+ (gimple_stringop_fixed_value): Likewise for param "vcall_stmt".
+ (gimple_stringops_transform): Likewise for local "stmt",
+ replacing a check for GIMPLE_CALL with a dyn_cast.
+ (gimple_stringops_values_to_profile): Rename param 1 from "stmt"
+ to "gs", reintroducing "stmt" as a gimple_call once we've
+ established that we're working with a GIMPLE_CALL.
+ * vtable-verify.c (verify_bb_vtables): Strengthen local
+ "call_stmt" from gimple to gimple_call.
+
+2014-10-24 David Malcolm <dmalcolm@redhat.com>
+
Concretize get_loop_exit_condition et al to working on gimple_cond
* tree-scalar-evolution.h (get_loop_exit_condition): Return a
diff --git a/gcc/asan.c b/gcc/asan.c
index ccf487b..ad42dd6 100644
--- a/gcc/asan.c
+++ b/gcc/asan.c
@@ -482,7 +482,7 @@ get_mem_ref_of_assignment (const_gimple_assign assignment,
representing a builtin call that has to do with memory access. */
static bool
-get_mem_refs_of_builtin_call (const gimple call,
+get_mem_refs_of_builtin_call (const_gimple_call call,
asan_mem_ref *src0,
tree *src0_len,
bool *src0_is_store,
@@ -836,7 +836,7 @@ has_stmt_been_instrumented_p (gimple stmt)
tree src0_len = NULL_TREE, src1_len = NULL_TREE, dest_len = NULL_TREE;
bool src0_is_store = false, src1_is_store = false,
dest_is_store = false, dest_is_deref = false;
- if (get_mem_refs_of_builtin_call (stmt,
+ if (get_mem_refs_of_builtin_call (as_a <gimple_call> (stmt),
&src0, &src0_len, &src0_is_store,
&src1, &src1_len, &src1_is_store,
&dest, &dest_len, &dest_is_store,
@@ -1844,7 +1844,7 @@ static bool
instrument_strlen_call (gimple_stmt_iterator *iter)
{
gimple g;
- gimple call = gsi_stmt (*iter);
+ gimple_call call = as_a <gimple_call> (gsi_stmt (*iter));
gcc_assert (is_gimple_call (call));
tree callee = gimple_call_fndecl (call);
@@ -1907,7 +1907,7 @@ instrument_builtin_call (gimple_stmt_iterator *iter)
return false;
bool iter_advanced_p = false;
- gimple call = gsi_stmt (*iter);
+ gimple_call call = as_a <gimple_call> (gsi_stmt (*iter));
gcc_checking_assert (gimple_call_builtin_p (call, BUILT_IN_NORMAL));
diff --git a/gcc/builtins.c b/gcc/builtins.c
index 975f696..b571b7d 100644
--- a/gcc/builtins.c
+++ b/gcc/builtins.c
@@ -10631,7 +10631,7 @@ validate_arg (const_tree arg, enum tree_code code)
validate_arglist will then be removed. */
bool
-validate_gimple_arglist (const_gimple call, ...)
+validate_gimple_arglist (const_gimple_call call, ...)
{
enum tree_code code;
bool res = 0;
@@ -12541,7 +12541,7 @@ do_mpc_arg2 (tree arg0, tree arg1, tree type, int do_nonfinite,
call node earlier than the warning is generated. */
tree
-fold_call_stmt (gimple stmt, bool ignore)
+fold_call_stmt (gimple_call stmt, bool ignore)
{
tree ret = NULL_TREE;
tree fndecl = gimple_call_fndecl (stmt);
diff --git a/gcc/builtins.h b/gcc/builtins.h
index dd1cdbc..d93422e 100644
--- a/gcc/builtins.h
+++ b/gcc/builtins.h
@@ -75,11 +75,11 @@ extern tree fold_fma (location_t, tree, tree, tree, tree);
extern bool avoid_folding_inline_builtin (tree);
extern tree fold_call_expr (location_t, tree, bool);
extern tree fold_builtin_call_array (location_t, tree, tree, int, tree *);
-extern bool validate_gimple_arglist (const_gimple, ...);
+extern bool validate_gimple_arglist (const_gimple_call, ...);
extern rtx default_expand_builtin (tree, rtx, rtx, enum machine_mode, int);
extern bool fold_builtin_next_arg (tree, bool);
extern tree do_mpc_arg2 (tree, tree, tree, int, int (*)(mpc_ptr, mpc_srcptr, mpc_srcptr, mpc_rnd_t));
-extern tree fold_call_stmt (gimple, bool);
+extern tree fold_call_stmt (gimple_call, bool);
extern void set_builtin_user_assembler_name (tree decl, const char *asmspec);
extern bool is_simple_builtin (tree);
extern bool is_inexpensive_builtin (tree);
diff --git a/gcc/cfgexpand.c b/gcc/cfgexpand.c
index 200cda6..e656ed5 100644
--- a/gcc/cfgexpand.c
+++ b/gcc/cfgexpand.c
@@ -2241,7 +2241,7 @@ mark_transaction_restart_calls (gimple stmt)
statement STMT. */
static void
-expand_call_stmt (gimple stmt)
+expand_call_stmt (gimple_call stmt)
{
tree exp, decl, lhs;
bool builtin_p;
@@ -3215,7 +3215,7 @@ expand_gimple_stmt_1 (gimple stmt)
expand_asm_stmt (stmt);
break;
case GIMPLE_CALL:
- expand_call_stmt (stmt);
+ expand_call_stmt (as_a <gimple_call> (stmt));
break;
case GIMPLE_RETURN:
diff --git a/gcc/cgraph.c b/gcc/cgraph.c
index 02224f3..2694c40 100644
--- a/gcc/cgraph.c
+++ b/gcc/cgraph.c
@@ -1238,7 +1238,7 @@ cgraph_edge::redirect_call_stmt_to_callee (void)
tree decl = gimple_call_fndecl (e->call_stmt);
tree lhs = gimple_call_lhs (e->call_stmt);
- gimple new_stmt;
+ gimple_call new_stmt;
gimple_stmt_iterator gsi;
#ifdef ENABLE_CHECKING
cgraph_node *node;
@@ -1375,7 +1375,7 @@ cgraph_edge::redirect_call_stmt_to_callee (void)
}
else
{
- new_stmt = e->call_stmt;
+ new_stmt = as_a <gimple_call> (e->call_stmt);
gimple_call_set_fndecl (new_stmt, e->callee->decl);
update_stmt_fn (DECL_STRUCT_FUNCTION (e->caller->decl), new_stmt);
}
diff --git a/gcc/cgraphunit.c b/gcc/cgraphunit.c
index 5985e3d..723ec5e 100644
--- a/gcc/cgraphunit.c
+++ b/gcc/cgraphunit.c
@@ -1495,7 +1495,7 @@ cgraph_node::expand_thunk (bool output_asm_thunks, bool force_gimple_thunk)
tree resdecl;
tree restmp = NULL;
- gimple call;
+ gimple_call call;
gimple ret;
if (in_lto_p)
diff --git a/gcc/coretypes.h b/gcc/coretypes.h
index 9b5a007..4981e7c 100644
--- a/gcc/coretypes.h
+++ b/gcc/coretypes.h
@@ -110,6 +110,10 @@ struct gimple_statement_assign;
typedef struct gimple_statement_assign *gimple_assign;
typedef const struct gimple_statement_assign *const_gimple_assign;
+struct gimple_statement_call;
+typedef struct gimple_statement_call *gimple_call;
+typedef const struct gimple_statement_call *const_gimple_call;
+
struct gimple_statement_bind;
typedef struct gimple_statement_bind *gimple_bind;
typedef const struct gimple_statement_bind *const_gimple_bind;
diff --git a/gcc/gimple-fold.c b/gcc/gimple-fold.c
index 34dd32b..56b1e5b 100644
--- a/gcc/gimple-fold.c
+++ b/gcc/gimple-fold.c
@@ -1970,7 +1970,7 @@ static bool
gimple_fold_builtin_snprintf_chk (gimple_stmt_iterator *gsi,
enum built_in_function fcode)
{
- gimple stmt = gsi_stmt (*gsi);
+ gimple_call stmt = as_a <gimple_call> (gsi_stmt (*gsi));
tree dest, size, len, fn, fmt, flag;
const char *fmt_str;
@@ -2273,7 +2273,7 @@ gimple_fold_builtin_sprintf (gimple_stmt_iterator *gsi)
static bool
gimple_fold_builtin_snprintf (gimple_stmt_iterator *gsi)
{
- gimple stmt = gsi_stmt (*gsi);
+ gimple_call stmt = as_a <gimple_call> (gsi_stmt (*gsi));
tree dest = gimple_call_arg (stmt, 0);
tree destsize = gimple_call_arg (stmt, 1);
tree fmt = gimple_call_arg (stmt, 2);
@@ -2423,7 +2423,7 @@ gimple_fold_builtin_strlen (gimple_stmt_iterator *gsi)
static bool
gimple_fold_builtin (gimple_stmt_iterator *gsi)
{
- gimple stmt = gsi_stmt (*gsi);
+ gimple_call stmt = as_a <gimple_call >(gsi_stmt (*gsi));
tree callee = gimple_call_fndecl (stmt);
/* Give up for always_inline inline builtins until they are
@@ -2538,7 +2538,7 @@ gimple_fold_builtin (gimple_stmt_iterator *gsi)
static bool
gimple_fold_call (gimple_stmt_iterator *gsi, bool inplace)
{
- gimple stmt = gsi_stmt (*gsi);
+ gimple_call stmt = as_a <gimple_call> (gsi_stmt (*gsi));
tree callee;
bool changed = false;
unsigned i;
@@ -4329,6 +4329,7 @@ gimple_fold_stmt_to_constant_1 (gimple stmt, tree (*valueize) (tree))
case GIMPLE_CALL:
{
tree fn;
+ gimple_call call_stmt = as_a <gimple_call> (stmt);
if (gimple_call_internal_p (stmt))
{
@@ -4393,14 +4394,15 @@ gimple_fold_stmt_to_constant_1 (gimple stmt, tree (*valueize) (tree))
for (i = 0; i < gimple_call_num_args (stmt); ++i)
args[i] = (*valueize) (gimple_call_arg (stmt, i));
call = build_call_array_loc (loc,
- gimple_call_return_type (stmt),
+ gimple_call_return_type (call_stmt),
fn, gimple_call_num_args (stmt), args);
retval = fold_call_expr (EXPR_LOCATION (call), call, false);
if (retval)
{
/* fold_call_expr wraps the result inside a NOP_EXPR. */
STRIP_NOPS (retval);
- retval = fold_convert (gimple_call_return_type (stmt), retval);
+ retval = fold_convert (gimple_call_return_type (call_stmt),
+ retval);
}
return retval;
}
diff --git a/gcc/gimple-pretty-print.c b/gcc/gimple-pretty-print.c
index b5875b7..a1e1f1f 100644
--- a/gcc/gimple-pretty-print.c
+++ b/gcc/gimple-pretty-print.c
@@ -579,7 +579,7 @@ dump_gimple_return (pretty_printer *buffer, gimple gs, int spc, int flags)
dump_gimple_call. */
static void
-dump_gimple_call_args (pretty_printer *buffer, gimple gs, int flags)
+dump_gimple_call_args (pretty_printer *buffer, gimple_call gs, int flags)
{
size_t i;
@@ -652,7 +652,7 @@ pp_points_to_solution (pretty_printer *buffer, struct pt_solution *pt)
pp_gimple_stmt_1. */
static void
-dump_gimple_call (pretty_printer *buffer, gimple gs, int spc, int flags)
+dump_gimple_call (pretty_printer *buffer, gimple_call gs, int spc, int flags)
{
tree lhs = gimple_call_lhs (gs);
tree fn = gimple_call_fn (gs);
@@ -2097,7 +2097,7 @@ pp_gimple_stmt_1 (pretty_printer *buffer, gimple gs, int spc, int flags)
break;
case GIMPLE_CALL:
- dump_gimple_call (buffer, gs, spc, flags);
+ dump_gimple_call (buffer, as_a <gimple_call> (gs), spc, flags);
break;
case GIMPLE_COND:
diff --git a/gcc/gimple-streamer-in.c b/gcc/gimple-streamer-in.c
index f7b5d01..2741ea7 100644
--- a/gcc/gimple-streamer-in.c
+++ b/gcc/gimple-streamer-in.c
@@ -185,13 +185,13 @@ input_gimple_stmt (struct lto_input_block *ib, struct data_in *data_in,
== TREE_TYPE (TREE_OPERAND (TREE_OPERAND (*opp, 0), 0))))
*opp = TREE_OPERAND (TREE_OPERAND (*opp, 0), 0);
}
- if (is_gimple_call (stmt))
+ if (gimple_call call_stmt = dyn_cast <gimple_call> (stmt))
{
- if (gimple_call_internal_p (stmt))
+ if (gimple_call_internal_p (call_stmt))
gimple_call_set_internal_fn
- (stmt, streamer_read_enum (ib, internal_fn, IFN_LAST));
+ (call_stmt, streamer_read_enum (ib, internal_fn, IFN_LAST));
else
- gimple_call_set_fntype (stmt, stream_read_tree (ib, data_in));
+ gimple_call_set_fntype (call_stmt, stream_read_tree (ib, data_in));
}
break;
@@ -230,7 +230,7 @@ input_gimple_stmt (struct lto_input_block *ib, struct data_in *data_in,
/* Reset alias information. */
if (code == GIMPLE_CALL)
- gimple_call_reset_alias_info (stmt);
+ gimple_call_reset_alias_info (as_a <gimple_call> (stmt));
/* Mark the statement modified so its operand vectors can be filled in. */
gimple_set_modified (stmt, true);
diff --git a/gcc/gimple-walk.c b/gcc/gimple-walk.c
index 830516e..661a69e 100644
--- a/gcc/gimple-walk.c
+++ b/gcc/gimple-walk.c
@@ -236,7 +236,8 @@ walk_gimple_op (gimple stmt, walk_tree_fn callback_op,
wi->val_only = true;
}
- ret = walk_tree (gimple_call_chain_ptr (stmt), callback_op, wi, pset);
+ ret = walk_tree (gimple_call_chain_ptr (as_a <gimple_call> (stmt)),
+ callback_op, wi, pset);
if (ret)
return ret;
diff --git a/gcc/gimple.c b/gcc/gimple.c
index b99e0d4..5f5b33f 100644
--- a/gcc/gimple.c
+++ b/gcc/gimple.c
@@ -189,7 +189,7 @@ gimple_build_return (tree retval)
/* Reset alias information on call S. */
void
-gimple_call_reset_alias_info (gimple s)
+gimple_call_reset_alias_info (gimple_call s)
{
if (gimple_call_flags (s) & ECF_CONST)
memset (gimple_call_use_set (s), 0, sizeof (struct pt_solution));
@@ -206,10 +206,12 @@ gimple_call_reset_alias_info (gimple s)
components of a GIMPLE_CALL statement to function FN with NARGS
arguments. */
-static inline gimple
+static inline gimple_call
gimple_build_call_1 (tree fn, unsigned nargs)
{
- gimple s = gimple_build_with_ops (GIMPLE_CALL, ERROR_MARK, nargs + 3);
+ gimple_call s =
+ as_a <gimple_call> (gimple_build_with_ops (GIMPLE_CALL, ERROR_MARK,
+ nargs + 3));
if (TREE_CODE (fn) == FUNCTION_DECL)
fn = build_fold_addr_expr (fn);
gimple_set_op (s, 1, fn);
@@ -222,12 +224,12 @@ gimple_build_call_1 (tree fn, unsigned nargs)
/* Build a GIMPLE_CALL statement to function FN with the arguments
specified in vector ARGS. */
-gimple
+gimple_call
gimple_build_call_vec (tree fn, vec<tree> args)
{
unsigned i;
unsigned nargs = args.length ();
- gimple call = gimple_build_call_1 (fn, nargs);
+ gimple_call call = gimple_build_call_1 (fn, nargs);
for (i = 0; i < nargs; i++)
gimple_call_set_arg (call, i, args[i]);
@@ -239,11 +241,11 @@ gimple_build_call_vec (tree fn, vec<tree> args)
/* Build a GIMPLE_CALL statement to function FN. NARGS is the number of
arguments. The ... are the arguments. */
-gimple
+gimple_call
gimple_build_call (tree fn, unsigned nargs, ...)
{
va_list ap;
- gimple call;
+ gimple_call call;
unsigned i;
gcc_assert (TREE_CODE (fn) == FUNCTION_DECL || is_gimple_call_addr (fn));
@@ -262,10 +264,10 @@ gimple_build_call (tree fn, unsigned nargs, ...)
/* Build a GIMPLE_CALL statement to function FN. NARGS is the number of
arguments. AP contains the arguments. */
-gimple
+gimple_call
gimple_build_call_valist (tree fn, unsigned nargs, va_list ap)
{
- gimple call;
+ gimple_call call;
unsigned i;
gcc_assert (TREE_CODE (fn) == FUNCTION_DECL || is_gimple_call_addr (fn));
@@ -283,10 +285,12 @@ gimple_build_call_valist (tree fn, unsigned nargs, va_list ap)
Build the basic components of a GIMPLE_CALL statement to internal
function FN with NARGS arguments. */
-static inline gimple
+static inline gimple_call
gimple_build_call_internal_1 (enum internal_fn fn, unsigned nargs)
{
- gimple s = gimple_build_with_ops (GIMPLE_CALL, ERROR_MARK, nargs + 3);
+ gimple_call s =
+ as_a <gimple_call> (gimple_build_with_ops (GIMPLE_CALL, ERROR_MARK,
+ nargs + 3));
s->subcode |= GF_CALL_INTERNAL;
gimple_call_set_internal_fn (s, fn);
gimple_call_reset_alias_info (s);
@@ -297,11 +301,11 @@ gimple_build_call_internal_1 (enum internal_fn fn, unsigned nargs)
/* Build a GIMPLE_CALL statement to internal function FN. NARGS is
the number of arguments. The ... are the arguments. */
-gimple
+gimple_call
gimple_build_call_internal (enum internal_fn fn, unsigned nargs, ...)
{
va_list ap;
- gimple call;
+ gimple_call call;
unsigned i;
call = gimple_build_call_internal_1 (fn, nargs);
@@ -317,11 +321,11 @@ gimple_build_call_internal (enum internal_fn fn, unsigned nargs, ...)
/* Build a GIMPLE_CALL statement to internal function FN with the arguments
specified in vector ARGS. */
-gimple
+gimple_call
gimple_build_call_internal_vec (enum internal_fn fn, vec<tree> args)
{
unsigned i, nargs;
- gimple call;
+ gimple_call call;
nargs = args.length ();
call = gimple_build_call_internal_1 (fn, nargs);
@@ -336,11 +340,11 @@ gimple_build_call_internal_vec (enum internal_fn fn, vec<tree> args)
assumed to be in GIMPLE form already. Minimal checking is done of
this fact. */
-gimple
+gimple_call
gimple_build_call_from_tree (tree t)
{
unsigned i, nargs;
- gimple call;
+ gimple_call call;
tree fndecl = get_callee_fndecl (t);
gcc_assert (TREE_CODE (t) == CALL_EXPR);
@@ -1403,7 +1407,7 @@ gimple_call_arg_flags (const_gimple stmt, unsigned arg)
/* Detects return flags for the call STMT. */
int
-gimple_call_return_flags (const_gimple stmt)
+gimple_call_return_flags (const_gimple_call stmt)
{
const_tree attr;
@@ -2028,13 +2032,13 @@ canonicalize_cond_expr_cond (tree t)
/* Build a GIMPLE_CALL identical to STMT but skipping the arguments in
the positions marked by the set ARGS_TO_SKIP. */
-gimple
+gimple_call
gimple_call_copy_skip_args (gimple stmt, bitmap args_to_skip)
{
int i;
int nargs = gimple_call_num_args (stmt);
auto_vec<tree> vargs (nargs);
- gimple new_stmt;
+ gimple_call new_stmt;
for (i = 0; i < nargs; i++)
if (!bitmap_bit_p (args_to_skip, i))
diff --git a/gcc/gimple.h b/gcc/gimple.h
index de0fae4..e68cc44 100644
--- a/gcc/gimple.h
+++ b/gcc/gimple.h
@@ -1261,13 +1261,13 @@ extern gimple currently_expanding_gimple_stmt;
#define gimple_alloc(c, n) gimple_alloc_stat (c, n MEM_STAT_INFO)
gimple gimple_alloc_stat (enum gimple_code, unsigned MEM_STAT_DECL);
gimple gimple_build_return (tree);
-void gimple_call_reset_alias_info (gimple);
-gimple gimple_build_call_vec (tree, vec<tree> );
-gimple gimple_build_call (tree, unsigned, ...);
-gimple gimple_build_call_valist (tree, unsigned, va_list);
-gimple gimple_build_call_internal (enum internal_fn, unsigned, ...);
-gimple gimple_build_call_internal_vec (enum internal_fn, vec<tree> );
-gimple gimple_build_call_from_tree (tree);
+void gimple_call_reset_alias_info (gimple_call);
+gimple_call gimple_build_call_vec (tree, vec<tree> );
+gimple_call gimple_build_call (tree, unsigned, ...);
+gimple_call gimple_build_call_valist (tree, unsigned, va_list);
+gimple_call gimple_build_call_internal (enum internal_fn, unsigned, ...);
+gimple_call gimple_build_call_internal_vec (enum internal_fn, vec<tree> );
+gimple_call gimple_build_call_from_tree (tree);
gimple_assign gimple_build_assign_stat (tree, tree MEM_STAT_DECL);
#define gimple_build_assign(l,r) gimple_build_assign_stat (l, r MEM_STAT_INFO)
gimple_assign gimple_build_assign_with_ops (enum tree_code, tree,
@@ -1333,7 +1333,7 @@ gimple_seq gimple_seq_copy (gimple_seq);
bool gimple_call_same_target_p (const_gimple, const_gimple);
int gimple_call_flags (const_gimple);
int gimple_call_arg_flags (const_gimple, unsigned);
-int gimple_call_return_flags (const_gimple);
+int gimple_call_return_flags (const_gimple_call);
bool gimple_assign_copy_p (gimple);
bool gimple_assign_ssa_name_copy_p (gimple);
bool gimple_assign_unary_nop_p (gimple);
@@ -1351,7 +1351,7 @@ bool gimple_assign_rhs_could_trap_p (gimple);
extern void dump_gimple_statistics (void);
unsigned get_gimple_rhs_num_ops (enum tree_code);
extern tree canonicalize_cond_expr_cond (tree);
-gimple gimple_call_copy_skip_args (gimple, bitmap);
+gimple_call gimple_call_copy_skip_args (gimple, bitmap);
extern bool gimple_compare_field_offset (tree, tree);
extern tree gimple_unsigned_type (tree);
extern tree gimple_signed_type (tree);
@@ -2657,13 +2657,12 @@ gimple_call_set_fndecl (gimple gs, tree decl)
}
-/* Set internal function FN to be the function called by call statement GS. */
+/* Set internal function FN to be the function called by call statement CALL_STMT. */
static inline void
-gimple_call_set_internal_fn (gimple gs, enum internal_fn fn)
+gimple_call_set_internal_fn (gimple_call call_stmt, enum internal_fn fn)
{
- gimple_statement_call *call_stmt = as_a <gimple_statement_call *> (gs);
- gcc_gimple_checking_assert (gimple_call_internal_p (gs));
+ gcc_gimple_checking_assert (gimple_call_internal_p (call_stmt));
call_stmt->u.internal_fn = fn;
}
@@ -2682,7 +2681,7 @@ gimple_call_fndecl (const_gimple gs)
/* Return the type returned by call statement GS. */
static inline tree
-gimple_call_return_type (const_gimple gs)
+gimple_call_return_type (const_gimple_call gs)
{
tree type = gimple_call_fntype (gs);
@@ -2705,23 +2704,20 @@ gimple_call_chain (const_gimple gs)
}
-/* Return a pointer to the static chain for call statement GS. */
+/* Return a pointer to the static chain for call statement CALL_STMT. */
static inline tree *
-gimple_call_chain_ptr (const_gimple gs)
+gimple_call_chain_ptr (const_gimple_call call_stmt)
{
- GIMPLE_CHECK (gs, GIMPLE_CALL);
- return gimple_op_ptr (gs, 2);
+ return gimple_op_ptr (call_stmt, 2);
}
-/* Set CHAIN to be the static chain for call statement GS. */
+/* Set CHAIN to be the static chain for call statement CALL_STMT. */
static inline void
-gimple_call_set_chain (gimple gs, tree chain)
+gimple_call_set_chain (gimple_call call_stmt, tree chain)
{
- GIMPLE_CHECK (gs, GIMPLE_CALL);
-
- gimple_set_op (gs, 2, chain);
+ gimple_set_op (call_stmt, 2, chain);
}
@@ -2798,9 +2794,8 @@ gimple_call_tail_p (gimple s)
expansion as the return slot for calls that return in memory. */
static inline void
-gimple_call_set_return_slot_opt (gimple s, bool return_slot_opt_p)
+gimple_call_set_return_slot_opt (gimple_call s, bool return_slot_opt_p)
{
- GIMPLE_CHECK (s, GIMPLE_CALL);
if (return_slot_opt_p)
s->subcode |= GF_CALL_RETURN_SLOT_OPT;
else
@@ -2822,9 +2817,8 @@ gimple_call_return_slot_opt_p (gimple s)
thunk to the thunked-to function. */
static inline void
-gimple_call_set_from_thunk (gimple s, bool from_thunk_p)
+gimple_call_set_from_thunk (gimple_call s, bool from_thunk_p)
{
- GIMPLE_CHECK (s, GIMPLE_CALL);
if (from_thunk_p)
s->subcode |= GF_CALL_FROM_THUNK;
else
@@ -2835,9 +2829,8 @@ gimple_call_set_from_thunk (gimple s, bool from_thunk_p)
/* Return true if GIMPLE_CALL S is a jump from a thunk. */
static inline bool
-gimple_call_from_thunk_p (gimple s)
+gimple_call_from_thunk_p (gimple_call s)
{
- GIMPLE_CHECK (s, GIMPLE_CALL);
return (s->subcode & GF_CALL_FROM_THUNK) != 0;
}
@@ -2846,9 +2839,8 @@ gimple_call_from_thunk_p (gimple s)
argument pack in its argument list. */
static inline void
-gimple_call_set_va_arg_pack (gimple s, bool pass_arg_pack_p)
+gimple_call_set_va_arg_pack (gimple_call s, bool pass_arg_pack_p)
{
- GIMPLE_CHECK (s, GIMPLE_CALL);
if (pass_arg_pack_p)
s->subcode |= GF_CALL_VA_ARG_PACK;
else
@@ -2860,9 +2852,8 @@ gimple_call_set_va_arg_pack (gimple s, bool pass_arg_pack_p)
argument pack in its argument list. */
static inline bool
-gimple_call_va_arg_pack_p (gimple s)
+gimple_call_va_arg_pack_p (gimple_call s)
{
- GIMPLE_CHECK (s, GIMPLE_CALL);
return (s->subcode & GF_CALL_VA_ARG_PACK) != 0;
}
@@ -2905,9 +2896,8 @@ gimple_call_nothrow_p (gimple s)
stack growth even when they occur in loops. */
static inline void
-gimple_call_set_alloca_for_var (gimple s, bool for_var)
+gimple_call_set_alloca_for_var (gimple_call s, bool for_var)
{
- GIMPLE_CHECK (s, GIMPLE_CALL);
if (for_var)
s->subcode |= GF_CALL_ALLOCA_FOR_VAR;
else
@@ -2917,9 +2907,8 @@ gimple_call_set_alloca_for_var (gimple s, bool for_var)
/* Return true of S is a call to builtin_alloca emitted for VLA objects. */
static inline bool
-gimple_call_alloca_for_var_p (gimple s)
+gimple_call_alloca_for_var_p (gimple_call s)
{
- GIMPLE_CHECK (s, GIMPLE_CALL);
return (s->subcode & GF_CALL_ALLOCA_FOR_VAR) != 0;
}
@@ -5762,11 +5751,12 @@ gimple_expr_type (const_gimple stmt)
original RHS type as far as we can reconstruct it. */
if (code == GIMPLE_CALL)
{
- if (gimple_call_internal_p (stmt)
- && gimple_call_internal_fn (stmt) == IFN_MASK_STORE)
- type = TREE_TYPE (gimple_call_arg (stmt, 3));
+ const_gimple_call call_stmt = as_a <const_gimple_call> (stmt);
+ if (gimple_call_internal_p (call_stmt)
+ && gimple_call_internal_fn (call_stmt) == IFN_MASK_STORE)
+ type = TREE_TYPE (gimple_call_arg (call_stmt, 3));
else
- type = gimple_call_return_type (stmt);
+ type = gimple_call_return_type (call_stmt);
}
else
switch (gimple_assign_rhs_code (stmt))
diff --git a/gcc/gimplify.c b/gcc/gimplify.c
index f4cbe52..a20c59d 100644
--- a/gcc/gimplify.c
+++ b/gcc/gimplify.c
@@ -2252,7 +2252,7 @@ gimplify_call_expr (tree *expr_p, gimple_seq *pre_p, bool want_value)
tree fndecl, parms, p, fnptrtype;
enum gimplify_status ret;
int i, nargs;
- gimple call;
+ gimple_call call;
bool builtin_va_start_p = false;
location_t loc = EXPR_LOCATION (*expr_p);
@@ -3205,7 +3205,7 @@ gimplify_modify_expr_to_memcpy (tree *expr_p, tree size, bool want_value,
gimple_seq *seq_p)
{
tree t, to, to_ptr, from, from_ptr;
- gimple gs;
+ gimple_call gs;
location_t loc = EXPR_LOCATION (*expr_p);
to = TREE_OPERAND (*expr_p, 0);
@@ -3252,7 +3252,7 @@ gimplify_modify_expr_to_memset (tree *expr_p, tree size, bool want_value,
gimple_seq *seq_p)
{
tree t, from, to, to_ptr;
- gimple gs;
+ gimple_call gs;
location_t loc = EXPR_LOCATION (*expr_p);
/* Assert our assumptions, to abort instead of producing wrong code
@@ -4637,7 +4637,7 @@ gimplify_modify_expr (tree *expr_p, gimple_seq *pre_p, gimple_seq *post_p,
assign = gimple_build_call_from_tree (*from_p);
gimple_call_set_fntype (assign, TREE_TYPE (fnptrtype));
}
- notice_special_calls (assign);
+ notice_special_calls (as_a <gimple_call> (assign));
if (!gimple_call_noreturn_p (assign))
gimple_call_set_lhs (assign, *to_p);
}
@@ -7728,7 +7728,7 @@ gimplify_expr (tree *expr_p, gimple_seq *pre_p, gimple_seq *post_p,
}
tree tmp = create_tmp_var (type, NULL);
gimplify_arg (&cond, pre_p, EXPR_LOCATION (*expr_p));
- gimple call
+ gimple_call call
= gimple_build_call_internal (IFN_ANNOTATE, 2, cond, kind);
gimple_call_set_lhs (call, tmp);
gimplify_seq_add_stmt (pre_p, call);
@@ -8949,7 +8949,7 @@ gimplify_function_tree (tree fndecl)
gimple tf;
gimple_seq cleanup = NULL, body = NULL;
tree tmp_var;
- gimple call;
+ gimple_call call;
x = builtin_decl_implicit (BUILT_IN_RETURN_ADDRESS);
call = gimple_build_call (x, 1, integer_zero_node);
diff --git a/gcc/internal-fn.c b/gcc/internal-fn.c
index c71259d..dc6a4ef 100644
--- a/gcc/internal-fn.c
+++ b/gcc/internal-fn.c
@@ -90,7 +90,7 @@ get_multi_vector_move (tree array_type, convert_optab optab)
/* Expand LOAD_LANES call STMT. */
static void
-expand_LOAD_LANES (gimple stmt)
+expand_LOAD_LANES (gimple_call stmt)
{
struct expand_operand ops[2];
tree type, lhs, rhs;
@@ -114,7 +114,7 @@ expand_LOAD_LANES (gimple stmt)
/* Expand STORE_LANES call STMT. */
static void
-expand_STORE_LANES (gimple stmt)
+expand_STORE_LANES (gimple_call stmt)
{
struct expand_operand ops[2];
tree type, lhs, rhs;
@@ -136,7 +136,7 @@ expand_STORE_LANES (gimple stmt)
}
static void
-expand_ANNOTATE (gimple stmt ATTRIBUTE_UNUSED)
+expand_ANNOTATE (gimple_call stmt ATTRIBUTE_UNUSED)
{
gcc_unreachable ();
}
@@ -144,7 +144,7 @@ expand_ANNOTATE (gimple stmt ATTRIBUTE_UNUSED)
/* This should get expanded in adjust_simduid_builtins. */
static void
-expand_GOMP_SIMD_LANE (gimple stmt ATTRIBUTE_UNUSED)
+expand_GOMP_SIMD_LANE (gimple_call stmt ATTRIBUTE_UNUSED)
{
gcc_unreachable ();
}
@@ -152,7 +152,7 @@ expand_GOMP_SIMD_LANE (gimple stmt ATTRIBUTE_UNUSED)
/* This should get expanded in adjust_simduid_builtins. */
static void
-expand_GOMP_SIMD_VF (gimple stmt ATTRIBUTE_UNUSED)
+expand_GOMP_SIMD_VF (gimple_call stmt ATTRIBUTE_UNUSED)
{
gcc_unreachable ();
}
@@ -160,7 +160,7 @@ expand_GOMP_SIMD_VF (gimple stmt ATTRIBUTE_UNUSED)
/* This should get expanded in adjust_simduid_builtins. */
static void
-expand_GOMP_SIMD_LAST_LANE (gimple stmt ATTRIBUTE_UNUSED)
+expand_GOMP_SIMD_LAST_LANE (gimple_call stmt ATTRIBUTE_UNUSED)
{
gcc_unreachable ();
}
@@ -168,7 +168,7 @@ expand_GOMP_SIMD_LAST_LANE (gimple stmt ATTRIBUTE_UNUSED)
/* This should get expanded in the sanopt pass. */
static void
-expand_UBSAN_NULL (gimple stmt ATTRIBUTE_UNUSED)
+expand_UBSAN_NULL (gimple_call stmt ATTRIBUTE_UNUSED)
{
gcc_unreachable ();
}
@@ -176,7 +176,7 @@ expand_UBSAN_NULL (gimple stmt ATTRIBUTE_UNUSED)
/* This should get expanded in the sanopt pass. */
static void
-expand_UBSAN_BOUNDS (gimple stmt ATTRIBUTE_UNUSED)
+expand_UBSAN_BOUNDS (gimple_call stmt ATTRIBUTE_UNUSED)
{
gcc_unreachable ();
}
@@ -184,7 +184,7 @@ expand_UBSAN_BOUNDS (gimple stmt ATTRIBUTE_UNUSED)
/* This should get expanded in the sanopt pass. */
static void
-expand_UBSAN_OBJECT_SIZE (gimple stmt ATTRIBUTE_UNUSED)
+expand_UBSAN_OBJECT_SIZE (gimple_call stmt ATTRIBUTE_UNUSED)
{
gcc_unreachable ();
}
@@ -192,7 +192,7 @@ expand_UBSAN_OBJECT_SIZE (gimple stmt ATTRIBUTE_UNUSED)
/* This should get expanded in the sanopt pass. */
static void
-expand_ASAN_CHECK (gimple stmt ATTRIBUTE_UNUSED)
+expand_ASAN_CHECK (gimple_call stmt ATTRIBUTE_UNUSED)
{
gcc_unreachable ();
}
@@ -201,7 +201,7 @@ expand_ASAN_CHECK (gimple stmt ATTRIBUTE_UNUSED)
CODE says whether the operation is +, or -. */
void
-ubsan_expand_si_overflow_addsub_check (tree_code code, gimple stmt)
+ubsan_expand_si_overflow_addsub_check (tree_code code, gimple_call stmt)
{
rtx res, op0, op1;
tree lhs, fn, arg0, arg1;
@@ -350,7 +350,7 @@ ubsan_expand_si_overflow_addsub_check (tree_code code, gimple stmt)
/* Add negate overflow checking to the statement STMT. */
void
-ubsan_expand_si_overflow_neg_check (gimple stmt)
+ubsan_expand_si_overflow_neg_check (gimple_call stmt)
{
rtx res, op1;
tree lhs, fn, arg1;
@@ -427,7 +427,7 @@ ubsan_expand_si_overflow_neg_check (gimple stmt)
/* Add mul overflow checking to the statement STMT. */
void
-ubsan_expand_si_overflow_mul_check (gimple stmt)
+ubsan_expand_si_overflow_mul_check (gimple_call stmt)
{
rtx res, op0, op1;
tree lhs, fn, arg0, arg1;
@@ -821,7 +821,7 @@ ubsan_expand_si_overflow_mul_check (gimple stmt)
/* Expand UBSAN_CHECK_ADD call STMT. */
static void
-expand_UBSAN_CHECK_ADD (gimple stmt)
+expand_UBSAN_CHECK_ADD (gimple_call stmt)
{
ubsan_expand_si_overflow_addsub_check (PLUS_EXPR, stmt);
}
@@ -829,7 +829,7 @@ expand_UBSAN_CHECK_ADD (gimple stmt)
/* Expand UBSAN_CHECK_SUB call STMT. */
static void
-expand_UBSAN_CHECK_SUB (gimple stmt)
+expand_UBSAN_CHECK_SUB (gimple_call stmt)
{
if (integer_zerop (gimple_call_arg (stmt, 0)))
ubsan_expand_si_overflow_neg_check (stmt);
@@ -840,7 +840,7 @@ expand_UBSAN_CHECK_SUB (gimple stmt)
/* Expand UBSAN_CHECK_MUL call STMT. */
static void
-expand_UBSAN_CHECK_MUL (gimple stmt)
+expand_UBSAN_CHECK_MUL (gimple_call stmt)
{
ubsan_expand_si_overflow_mul_check (stmt);
}
@@ -848,13 +848,13 @@ expand_UBSAN_CHECK_MUL (gimple stmt)
/* This should get folded in tree-vectorizer.c. */
static void
-expand_LOOP_VECTORIZED (gimple stmt ATTRIBUTE_UNUSED)
+expand_LOOP_VECTORIZED (gimple_call stmt ATTRIBUTE_UNUSED)
{
gcc_unreachable ();
}
static void
-expand_MASK_LOAD (gimple stmt)
+expand_MASK_LOAD (gimple_call stmt)
{
struct expand_operand ops[3];
tree type, lhs, rhs, maskt;
@@ -879,7 +879,7 @@ expand_MASK_LOAD (gimple stmt)
}
static void
-expand_MASK_STORE (gimple stmt)
+expand_MASK_STORE (gimple_call stmt)
{
struct expand_operand ops[3];
tree type, lhs, rhs, maskt;
@@ -902,12 +902,12 @@ expand_MASK_STORE (gimple stmt)
}
static void
-expand_ABNORMAL_DISPATCHER (gimple)
+expand_ABNORMAL_DISPATCHER (gimple_call)
{
}
static void
-expand_BUILTIN_EXPECT (gimple stmt)
+expand_BUILTIN_EXPECT (gimple_call stmt)
{
/* When guessing was done, the hints should be already stripped away. */
gcc_assert (!flag_guess_branch_prob || optimize == 0 || seen_error ());
@@ -926,10 +926,10 @@ expand_BUILTIN_EXPECT (gimple stmt)
/* Routines to expand each internal function, indexed by function number.
Each routine has the prototype:
- expand_<NAME> (gimple stmt)
+ expand_<NAME> (gimple_call stmt)
where STMT is the statement that performs the call. */
-static void (*const internal_fn_expanders[]) (gimple) = {
+static void (*const internal_fn_expanders[]) (gimple_call) = {
#define DEF_INTERNAL_FN(CODE, FLAGS, FNSPEC) expand_##CODE,
#include "internal-fn.def"
#undef DEF_INTERNAL_FN
@@ -939,7 +939,7 @@ static void (*const internal_fn_expanders[]) (gimple) = {
/* Expand STMT, which is a call to internal function FN. */
void
-expand_internal_call (gimple stmt)
+expand_internal_call (gimple_call stmt)
{
internal_fn_expanders[(int) gimple_call_internal_fn (stmt)] (stmt);
}
diff --git a/gcc/internal-fn.def b/gcc/internal-fn.def
index b8e457c..8d84474 100644
--- a/gcc/internal-fn.def
+++ b/gcc/internal-fn.def
@@ -35,7 +35,7 @@ along with GCC; see the file COPYING3. If not see
Each entry must have a corresponding expander of the form:
- void expand_NAME (gimple stmt)
+ void expand_NAME (gimple_call stmt)
where STMT is the statement that performs the call. */
diff --git a/gcc/internal-fn.h b/gcc/internal-fn.h
index 14573aa..390a6e9 100644
--- a/gcc/internal-fn.h
+++ b/gcc/internal-fn.h
@@ -57,6 +57,6 @@ internal_fn_fnspec (enum internal_fn fn)
return internal_fn_fnspec_array[(int) fn];
}
-extern void expand_internal_call (gimple);
+extern void expand_internal_call (gimple_call);
#endif
diff --git a/gcc/ipa-prop.c b/gcc/ipa-prop.c
index 62db327..45bfbc6 100644
--- a/gcc/ipa-prop.c
+++ b/gcc/ipa-prop.c
@@ -4148,7 +4148,7 @@ ipa_modify_call_arguments (struct cgraph_edge *cs, gimple stmt,
struct cgraph_node *current_node = cgraph_node::get (current_function_decl);
vec<tree> vargs;
vec<tree, va_gc> **debug_args = NULL;
- gimple new_stmt;
+ gimple_call new_stmt;
gimple_stmt_iterator gsi, prev_gsi;
tree callee_decl;
int i, len;
diff --git a/gcc/ipa-pure-const.c b/gcc/ipa-pure-const.c
index b5ded3e..6beca09 100644
--- a/gcc/ipa-pure-const.c
+++ b/gcc/ipa-pure-const.c
@@ -465,7 +465,7 @@ special_builtin_state (enum pure_const_state_e *state, bool *looping,
the entire call expression. */
static void
-check_call (funct_state local, gimple call, bool ipa)
+check_call (funct_state local, gimple_call call, bool ipa)
{
int flags = gimple_call_flags (call);
tree callee_t = gimple_call_fndecl (call);
@@ -686,7 +686,7 @@ check_stmt (gimple_stmt_iterator *gsip, funct_state local, bool ipa)
switch (gimple_code (stmt))
{
case GIMPLE_CALL:
- check_call (local, stmt, ipa);
+ check_call (local, as_a <gimple_call> (stmt), ipa);
break;
case GIMPLE_LABEL:
if (DECL_NONLOCAL (gimple_label_label (stmt)))
diff --git a/gcc/ipa-split.c b/gcc/ipa-split.c
index f57ce9c..572467c 100644
--- a/gcc/ipa-split.c
+++ b/gcc/ipa-split.c
@@ -1119,7 +1119,7 @@ split_function (struct split_point *split_point)
basic_block return_bb = find_return_bb ();
basic_block call_bb;
gimple_stmt_iterator gsi;
- gimple call;
+ gimple_call call;
edge e;
edge_iterator ei;
tree retval = NULL, real_retval = NULL;
diff --git a/gcc/omp-low.c b/gcc/omp-low.c
index ffec0d0..0a4f572 100644
--- a/gcc/omp-low.c
+++ b/gcc/omp-low.c
@@ -2884,7 +2884,7 @@ build_omp_barrier (tree lhs)
{
tree fndecl = builtin_decl_explicit (lhs ? BUILT_IN_GOMP_BARRIER_CANCEL
: BUILT_IN_GOMP_BARRIER);
- gimple g = gimple_build_call (fndecl, 0);
+ gimple_call g = gimple_build_call (fndecl, 0);
if (lhs)
gimple_call_set_lhs (g, lhs);
return g;
@@ -3347,7 +3347,7 @@ lower_rec_input_clauses (tree clauses, gimple_seq *ilist, gimple_seq *dlist,
if (c_kind != OMP_CLAUSE_FIRSTPRIVATE || !is_task_ctx (ctx))
{
- gimple stmt;
+ gimple_call stmt;
tree tmp, atmp;
ptr = DECL_VALUE_EXPR (new_var);
diff --git a/gcc/trans-mem.c b/gcc/trans-mem.c
index 883efbb..fe8be6c 100644
--- a/gcc/trans-mem.c
+++ b/gcc/trans-mem.c
@@ -2084,12 +2084,12 @@ transaction_subcode_ior (struct tm_region *region, unsigned flags)
LOC is the location to use for the new statement(s). */
-static gimple
+static gimple_call
build_tm_load (location_t loc, tree lhs, tree rhs, gimple_stmt_iterator *gsi)
{
enum built_in_function code = END_BUILTINS;
tree t, type = TREE_TYPE (rhs), decl;
- gimple gcall;
+ gimple_call gcall;
if (type == float_type_node)
code = BUILT_IN_TM_LOAD_FLOAT;
@@ -2156,12 +2156,12 @@ build_tm_load (location_t loc, tree lhs, tree rhs, gimple_stmt_iterator *gsi)
/* Similarly for storing TYPE in a transactional context. */
-static gimple
+static gimple_call
build_tm_store (location_t loc, tree lhs, tree rhs, gimple_stmt_iterator *gsi)
{
enum built_in_function code = END_BUILTINS;
tree t, fn, type = TREE_TYPE (rhs), simple_type;
- gimple gcall;
+ gimple_call gcall;
if (type == float_type_node)
code = BUILT_IN_TM_STORE_FLOAT;
@@ -2717,7 +2717,7 @@ expand_transaction (struct tm_region *region, void *data ATTRIBUTE_UNUSED)
if (subcode & GTMA_IS_OUTER)
region->original_transaction_was_outer = true;
tree t = build_int_cst (tm_state_type, flags);
- gimple call = gimple_build_call (tm_start, 1, t);
+ gimple_call call = gimple_build_call (tm_start, 1, t);
gimple_call_set_lhs (call, tm_state);
gimple_set_location (call, gimple_location (region->transaction_stmt));
diff --git a/gcc/tree-call-cdce.c b/gcc/tree-call-cdce.c
index 65027e8..0a2f563 100644
--- a/gcc/tree-call-cdce.c
+++ b/gcc/tree-call-cdce.c
@@ -174,7 +174,7 @@ check_target_format (tree arg)
#define MAX_BASE_INT_BIT_SIZE 32
static bool
-check_pow (gimple pow_call)
+check_pow (gimple_call pow_call)
{
tree base, expn;
enum tree_code bc, ec;
@@ -248,7 +248,7 @@ check_pow (gimple pow_call)
Returns true if the function call is a candidate. */
static bool
-check_builtin_call (gimple bcall)
+check_builtin_call (gimple_call bcall)
{
tree arg;
@@ -261,7 +261,7 @@ check_builtin_call (gimple bcall)
is a candidate. */
static bool
-is_call_dce_candidate (gimple call)
+is_call_dce_candidate (gimple_call call)
{
tree fn;
enum built_in_function fnc;
@@ -537,7 +537,7 @@ gen_conditions_for_pow_int_base (tree base, tree expn,
and *NCONDS is the number of logical conditions. */
static void
-gen_conditions_for_pow (gimple pow_call, vec<gimple> conds,
+gen_conditions_for_pow (gimple_call pow_call, vec<gimple> conds,
unsigned *nconds)
{
tree base, expn;
@@ -673,10 +673,10 @@ get_no_error_domain (enum built_in_function fnc)
condition are separated by NULL tree in the vector. */
static void
-gen_shrink_wrap_conditions (gimple bi_call, vec<gimple> conds,
+gen_shrink_wrap_conditions (gimple_call bi_call, vec<gimple> conds,
unsigned int *nconds)
{
- gimple call;
+ gimple_call call;
tree fn;
enum built_in_function fnc;
@@ -714,7 +714,7 @@ gen_shrink_wrap_conditions (gimple bi_call, vec<gimple> conds,
transformation actually happens. */
static bool
-shrink_wrap_one_built_in_call (gimple bi_call)
+shrink_wrap_one_built_in_call (gimple_call bi_call)
{
gimple_stmt_iterator bi_call_bsi;
basic_block bi_call_bb, join_tgt_bb, guard_bb, guard_bb0;
@@ -849,7 +849,7 @@ shrink_wrap_one_built_in_call (gimple bi_call)
wrapping transformation. */
static bool
-shrink_wrap_conditional_dead_built_in_calls (vec<gimple> calls)
+shrink_wrap_conditional_dead_built_in_calls (vec<gimple_call> calls)
{
bool changed = false;
unsigned i = 0;
@@ -860,7 +860,7 @@ shrink_wrap_conditional_dead_built_in_calls (vec<gimple> calls)
for (; i < n ; i++)
{
- gimple bi_call = calls[i];
+ gimple_call bi_call = calls[i];
changed |= shrink_wrap_one_built_in_call (bi_call);
}
@@ -909,15 +909,14 @@ pass_call_cdce::execute (function *fun)
basic_block bb;
gimple_stmt_iterator i;
bool something_changed = false;
- auto_vec<gimple> cond_dead_built_in_calls;
+ auto_vec<gimple_call> cond_dead_built_in_calls;
FOR_EACH_BB_FN (bb, fun)
{
/* Collect dead call candidates. */
for (i = gsi_start_bb (bb); !gsi_end_p (i); gsi_next (&i))
{
- gimple stmt = gsi_stmt (i);
- if (is_gimple_call (stmt)
- && is_call_dce_candidate (stmt))
+ gimple_call stmt = dyn_cast <gimple_call> (gsi_stmt (i));
+ if (stmt && is_call_dce_candidate (stmt))
{
if (dump_file && (dump_flags & TDF_DETAILS))
{
diff --git a/gcc/tree-cfg.c b/gcc/tree-cfg.c
index 736c451..c852d7a 100644
--- a/gcc/tree-cfg.c
+++ b/gcc/tree-cfg.c
@@ -1952,7 +1952,7 @@ single_noncomplex_succ (basic_block bb)
/* T is CALL_EXPR. Set current_function_calls_* flags. */
void
-notice_special_calls (gimple call)
+notice_special_calls (gimple_call call)
{
int flags = gimple_call_flags (call);
diff --git a/gcc/tree-cfg.h b/gcc/tree-cfg.h
index 2be38df..20a2e06 100644
--- a/gcc/tree-cfg.h
+++ b/gcc/tree-cfg.h
@@ -36,7 +36,7 @@ extern void group_case_labels_stmt (gimple_switch);
extern void group_case_labels (void);
extern void replace_uses_by (tree, tree);
extern basic_block single_noncomplex_succ (basic_block bb);
-extern void notice_special_calls (gimple);
+extern void notice_special_calls (gimple_call);
extern void clear_special_calls (void);
extern edge find_taken_edge (basic_block, tree);
extern void gimple_debug_bb (basic_block);
diff --git a/gcc/tree-complex.c b/gcc/tree-complex.c
index 25dcad8..c259504 100644
--- a/gcc/tree-complex.c
+++ b/gcc/tree-complex.c
@@ -950,7 +950,8 @@ expand_complex_libcall (gimple_stmt_iterator *gsi, tree ar, tree ai,
enum machine_mode mode;
enum built_in_function bcode;
tree fn, type, lhs;
- gimple old_stmt, stmt;
+ gimple old_stmt;
+ gimple_call stmt;
old_stmt = gsi_stmt (*gsi);
lhs = gimple_assign_lhs (old_stmt);
diff --git a/gcc/tree-inline.c b/gcc/tree-inline.c
index b5ba212..15b2cdd 100644
--- a/gcc/tree-inline.c
+++ b/gcc/tree-inline.c
@@ -1565,7 +1565,7 @@ remap_gimple_stmt (gimple stmt, copy_body_data *id)
keep it valid over inlining by setting DECL_PT_UID. */
if (!id->src_cfun->gimple_df
|| !id->src_cfun->gimple_df->ipa_pta)
- gimple_call_reset_alias_info (copy);
+ gimple_call_reset_alias_info (as_a <gimple_call> (copy));
}
break;
@@ -1707,13 +1707,13 @@ copy_bb (copy_body_data *id, basic_block bb, int frequency_scale,
stmt = gsi_stmt (copy_gsi);
if (is_gimple_call (stmt)
- && gimple_call_va_arg_pack_p (stmt)
+ && gimple_call_va_arg_pack_p (as_a <gimple_call> (stmt))
&& id->gimple_call)
{
/* __builtin_va_arg_pack () should be replaced by
all arguments corresponding to ... in the caller. */
tree p;
- gimple new_call;
+ gimple_call new_call;
vec<tree> argarray;
size_t nargs = gimple_call_num_args (id->gimple_call);
size_t n;
@@ -1915,7 +1915,7 @@ copy_bb (copy_body_data *id, basic_block bb, int frequency_scale,
}
}
- notice_special_calls (stmt);
+ notice_special_calls (as_a <gimple_call> (stmt));
}
maybe_duplicate_eh_stmt_fn (cfun, stmt, id->src_cfun, orig_stmt,
@@ -3395,7 +3395,7 @@ inline_forbidden_p_stmt (gimple_stmt_iterator *gsi, bool *handled_ops_p,
VLA objects as those can't cause unbounded growth (they're always
wrapped inside stack_save/stack_restore regions. */
if (gimple_alloca_call_p (stmt)
- && !gimple_call_alloca_for_var_p (stmt)
+ && !gimple_call_alloca_for_var_p (as_a <gimple_call> (stmt))
&& !lookup_attribute ("always_inline", DECL_ATTRIBUTES (fn)))
{
inline_forbidden_reason
diff --git a/gcc/tree-nested.c b/gcc/tree-nested.c
index 1f54a07..3caa335 100644
--- a/gcc/tree-nested.c
+++ b/gcc/tree-nested.c
@@ -408,7 +408,7 @@ get_chain_field (struct nesting_info *info)
static tree
init_tmp_var_with_call (struct nesting_info *info, gimple_stmt_iterator *gsi,
- gimple call)
+ gimple_call call)
{
tree t;
@@ -2063,7 +2063,7 @@ convert_nl_goto_reference (gimple_stmt_iterator *gsi, bool *handled_ops_p,
{
struct nesting_info *const info = (struct nesting_info *) wi->info, *i;
tree label, new_label, target_context, x, field;
- gimple call;
+ gimple_call call;
gimple stmt = gsi_stmt (*gsi);
if (gimple_code (stmt) != GIMPLE_GOTO)
@@ -2180,7 +2180,7 @@ convert_tramp_reference_op (tree *tp, int *walk_subtrees, void *data)
struct walk_stmt_info *wi = (struct walk_stmt_info *) data;
struct nesting_info *const info = (struct nesting_info *) wi->info, *i;
tree t = *tp, decl, target_context, x, builtin;
- gimple call;
+ gimple_call call;
*walk_subtrees = 0;
switch (TREE_CODE (t))
@@ -2329,8 +2329,9 @@ convert_gimple_call (gimple_stmt_iterator *gsi, bool *handled_ops_p,
target_context = decl_function_context (decl);
if (target_context && DECL_STATIC_CHAIN (decl))
{
- gimple_call_set_chain (stmt, get_static_chain (info, target_context,
- &wi->gsi));
+ gimple_call_set_chain (as_a <gimple_call> (stmt),
+ get_static_chain (info, target_context,
+ &wi->gsi));
info->static_chain_added |= (1 << (info->context != target_context));
}
break;
diff --git a/gcc/tree-nrv.c b/gcc/tree-nrv.c
index 02a4af9..91a9531 100644
--- a/gcc/tree-nrv.c
+++ b/gcc/tree-nrv.c
@@ -315,7 +315,7 @@ make_pass_nrv (gcc::context *ctxt)
DEST is available if it is not clobbered or used by the call. */
static bool
-dest_safe_for_nrv_p (gimple call)
+dest_safe_for_nrv_p (gimple_call call)
{
tree dest = gimple_call_lhs (call);
@@ -382,10 +382,11 @@ pass_return_slot::execute (function *fun)
gimple_stmt_iterator gsi;
for (gsi = gsi_start_bb (bb); !gsi_end_p (gsi); gsi_next (&gsi))
{
- gimple stmt = gsi_stmt (gsi);
+ gimple_call stmt;
bool slot_opt_p;
- if (is_gimple_call (stmt)
+ stmt = dyn_cast <gimple_call> (gsi_stmt (gsi));
+ if (stmt
&& gimple_call_lhs (stmt)
&& !gimple_call_return_slot_opt_p (stmt)
&& aggregate_value_p (TREE_TYPE (gimple_call_lhs (stmt)),
diff --git a/gcc/tree-object-size.c b/gcc/tree-object-size.c
index 220ad1f..27633e2 100644
--- a/gcc/tree-object-size.c
+++ b/gcc/tree-object-size.c
@@ -59,8 +59,8 @@ static const unsigned HOST_WIDE_INT unknown[4] = { -1, -1, 0, 0 };
static tree compute_object_offset (const_tree, const_tree);
static unsigned HOST_WIDE_INT addr_object_size (struct object_size_info *,
const_tree, int);
-static unsigned HOST_WIDE_INT alloc_object_size (const_gimple, int);
-static tree pass_through_call (const_gimple);
+static unsigned HOST_WIDE_INT alloc_object_size (const_gimple_call, int);
+static tree pass_through_call (const_gimple_call);
static void collect_object_sizes_for (struct object_size_info *, tree);
static void expr_object_size (struct object_size_info *, tree, tree);
static bool merge_object_sizes (struct object_size_info *, tree, tree,
@@ -392,7 +392,7 @@ addr_object_size (struct object_size_info *osi, const_tree ptr,
unknown[object_size_type]. */
static unsigned HOST_WIDE_INT
-alloc_object_size (const_gimple call, int object_size_type)
+alloc_object_size (const_gimple_call call, int object_size_type)
{
tree callee, bytes = NULL_TREE;
tree alloc_size;
@@ -455,7 +455,7 @@ alloc_object_size (const_gimple call, int object_size_type)
Otherwise return NULL. */
static tree
-pass_through_call (const_gimple call)
+pass_through_call (const_gimple_call call)
{
tree callee = gimple_call_fndecl (call);
@@ -669,7 +669,7 @@ expr_object_size (struct object_size_info *osi, tree ptr, tree value)
/* Compute object_sizes for PTR, defined to the result of a call. */
static void
-call_object_size (struct object_size_info *osi, tree ptr, gimple call)
+call_object_size (struct object_size_info *osi, tree ptr, gimple_call call)
{
int object_size_type = osi->object_size_type;
unsigned int varno = SSA_NAME_VERSION (ptr);
@@ -966,7 +966,8 @@ collect_object_sizes_for (struct object_size_info *osi, tree var)
case GIMPLE_CALL:
{
- tree arg = pass_through_call (stmt);
+ gimple_call call_stmt = as_a <gimple_call> (stmt);
+ tree arg = pass_through_call (call_stmt);
if (arg)
{
if (TREE_CODE (arg) == SSA_NAME
@@ -976,7 +977,7 @@ collect_object_sizes_for (struct object_size_info *osi, tree var)
expr_object_size (osi, var, arg);
}
else
- call_object_size (osi, var, stmt);
+ call_object_size (osi, var, call_stmt);
break;
}
@@ -1102,7 +1103,8 @@ check_for_plus_in_loops_1 (struct object_size_info *osi, tree var,
case GIMPLE_CALL:
{
- tree arg = pass_through_call (stmt);
+ gimple_call call_stmt = as_a <gimple_call> (stmt);
+ tree arg = pass_through_call (call_stmt);
if (arg)
{
if (TREE_CODE (arg) == SSA_NAME)
@@ -1250,7 +1252,7 @@ pass_object_sizes::execute (function *fun)
continue;
init_object_sizes ();
- result = fold_call_stmt (call, false);
+ result = fold_call_stmt (as_a <gimple_call> (call), false);
if (!result)
{
if (gimple_call_num_args (call) == 2
diff --git a/gcc/tree-profile.c b/gcc/tree-profile.c
index 48d13a2..d8f5031 100644
--- a/gcc/tree-profile.c
+++ b/gcc/tree-profile.c
@@ -335,7 +335,7 @@ gimple_gen_interval_profiler (histogram_value value, unsigned tag, unsigned base
gimple stmt = value->hvalue.stmt;
gimple_stmt_iterator gsi = gsi_for_stmt (stmt);
tree ref = tree_coverage_counter_ref (tag, base), ref_ptr;
- gimple call;
+ gimple_call call;
tree val;
tree start = build_int_cst_type (integer_type_node,
value->hdata.intvl.int_start);
@@ -361,7 +361,7 @@ gimple_gen_pow2_profiler (histogram_value value, unsigned tag, unsigned base)
gimple stmt = value->hvalue.stmt;
gimple_stmt_iterator gsi = gsi_for_stmt (stmt);
tree ref_ptr = tree_coverage_counter_addr (tag, base);
- gimple call;
+ gimple_call call;
tree val;
ref_ptr = force_gimple_operand_gsi (&gsi, ref_ptr,
@@ -381,7 +381,7 @@ gimple_gen_one_value_profiler (histogram_value value, unsigned tag, unsigned bas
gimple stmt = value->hvalue.stmt;
gimple_stmt_iterator gsi = gsi_for_stmt (stmt);
tree ref_ptr = tree_coverage_counter_addr (tag, base);
- gimple call;
+ gimple_call call;
tree val;
ref_ptr = force_gimple_operand_gsi (&gsi, ref_ptr,
@@ -504,7 +504,7 @@ gimple_gen_time_profiler (unsigned tag, unsigned base,
gimple_stmt_iterator &gsi)
{
tree ref_ptr = tree_coverage_counter_addr (tag, base);
- gimple call;
+ gimple_call call;
ref_ptr = force_gimple_operand_gsi (&gsi, ref_ptr,
true, NULL_TREE, true, GSI_SAME_STMT);
@@ -539,7 +539,7 @@ gimple_gen_average_profiler (histogram_value value, unsigned tag, unsigned base)
gimple stmt = value->hvalue.stmt;
gimple_stmt_iterator gsi = gsi_for_stmt (stmt);
tree ref_ptr = tree_coverage_counter_addr (tag, base);
- gimple call;
+ gimple_call call;
tree val;
ref_ptr = force_gimple_operand_gsi (&gsi, ref_ptr,
@@ -560,7 +560,7 @@ gimple_gen_ior_profiler (histogram_value value, unsigned tag, unsigned base)
gimple stmt = value->hvalue.stmt;
gimple_stmt_iterator gsi = gsi_for_stmt (stmt);
tree ref_ptr = tree_coverage_counter_addr (tag, base);
- gimple call;
+ gimple_call call;
tree val;
ref_ptr = force_gimple_operand_gsi (&gsi, ref_ptr,
diff --git a/gcc/tree-ssa-alias.c b/gcc/tree-ssa-alias.c
index 1bf88e2..611b16f 100644
--- a/gcc/tree-ssa-alias.c
+++ b/gcc/tree-ssa-alias.c
@@ -1477,7 +1477,7 @@ refs_output_dependent_p (tree store1, tree store2)
otherwise return false. */
static bool
-ref_maybe_used_by_call_p_1 (gimple call, ao_ref *ref)
+ref_maybe_used_by_call_p_1 (gimple_call call, ao_ref *ref)
{
tree base, callee;
unsigned i;
@@ -1790,7 +1790,7 @@ process_args:
}
static bool
-ref_maybe_used_by_call_p (gimple call, ao_ref *ref)
+ref_maybe_used_by_call_p (gimple_call call, ao_ref *ref)
{
bool res;
res = ref_maybe_used_by_call_p_1 (call, ref);
@@ -1825,7 +1825,7 @@ ref_maybe_used_by_stmt_p (gimple stmt, ao_ref *ref)
return refs_may_alias_p (rhs, ref);
}
else if (is_gimple_call (stmt))
- return ref_maybe_used_by_call_p (stmt, ref);
+ return ref_maybe_used_by_call_p (as_a <gimple_call> (stmt), ref);
else if (gimple_code (stmt) == GIMPLE_RETURN)
{
tree retval = gimple_return_retval (stmt);
@@ -1861,7 +1861,7 @@ ref_maybe_used_by_stmt_p (gimple stmt, tree ref)
return true, otherwise return false. */
bool
-call_may_clobber_ref_p_1 (gimple call, ao_ref *ref)
+call_may_clobber_ref_p_1 (gimple_call call, ao_ref *ref)
{
tree base;
tree callee;
@@ -2134,7 +2134,7 @@ call_may_clobber_ref_p_1 (gimple call, ao_ref *ref)
return true, otherwise return false. */
bool
-call_may_clobber_ref_p (gimple call, tree ref)
+call_may_clobber_ref_p (gimple_call call, tree ref)
{
bool res;
ao_ref r;
@@ -2166,7 +2166,7 @@ stmt_may_clobber_ref_p_1 (gimple stmt, ao_ref *ref)
return true;
}
- return call_may_clobber_ref_p_1 (stmt, ref);
+ return call_may_clobber_ref_p_1 (as_a <gimple_call> (stmt), ref);
}
else if (gimple_assign_single_p (stmt))
{
diff --git a/gcc/tree-ssa-alias.h b/gcc/tree-ssa-alias.h
index 0d35283..42395bd 100644
--- a/gcc/tree-ssa-alias.h
+++ b/gcc/tree-ssa-alias.h
@@ -112,8 +112,8 @@ extern bool ref_maybe_used_by_stmt_p (gimple, ao_ref *);
extern bool stmt_may_clobber_global_p (gimple);
extern bool stmt_may_clobber_ref_p (gimple, tree);
extern bool stmt_may_clobber_ref_p_1 (gimple, ao_ref *);
-extern bool call_may_clobber_ref_p (gimple, tree);
-extern bool call_may_clobber_ref_p_1 (gimple, ao_ref *);
+extern bool call_may_clobber_ref_p (gimple_call, tree);
+extern bool call_may_clobber_ref_p_1 (gimple_call, ao_ref *);
extern bool stmt_kills_ref_p (gimple, tree);
extern bool stmt_kills_ref_p (gimple, ao_ref *);
extern tree get_continuation_for_phi (gimple, ao_ref *,
diff --git a/gcc/tree-ssa-dce.c b/gcc/tree-ssa-dce.c
index 70b405c..f95c0ea 100644
--- a/gcc/tree-ssa-dce.c
+++ b/gcc/tree-ssa-dce.c
@@ -1221,7 +1221,7 @@ eliminate_unnecessary_stmts (void)
{
tree name = gimple_call_lhs (stmt);
- notice_special_calls (stmt);
+ notice_special_calls (as_a <gimple_call> (stmt));
/* When LHS of var = call (); is dead, simplify it into
call (); saving one operand. */
diff --git a/gcc/tree-ssa-loop-prefetch.c b/gcc/tree-ssa-loop-prefetch.c
index 29b02f0..a8127d5 100644
--- a/gcc/tree-ssa-loop-prefetch.c
+++ b/gcc/tree-ssa-loop-prefetch.c
@@ -1244,7 +1244,7 @@ emit_mfence_after_loop (struct loop *loop)
{
vec<edge> exits = get_loop_exit_edges (loop);
edge exit;
- gimple call;
+ gimple_call call;
gimple_stmt_iterator bsi;
unsigned i;
diff --git a/gcc/tree-ssa-math-opts.c b/gcc/tree-ssa-math-opts.c
index 3c6e935..3495a76 100644
--- a/gcc/tree-ssa-math-opts.c
+++ b/gcc/tree-ssa-math-opts.c
@@ -1065,7 +1065,7 @@ static tree
build_and_insert_call (gimple_stmt_iterator *gsi, location_t loc,
tree fn, tree arg)
{
- gimple call_stmt;
+ gimple_call call_stmt;
tree ssa_target;
call_stmt = gimple_build_call (fn, 1, arg);
diff --git a/gcc/tree-ssa-operands.c b/gcc/tree-ssa-operands.c
index a7ccf04..1e59b76 100644
--- a/gcc/tree-ssa-operands.c
+++ b/gcc/tree-ssa-operands.c
@@ -634,7 +634,7 @@ get_tmr_operands (struct function *fn, gimple stmt, tree expr, int flags)
escape, add them to the VDEF/VUSE lists for it. */
static void
-maybe_add_call_vops (struct function *fn, gimple stmt)
+maybe_add_call_vops (struct function *fn, gimple_call stmt)
{
int call_flags = gimple_call_flags (stmt);
@@ -930,7 +930,7 @@ parse_ssa_operands (struct function *fn, gimple stmt)
case GIMPLE_CALL:
/* Add call-clobbered operands, if needed. */
- maybe_add_call_vops (fn, stmt);
+ maybe_add_call_vops (fn, as_a <gimple_call> (stmt));
/* FALLTHRU */
case GIMPLE_ASSIGN:
diff --git a/gcc/tree-ssa-pre.c b/gcc/tree-ssa-pre.c
index 9deaa5e..7794501 100644
--- a/gcc/tree-ssa-pre.c
+++ b/gcc/tree-ssa-pre.c
@@ -3713,7 +3713,7 @@ compute_avail (void)
if (gimple_call_internal_p (stmt))
continue;
- vn_reference_lookup_call (stmt, &ref, &ref1);
+ vn_reference_lookup_call (as_a <gimple_call> (stmt), &ref, &ref1);
if (!ref)
continue;
diff --git a/gcc/tree-ssa-sccvn.c b/gcc/tree-ssa-sccvn.c
index f1fd0f5..4f0ab06 100644
--- a/gcc/tree-ssa-sccvn.c
+++ b/gcc/tree-ssa-sccvn.c
@@ -1119,7 +1119,7 @@ ao_ref_init_from_vn_reference (ao_ref *ref,
vn_reference_op_s's. */
static void
-copy_reference_ops_from_call (gimple call,
+copy_reference_ops_from_call (gimple_call call,
vec<vn_reference_op_s> *result)
{
vn_reference_op_s temp;
@@ -1443,7 +1443,7 @@ valueize_shared_reference_ops_from_ref (tree ref, bool *valueized_anything)
this function. */
static vec<vn_reference_op_s>
-valueize_shared_reference_ops_from_call (gimple call)
+valueize_shared_reference_ops_from_call (gimple_call call)
{
if (!call)
return vNULL;
@@ -1617,7 +1617,8 @@ vn_reference_lookup_3 (ao_ref *ref, tree vuse, void *vr_,
}
if (valueized_anything)
{
- bool res = call_may_clobber_ref_p_1 (def_stmt, ref);
+ bool res = call_may_clobber_ref_p_1 (as_a <gimple_call> (def_stmt),
+ ref);
for (unsigned i = 0; i < gimple_call_num_args (def_stmt); ++i)
gimple_call_set_arg (def_stmt, i, oldargs[i]);
if (!res)
@@ -2143,7 +2144,7 @@ vn_reference_lookup (tree op, tree vuse, vn_lookup_kind kind,
*VNRESULT if found. Populates *VR for the hashtable lookup. */
void
-vn_reference_lookup_call (gimple call, vn_reference_t *vnresult,
+vn_reference_lookup_call (gimple_call call, vn_reference_t *vnresult,
vn_reference_t vr)
{
if (vnresult)
@@ -2846,7 +2847,7 @@ visit_nary_op (tree lhs, gimple stmt)
of the LHS has changed as a result. */
static bool
-visit_reference_op_call (tree lhs, gimple stmt)
+visit_reference_op_call (tree lhs, gimple_call stmt)
{
bool changed = false;
struct vn_reference_s vr1;
@@ -3580,7 +3581,7 @@ visit_use (tree use)
else
changed = defs_to_varying (stmt);
}
- else if (is_gimple_call (stmt))
+ else if (gimple_call call_stmt = dyn_cast <gimple_call> (stmt))
{
tree lhs = gimple_call_lhs (stmt);
if (lhs && TREE_CODE (lhs) == SSA_NAME)
@@ -3666,11 +3667,11 @@ visit_use (tree use)
not alias with anything else. In which case the
information that the values are distinct are encoded
in the IL. */
- && !(gimple_call_return_flags (stmt) & ERF_NOALIAS)
+ && !(gimple_call_return_flags (call_stmt) & ERF_NOALIAS)
/* Only perform the following when being called from PRE
which embeds tail merging. */
&& default_vn_walk_kind == VN_WALK)))
- changed = visit_reference_op_call (lhs, stmt);
+ changed = visit_reference_op_call (lhs, call_stmt);
else
changed = defs_to_varying (stmt);
}
diff --git a/gcc/tree-ssa-sccvn.h b/gcc/tree-ssa-sccvn.h
index ad99604..e3def8a 100644
--- a/gcc/tree-ssa-sccvn.h
+++ b/gcc/tree-ssa-sccvn.h
@@ -210,7 +210,7 @@ tree vn_reference_lookup_pieces (tree, alias_set_type, tree,
vec<vn_reference_op_s> ,
vn_reference_t *, vn_lookup_kind);
tree vn_reference_lookup (tree, tree, vn_lookup_kind, vn_reference_t *);
-void vn_reference_lookup_call (gimple, vn_reference_t *, vn_reference_t);
+void vn_reference_lookup_call (gimple_call, vn_reference_t *, vn_reference_t);
vn_reference_t vn_reference_insert_pieces (tree, alias_set_type, tree,
vec<vn_reference_op_s> ,
tree, unsigned int);
diff --git a/gcc/tree-ssa-structalias.c b/gcc/tree-ssa-structalias.c
index 0169087..4bde124 100644
--- a/gcc/tree-ssa-structalias.c
+++ b/gcc/tree-ssa-structalias.c
@@ -397,7 +397,7 @@ static hash_map<gimple, varinfo_t> *call_stmt_vars;
/* Lookup or create the variable for the call statement CALL. */
static varinfo_t
-get_call_vi (gimple call)
+get_call_vi (gimple_call call)
{
varinfo_t vi, vi2;
@@ -428,7 +428,7 @@ get_call_vi (gimple call)
the uses. Returns NULL if there is nothing special about this call. */
static varinfo_t
-lookup_call_use_vi (gimple call)
+lookup_call_use_vi (gimple_call call)
{
varinfo_t *slot_p = call_stmt_vars->get (call);
if (slot_p)
@@ -441,7 +441,7 @@ lookup_call_use_vi (gimple call)
the clobbers. Returns NULL if there is nothing special about this call. */
static varinfo_t
-lookup_call_clobber_vi (gimple call)
+lookup_call_clobber_vi (gimple_call call)
{
varinfo_t uses = lookup_call_use_vi (call);
if (!uses)
@@ -454,7 +454,7 @@ lookup_call_clobber_vi (gimple call)
the uses. */
static varinfo_t
-get_call_use_vi (gimple call)
+get_call_use_vi (gimple_call call)
{
return get_call_vi (call);
}
@@ -463,7 +463,7 @@ get_call_use_vi (gimple call)
the clobbers. */
static varinfo_t ATTRIBUTE_UNUSED
-get_call_clobber_vi (gimple call)
+get_call_clobber_vi (gimple_call call)
{
return vi_next (get_call_vi (call));
}
@@ -3842,7 +3842,7 @@ get_function_part_constraint (varinfo_t fi, unsigned part)
RHS. */
static void
-handle_rhs_call (gimple stmt, vec<ce_s> *results)
+handle_rhs_call (gimple_call stmt, vec<ce_s> *results)
{
struct constraint_expr rhsc;
unsigned i;
@@ -3944,7 +3944,7 @@ handle_rhs_call (gimple stmt, vec<ce_s> *results)
the LHS point to global and escaped variables. */
static void
-handle_lhs_call (gimple stmt, tree lhs, int flags, vec<ce_s> rhsc,
+handle_lhs_call (gimple_call stmt, tree lhs, int flags, vec<ce_s> rhsc,
tree fndecl)
{
auto_vec<ce_s> lhsc;
@@ -4007,7 +4007,7 @@ handle_lhs_call (gimple stmt, tree lhs, int flags, vec<ce_s> rhsc,
const function that returns a pointer in the statement STMT. */
static void
-handle_const_call (gimple stmt, vec<ce_s> *results)
+handle_const_call (gimple_call stmt, vec<ce_s> *results)
{
struct constraint_expr rhsc;
unsigned int k;
@@ -4048,7 +4048,7 @@ handle_const_call (gimple stmt, vec<ce_s> *results)
pure function in statement STMT. */
static void
-handle_pure_call (gimple stmt, vec<ce_s> *results)
+handle_pure_call (gimple_call stmt, vec<ce_s> *results)
{
struct constraint_expr rhsc;
unsigned i;
@@ -4095,7 +4095,7 @@ handle_pure_call (gimple stmt, vec<ce_s> *results)
/* Return the varinfo for the callee of CALL. */
static varinfo_t
-get_fi_for_callee (gimple call)
+get_fi_for_callee (gimple_call call)
{
tree decl, fn = gimple_call_fn (call);
@@ -4126,7 +4126,7 @@ get_fi_for_callee (gimple call)
was handled, otherwise false. */
static bool
-find_func_aliases_for_builtin_call (struct function *fn, gimple t)
+find_func_aliases_for_builtin_call (struct function *fn, gimple_call t)
{
tree fndecl = gimple_call_fndecl (t);
auto_vec<ce_s, 2> lhsc;
@@ -4484,7 +4484,7 @@ find_func_aliases_for_builtin_call (struct function *fn, gimple t)
/* Create constraints for the call T. */
static void
-find_func_aliases_for_call (struct function *fn, gimple t)
+find_func_aliases_for_call (struct function *fn, gimple_call t)
{
tree fndecl = gimple_call_fndecl (t);
varinfo_t fi;
@@ -4647,7 +4647,7 @@ find_func_aliases (struct function *fn, gimple origt)
In non-ipa mode, we need to generate constraints for each
pointer passed by address. */
else if (is_gimple_call (t))
- find_func_aliases_for_call (fn, t);
+ find_func_aliases_for_call (fn, as_a <gimple_call> (t));
/* Otherwise, just a regular assignment statement. Only care about
operations with pointer result, others are dealt with as escape
@@ -4910,7 +4910,7 @@ find_func_clobbers (struct function *fn, gimple origt)
}
}
- if (is_gimple_call (t))
+ if (gimple_call call_stmt = dyn_cast <gimple_call> (t))
{
varinfo_t cfi = NULL;
tree decl = gimple_call_fndecl (t);
@@ -5047,7 +5047,7 @@ find_func_clobbers (struct function *fn, gimple origt)
/* Build constraints for propagating clobbers/uses along the
callgraph edges. */
- cfi = get_fi_for_callee (t);
+ cfi = get_fi_for_callee (call_stmt);
if (cfi->id == anything_id)
{
if (gimple_vdef (t))
@@ -5071,10 +5071,10 @@ find_func_clobbers (struct function *fn, gimple origt)
make_copy_constraint (first_vi_for_offset (fi, fi_uses), escaped_id);
/* Also honor the call statement use/clobber info. */
- if ((vi = lookup_call_clobber_vi (t)) != NULL)
+ if ((vi = lookup_call_clobber_vi (call_stmt)) != NULL)
make_copy_constraint (first_vi_for_offset (fi, fi_clobbers),
vi->id);
- if ((vi = lookup_call_use_vi (t)) != NULL)
+ if ((vi = lookup_call_use_vi (call_stmt)) != NULL)
make_copy_constraint (first_vi_for_offset (fi, fi_uses),
vi->id);
return;
@@ -6825,9 +6825,11 @@ compute_points_to_sets (void)
for (gsi = gsi_start_bb (bb); !gsi_end_p (gsi); gsi_next (&gsi))
{
- gimple stmt = gsi_stmt (gsi);
+ gimple_call stmt;
struct pt_solution *pt;
- if (!is_gimple_call (stmt))
+
+ stmt = dyn_cast <gimple_call> (gsi_stmt (gsi));
+ if (!stmt)
continue;
pt = gimple_call_use_set (stmt);
@@ -7235,12 +7237,13 @@ ipa_pta_execute (void)
for (gsi = gsi_start_bb (bb); !gsi_end_p (gsi); gsi_next (&gsi))
{
- gimple stmt = gsi_stmt (gsi);
+ gimple_call stmt;
struct pt_solution *pt;
varinfo_t vi, fi;
tree decl;
- if (!is_gimple_call (stmt))
+ stmt = dyn_cast <gimple_call> (gsi_stmt (gsi));
+ if (!stmt)
continue;
/* Handle direct calls to functions with body. */
diff --git a/gcc/tree-ssa-threadedge.c b/gcc/tree-ssa-threadedge.c
index da4419d..45083df 100644
--- a/gcc/tree-ssa-threadedge.c
+++ b/gcc/tree-ssa-threadedge.c
@@ -463,7 +463,7 @@ record_temporary_equivalences_from_stmts_at_dest (edge e,
/* Try to fold/lookup the new expression. Inserting the
expression into the hash table is unlikely to help. */
if (is_gimple_call (stmt))
- cached_lhs = fold_call_stmt (stmt, false);
+ cached_lhs = fold_call_stmt (as_a <gimple_call> (stmt), false);
else
cached_lhs = fold_assignment_stmt (stmt);
diff --git a/gcc/tree-tailcall.c b/gcc/tree-tailcall.c
index c45c89e..361f2ea 100644
--- a/gcc/tree-tailcall.c
+++ b/gcc/tree-tailcall.c
@@ -406,7 +406,8 @@ static void
find_tail_calls (basic_block bb, struct tailcall **ret)
{
tree ass_var = NULL_TREE, ret_var, func, param;
- gimple stmt, call = NULL;
+ gimple stmt;
+ gimple_call call = NULL;
gimple_stmt_iterator gsi, agsi;
bool tail_recursion;
struct tailcall *nw;
@@ -433,8 +434,8 @@ find_tail_calls (basic_block bb, struct tailcall **ret)
/* Check for a call. */
if (is_gimple_call (stmt))
{
- call = stmt;
- ass_var = gimple_call_lhs (stmt);
+ call = as_a <gimple_call> (stmt);
+ ass_var = gimple_call_lhs (call);
break;
}
diff --git a/gcc/tree-vect-data-refs.c b/gcc/tree-vect-data-refs.c
index e4befc0..4c3e161 100644
--- a/gcc/tree-vect-data-refs.c
+++ b/gcc/tree-vect-data-refs.c
@@ -4769,7 +4769,6 @@ vect_setup_realignment (gimple stmt, gimple_stmt_iterator *gsi,
gimple inc;
tree ptr;
tree data_ref;
- gimple new_stmt;
basic_block new_bb;
tree msq_init = NULL_TREE;
tree new_temp;
@@ -4864,6 +4863,7 @@ vect_setup_realignment (gimple stmt, gimple_stmt_iterator *gsi,
if (alignment_support_scheme == dr_explicit_realign_optimized)
{
/* Create msq_init = *(floor(p1)) in the loop preheader */
+ gimple_assign new_stmt;
gcc_assert (!compute_in_loop);
vec_dest = vect_create_destination_var (scalar_dest, vectype);
@@ -4900,6 +4900,7 @@ vect_setup_realignment (gimple stmt, gimple_stmt_iterator *gsi,
if (targetm.vectorize.builtin_mask_for_load)
{
+ gimple_call new_stmt;
tree builtin_decl;
/* Compute INIT_ADDR - the initial addressed accessed by this memref. */
diff --git a/gcc/tree-vect-patterns.c b/gcc/tree-vect-patterns.c
index ea3d542..9a1bbfb 100644
--- a/gcc/tree-vect-patterns.c
+++ b/gcc/tree-vect-patterns.c
@@ -1119,7 +1119,7 @@ vect_recog_pow_pattern (vec<gimple> *stmts, tree *type_in,
*type_in = get_vectype_for_scalar_type (TREE_TYPE (base));
if (*type_in)
{
- gimple stmt = gimple_build_call (newfn, 1, base);
+ gimple_call stmt = gimple_build_call (newfn, 1, base);
if (vectorizable_function (stmt, *type_in, *type_in)
!= NULL_TREE)
{
diff --git a/gcc/tree-vect-stmts.c b/gcc/tree-vect-stmts.c
index 350557c..dd3a9b8 100644
--- a/gcc/tree-vect-stmts.c
+++ b/gcc/tree-vect-stmts.c
@@ -1707,7 +1707,7 @@ vect_finish_stmt_generation (gimple stmt, gimple vec_stmt,
of the function, or NULL_TREE if the function cannot be vectorized. */
tree
-vectorizable_function (gimple call, tree vectype_out, tree vectype_in)
+vectorizable_function (gimple_call call, tree vectype_out, tree vectype_in)
{
tree fndecl = gimple_call_fndecl (call);
@@ -2178,20 +2178,21 @@ vectorizable_mask_load_store (gimple stmt, gimple_stmt_iterator *gsi,
/* Function vectorizable_call.
- Check if STMT performs a function call that can be vectorized.
+ Check if GS performs a function call that can be vectorized.
If VEC_STMT is also passed, vectorize the STMT: create a vectorized
stmt to replace it, put it in VEC_STMT, and insert it at BSI.
Return FALSE if not a vectorizable STMT, TRUE otherwise. */
static bool
-vectorizable_call (gimple stmt, gimple_stmt_iterator *gsi, gimple *vec_stmt,
+vectorizable_call (gimple gs, gimple_stmt_iterator *gsi, gimple *vec_stmt,
slp_tree slp_node)
{
+ gimple_call stmt;
tree vec_dest;
tree scalar_dest;
tree op, type;
tree vec_oprnd0 = NULL_TREE, vec_oprnd1 = NULL_TREE;
- stmt_vec_info stmt_info = vinfo_for_stmt (stmt), prev_stmt_info;
+ stmt_vec_info stmt_info = vinfo_for_stmt (gs), prev_stmt_info;
tree vectype_out, vectype_in;
int nunits_in;
int nunits_out;
@@ -2214,8 +2215,9 @@ vectorizable_call (gimple stmt, gimple_stmt_iterator *gsi, gimple *vec_stmt,
if (STMT_VINFO_DEF_TYPE (stmt_info) != vect_internal_def)
return false;
- /* Is STMT a vectorizable call? */
- if (!is_gimple_call (stmt))
+ /* Is GS a vectorizable call? */
+ stmt = dyn_cast <gimple_call> (gs);
+ if (!stmt)
return false;
if (gimple_call_internal_p (stmt)
diff --git a/gcc/tree-vectorizer.h b/gcc/tree-vectorizer.h
index 93aa73e..5fe3a6c 100644
--- a/gcc/tree-vectorizer.h
+++ b/gcc/tree-vectorizer.h
@@ -1004,7 +1004,7 @@ extern bool supportable_narrowing_operation (enum tree_code, tree, tree,
extern stmt_vec_info new_stmt_vec_info (gimple stmt, loop_vec_info,
bb_vec_info);
extern void free_stmt_vec_info (gimple stmt);
-extern tree vectorizable_function (gimple, tree, tree);
+extern tree vectorizable_function (gimple_call, tree, tree);
extern void vect_model_simple_cost (stmt_vec_info, int, enum vect_def_type *,
stmt_vector_for_cost *,
stmt_vector_for_cost *);
diff --git a/gcc/value-prof.c b/gcc/value-prof.c
index 0312295..e8f9f73 100644
--- a/gcc/value-prof.c
+++ b/gcc/value-prof.c
@@ -1343,7 +1343,7 @@ find_func_by_profile_id (int profile_id)
Returns true if TARGET is considered ok for call CALL_STMT. */
static bool
-check_ic_target (gimple call_stmt, struct cgraph_node *target)
+check_ic_target (gimple_call call_stmt, struct cgraph_node *target)
{
location_t locus;
if (gimple_check_call_matching_types (call_stmt, target->decl, true))
@@ -1508,12 +1508,13 @@ gimple_ic (gimple icall_stmt, struct cgraph_node *direct_call,
static bool
gimple_ic_transform (gimple_stmt_iterator *gsi)
{
- gimple stmt = gsi_stmt (*gsi);
+ gimple_call stmt;
histogram_value histogram;
gcov_type val, count, all, bb_all;
struct cgraph_node *direct_call;
- if (gimple_code (stmt) != GIMPLE_CALL)
+ stmt = dyn_cast <gimple_call> (gsi_stmt (*gsi));
+ if (!stmt)
return false;
if (gimple_call_fndecl (stmt) != NULL_TREE)
@@ -1595,7 +1596,7 @@ gimple_ic_transform (gimple_stmt_iterator *gsi)
operation.
*/
static bool
-interesting_stringop_to_profile_p (tree fndecl, gimple call, int *size_arg)
+interesting_stringop_to_profile_p (tree fndecl, gimple_call call, int *size_arg)
{
enum built_in_function fcode = DECL_FUNCTION_CODE (fndecl);
@@ -1632,7 +1633,7 @@ interesting_stringop_to_profile_p (tree fndecl, gimple call, int *size_arg)
assuming we'll propagate a true constant into ICALL_SIZE later. */
static void
-gimple_stringop_fixed_value (gimple vcall_stmt, tree icall_size, int prob,
+gimple_stringop_fixed_value (gimple_call vcall_stmt, tree icall_size, int prob,
gcov_type count, gcov_type all)
{
gimple tmp_stmt, cond_stmt, icall_stmt;
@@ -1726,7 +1727,7 @@ gimple_stringop_fixed_value (gimple vcall_stmt, tree icall_size, int prob,
static bool
gimple_stringops_transform (gimple_stmt_iterator *gsi)
{
- gimple stmt = gsi_stmt (*gsi);
+ gimple_call stmt;
tree fndecl;
tree blck_size;
enum built_in_function fcode;
@@ -1738,7 +1739,8 @@ gimple_stringops_transform (gimple_stmt_iterator *gsi)
tree tree_val;
int size_arg;
- if (gimple_code (stmt) != GIMPLE_CALL)
+ stmt = dyn_cast <gimple_call> (gsi_stmt (*gsi));
+ if (!stmt)
return false;
fndecl = gimple_call_fndecl (stmt);
if (!fndecl)
@@ -1955,14 +1957,16 @@ gimple_indirect_call_to_profile (gimple stmt, histogram_values *values)
/* Find values inside STMT for that we want to measure histograms for
string operations. */
static void
-gimple_stringops_values_to_profile (gimple stmt, histogram_values *values)
+gimple_stringops_values_to_profile (gimple gs, histogram_values *values)
{
+ gimple_call stmt;
tree fndecl;
tree blck_size;
tree dest;
int size_arg;
- if (gimple_code (stmt) != GIMPLE_CALL)
+ stmt = dyn_cast <gimple_call> (gs);
+ if (!stmt)
return;
fndecl = gimple_call_fndecl (stmt);
if (!fndecl)
diff --git a/gcc/vtable-verify.c b/gcc/vtable-verify.c
index cb331d2..bf23d29 100644
--- a/gcc/vtable-verify.c
+++ b/gcc/vtable-verify.c
@@ -594,7 +594,7 @@ verify_bb_vtables (basic_block bb)
tree vtbl_var_decl = NULL_TREE;
struct vtbl_map_node *vtable_map_node;
tree vtbl_decl = NULL_TREE;
- gimple call_stmt;
+ gimple_call call_stmt;
const char *vtable_name = "<unknown>";
tree tmp0;
bool found;
--
1.8.5.3
^ permalink raw reply [flat|nested] 93+ messages in thread
* [gimple-classes, committed 46/92] Make gimple_phi_arg_def_ptr and gimple_phi_arg_has_location require a gimple_phi
2014-10-27 20:35 [gimple-classes, committed 00/92] Initial slew of commits David Malcolm
` (66 preceding siblings ...)
2014-10-27 20:54 ` [gimple-classes, committed 56/92] Make gimple_label_set_label require a gimple_label David Malcolm
@ 2014-10-27 20:55 ` David Malcolm
2014-10-27 20:55 ` [gimple-classes, committed 41/92] Introduce gimple_omp_target David Malcolm
` (23 subsequent siblings)
91 siblings, 0 replies; 93+ messages in thread
From: David Malcolm @ 2014-10-27 20:55 UTC (permalink / raw)
To: gcc-patches; +Cc: David Malcolm
This corresponds to:
[PATCH 48/89] Make gimple_phi_arg_def_ptr and gimple_phi_arg_has_location require a gimple_phi
https://gcc.gnu.org/ml/gcc-patches/2014-04/msg01197.html
from the original 89-patch kit
That earlier patch was approved by Jeff:
> OK once prerequisites have gone in.
in https://gcc.gnu.org/ml/gcc-patches/2014-05/msg00828.html
gcc/
* gimple.h (gimple_phi_arg_def_ptr): Require a gimple_phi rather
than a plain gimple.
(gimple_phi_arg_has_location): Likewise.
* gimple-streamer-in.c (input_phi): Return a gimple_phi rather
than a plain gimple.
* gimple-streamer-out.c (output_phi): Require a gimple_phi rather
than a plain gimple.
(output_bb): Convert iteration to a gimple_phi_iterator, and local
"phi" to gimple_phi.
* omp-low.c (expand_omp_for_static_chunk): Convert iterator "psi"
to a gimple_phi_iterator; convert locals "phi" and "nphi" to be
gimple_phi.
* tree-cfg.c (gimple_duplicate_sese_tail): Likewise for "psi" and
"phi".
(move_block_to_fn): Introduce new gimple_phi_iterator "psi", using
it in place of "gsi" where necessary. Convert "phi" to be a
gimple_phi.
* tree-cfgcleanup.c (remove_forwarder_block): Likewise.
* tree-vect-loop-manip.c (vect_loop_versioning): Convert "gsi" to
a gimple_phi_iterator, and "orig_phi" and "new_phi" to be
gimple_phi.
* tree.c (find_decls_types_in_node): Introduce new
gimple_phi_iterator "psi", using it in place of "si" where
necessary. Convert "phi" to be a gimple_phi.
---
gcc/ChangeLog.gimple-classes | 35 +++++++++++++++++++++++++++++++++++
gcc/gimple-streamer-in.c | 4 ++--
gcc/gimple-streamer-out.c | 8 +++++---
gcc/gimple.h | 12 ++++++------
gcc/omp-low.c | 8 ++++----
gcc/tree-cfg.c | 15 ++++++++-------
gcc/tree-cfgcleanup.c | 8 ++++----
gcc/tree-vect-loop-manip.c | 7 ++++---
gcc/tree.c | 5 +++--
9 files changed, 71 insertions(+), 31 deletions(-)
diff --git a/gcc/ChangeLog.gimple-classes b/gcc/ChangeLog.gimple-classes
index b0391f3..b2ca765 100644
--- a/gcc/ChangeLog.gimple-classes
+++ b/gcc/ChangeLog.gimple-classes
@@ -1,5 +1,40 @@
2014-10-24 David Malcolm <dmalcolm@redhat.com>
+ Make gimple_phi_arg_def_ptr and gimple_phi_arg_has_location require a gimple_phi
+
+ * gimple.h (gimple_phi_arg_def_ptr): Require a gimple_phi rather
+ than a plain gimple.
+ (gimple_phi_arg_has_location): Likewise.
+
+ * gimple-streamer-in.c (input_phi): Return a gimple_phi rather
+ than a plain gimple.
+ * gimple-streamer-out.c (output_phi): Require a gimple_phi rather
+ than a plain gimple.
+ (output_bb): Convert iteration to a gimple_phi_iterator, and local
+ "phi" to gimple_phi.
+
+ * omp-low.c (expand_omp_for_static_chunk): Convert iterator "psi"
+ to a gimple_phi_iterator; convert locals "phi" and "nphi" to be
+ gimple_phi.
+
+ * tree-cfg.c (gimple_duplicate_sese_tail): Likewise for "psi" and
+ "phi".
+ (move_block_to_fn): Introduce new gimple_phi_iterator "psi", using
+ it in place of "gsi" where necessary. Convert "phi" to be a
+ gimple_phi.
+
+ * tree-cfgcleanup.c (remove_forwarder_block): Likewise.
+
+ * tree-vect-loop-manip.c (vect_loop_versioning): Convert "gsi" to
+ a gimple_phi_iterator, and "orig_phi" and "new_phi" to be
+ gimple_phi.
+
+ * tree.c (find_decls_types_in_node): Introduce new
+ gimple_phi_iterator "psi", using it in place of "si" where
+ necessary. Convert "phi" to be a gimple_phi.
+
+2014-10-24 David Malcolm <dmalcolm@redhat.com>
+
omp-low.c: Use more concrete types of gimple statement for various locals
* omp-low.c (finalize_task_copyfn): Strengthen local "bind" from
diff --git a/gcc/gimple-streamer-in.c b/gcc/gimple-streamer-in.c
index 202ecac..ae9dcfb 100644
--- a/gcc/gimple-streamer-in.c
+++ b/gcc/gimple-streamer-in.c
@@ -44,14 +44,14 @@ along with GCC; see the file COPYING3. If not see
/* Read a PHI function for basic block BB in function FN. DATA_IN is
the file being read. IB is the input block to use for reading. */
-static gimple
+static gimple_phi
input_phi (struct lto_input_block *ib, basic_block bb, struct data_in *data_in,
struct function *fn)
{
unsigned HOST_WIDE_INT ix;
tree phi_result;
int i, len;
- gimple result;
+ gimple_phi result;
ix = streamer_read_uhwi (ib);
phi_result = (*SSANAMES (fn))[ix];
diff --git a/gcc/gimple-streamer-out.c b/gcc/gimple-streamer-out.c
index 2bc605f..71def75 100644
--- a/gcc/gimple-streamer-out.c
+++ b/gcc/gimple-streamer-out.c
@@ -41,7 +41,7 @@ along with GCC; see the file COPYING3. If not see
/* Output PHI function PHI to the main stream in OB. */
static void
-output_phi (struct output_block *ob, gimple phi)
+output_phi (struct output_block *ob, gimple_phi phi)
{
unsigned i, len = gimple_phi_num_args (phi);
@@ -238,9 +238,11 @@ output_bb (struct output_block *ob, basic_block bb, struct function *fn)
streamer_write_record_start (ob, LTO_null);
- for (bsi = gsi_start_phis (bb); !gsi_end_p (bsi); gsi_next (&bsi))
+ for (gimple_phi_iterator psi = gsi_start_phis (bb);
+ !gsi_end_p (psi);
+ gsi_next (&psi))
{
- gimple phi = gsi_stmt (bsi);
+ gimple_phi phi = psi.phi ();
/* Only emit PHIs for gimple registers. PHI nodes for .MEM
will be filled in on reading when the SSA form is
diff --git a/gcc/gimple.h b/gcc/gimple.h
index 4e59777..e4ebcff 100644
--- a/gcc/gimple.h
+++ b/gcc/gimple.h
@@ -3971,12 +3971,12 @@ gimple_phi_arg_def (gimple gs, size_t index)
}
-/* Return a pointer to the tree operand for argument I of PHI node GS. */
+/* Return a pointer to the tree operand for argument I of phi node PHI. */
static inline tree *
-gimple_phi_arg_def_ptr (gimple gs, size_t index)
+gimple_phi_arg_def_ptr (gimple_phi phi, size_t index)
{
- return &gimple_phi_arg (gs, index)->def;
+ return &gimple_phi_arg (phi, index)->def;
}
/* Return the edge associated with argument I of phi node GS. */
@@ -4011,12 +4011,12 @@ gimple_phi_arg_set_location (gimple gs, size_t i, source_location loc)
gimple_phi_arg (gs, i)->locus = loc;
}
-/* Return TRUE if argument I of phi node GS has a location record. */
+/* Return TRUE if argument I of phi node PHI has a location record. */
static inline bool
-gimple_phi_arg_has_location (gimple gs, size_t i)
+gimple_phi_arg_has_location (gimple_phi phi, size_t i)
{
- return gimple_phi_arg_location (gs, i) != UNKNOWN_LOCATION;
+ return gimple_phi_arg_location (phi, i) != UNKNOWN_LOCATION;
}
diff --git a/gcc/omp-low.c b/gcc/omp-low.c
index 9946f3f..720a885 100644
--- a/gcc/omp-low.c
+++ b/gcc/omp-low.c
@@ -6732,8 +6732,8 @@ expand_omp_for_static_chunk (struct omp_region *region,
if (gimple_in_ssa_p (cfun))
{
- gimple_stmt_iterator psi;
- gimple phi;
+ gimple_phi_iterator psi;
+ gimple_phi phi;
edge re, ene;
edge_var_map *vm;
size_t i;
@@ -6752,10 +6752,10 @@ expand_omp_for_static_chunk (struct omp_region *region,
for (i = 0; !gsi_end_p (psi) && head->iterate (i, &vm);
gsi_next (&psi), ++i)
{
- gimple nphi;
+ gimple_phi nphi;
source_location locus;
- phi = gsi_stmt (psi);
+ phi = psi.phi ();
t = gimple_phi_result (phi);
gcc_assert (t == redirect_edge_var_map_result (vm));
nphi = create_phi_node (t, iter_part_bb);
diff --git a/gcc/tree-cfg.c b/gcc/tree-cfg.c
index 9db1ffd..479989f 100644
--- a/gcc/tree-cfg.c
+++ b/gcc/tree-cfg.c
@@ -6131,8 +6131,8 @@ gimple_duplicate_sese_tail (edge entry ATTRIBUTE_UNUSED, edge exit ATTRIBUTE_UNU
gimple cond_stmt;
edge sorig, snew;
basic_block exit_bb;
- gimple_stmt_iterator psi;
- gimple phi;
+ gimple_phi_iterator psi;
+ gimple_phi phi;
tree def;
struct loop *target, *aloop, *cloop;
@@ -6252,7 +6252,7 @@ gimple_duplicate_sese_tail (edge entry ATTRIBUTE_UNUSED, edge exit ATTRIBUTE_UNU
!gsi_end_p (psi);
gsi_next (&psi))
{
- phi = gsi_stmt (psi);
+ phi = psi.phi ();
def = PHI_ARG_DEF (phi, nexits[0]->dest_idx);
add_phi_arg (phi, def, e, gimple_phi_arg_location_from_edge (phi, e));
}
@@ -6629,9 +6629,10 @@ move_block_to_fn (struct function *dest_cfun, basic_block bb,
(*cfg->x_basic_block_info)[bb->index] = bb;
/* Remap the variables in phi nodes. */
- for (si = gsi_start_phis (bb); !gsi_end_p (si); )
+ for (gimple_phi_iterator psi = gsi_start_phis (bb);
+ !gsi_end_p (psi); )
{
- gimple phi = gsi_stmt (si);
+ gimple_phi phi = psi.phi ();
use_operand_p use;
tree op = PHI_RESULT (phi);
ssa_op_iter oi;
@@ -6641,7 +6642,7 @@ move_block_to_fn (struct function *dest_cfun, basic_block bb,
{
/* Remove the phi nodes for virtual operands (alias analysis will be
run for the new function, anyway). */
- remove_phi_node (&si, true);
+ remove_phi_node (&psi, true);
continue;
}
@@ -6671,7 +6672,7 @@ move_block_to_fn (struct function *dest_cfun, basic_block bb,
}
}
- gsi_next (&si);
+ gsi_next (&psi);
}
for (si = gsi_start_bb (bb); !gsi_end_p (si); gsi_next (&si))
diff --git a/gcc/tree-cfgcleanup.c b/gcc/tree-cfgcleanup.c
index 3b2a107..f4abe53 100644
--- a/gcc/tree-cfgcleanup.c
+++ b/gcc/tree-cfgcleanup.c
@@ -468,11 +468,11 @@ remove_forwarder_block (basic_block bb)
{
/* Create arguments for the phi nodes, since the edge was not
here before. */
- for (gsi = gsi_start_phis (dest);
- !gsi_end_p (gsi);
- gsi_next (&gsi))
+ for (gimple_phi_iterator psi = gsi_start_phis (dest);
+ !gsi_end_p (psi);
+ gsi_next (&psi))
{
- gimple phi = gsi_stmt (gsi);
+ gimple_phi phi = psi.phi ();
source_location l = gimple_phi_arg_location_from_edge (phi, succ);
tree def = gimple_phi_arg_def (phi, succ->dest_idx);
add_phi_arg (phi, unshare_expr (def), s, l);
diff --git a/gcc/tree-vect-loop-manip.c b/gcc/tree-vect-loop-manip.c
index db565a4..2aa3720 100644
--- a/gcc/tree-vect-loop-manip.c
+++ b/gcc/tree-vect-loop-manip.c
@@ -2317,11 +2317,12 @@ vect_loop_versioning (loop_vec_info loop_vinfo,
struct loop *loop = LOOP_VINFO_LOOP (loop_vinfo);
struct loop *scalar_loop = LOOP_VINFO_SCALAR_LOOP (loop_vinfo);
basic_block condition_bb;
- gimple_stmt_iterator gsi, cond_exp_gsi;
+ gimple_phi_iterator gsi;
+ gimple_stmt_iterator cond_exp_gsi;
basic_block merge_bb;
basic_block new_exit_bb;
edge new_exit_e, e;
- gimple orig_phi, new_phi;
+ gimple_phi orig_phi, new_phi;
tree cond_expr = NULL_TREE;
gimple_seq cond_expr_stmt_list = NULL;
tree arg;
@@ -2425,7 +2426,7 @@ vect_loop_versioning (loop_vec_info loop_vinfo,
for (gsi = gsi_start_phis (merge_bb); !gsi_end_p (gsi); gsi_next (&gsi))
{
tree new_res;
- orig_phi = gsi_stmt (gsi);
+ orig_phi = gsi.phi ();
new_res = copy_ssa_name (PHI_RESULT (orig_phi), NULL);
new_phi = create_phi_node (new_res, new_exit_bb);
arg = PHI_ARG_DEF_FROM_EDGE (orig_phi, e);
diff --git a/gcc/tree.c b/gcc/tree.c
index 2f4d194..72843ca 100644
--- a/gcc/tree.c
+++ b/gcc/tree.c
@@ -5502,12 +5502,13 @@ find_decls_types_in_node (struct cgraph_node *n, struct free_lang_data_d *fld)
/* Traverse every statement in FN. */
FOR_EACH_BB_FN (bb, fn)
{
+ gimple_phi_iterator psi;
gimple_stmt_iterator si;
unsigned i;
- for (si = gsi_start_phis (bb); !gsi_end_p (si); gsi_next (&si))
+ for (psi = gsi_start_phis (bb); !gsi_end_p (psi); gsi_next (&psi))
{
- gimple phi = gsi_stmt (si);
+ gimple_phi phi = psi.phi ();
for (i = 0; i < gimple_phi_num_args (phi); i++)
{
--
1.8.5.3
^ permalink raw reply [flat|nested] 93+ messages in thread
* [gimple-classes, committed 62/92] Concretize gimple_try_set_catch_is_cleanup
2014-10-27 20:35 [gimple-classes, committed 00/92] Initial slew of commits David Malcolm
` (78 preceding siblings ...)
2014-10-27 20:56 ` [gimple-classes, committed 81/92] Concretize gimple_call_set_tail and gimple_call_tail_p David Malcolm
@ 2014-10-27 20:56 ` David Malcolm
2014-10-27 20:57 ` [gimple-classes, committed 50/92] Make gimple_phi_arg_edge require a gimple_phi David Malcolm
` (11 subsequent siblings)
91 siblings, 0 replies; 93+ messages in thread
From: David Malcolm @ 2014-10-27 20:56 UTC (permalink / raw)
To: gcc-patches; +Cc: David Malcolm
This corresponds to:
[PATCH 64/89] Concretize gimple_try_set_catch_is_cleanup
https://gcc.gnu.org/ml/gcc-patches/2014-04/msg01181.html
from the original 89-patch kit
That earlier patch was approved by Jeff:
> OK after prerequisites have gone in.
in https://gcc.gnu.org/ml/gcc-patches/2014-05/msg00818.html
gcc/
* gimple.h (gimple_try_set_catch_is_cleanup): Require a gimple_try.
* gimplify.c (gimplify_expr): Convert local "try_" from a gimple
to a gimple_try.
---
gcc/ChangeLog.gimple-classes | 9 +++++++++
gcc/gimple.h | 2 +-
gcc/gimplify.c | 2 +-
3 files changed, 11 insertions(+), 2 deletions(-)
diff --git a/gcc/ChangeLog.gimple-classes b/gcc/ChangeLog.gimple-classes
index ba0f5c1..b874697 100644
--- a/gcc/ChangeLog.gimple-classes
+++ b/gcc/ChangeLog.gimple-classes
@@ -1,5 +1,14 @@
2014-10-24 David Malcolm <dmalcolm@redhat.com>
+ Concretize gimple_try_set_catch_is_cleanup
+
+ * gimple.h (gimple_try_set_catch_is_cleanup): Require a gimple_try.
+
+ * gimplify.c (gimplify_expr): Convert local "try_" from a gimple
+ to a gimple_try.
+
+2014-10-24 David Malcolm <dmalcolm@redhat.com>
+
Concretize gimple_eh_filter_set_types and gimple_eh_filter_set_failure
* gimple.h (gimple_eh_filter_set_types): Require a gimple_eh_filter.
diff --git a/gcc/gimple.h b/gcc/gimple.h
index 79ee8ba..990e90d 100644
--- a/gcc/gimple.h
+++ b/gcc/gimple.h
@@ -3775,7 +3775,7 @@ gimple_try_cleanup (gimple gs)
/* Set the GIMPLE_TRY_CATCH_IS_CLEANUP flag. */
static inline void
-gimple_try_set_catch_is_cleanup (gimple g, bool catch_is_cleanup)
+gimple_try_set_catch_is_cleanup (gimple_try g, bool catch_is_cleanup)
{
gcc_gimple_checking_assert (gimple_try_kind (g) == GIMPLE_TRY_CATCH);
if (catch_is_cleanup)
diff --git a/gcc/gimplify.c b/gcc/gimplify.c
index e3da6ae..b49aab7 100644
--- a/gcc/gimplify.c
+++ b/gcc/gimplify.c
@@ -7993,7 +7993,7 @@ gimplify_expr (tree *expr_p, gimple_seq *pre_p, gimple_seq *post_p,
case TRY_CATCH_EXPR:
{
gimple_seq eval, cleanup;
- gimple try_;
+ gimple_try try_;
/* Calls to destructors are generated automatically in FINALLY/CATCH
block. They should have location as UNKNOWN_LOCATION. However,
--
1.8.5.3
^ permalink raw reply [flat|nested] 93+ messages in thread
* [gimple-classes, committed 81/92] Concretize gimple_call_set_tail and gimple_call_tail_p
2014-10-27 20:35 [gimple-classes, committed 00/92] Initial slew of commits David Malcolm
` (77 preceding siblings ...)
2014-10-27 20:56 ` [gimple-classes, committed 76/92] Concretize gimple_call_set_nothrow David Malcolm
@ 2014-10-27 20:56 ` David Malcolm
2014-10-27 20:56 ` [gimple-classes, committed 62/92] Concretize gimple_try_set_catch_is_cleanup David Malcolm
` (12 subsequent siblings)
91 siblings, 0 replies; 93+ messages in thread
From: David Malcolm @ 2014-10-27 20:56 UTC (permalink / raw)
To: gcc-patches; +Cc: David Malcolm
This corresponds to:
[PATCH 83/89] Concretize gimple_call_set_tail and gimple_call_tail_p
https://gcc.gnu.org/ml/gcc-patches/2014-04/msg01172.html
from the original 89-patch kit
That earlier patch was approved by Jeff:
> OK once prereqs go in.
in https://gcc.gnu.org/ml/gcc-patches/2014-05/msg00859.html
gcc/
* gimple.h (gimple_call_set_tail): Require a gimple_call.
(gimple_call_tail_p): Likewise.
* cfgexpand.c (expand_gimple_tailcall): Likewise.
(expand_gimple_basic_block): Convert calls to is_gimple_call to a
dyn_cast, introducing a new "call_stmt" local.
* trans-mem.c (expand_block_edges): Likewise, for comparison against
GIMPLE_CALL.
* tree-inline.c (remap_gimple_stmt): Add checked casts to
gimple_call in region guarded by is_gimple_call.
* tree-tailcall.c (optimize_tail_call): Add checked cast to gimple_call
for t->call_gsi.
---
gcc/ChangeLog.gimple-classes | 20 ++++++++++++++++++++
gcc/cfgexpand.c | 13 +++++++------
gcc/gimple.h | 6 ++----
gcc/trans-mem.c | 20 ++++++++++++--------
gcc/tree-inline.c | 4 ++--
gcc/tree-tailcall.c | 2 +-
6 files changed, 44 insertions(+), 21 deletions(-)
diff --git a/gcc/ChangeLog.gimple-classes b/gcc/ChangeLog.gimple-classes
index f0737b9..56fe40d 100644
--- a/gcc/ChangeLog.gimple-classes
+++ b/gcc/ChangeLog.gimple-classes
@@ -1,5 +1,25 @@
2014-10-24 David Malcolm <dmalcolm@redhat.com>
+ Concretize gimple_call_set_tail and gimple_call_tail_p
+
+ * gimple.h (gimple_call_set_tail): Require a gimple_call.
+ (gimple_call_tail_p): Likewise.
+
+ * cfgexpand.c (expand_gimple_tailcall): Likewise.
+ (expand_gimple_basic_block): Convert calls to is_gimple_call to a
+ dyn_cast, introducing a new "call_stmt" local.
+
+ * trans-mem.c (expand_block_edges): Likewise, for comparison against
+ GIMPLE_CALL.
+
+ * tree-inline.c (remap_gimple_stmt): Add checked casts to
+ gimple_call in region guarded by is_gimple_call.
+
+ * tree-tailcall.c (optimize_tail_call): Add checked cast to gimple_call
+ for t->call_gsi.
+
+2014-10-24 David Malcolm <dmalcolm@redhat.com>
+
Concretize gimple_call_set_fntype
* gimple-fold.c (gimple_fold_builtin_sprintf_chk): Strengthen
diff --git a/gcc/cfgexpand.c b/gcc/cfgexpand.c
index 0715b83..65de5b2 100644
--- a/gcc/cfgexpand.c
+++ b/gcc/cfgexpand.c
@@ -3407,7 +3407,7 @@ expand_gimple_stmt (gimple stmt)
tailcall) and the normal result happens via a sqrt instruction. */
static basic_block
-expand_gimple_tailcall (basic_block bb, gimple stmt, bool *can_fallthru)
+expand_gimple_tailcall (basic_block bb, gimple_call stmt, bool *can_fallthru)
{
rtx_insn *last2, *last;
edge e;
@@ -5172,15 +5172,16 @@ expand_gimple_basic_block (basic_block bb, bool disable_tail_calls)
}
else
{
- if (is_gimple_call (stmt)
- && gimple_call_tail_p (stmt)
+ gimple_call call_stmt = dyn_cast <gimple_call> (stmt);
+ if (call_stmt
+ && gimple_call_tail_p (call_stmt)
&& disable_tail_calls)
- gimple_call_set_tail (stmt, false);
+ gimple_call_set_tail (call_stmt, false);
- if (is_gimple_call (stmt) && gimple_call_tail_p (stmt))
+ if (call_stmt && gimple_call_tail_p (call_stmt))
{
bool can_fallthru;
- new_bb = expand_gimple_tailcall (bb, stmt, &can_fallthru);
+ new_bb = expand_gimple_tailcall (bb, call_stmt, &can_fallthru);
if (new_bb)
{
if (can_fallthru)
diff --git a/gcc/gimple.h b/gcc/gimple.h
index d37c441..9d09804 100644
--- a/gcc/gimple.h
+++ b/gcc/gimple.h
@@ -2808,9 +2808,8 @@ gimple_call_set_arg (gimple gs, unsigned index, tree arg)
candidate for tail call optimization. */
static inline void
-gimple_call_set_tail (gimple s, bool tail_p)
+gimple_call_set_tail (gimple_call s, bool tail_p)
{
- GIMPLE_CHECK (s, GIMPLE_CALL);
if (tail_p)
s->subcode |= GF_CALL_TAILCALL;
else
@@ -2821,9 +2820,8 @@ gimple_call_set_tail (gimple s, bool tail_p)
/* Return true if GIMPLE_CALL S is marked as a tail call. */
static inline bool
-gimple_call_tail_p (gimple s)
+gimple_call_tail_p (gimple_call s)
{
- GIMPLE_CHECK (s, GIMPLE_CALL);
return (s->subcode & GF_CALL_TAILCALL) != 0;
}
diff --git a/gcc/trans-mem.c b/gcc/trans-mem.c
index bdd4a77..0912cc8 100644
--- a/gcc/trans-mem.c
+++ b/gcc/trans-mem.c
@@ -3111,23 +3111,26 @@ expand_block_edges (struct tm_region *const region, basic_block bb)
for (gsi = gsi_start_bb (bb); !gsi_end_p (gsi); gsi = next_gsi)
{
gimple stmt = gsi_stmt (gsi);
+ gimple_call call_stmt;
next_gsi = gsi;
gsi_next (&next_gsi);
// ??? Shouldn't we split for any non-pure, non-irrevocable function?
- if (gimple_code (stmt) != GIMPLE_CALL
- || (gimple_call_flags (stmt) & ECF_TM_BUILTIN) == 0)
+ call_stmt = dyn_cast <gimple_call> (stmt);
+ if ((!call_stmt)
+ || (gimple_call_flags (call_stmt) & ECF_TM_BUILTIN) == 0)
continue;
- if (DECL_FUNCTION_CODE (gimple_call_fndecl (stmt)) == BUILT_IN_TM_ABORT)
+ if (DECL_FUNCTION_CODE (gimple_call_fndecl (call_stmt))
+ == BUILT_IN_TM_ABORT)
{
// If we have a ``_transaction_cancel [[outer]]'', there is only
// one abnormal edge: to the transaction marked OUTER.
// All compiler-generated instances of BUILT_IN_TM_ABORT have a
// constant argument, which we can examine here. Users invoking
// TM_ABORT directly get what they deserve.
- tree arg = gimple_call_arg (stmt, 0);
+ tree arg = gimple_call_arg (call_stmt, 0);
if (TREE_CODE (arg) == INTEGER_CST
&& (TREE_INT_CST_LOW (arg) & AR_OUTERABORT) != 0
&& !decl_is_tm_clone (current_function_decl))
@@ -3136,7 +3139,7 @@ expand_block_edges (struct tm_region *const region, basic_block bb)
for (struct tm_region *o = region; o; o = o->outer)
if (o->original_transaction_was_outer)
{
- split_bb_make_tm_edge (stmt, o->restart_block,
+ split_bb_make_tm_edge (call_stmt, o->restart_block,
gsi, &next_gsi);
break;
}
@@ -3149,7 +3152,8 @@ expand_block_edges (struct tm_region *const region, basic_block bb)
// Non-outer, TM aborts have an abnormal edge to the inner-most
// transaction, the one being aborted;
- split_bb_make_tm_edge (stmt, region->restart_block, gsi, &next_gsi);
+ split_bb_make_tm_edge (call_stmt, region->restart_block, gsi,
+ &next_gsi);
}
// All TM builtins have an abnormal edge to the outer-most transaction.
@@ -3167,14 +3171,14 @@ expand_block_edges (struct tm_region *const region, basic_block bb)
for (struct tm_region *o = region; o; o = o->outer)
if (!o->outer)
{
- split_bb_make_tm_edge (stmt, o->restart_block, gsi, &next_gsi);
+ split_bb_make_tm_edge (call_stmt, o->restart_block, gsi, &next_gsi);
break;
}
// Delete any tail-call annotation that may have been added.
// The tail-call pass may have mis-identified the commit as being
// a candidate because we had not yet added this restart edge.
- gimple_call_set_tail (stmt, false);
+ gimple_call_set_tail (call_stmt, false);
}
}
diff --git a/gcc/tree-inline.c b/gcc/tree-inline.c
index 11446d7..84dfea8 100644
--- a/gcc/tree-inline.c
+++ b/gcc/tree-inline.c
@@ -1549,8 +1549,8 @@ remap_gimple_stmt (gimple stmt, copy_body_data *id)
/* Clear flags that need revisiting. */
if (is_gimple_call (copy)
- && gimple_call_tail_p (copy))
- gimple_call_set_tail (copy, false);
+ && gimple_call_tail_p (as_a <gimple_call> (copy)))
+ gimple_call_set_tail (as_a <gimple_call> (copy), false);
/* Remap the region numbers for __builtin_eh_{pointer,filter},
RESX and EH_DISPATCH. */
diff --git a/gcc/tree-tailcall.c b/gcc/tree-tailcall.c
index 9bf3c42..b941396 100644
--- a/gcc/tree-tailcall.c
+++ b/gcc/tree-tailcall.c
@@ -920,7 +920,7 @@ optimize_tail_call (struct tailcall *t, bool opt_tailcalls)
if (opt_tailcalls)
{
- gimple stmt = gsi_stmt (t->call_gsi);
+ gimple_call stmt = as_a <gimple_call> (gsi_stmt (t->call_gsi));
gimple_call_set_tail (stmt, true);
cfun->tail_call_marked = true;
--
1.8.5.3
^ permalink raw reply [flat|nested] 93+ messages in thread
* [gimple-classes, committed 76/92] Concretize gimple_call_set_nothrow
2014-10-27 20:35 [gimple-classes, committed 00/92] Initial slew of commits David Malcolm
` (76 preceding siblings ...)
2014-10-27 20:56 ` [gimple-classes, committed 30/92] Introduce gimple_try David Malcolm
@ 2014-10-27 20:56 ` David Malcolm
2014-10-27 20:56 ` [gimple-classes, committed 81/92] Concretize gimple_call_set_tail and gimple_call_tail_p David Malcolm
` (13 subsequent siblings)
91 siblings, 0 replies; 93+ messages in thread
From: David Malcolm @ 2014-10-27 20:56 UTC (permalink / raw)
To: gcc-patches; +Cc: David Malcolm
This corresponds to:
[PATCH 78/89] Concretize gimple_call_set_nothrow
https://gcc.gnu.org/ml/gcc-patches/2014-04/msg01184.html
from the original 89-patch kit
That earlier patch was approved by Jeff:
> OK once prerequisites have gone in.
in https://gcc.gnu.org/ml/gcc-patches/2014-05/msg00837.html
gcc/
* gimple.h (gimple_call_set_nothrow): Require a gimple_call.
* trans-mem.c (ipa_tm_insert_gettmclone_call): Likewise.
(ipa_tm_transform_calls_redirect): Add checked cast to gimple call; this
is only called for gsi on a GIMPLE_CALL statement.
---
gcc/ChangeLog.gimple-classes | 10 ++++++++++
gcc/gimple.h | 3 +--
gcc/trans-mem.c | 4 ++--
3 files changed, 13 insertions(+), 4 deletions(-)
diff --git a/gcc/ChangeLog.gimple-classes b/gcc/ChangeLog.gimple-classes
index 86e1718..21e051b 100644
--- a/gcc/ChangeLog.gimple-classes
+++ b/gcc/ChangeLog.gimple-classes
@@ -1,5 +1,15 @@
2014-10-24 David Malcolm <dmalcolm@redhat.com>
+ Concretize gimple_call_set_nothrow
+
+ * gimple.h (gimple_call_set_nothrow): Require a gimple_call.
+
+ * trans-mem.c (ipa_tm_insert_gettmclone_call): Likewise.
+ (ipa_tm_transform_calls_redirect): Add checked cast to gimple call; this
+ is only called for gsi on a GIMPLE_CALL statement.
+
+2014-10-24 David Malcolm <dmalcolm@redhat.com>
+
Concretize various expressions from gimple to gimple_cond
* ipa-split.c (check_forbidden_calls): Replace check against
diff --git a/gcc/gimple.h b/gcc/gimple.h
index 4afb86f..e220228 100644
--- a/gcc/gimple.h
+++ b/gcc/gimple.h
@@ -2912,9 +2912,8 @@ gimple_call_noreturn_p (gimple s)
even if the called function can throw in other cases. */
static inline void
-gimple_call_set_nothrow (gimple s, bool nothrow_p)
+gimple_call_set_nothrow (gimple_call s, bool nothrow_p)
{
- GIMPLE_CHECK (s, GIMPLE_CALL);
if (nothrow_p)
s->subcode |= GF_CALL_NOTHROW;
else
diff --git a/gcc/trans-mem.c b/gcc/trans-mem.c
index 9e90812..98fd3a2 100644
--- a/gcc/trans-mem.c
+++ b/gcc/trans-mem.c
@@ -4988,7 +4988,7 @@ ipa_tm_insert_irr_call (struct cgraph_node *node, struct tm_region *region,
static bool
ipa_tm_insert_gettmclone_call (struct cgraph_node *node,
struct tm_region *region,
- gimple_stmt_iterator *gsi, gimple stmt)
+ gimple_stmt_iterator *gsi, gimple_call stmt)
{
tree gettm_fn, ret, old_fn, callfn;
gimple_call g;
@@ -5088,7 +5088,7 @@ ipa_tm_transform_calls_redirect (struct cgraph_node *node,
gimple_stmt_iterator *gsi,
bool *need_ssa_rename_p)
{
- gimple stmt = gsi_stmt (*gsi);
+ gimple_call stmt = as_a <gimple_call> (gsi_stmt (*gsi));
struct cgraph_node *new_node;
struct cgraph_edge *e = node->get_edge (stmt);
tree fndecl = gimple_call_fndecl (stmt);
--
1.8.5.3
^ permalink raw reply [flat|nested] 93+ messages in thread
* [gimple-classes, committed 52/92] Make gimple_call_return_slot_opt_p require a gimple_call.
2014-10-27 20:35 [gimple-classes, committed 00/92] Initial slew of commits David Malcolm
` (73 preceding siblings ...)
2014-10-27 20:55 ` [gimple-classes, committed 18/92] Introduce gimple_call David Malcolm
@ 2014-10-27 20:56 ` David Malcolm
2014-10-27 20:56 ` [gimple-classes, committed 07/92] Introduce gimple_phi and use it in various places David Malcolm
` (16 subsequent siblings)
91 siblings, 0 replies; 93+ messages in thread
From: David Malcolm @ 2014-10-27 20:56 UTC (permalink / raw)
To: gcc-patches; +Cc: David Malcolm
This corresponds to:
[PATCH 54/89] Make gimple_call_return_slot_opt_p require a gimple_call.
https://gcc.gnu.org/ml/gcc-patches/2014-04/msg01230.html
from the original 89-patch kit
That earlier patch was approved by Jeff:
> OK once prerequisites have gone in.
in https://gcc.gnu.org/ml/gcc-patches/2014-05/msg00829.html
gcc/
* gimple.h (gimple_call_return_slot_opt_p): Require a gimple_call
rather than a plain gimple.
* gimple-walk.c (walk_stmt_load_store_addr_ops): Convert usage of
is_gimple_call to dyn_cast<gimple_call>, introducing a new local
"call_stmt".
* trans-mem.c (expand_call_tm): Split local "stmt", strengthening
from plain gimple to a gimple_call, and introducing new local
gimple_assign "assign_stmt".
* tree-inline.c (expand_call_inline): Convert check of code against
GIMPLE_CALL to dyn_cast<gimple_call>, introducing a new local
"call_stmt".
---
gcc/ChangeLog.gimple-classes | 19 +++++++++++++++++++
gcc/gimple-walk.c | 26 +++++++++++++-------------
gcc/gimple.h | 3 +--
gcc/trans-mem.c | 11 ++++++-----
gcc/tree-inline.c | 6 ++++--
5 files changed, 43 insertions(+), 22 deletions(-)
diff --git a/gcc/ChangeLog.gimple-classes b/gcc/ChangeLog.gimple-classes
index 8662070..9654b49 100644
--- a/gcc/ChangeLog.gimple-classes
+++ b/gcc/ChangeLog.gimple-classes
@@ -1,5 +1,24 @@
2014-10-24 David Malcolm <dmalcolm@redhat.com>
+ Make gimple_call_return_slot_opt_p require a gimple_call.
+
+ * gimple.h (gimple_call_return_slot_opt_p): Require a gimple_call
+ rather than a plain gimple.
+
+ * gimple-walk.c (walk_stmt_load_store_addr_ops): Convert usage of
+ is_gimple_call to dyn_cast<gimple_call>, introducing a new local
+ "call_stmt".
+
+ * trans-mem.c (expand_call_tm): Split local "stmt", strengthening
+ from plain gimple to a gimple_call, and introducing new local
+ gimple_assign "assign_stmt".
+
+ * tree-inline.c (expand_call_inline): Convert check of code against
+ GIMPLE_CALL to dyn_cast<gimple_call>, introducing a new local
+ "call_stmt".
+
+2014-10-24 David Malcolm <dmalcolm@redhat.com>
+
More gimple_phi
* gimple.h (gimple_phi_set_result): Require a gimple_phi rather
diff --git a/gcc/gimple-walk.c b/gcc/gimple-walk.c
index 2b823ac..bbc5963 100644
--- a/gcc/gimple-walk.c
+++ b/gcc/gimple-walk.c
@@ -758,11 +758,11 @@ walk_stmt_load_store_addr_ops (gimple stmt, void *data,
}
}
}
- else if (is_gimple_call (stmt))
+ else if (gimple_call call_stmt = dyn_cast <gimple_call> (stmt))
{
if (visit_store)
{
- tree arg = gimple_call_lhs (stmt);
+ tree arg = gimple_call_lhs (call_stmt);
if (arg)
{
tree lhs = get_base_loadstore (arg);
@@ -771,9 +771,9 @@ walk_stmt_load_store_addr_ops (gimple stmt, void *data,
}
}
if (visit_load || visit_addr)
- for (i = 0; i < gimple_call_num_args (stmt); ++i)
+ for (i = 0; i < gimple_call_num_args (call_stmt); ++i)
{
- tree arg = gimple_call_arg (stmt, i);
+ tree arg = gimple_call_arg (call_stmt, i);
if (visit_addr
&& TREE_CODE (arg) == ADDR_EXPR)
ret |= visit_addr (stmt, TREE_OPERAND (arg, 0), arg, data);
@@ -785,16 +785,16 @@ walk_stmt_load_store_addr_ops (gimple stmt, void *data,
}
}
if (visit_addr
- && gimple_call_chain (stmt)
- && TREE_CODE (gimple_call_chain (stmt)) == ADDR_EXPR)
- ret |= visit_addr (stmt, TREE_OPERAND (gimple_call_chain (stmt), 0),
- gimple_call_chain (stmt), data);
+ && gimple_call_chain (call_stmt)
+ && TREE_CODE (gimple_call_chain (call_stmt)) == ADDR_EXPR)
+ ret |= visit_addr (stmt, TREE_OPERAND (gimple_call_chain (call_stmt), 0),
+ gimple_call_chain (call_stmt), data);
if (visit_addr
- && gimple_call_return_slot_opt_p (stmt)
- && gimple_call_lhs (stmt) != NULL_TREE
- && TREE_ADDRESSABLE (TREE_TYPE (gimple_call_lhs (stmt))))
- ret |= visit_addr (stmt, gimple_call_lhs (stmt),
- gimple_call_lhs (stmt), data);
+ && gimple_call_return_slot_opt_p (call_stmt)
+ && gimple_call_lhs (call_stmt) != NULL_TREE
+ && TREE_ADDRESSABLE (TREE_TYPE (gimple_call_lhs (call_stmt))))
+ ret |= visit_addr (stmt, gimple_call_lhs (call_stmt),
+ gimple_call_lhs (call_stmt), data);
}
else if (gimple_asm asm_stmt = dyn_cast <gimple_asm> (stmt))
{
diff --git a/gcc/gimple.h b/gcc/gimple.h
index eff62d2..4c4afb5 100644
--- a/gcc/gimple.h
+++ b/gcc/gimple.h
@@ -2847,9 +2847,8 @@ gimple_call_set_return_slot_opt (gimple_call s, bool return_slot_opt_p)
/* Return true if S is marked for return slot optimization. */
static inline bool
-gimple_call_return_slot_opt_p (gimple s)
+gimple_call_return_slot_opt_p (gimple_call s)
{
- GIMPLE_CHECK (s, GIMPLE_CALL);
return (s->subcode & GF_CALL_RETURN_SLOT_OPT) != 0;
}
diff --git a/gcc/trans-mem.c b/gcc/trans-mem.c
index 82f93b9..86a081a 100644
--- a/gcc/trans-mem.c
+++ b/gcc/trans-mem.c
@@ -2350,7 +2350,7 @@ static bool
expand_call_tm (struct tm_region *region,
gimple_stmt_iterator *gsi)
{
- gimple stmt = gsi_stmt (*gsi);
+ gimple_call stmt = as_a <gimple_call> (gsi_stmt (*gsi));
tree lhs = gimple_call_lhs (stmt);
tree fn_decl;
struct cgraph_node *node;
@@ -2437,6 +2437,7 @@ expand_call_tm (struct tm_region *region,
tree tmp = create_tmp_reg (TREE_TYPE (lhs), NULL);
location_t loc = gimple_location (stmt);
edge fallthru_edge = NULL;
+ gimple_assign assign_stmt;
/* Remember if the call was going to throw. */
if (stmt_can_throw_internal (stmt))
@@ -2455,15 +2456,15 @@ expand_call_tm (struct tm_region *region,
gimple_call_set_lhs (stmt, tmp);
update_stmt (stmt);
- stmt = gimple_build_assign (lhs, tmp);
- gimple_set_location (stmt, loc);
+ assign_stmt = gimple_build_assign (lhs, tmp);
+ gimple_set_location (assign_stmt, loc);
/* We cannot throw in the middle of a BB. If the call was going
to throw, place the instrumentation on the fallthru edge, so
the call remains the last statement in the block. */
if (fallthru_edge)
{
- gimple_seq fallthru_seq = gimple_seq_alloc_with_stmt (stmt);
+ gimple_seq fallthru_seq = gimple_seq_alloc_with_stmt (assign_stmt);
gimple_stmt_iterator fallthru_gsi = gsi_start (fallthru_seq);
expand_assign_tm (region, &fallthru_gsi);
gsi_insert_seq_on_edge (fallthru_edge, fallthru_seq);
@@ -2471,7 +2472,7 @@ expand_call_tm (struct tm_region *region,
}
else
{
- gsi_insert_after (gsi, stmt, GSI_CONTINUE_LINKING);
+ gsi_insert_after (gsi, assign_stmt, GSI_CONTINUE_LINKING);
expand_assign_tm (region, gsi);
}
diff --git a/gcc/tree-inline.c b/gcc/tree-inline.c
index a4d5809..beae377 100644
--- a/gcc/tree-inline.c
+++ b/gcc/tree-inline.c
@@ -4172,6 +4172,7 @@ expand_call_inline (basic_block bb, gimple stmt, copy_body_data *id)
gimple_stmt_iterator gsi, stmt_gsi;
bool successfully_inlined = FALSE;
bool purge_dead_abnormal_edges;
+ gimple_call call_stmt;
/* Set input_location here so we get the right instantiation context
if we call instantiate_decl from inlinable_function_p. */
@@ -4180,7 +4181,8 @@ expand_call_inline (basic_block bb, gimple stmt, copy_body_data *id)
input_location = gimple_location (stmt);
/* From here on, we're only interested in CALL_EXPRs. */
- if (gimple_code (stmt) != GIMPLE_CALL)
+ call_stmt = dyn_cast <gimple_call> (stmt);
+ if (!call_stmt)
goto egress;
cg_edge = id->dst_node->get_edge (stmt);
@@ -4390,7 +4392,7 @@ expand_call_inline (basic_block bb, gimple stmt, copy_body_data *id)
if (DECL_P (modify_dest))
TREE_NO_WARNING (modify_dest) = 1;
- if (gimple_call_return_slot_opt_p (stmt))
+ if (gimple_call_return_slot_opt_p (call_stmt))
{
return_slot = modify_dest;
modify_dest = NULL;
--
1.8.5.3
^ permalink raw reply [flat|nested] 93+ messages in thread
* [gimple-classes, committed 07/92] Introduce gimple_phi and use it in various places
2014-10-27 20:35 [gimple-classes, committed 00/92] Initial slew of commits David Malcolm
` (74 preceding siblings ...)
2014-10-27 20:56 ` [gimple-classes, committed 52/92] Make gimple_call_return_slot_opt_p require a gimple_call David Malcolm
@ 2014-10-27 20:56 ` David Malcolm
2014-10-27 20:56 ` [gimple-classes, committed 30/92] Introduce gimple_try David Malcolm
` (15 subsequent siblings)
91 siblings, 0 replies; 93+ messages in thread
From: David Malcolm @ 2014-10-27 20:56 UTC (permalink / raw)
To: gcc-patches; +Cc: David Malcolm
This corresponds to:
[PATCH 08/89] Introduce gimple_phi and use it in various places
https://gcc.gnu.org/ml/gcc-patches/2014-04/msg01211.html
from the original 89-patch kit
That earlier patch was approved by Jeff:
> Same as prior patches in this set. Just get the const/renaming stuff
> addressed and it's good to go.
in https://gcc.gnu.org/ml/gcc-patches/2014-05/msg00618.html
gcc/
* coretypes.h (gimple_phi): New typedef.
(const_gimple_phi): New typedef.
* gdbhooks.py (build_pretty_printer): Add gimple_phi and its
variants, using the gimple printer.
* gimple.h (gimple_vec): Eliminate thie typedef in the hope of using
vecs of more concrete gimple subclasses as appropriate; also the
comment is about to become misleading.
* gimple.h (gimple_phi_capacity): Use const_gimple_phi typedef
rather than spelling out the full type.
(gimple_phi_num_args): Likewise.
(gimple_phi_result): Likewise.
(gimple_phi_result_ptr): Use gimple_phi typedef.
(gimple_phi_set_result): Likewise.
(gimple_phi_arg): Likewise.
(gimple_phi_set_arg): Likewise.
* tree-phinodes.c (allocate_phi_node): Likewise.
(resize_phi_node): Likewise.
(reserve_phi_args_for_new_edge): Likewise.
(remove_phi_arg_num): Likewise.
* gimple-pretty-print.c (dump_gimple_phi): Require a gimple_phi
rather than just a gimple.
* tree-into-ssa.c (mark_phi_for_rewrite): Likewise.
* tree-phinodes.c (make_phi_node): Return a gimple_phi rather than
just a gimple.
(create_phi_node): Likewise.
* tree-phinodes.h (create_phi_node): Likewise.
* trans-mem.c (struct struct tm_log_entry): Replace use of
now-removed gimple_vec with a plain vec<gimple>.
* tree-into-ssa.c (phis_to_rewrite): Strengthen from a
vec<gimple_vec> to a vec< vec<gimple_phi> >.
* tree-into-ssa.c (insert_phi_nodes_for): Update local to be a
gimple_phi.
* tree-into-ssa.c (rewrite_update_phi_arguments): Strengthen local
"phis" from a gimple_vec to a vec<gimple_phi>, and local "phi" to
a gimple_phi.
* tree-into-ssa.c (delete_update_ssa): Strengthen local
"phis" from a gimple_vec to a vec<gimple_phi>.
* gimple-pretty-print.c (pp_gimple_stmt_1): Add checked cast to
gimple_phi in regions where a stmt is known to have code
GIMPLE_PHI.
* tree-into-ssa.c (mark_use_interesting): Likewise.
---
gcc/ChangeLog.gimple-classes | 55 ++++++++++++++++++++++++++++++++++++++++++++
gcc/coretypes.h | 4 ++++
gcc/gdbhooks.py | 4 +++-
gcc/gimple-pretty-print.c | 6 ++---
gcc/gimple.h | 24 ++++++++-----------
gcc/trans-mem.c | 2 +-
gcc/tree-into-ssa.c | 16 ++++++-------
gcc/tree-phinodes.c | 28 +++++++++++-----------
gcc/tree-phinodes.h | 2 +-
9 files changed, 98 insertions(+), 43 deletions(-)
diff --git a/gcc/ChangeLog.gimple-classes b/gcc/ChangeLog.gimple-classes
index ec16551..7c2b168 100644
--- a/gcc/ChangeLog.gimple-classes
+++ b/gcc/ChangeLog.gimple-classes
@@ -1,5 +1,60 @@
2014-10-24 David Malcolm <dmalcolm@redhat.com>
+ Introduce gimple_phi and use it in various places
+
+ * coretypes.h (gimple_phi): New typedef.
+ (const_gimple_phi): New typedef.
+
+ * gdbhooks.py (build_pretty_printer): Add gimple_phi and its
+ variants, using the gimple printer.
+
+ * gimple.h (gimple_vec): Eliminate thie typedef in the hope of using
+ vecs of more concrete gimple subclasses as appropriate; also the
+ comment is about to become misleading.
+
+ * gimple.h (gimple_phi_capacity): Use const_gimple_phi typedef
+ rather than spelling out the full type.
+ (gimple_phi_num_args): Likewise.
+ (gimple_phi_result): Likewise.
+ (gimple_phi_result_ptr): Use gimple_phi typedef.
+ (gimple_phi_set_result): Likewise.
+ (gimple_phi_arg): Likewise.
+ (gimple_phi_set_arg): Likewise.
+ * tree-phinodes.c (allocate_phi_node): Likewise.
+ (resize_phi_node): Likewise.
+ (reserve_phi_args_for_new_edge): Likewise.
+ (remove_phi_arg_num): Likewise.
+
+ * gimple-pretty-print.c (dump_gimple_phi): Require a gimple_phi
+ rather than just a gimple.
+ * tree-into-ssa.c (mark_phi_for_rewrite): Likewise.
+
+ * tree-phinodes.c (make_phi_node): Return a gimple_phi rather than
+ just a gimple.
+ (create_phi_node): Likewise.
+ * tree-phinodes.h (create_phi_node): Likewise.
+
+ * trans-mem.c (struct struct tm_log_entry): Replace use of
+ now-removed gimple_vec with a plain vec<gimple>.
+
+ * tree-into-ssa.c (phis_to_rewrite): Strengthen from a
+ vec<gimple_vec> to a vec< vec<gimple_phi> >.
+
+ * tree-into-ssa.c (insert_phi_nodes_for): Update local to be a
+ gimple_phi.
+ * tree-into-ssa.c (rewrite_update_phi_arguments): Strengthen local
+ "phis" from a gimple_vec to a vec<gimple_phi>, and local "phi" to
+ a gimple_phi.
+ * tree-into-ssa.c (delete_update_ssa): Strengthen local
+ "phis" from a gimple_vec to a vec<gimple_phi>.
+
+ * gimple-pretty-print.c (pp_gimple_stmt_1): Add checked cast to
+ gimple_phi in regions where a stmt is known to have code
+ GIMPLE_PHI.
+ * tree-into-ssa.c (mark_use_interesting): Likewise.
+
+2014-10-24 David Malcolm <dmalcolm@redhat.com>
+
Introduce gimple_debug and use it in a few places
* coretypes.h (gimple_debug): New typedef.
diff --git a/gcc/coretypes.h b/gcc/coretypes.h
index a338599..9b5a007 100644
--- a/gcc/coretypes.h
+++ b/gcc/coretypes.h
@@ -114,6 +114,10 @@ struct gimple_statement_bind;
typedef struct gimple_statement_bind *gimple_bind;
typedef const struct gimple_statement_bind *const_gimple_bind;
+struct gimple_statement_phi;
+typedef struct gimple_statement_phi *gimple_phi;
+typedef const struct gimple_statement_phi *const_gimple_phi;
+
union section;
typedef union section section;
struct gcc_options;
diff --git a/gcc/gdbhooks.py b/gcc/gdbhooks.py
index 455fa5c..a74e712 100644
--- a/gcc/gdbhooks.py
+++ b/gcc/gdbhooks.py
@@ -469,7 +469,9 @@ def build_pretty_printer():
'gimple_assign', 'const_gimple_assign',
'gimple_statement_assign *',
'gimple_bind', 'const_gimple_bind',
- 'gimple_statement_bind *'],
+ 'gimple_statement_bind *',
+ 'gimple_phi', 'const_gimple_phi',
+ 'gimple_statement_phi *'],
'gimple',
GimplePrinter)
diff --git a/gcc/gimple-pretty-print.c b/gcc/gimple-pretty-print.c
index 4ab8673..51754c3 100644
--- a/gcc/gimple-pretty-print.c
+++ b/gcc/gimple-pretty-print.c
@@ -1812,7 +1812,7 @@ dump_ssaname_info (pretty_printer *buffer, tree node, int spc)
pretty printer. If COMMENT is true, print this after #. */
static void
-dump_gimple_phi (pretty_printer *buffer, gimple phi, int spc, bool comment,
+dump_gimple_phi (pretty_printer *buffer, gimple_phi phi, int spc, bool comment,
int flags)
{
size_t i;
@@ -2129,7 +2129,7 @@ pp_gimple_stmt_1 (pretty_printer *buffer, gimple gs, int spc, int flags)
break;
case GIMPLE_PHI:
- dump_gimple_phi (buffer, gs, spc, false, flags);
+ dump_gimple_phi (buffer, as_a <gimple_phi> (gs), spc, false, flags);
break;
case GIMPLE_OMP_PARALLEL:
@@ -2305,7 +2305,7 @@ dump_phi_nodes (pretty_printer *buffer, basic_block bb, int indent, int flags)
if (!virtual_operand_p (gimple_phi_result (phi)) || (flags & TDF_VOPS))
{
INDENT (indent);
- dump_gimple_phi (buffer, phi, indent, true, flags);
+ dump_gimple_phi (buffer, as_a <gimple_phi> (phi), indent, true, flags);
pp_newline (buffer);
}
}
diff --git a/gcc/gimple.h b/gcc/gimple.h
index 8e5b42a..de0fae4 100644
--- a/gcc/gimple.h
+++ b/gcc/gimple.h
@@ -24,10 +24,6 @@ along with GCC; see the file COPYING3. If not see
typedef gimple gimple_seq_node;
-/* For each block, the PHI nodes that need to be rewritten are stored into
- these vectors. */
-typedef vec<gimple> gimple_vec;
-
enum gimple_code {
#define DEFGSCODE(SYM, STRING, STRUCT) SYM,
#include "gimple.def"
@@ -3888,8 +3884,8 @@ gimple_wce_set_cleanup_eh_only (gimple gs, bool eh_only_p)
static inline unsigned
gimple_phi_capacity (const_gimple gs)
{
- const gimple_statement_phi *phi_stmt =
- as_a <const gimple_statement_phi *> (gs);
+ const_gimple_phi phi_stmt =
+ as_a <const_gimple_phi> (gs);
return phi_stmt->capacity;
}
@@ -3901,8 +3897,8 @@ gimple_phi_capacity (const_gimple gs)
static inline unsigned
gimple_phi_num_args (const_gimple gs)
{
- const gimple_statement_phi *phi_stmt =
- as_a <const gimple_statement_phi *> (gs);
+ const_gimple_phi phi_stmt =
+ as_a <const_gimple_phi> (gs);
return phi_stmt->nargs;
}
@@ -3912,8 +3908,8 @@ gimple_phi_num_args (const_gimple gs)
static inline tree
gimple_phi_result (const_gimple gs)
{
- const gimple_statement_phi *phi_stmt =
- as_a <const gimple_statement_phi *> (gs);
+ const_gimple_phi phi_stmt =
+ as_a <const_gimple_phi> (gs);
return phi_stmt->result;
}
@@ -3922,7 +3918,7 @@ gimple_phi_result (const_gimple gs)
static inline tree *
gimple_phi_result_ptr (gimple gs)
{
- gimple_statement_phi *phi_stmt = as_a <gimple_statement_phi *> (gs);
+ gimple_phi phi_stmt = as_a <gimple_phi> (gs);
return &phi_stmt->result;
}
@@ -3931,7 +3927,7 @@ gimple_phi_result_ptr (gimple gs)
static inline void
gimple_phi_set_result (gimple gs, tree result)
{
- gimple_statement_phi *phi_stmt = as_a <gimple_statement_phi *> (gs);
+ gimple_phi phi_stmt = as_a <gimple_phi> (gs);
phi_stmt->result = result;
if (result && TREE_CODE (result) == SSA_NAME)
SSA_NAME_DEF_STMT (result) = gs;
@@ -3944,7 +3940,7 @@ gimple_phi_set_result (gimple gs, tree result)
static inline struct phi_arg_d *
gimple_phi_arg (gimple gs, unsigned index)
{
- gimple_statement_phi *phi_stmt = as_a <gimple_statement_phi *> (gs);
+ gimple_phi phi_stmt = as_a <gimple_phi> (gs);
gcc_gimple_checking_assert (index <= phi_stmt->capacity);
return &(phi_stmt->args[index]);
}
@@ -3955,7 +3951,7 @@ gimple_phi_arg (gimple gs, unsigned index)
static inline void
gimple_phi_set_arg (gimple gs, unsigned index, struct phi_arg_d * phiarg)
{
- gimple_statement_phi *phi_stmt = as_a <gimple_statement_phi *> (gs);
+ gimple_phi phi_stmt = as_a <gimple_phi> (gs);
gcc_gimple_checking_assert (index <= phi_stmt->nargs);
phi_stmt->args[index] = *phiarg;
}
diff --git a/gcc/trans-mem.c b/gcc/trans-mem.c
index 94d896d..883efbb 100644
--- a/gcc/trans-mem.c
+++ b/gcc/trans-mem.c
@@ -918,7 +918,7 @@ typedef struct tm_log_entry
/* Entry block for the transaction this address occurs in. */
basic_block entry_block;
/* Dominating statements the store occurs in. */
- gimple_vec stmts;
+ vec<gimple> stmts;
/* Initially, while we are building the log, we place a nonzero
value here to mean that this address *will* be saved with a
save/restore sequence. Later, when generating the save sequence
diff --git a/gcc/tree-into-ssa.c b/gcc/tree-into-ssa.c
index 01203de..b4c4aab 100644
--- a/gcc/tree-into-ssa.c
+++ b/gcc/tree-into-ssa.c
@@ -118,7 +118,7 @@ static bitmap names_to_release;
/* vec of vec of PHIs to rewrite in a basic block. Element I corresponds
the to basic block with index I. Allocated once per compilation, *not*
released between different functions. */
-static vec<gimple_vec> phis_to_rewrite;
+static vec< vec<gimple_phi> > phis_to_rewrite;
/* The bitmap of non-NULL elements of PHIS_TO_REWRITE. */
static bitmap blocks_with_phis_to_rewrite;
@@ -950,9 +950,9 @@ find_def_blocks_for (tree var)
/* Marks phi node PHI in basic block BB for rewrite. */
static void
-mark_phi_for_rewrite (basic_block bb, gimple phi)
+mark_phi_for_rewrite (basic_block bb, gimple_phi phi)
{
- gimple_vec phis;
+ vec<gimple_phi> phis;
unsigned n, idx = bb->index;
if (rewrite_uses_p (phi))
@@ -991,7 +991,7 @@ insert_phi_nodes_for (tree var, bitmap phi_insertion_points, bool update_p)
{
unsigned bb_index;
edge e;
- gimple phi;
+ gimple_phi phi;
basic_block bb;
bitmap_iterator bi;
struct def_blocks_d *def_map = find_def_blocks_for (var);
@@ -1991,8 +1991,8 @@ rewrite_update_phi_arguments (basic_block bb)
FOR_EACH_EDGE (e, ei, bb->succs)
{
- gimple phi;
- gimple_vec phis;
+ gimple_phi phi;
+ vec<gimple_phi> phis;
if (!bitmap_bit_p (blocks_with_phis_to_rewrite, e->dest->index))
continue;
@@ -2452,7 +2452,7 @@ mark_use_interesting (tree var, gimple stmt, basic_block bb, bool insert_phi_p)
mark_block_for_update (bb);
if (gimple_code (stmt) == GIMPLE_PHI)
- mark_phi_for_rewrite (def_bb, stmt);
+ mark_phi_for_rewrite (def_bb, as_a <gimple_phi> (stmt));
else
{
set_rewrite_uses (stmt, true);
@@ -2812,7 +2812,7 @@ delete_update_ssa (void)
if (blocks_with_phis_to_rewrite)
EXECUTE_IF_SET_IN_BITMAP (blocks_with_phis_to_rewrite, 0, i, bi)
{
- gimple_vec phis = phis_to_rewrite[i];
+ vec<gimple_phi> phis = phis_to_rewrite[i];
phis.release ();
phis_to_rewrite[i].create (0);
}
diff --git a/gcc/tree-phinodes.c b/gcc/tree-phinodes.c
index 5bd8233..c075f98 100644
--- a/gcc/tree-phinodes.c
+++ b/gcc/tree-phinodes.c
@@ -97,10 +97,10 @@ phinodes_print_statistics (void)
happens to contain a PHI node with LEN arguments or more, return
that one. */
-static inline gimple_statement_phi *
+static inline gimple_phi
allocate_phi_node (size_t len)
{
- gimple_statement_phi *phi;
+ gimple_phi phi;
size_t bucket = NUM_BUCKETS - 2;
size_t size = sizeof (struct gimple_statement_phi)
+ (len - 1) * sizeof (struct phi_arg_d);
@@ -123,8 +123,7 @@ allocate_phi_node (size_t len)
}
else
{
- phi = static_cast <gimple_statement_phi *> (
- ggc_internal_alloc (size));
+ phi = static_cast <gimple_phi> (ggc_internal_alloc (size));
if (GATHER_STATISTICS)
{
enum gimple_alloc_kind kind = gimple_alloc_kind (GIMPLE_PHI);
@@ -173,10 +172,10 @@ ideal_phi_node_len (int len)
/* Return a PHI node with LEN argument slots for variable VAR. */
-static gimple
+static gimple_phi
make_phi_node (tree var, int len)
{
- gimple_statement_phi *phi;
+ gimple_phi phi;
int capacity, i;
capacity = ideal_phi_node_len (len);
@@ -241,11 +240,11 @@ release_phi_node (gimple phi)
/* Resize an existing PHI node. The only way is up. Return the
possibly relocated phi. */
-static gimple_statement_phi *
-resize_phi_node (gimple_statement_phi *phi, size_t len)
+static gimple_phi
+resize_phi_node (gimple_phi phi, size_t len)
{
size_t old_size, i;
- gimple_statement_phi *new_phi;
+ gimple_phi new_phi;
gcc_assert (len > gimple_phi_capacity (phi));
@@ -296,12 +295,11 @@ reserve_phi_args_for_new_edge (basic_block bb)
for (gsi = gsi_start_phis (bb); !gsi_end_p (gsi); gsi_next (&gsi))
{
- gimple_statement_phi *stmt =
- as_a <gimple_statement_phi *> (gsi_stmt (gsi));
+ gimple_phi stmt = as_a <gimple_phi> (gsi_stmt (gsi));
if (len > gimple_phi_capacity (stmt))
{
- gimple_statement_phi *new_phi = resize_phi_node (stmt, cap);
+ gimple_phi new_phi = resize_phi_node (stmt, cap);
/* The result of the PHI is defined by this PHI node. */
SSA_NAME_DEF_STMT (gimple_phi_result (new_phi)) = new_phi;
@@ -347,10 +345,10 @@ add_phi_node_to_bb (gimple phi, basic_block bb)
/* Create a new PHI node for variable VAR at basic block BB. */
-gimple
+gimple_phi
create_phi_node (tree var, basic_block bb)
{
- gimple phi = make_phi_node (var, EDGE_COUNT (bb->preds));
+ gimple_phi phi = make_phi_node (var, EDGE_COUNT (bb->preds));
add_phi_node_to_bb (phi, bb);
return phi;
@@ -397,7 +395,7 @@ add_phi_arg (gimple phi, tree def, edge e, source_location locus)
is consistent with how we remove an edge from the edge vector. */
static void
-remove_phi_arg_num (gimple_statement_phi *phi, int i)
+remove_phi_arg_num (gimple_phi phi, int i)
{
int num_elem = gimple_phi_num_args (phi);
diff --git a/gcc/tree-phinodes.h b/gcc/tree-phinodes.h
index 1e5df83..0159d5d 100644
--- a/gcc/tree-phinodes.h
+++ b/gcc/tree-phinodes.h
@@ -24,7 +24,7 @@ extern void phinodes_print_statistics (void);
extern void release_phi_node (gimple);
extern void reserve_phi_args_for_new_edge (basic_block);
extern void add_phi_node_to_bb (gimple phi, basic_block bb);
-extern gimple create_phi_node (tree, basic_block);
+extern gimple_phi create_phi_node (tree, basic_block);
extern void add_phi_arg (gimple, tree, edge, source_location);
extern void remove_phi_args (edge);
extern void remove_phi_node (gimple_stmt_iterator *, bool);
--
1.8.5.3
^ permalink raw reply [flat|nested] 93+ messages in thread
* [gimple-classes, committed 30/92] Introduce gimple_try
2014-10-27 20:35 [gimple-classes, committed 00/92] Initial slew of commits David Malcolm
` (75 preceding siblings ...)
2014-10-27 20:56 ` [gimple-classes, committed 07/92] Introduce gimple_phi and use it in various places David Malcolm
@ 2014-10-27 20:56 ` David Malcolm
2014-10-27 20:56 ` [gimple-classes, committed 76/92] Concretize gimple_call_set_nothrow David Malcolm
` (14 subsequent siblings)
91 siblings, 0 replies; 93+ messages in thread
From: David Malcolm @ 2014-10-27 20:56 UTC (permalink / raw)
To: gcc-patches; +Cc: David Malcolm
This corresponds to:
[PATCH 32/89] Introduce gimple_try
https://gcc.gnu.org/ml/gcc-patches/2014-04/msg01214.html
from the original 89-patch kit
That earlier patch was approved by Jeff:
> OK once const and associated renaming stuff is fixed.
in https://gcc.gnu.org/ml/gcc-patches/2014-05/msg00636.html
gcc/
* coretypes.h (gimple_try): New typedef.
(const_gimple_try): New typedef.
* gimple-low.c (gimple_try_catch_may_fallthru): Require a
gimple_try rather than a plain gimple.
(gimple_stmt_may_fallthru): Add checked cast to gimple_try.
* gimple-pretty-print.c (dump_gimple_try): Require a gimple_try
rather than a plain gimple.
(pp_gimple_stmt_1): Add checked cast to gimple_try within
GIMPLE_TRY case of switch statement.
* tree-eh.c (finally_tree_node::parent): Strengthen field from
gimple to gimple_try.
(record_in_finally_tree): Require a gimple_try rather than a plain
gimple.
(collect_finally_tree): Likewise.
(collect_finally_tree_1): Likewise.
(struct leh_tf_state::try_finally_expr): Strengthen field from
gimple to gimple_try.
(struct leh_tf_state::top_p): Likewise.
(lower_eh_must_not_throw): Require a gimple_try rather than a
plain gimple.
(frob_into_branch_around): Likewise.
(lower_try_finally_dup_block): Strengthen local from gimple to
gimple_try.
(honor_protect_cleanup_actions): Split out uses of "x" into new
locals "eh_mnt" and "try_stmt" with stronger types.
(lower_try_finally): Require a gimple_try rather than a plain
gimple.
(lower_catch): Likewise.
(lower_eh_filter): Likewise.
(lower_eh_must_not_throw): Likewise.
(lower_cleanup): Likewise.
(lower_eh_constructs_2): Add checked cast to gimple_try within
GIMPLE_TRY case of switch statement, introducing new local
"try_stmt", using it for type-safety.
---
gcc/ChangeLog.gimple-classes | 42 ++++++++++++++++++++
gcc/coretypes.h | 4 ++
gcc/gimple-low.c | 4 +-
gcc/gimple-pretty-print.c | 4 +-
gcc/tree-eh.c | 94 +++++++++++++++++++++++---------------------
5 files changed, 100 insertions(+), 48 deletions(-)
diff --git a/gcc/ChangeLog.gimple-classes b/gcc/ChangeLog.gimple-classes
index afdccbe..983819a 100644
--- a/gcc/ChangeLog.gimple-classes
+++ b/gcc/ChangeLog.gimple-classes
@@ -1,5 +1,47 @@
2014-10-24 David Malcolm <dmalcolm@redhat.com>
+ Introduce gimple_try
+
+ * coretypes.h (gimple_try): New typedef.
+ (const_gimple_try): New typedef.
+
+ * gimple-low.c (gimple_try_catch_may_fallthru): Require a
+ gimple_try rather than a plain gimple.
+ (gimple_stmt_may_fallthru): Add checked cast to gimple_try.
+
+ * gimple-pretty-print.c (dump_gimple_try): Require a gimple_try
+ rather than a plain gimple.
+ (pp_gimple_stmt_1): Add checked cast to gimple_try within
+ GIMPLE_TRY case of switch statement.
+
+ * tree-eh.c (finally_tree_node::parent): Strengthen field from
+ gimple to gimple_try.
+ (record_in_finally_tree): Require a gimple_try rather than a plain
+ gimple.
+ (collect_finally_tree): Likewise.
+ (collect_finally_tree_1): Likewise.
+ (struct leh_tf_state::try_finally_expr): Strengthen field from
+ gimple to gimple_try.
+ (struct leh_tf_state::top_p): Likewise.
+ (lower_eh_must_not_throw): Require a gimple_try rather than a
+ plain gimple.
+ (frob_into_branch_around): Likewise.
+ (lower_try_finally_dup_block): Strengthen local from gimple to
+ gimple_try.
+ (honor_protect_cleanup_actions): Split out uses of "x" into new
+ locals "eh_mnt" and "try_stmt" with stronger types.
+ (lower_try_finally): Require a gimple_try rather than a plain
+ gimple.
+ (lower_catch): Likewise.
+ (lower_eh_filter): Likewise.
+ (lower_eh_must_not_throw): Likewise.
+ (lower_cleanup): Likewise.
+ (lower_eh_constructs_2): Add checked cast to gimple_try within
+ GIMPLE_TRY case of switch statement, introducing new local
+ "try_stmt", using it for type-safety.
+
+2014-10-24 David Malcolm <dmalcolm@redhat.com>
+
Use subclasses of gimple in various places
* asan.c (insert_if_then_before_iter): Require a gimple cond
diff --git a/gcc/coretypes.h b/gcc/coretypes.h
index 6914027..e24a08e 100644
--- a/gcc/coretypes.h
+++ b/gcc/coretypes.h
@@ -162,6 +162,10 @@ struct gimple_statement_phi;
typedef struct gimple_statement_phi *gimple_phi;
typedef const struct gimple_statement_phi *const_gimple_phi;
+struct gimple_statement_try;
+typedef struct gimple_statement_try *gimple_try;
+typedef const struct gimple_statement_try *const_gimple_try;
+
union section;
typedef union section section;
struct gcc_options;
diff --git a/gcc/gimple-low.c b/gcc/gimple-low.c
index b5dc823..a9121aa 100644
--- a/gcc/gimple-low.c
+++ b/gcc/gimple-low.c
@@ -499,7 +499,7 @@ lower_try_catch (gimple_stmt_iterator *gsi, struct lower_data *data)
This is a subroutine of gimple_stmt_may_fallthru. */
static bool
-gimple_try_catch_may_fallthru (gimple stmt)
+gimple_try_catch_may_fallthru (gimple_try stmt)
{
gimple_stmt_iterator i;
@@ -585,7 +585,7 @@ gimple_stmt_may_fallthru (gimple stmt)
case GIMPLE_TRY:
if (gimple_try_kind (stmt) == GIMPLE_TRY_CATCH)
- return gimple_try_catch_may_fallthru (stmt);
+ return gimple_try_catch_may_fallthru (as_a <gimple_try> (stmt));
/* It must be a GIMPLE_TRY_FINALLY. */
diff --git a/gcc/gimple-pretty-print.c b/gcc/gimple-pretty-print.c
index 00ff34c..a1db8be 100644
--- a/gcc/gimple-pretty-print.c
+++ b/gcc/gimple-pretty-print.c
@@ -932,7 +932,7 @@ dump_gimple_bind (pretty_printer *buffer, gimple_bind gs, int spc, int flags)
dumpfile.h). */
static void
-dump_gimple_try (pretty_printer *buffer, gimple gs, int spc, int flags)
+dump_gimple_try (pretty_printer *buffer, gimple_try gs, int spc, int flags)
{
if (flags & TDF_RAW)
{
@@ -2128,7 +2128,7 @@ pp_gimple_stmt_1 (pretty_printer *buffer, gimple gs, int spc, int flags)
break;
case GIMPLE_TRY:
- dump_gimple_try (buffer, gs, spc, flags);
+ dump_gimple_try (buffer, as_a <gimple_try> (gs), spc, flags);
break;
case GIMPLE_PHI:
diff --git a/gcc/tree-eh.c b/gcc/tree-eh.c
index 5a83f3f..e45f234 100644
--- a/gcc/tree-eh.c
+++ b/gcc/tree-eh.c
@@ -177,7 +177,7 @@ struct finally_tree_node
tree) leaves the TRY block, its necessary to record a tree in
this field. Thus a treemple is used. */
treemple child;
- gimple parent;
+ gimple_try parent;
};
/* Hashtable helpers. */
@@ -206,7 +206,7 @@ finally_tree_hasher::equal (const value_type *v, const compare_type *c)
static hash_table<finally_tree_hasher> *finally_tree;
static void
-record_in_finally_tree (treemple child, gimple parent)
+record_in_finally_tree (treemple child, gimple_try parent)
{
struct finally_tree_node *n;
finally_tree_node **slot;
@@ -221,13 +221,13 @@ record_in_finally_tree (treemple child, gimple parent)
}
static void
-collect_finally_tree (gimple stmt, gimple region);
+collect_finally_tree (gimple stmt, gimple_try region);
/* Go through the gimple sequence. Works with collect_finally_tree to
record all GIMPLE_LABEL and GIMPLE_TRY statements. */
static void
-collect_finally_tree_1 (gimple_seq seq, gimple region)
+collect_finally_tree_1 (gimple_seq seq, gimple_try region)
{
gimple_stmt_iterator gsi;
@@ -236,7 +236,7 @@ collect_finally_tree_1 (gimple_seq seq, gimple region)
}
static void
-collect_finally_tree (gimple stmt, gimple region)
+collect_finally_tree (gimple stmt, gimple_try region)
{
treemple temp;
@@ -252,7 +252,8 @@ collect_finally_tree (gimple stmt, gimple region)
{
temp.g = stmt;
record_in_finally_tree (temp, region);
- collect_finally_tree_1 (gimple_try_eval (stmt), stmt);
+ collect_finally_tree_1 (gimple_try_eval (stmt),
+ as_a <gimple_try> (stmt));
collect_finally_tree_1 (gimple_try_cleanup (stmt), region);
}
else if (gimple_try_kind (stmt) == GIMPLE_TRY_CATCH)
@@ -369,8 +370,8 @@ struct leh_tf_state
try_finally_expr is the original GIMPLE_TRY_FINALLY. We need to retain
this so that outside_finally_tree can reliably reference the tree used
in the collect_finally_tree data structures. */
- gimple try_finally_expr;
- gimple top_p;
+ gimple_try try_finally_expr;
+ gimple_try top_p;
/* While lowering a top_p usually it is expanded into multiple statements,
thus we need the following field to store them. */
@@ -410,7 +411,7 @@ struct leh_tf_state
bool may_throw;
};
-static gimple_seq lower_eh_must_not_throw (struct leh_state *, gimple);
+static gimple_seq lower_eh_must_not_throw (struct leh_state *, gimple_try);
/* Search for STMT in the goto queue. Return the replacement,
or null if the statement isn't in the queue. */
@@ -861,7 +862,7 @@ eh_region_may_contain_throw (eh_region r)
an existing label that should be put at the exit, or NULL. */
static gimple_seq
-frob_into_branch_around (gimple tp, eh_region region, tree over)
+frob_into_branch_around (gimple_try tp, eh_region region, tree over)
{
gimple x;
gimple_seq cleanup, result;
@@ -898,7 +899,7 @@ static gimple_seq
lower_try_finally_dup_block (gimple_seq seq, struct leh_state *outer_state,
location_t loc)
{
- gimple region = NULL;
+ gimple_try region = NULL;
gimple_seq new_seq;
gimple_stmt_iterator gsi;
@@ -990,6 +991,8 @@ honor_protect_cleanup_actions (struct leh_state *outer_state,
bool finally_may_fallthru;
gimple_seq finally;
gimple x;
+ gimple_eh_must_not_throw eh_mnt;
+ gimple_try try_stmt;
gimple_eh_else eh_else;
/* First check for nothing to do. */
@@ -1032,10 +1035,10 @@ honor_protect_cleanup_actions (struct leh_state *outer_state,
}
/* Wrap the block with protect_cleanup_actions as the action. */
- x = gimple_build_eh_must_not_throw (protect_cleanup_actions);
- x = gimple_build_try (finally, gimple_seq_alloc_with_stmt (x),
- GIMPLE_TRY_CATCH);
- finally = lower_eh_must_not_throw (outer_state, x);
+ eh_mnt = gimple_build_eh_must_not_throw (protect_cleanup_actions);
+ try_stmt = gimple_build_try (finally, gimple_seq_alloc_with_stmt (eh_mnt),
+ GIMPLE_TRY_CATCH);
+ finally = lower_eh_must_not_throw (outer_state, try_stmt);
/* Drop all of this into the exception sequence. */
emit_post_landing_pad (&eh_seq, tf->region);
@@ -1640,7 +1643,7 @@ cleanup_is_dead_in (eh_region reg)
arrange for the FINALLY block to be executed on all exits. */
static gimple_seq
-lower_try_finally (struct leh_state *state, gimple tp)
+lower_try_finally (struct leh_state *state, gimple_try tp)
{
struct leh_tf_state this_tf;
struct leh_state this_state;
@@ -1747,7 +1750,7 @@ lower_try_finally (struct leh_state *state, gimple tp)
exception region trees that records all the magic. */
static gimple_seq
-lower_catch (struct leh_state *state, gimple tp)
+lower_catch (struct leh_state *state, gimple_try tp)
{
eh_region try_region = NULL;
struct leh_state this_state = *state;
@@ -1819,7 +1822,7 @@ lower_catch (struct leh_state *state, gimple tp)
region trees that record all the magic. */
static gimple_seq
-lower_eh_filter (struct leh_state *state, gimple tp)
+lower_eh_filter (struct leh_state *state, gimple_try tp)
{
struct leh_state this_state = *state;
eh_region this_region = NULL;
@@ -1864,7 +1867,7 @@ lower_eh_filter (struct leh_state *state, gimple tp)
plus the exception region trees that record all the magic. */
static gimple_seq
-lower_eh_must_not_throw (struct leh_state *state, gimple tp)
+lower_eh_must_not_throw (struct leh_state *state, gimple_try tp)
{
struct leh_state this_state = *state;
@@ -1897,7 +1900,7 @@ lower_eh_must_not_throw (struct leh_state *state, gimple tp)
except that we only execute the cleanup block for exception edges. */
static gimple_seq
-lower_cleanup (struct leh_state *state, gimple tp)
+lower_cleanup (struct leh_state *state, gimple_try tp)
{
struct leh_state this_state = *state;
eh_region this_region = NULL;
@@ -2052,36 +2055,39 @@ lower_eh_constructs_2 (struct leh_state *state, gimple_stmt_iterator *gsi)
break;
case GIMPLE_TRY:
- if (gimple_try_kind (stmt) == GIMPLE_TRY_FINALLY)
- replace = lower_try_finally (state, stmt);
- else
- {
- x = gimple_seq_first_stmt (gimple_try_cleanup (stmt));
- if (!x)
- {
- replace = gimple_try_eval (stmt);
- lower_eh_constructs_1 (state, &replace);
- }
- else
- switch (gimple_code (x))
+ {
+ gimple_try try_stmt = as_a <gimple_try> (stmt);
+ if (gimple_try_kind (try_stmt) == GIMPLE_TRY_FINALLY)
+ replace = lower_try_finally (state, try_stmt);
+ else
+ {
+ x = gimple_seq_first_stmt (gimple_try_cleanup (try_stmt));
+ if (!x)
{
+ replace = gimple_try_eval (try_stmt);
+ lower_eh_constructs_1 (state, &replace);
+ }
+ else
+ switch (gimple_code (x))
+ {
case GIMPLE_CATCH:
- replace = lower_catch (state, stmt);
- break;
+ replace = lower_catch (state, try_stmt);
+ break;
case GIMPLE_EH_FILTER:
- replace = lower_eh_filter (state, stmt);
- break;
+ replace = lower_eh_filter (state, try_stmt);
+ break;
case GIMPLE_EH_MUST_NOT_THROW:
- replace = lower_eh_must_not_throw (state, stmt);
- break;
+ replace = lower_eh_must_not_throw (state, try_stmt);
+ break;
case GIMPLE_EH_ELSE:
- /* This code is only valid with GIMPLE_TRY_FINALLY. */
- gcc_unreachable ();
+ /* This code is only valid with GIMPLE_TRY_FINALLY. */
+ gcc_unreachable ();
default:
- replace = lower_cleanup (state, stmt);
- break;
- }
- }
+ replace = lower_cleanup (state, try_stmt);
+ break;
+ }
+ }
+ }
/* Remove the old stmt and insert the transformed sequence
instead. */
--
1.8.5.3
^ permalink raw reply [flat|nested] 93+ messages in thread
* [gimple-classes, committed 32/92] Introduce gimple_omp_atomic_load
2014-10-27 20:35 [gimple-classes, committed 00/92] Initial slew of commits David Malcolm
` (80 preceding siblings ...)
2014-10-27 20:57 ` [gimple-classes, committed 50/92] Make gimple_phi_arg_edge require a gimple_phi David Malcolm
@ 2014-10-27 20:57 ` David Malcolm
2014-10-27 20:57 ` [gimple-classes, committed 24/92] Introduce gimple_eh_filter David Malcolm
` (9 subsequent siblings)
91 siblings, 0 replies; 93+ messages in thread
From: David Malcolm @ 2014-10-27 20:57 UTC (permalink / raw)
To: gcc-patches; +Cc: David Malcolm
This corresponds to:
[PATCH 34/89] Introduce gimple_omp_atomic_load
https://gcc.gnu.org/ml/gcc-patches/2014-04/msg01155.html
from the original 89-patch kit
That earlier patch was approved by Jeff:
> OK with expected changes due to renaming/updates to const handling.
> Please repost the final patch for archival purposes.
in https://gcc.gnu.org/ml/gcc-patches/2014-05/msg00802.html
gcc/
* coretypes.h (gimple_omp_atomic_load): New typedef.
(const_gimple_omp_atomic_load): New typedef.
* gimple-pretty-print.c (dump_gimple_omp_atomic_load): Require a
gimple_omp_atomic_load rather than a plain gimple.
(pp_gimple_stmt_1): Add a checked cast to gimple_omp_atomic_load
within GIMPLE_OMP_ATOMIC_LOAD case of switch statement.
* gimple-walk.c (walk_gimple_op): Likewise, introducing a new local.
* gimple.c (gimple_build_omp_atomic_load): Return a
gimple_omp_atomic_load rather than a plain gimple.
* gimple.h (gimple_build_omp_atomic_load): Return a
gimple_omp_atomic_load rather than a plain gimple.
(gimple_omp_atomic_load_set_lhs): Require a
gimple_omp_atomic_load rather than a plain gimple.
(gimple_omp_atomic_load_lhs_ptr): Likewise.
(gimple_omp_atomic_load_set_rhs): Likewise.
(gimple_omp_atomic_load_rhs_ptr): Likewise.
(gimple_omp_atomic_load_lhs): Require a
const_gimple_omp_atomic_load rather than a plain const_gimple.
(gimple_omp_atomic_load_rhs): Likewise.
* gimplify-me.c (gimple_regimplify_operands): Add a checked cast
to gimple_omp_atomic_load within GIMPLE_OMP_ATOMIC_LOAD case of
switch statement.
* omp-low.c (expand_omp_atomic): Strengthen type of local "load"
from gimple to gimple_omp_atomic_load.
(lower_omp_1): Add a checked cast to gimple_omp_atomic_load within
GIMPLE_OMP_ATOMIC_LOAD case of switch statement.
---
gcc/ChangeLog.gimple-classes | 37 +++++++++++++++++++++++++++++++++++++
gcc/coretypes.h | 5 +++++
gcc/gimple-pretty-print.c | 8 ++++----
gcc/gimple-walk.c | 19 +++++++++++--------
gcc/gimple.c | 5 +++--
gcc/gimple.h | 38 +++++++++++++-------------------------
gcc/gimplify-me.c | 5 +++--
gcc/omp-low.c | 7 +++++--
8 files changed, 81 insertions(+), 43 deletions(-)
diff --git a/gcc/ChangeLog.gimple-classes b/gcc/ChangeLog.gimple-classes
index 5e6b383..3026787 100644
--- a/gcc/ChangeLog.gimple-classes
+++ b/gcc/ChangeLog.gimple-classes
@@ -1,5 +1,42 @@
2014-10-24 David Malcolm <dmalcolm@redhat.com>
+ Introduce gimple_omp_atomic_load
+
+ * coretypes.h (gimple_omp_atomic_load): New typedef.
+ (const_gimple_omp_atomic_load): New typedef.
+
+ * gimple-pretty-print.c (dump_gimple_omp_atomic_load): Require a
+ gimple_omp_atomic_load rather than a plain gimple.
+ (pp_gimple_stmt_1): Add a checked cast to gimple_omp_atomic_load
+ within GIMPLE_OMP_ATOMIC_LOAD case of switch statement.
+
+ * gimple-walk.c (walk_gimple_op): Likewise, introducing a new local.
+
+ * gimple.c (gimple_build_omp_atomic_load): Return a
+ gimple_omp_atomic_load rather than a plain gimple.
+
+ * gimple.h (gimple_build_omp_atomic_load): Return a
+ gimple_omp_atomic_load rather than a plain gimple.
+ (gimple_omp_atomic_load_set_lhs): Require a
+ gimple_omp_atomic_load rather than a plain gimple.
+ (gimple_omp_atomic_load_lhs_ptr): Likewise.
+ (gimple_omp_atomic_load_set_rhs): Likewise.
+ (gimple_omp_atomic_load_rhs_ptr): Likewise.
+ (gimple_omp_atomic_load_lhs): Require a
+ const_gimple_omp_atomic_load rather than a plain const_gimple.
+ (gimple_omp_atomic_load_rhs): Likewise.
+
+ * gimplify-me.c (gimple_regimplify_operands): Add a checked cast
+ to gimple_omp_atomic_load within GIMPLE_OMP_ATOMIC_LOAD case of
+ switch statement.
+
+ * omp-low.c (expand_omp_atomic): Strengthen type of local "load"
+ from gimple to gimple_omp_atomic_load.
+ (lower_omp_1): Add a checked cast to gimple_omp_atomic_load within
+ GIMPLE_OMP_ATOMIC_LOAD case of switch statement.
+
+2014-10-24 David Malcolm <dmalcolm@redhat.com>
+
Use more concrete types for various gimple statements
* cgraphunit.c (thunk_adjust): Strengthen local "stmt" from gimple
diff --git a/gcc/coretypes.h b/gcc/coretypes.h
index e24a08e..06b3be8 100644
--- a/gcc/coretypes.h
+++ b/gcc/coretypes.h
@@ -166,6 +166,11 @@ struct gimple_statement_try;
typedef struct gimple_statement_try *gimple_try;
typedef const struct gimple_statement_try *const_gimple_try;
+struct gimple_statement_omp_atomic_load;
+typedef struct gimple_statement_omp_atomic_load *gimple_omp_atomic_load;
+typedef const struct gimple_statement_omp_atomic_load *
+ const_gimple_omp_atomic_load;
+
union section;
typedef union section section;
struct gcc_options;
diff --git a/gcc/gimple-pretty-print.c b/gcc/gimple-pretty-print.c
index a1db8be..eafb6cd 100644
--- a/gcc/gimple-pretty-print.c
+++ b/gcc/gimple-pretty-print.c
@@ -1967,8 +1967,8 @@ dump_gimple_omp_task (pretty_printer *buffer, gimple gs, int spc,
in dumpfile.h). */
static void
-dump_gimple_omp_atomic_load (pretty_printer *buffer, gimple gs, int spc,
- int flags)
+dump_gimple_omp_atomic_load (pretty_printer *buffer, gimple_omp_atomic_load gs,
+ int spc, int flags)
{
if (flags & TDF_RAW)
{
@@ -2144,8 +2144,8 @@ pp_gimple_stmt_1 (pretty_printer *buffer, gimple gs, int spc, int flags)
break;
case GIMPLE_OMP_ATOMIC_LOAD:
- dump_gimple_omp_atomic_load (buffer, gs, spc, flags);
-
+ dump_gimple_omp_atomic_load (buffer, as_a <gimple_omp_atomic_load> (gs),
+ spc, flags);
break;
case GIMPLE_OMP_ATOMIC_STORE:
diff --git a/gcc/gimple-walk.c b/gcc/gimple-walk.c
index d36263a..af67218 100644
--- a/gcc/gimple-walk.c
+++ b/gcc/gimple-walk.c
@@ -419,15 +419,18 @@ walk_gimple_op (gimple stmt, walk_tree_fn callback_op,
break;
case GIMPLE_OMP_ATOMIC_LOAD:
- ret = walk_tree (gimple_omp_atomic_load_lhs_ptr (stmt), callback_op, wi,
- pset);
- if (ret)
- return ret;
+ {
+ gimple_omp_atomic_load omp_stmt = as_a <gimple_omp_atomic_load> (stmt);
+ ret = walk_tree (gimple_omp_atomic_load_lhs_ptr (omp_stmt),
+ callback_op, wi, pset);
+ if (ret)
+ return ret;
- ret = walk_tree (gimple_omp_atomic_load_rhs_ptr (stmt), callback_op, wi,
- pset);
- if (ret)
- return ret;
+ ret = walk_tree (gimple_omp_atomic_load_rhs_ptr (omp_stmt),
+ callback_op, wi, pset);
+ if (ret)
+ return ret;
+ }
break;
case GIMPLE_OMP_ATOMIC_STORE:
diff --git a/gcc/gimple.c b/gcc/gimple.c
index 2b00869..8672b83 100644
--- a/gcc/gimple.c
+++ b/gcc/gimple.c
@@ -1080,10 +1080,11 @@ gimple_build_omp_teams (gimple_seq body, tree clauses)
/* Build a GIMPLE_OMP_ATOMIC_LOAD statement. */
-gimple
+gimple_omp_atomic_load
gimple_build_omp_atomic_load (tree lhs, tree rhs)
{
- gimple p = gimple_alloc (GIMPLE_OMP_ATOMIC_LOAD, 0);
+ gimple_omp_atomic_load p =
+ as_a <gimple_omp_atomic_load> (gimple_alloc (GIMPLE_OMP_ATOMIC_LOAD, 0));
gimple_omp_atomic_load_set_lhs (p, lhs);
gimple_omp_atomic_load_set_rhs (p, rhs);
return p;
diff --git a/gcc/gimple.h b/gcc/gimple.h
index f1af63a..a302529 100644
--- a/gcc/gimple.h
+++ b/gcc/gimple.h
@@ -1357,7 +1357,7 @@ gimple gimple_build_omp_sections_switch (void);
gimple gimple_build_omp_single (gimple_seq, tree);
gimple gimple_build_omp_target (gimple_seq, int, tree);
gimple gimple_build_omp_teams (gimple_seq, tree);
-gimple gimple_build_omp_atomic_load (tree, tree);
+gimple_omp_atomic_load gimple_build_omp_atomic_load (tree, tree);
gimple gimple_build_omp_atomic_store (tree);
gimple_transaction gimple_build_transaction (gimple_seq, tree);
gimple gimple_build_predict (enum br_predictor, enum prediction);
@@ -5400,66 +5400,54 @@ gimple_omp_atomic_store_val_ptr (gimple g)
/* Set the LHS of an atomic load. */
static inline void
-gimple_omp_atomic_load_set_lhs (gimple g, tree lhs)
+gimple_omp_atomic_load_set_lhs (gimple_omp_atomic_load load_stmt, tree lhs)
{
- gimple_statement_omp_atomic_load *omp_atomic_load_stmt =
- as_a <gimple_statement_omp_atomic_load *> (g);
- omp_atomic_load_stmt->lhs = lhs;
+ load_stmt->lhs = lhs;
}
/* Get the LHS of an atomic load. */
static inline tree
-gimple_omp_atomic_load_lhs (const_gimple g)
+gimple_omp_atomic_load_lhs (const_gimple_omp_atomic_load load_stmt)
{
- const gimple_statement_omp_atomic_load *omp_atomic_load_stmt =
- as_a <const gimple_statement_omp_atomic_load *> (g);
- return omp_atomic_load_stmt->lhs;
+ return load_stmt->lhs;
}
/* Return a pointer to the LHS of an atomic load. */
static inline tree *
-gimple_omp_atomic_load_lhs_ptr (gimple g)
+gimple_omp_atomic_load_lhs_ptr (gimple_omp_atomic_load load_stmt)
{
- gimple_statement_omp_atomic_load *omp_atomic_load_stmt =
- as_a <gimple_statement_omp_atomic_load *> (g);
- return &omp_atomic_load_stmt->lhs;
+ return &load_stmt->lhs;
}
/* Set the RHS of an atomic load. */
static inline void
-gimple_omp_atomic_load_set_rhs (gimple g, tree rhs)
+gimple_omp_atomic_load_set_rhs (gimple_omp_atomic_load load_stmt, tree rhs)
{
- gimple_statement_omp_atomic_load *omp_atomic_load_stmt =
- as_a <gimple_statement_omp_atomic_load *> (g);
- omp_atomic_load_stmt->rhs = rhs;
+ load_stmt->rhs = rhs;
}
/* Get the RHS of an atomic load. */
static inline tree
-gimple_omp_atomic_load_rhs (const_gimple g)
+gimple_omp_atomic_load_rhs (const_gimple_omp_atomic_load load_stmt)
{
- const gimple_statement_omp_atomic_load *omp_atomic_load_stmt =
- as_a <const gimple_statement_omp_atomic_load *> (g);
- return omp_atomic_load_stmt->rhs;
+ return load_stmt->rhs;
}
/* Return a pointer to the RHS of an atomic load. */
static inline tree *
-gimple_omp_atomic_load_rhs_ptr (gimple g)
+gimple_omp_atomic_load_rhs_ptr (gimple_omp_atomic_load load_stmt)
{
- gimple_statement_omp_atomic_load *omp_atomic_load_stmt =
- as_a <gimple_statement_omp_atomic_load *> (g);
- return &omp_atomic_load_stmt->rhs;
+ return &load_stmt->rhs;
}
diff --git a/gcc/gimplify-me.c b/gcc/gimplify-me.c
index 08d2b9c..67d71fc 100644
--- a/gcc/gimplify-me.c
+++ b/gcc/gimplify-me.c
@@ -178,8 +178,9 @@ gimple_regimplify_operands (gimple stmt, gimple_stmt_iterator *gsi_p)
is_gimple_val, fb_rvalue);
break;
case GIMPLE_OMP_ATOMIC_LOAD:
- gimplify_expr (gimple_omp_atomic_load_rhs_ptr (stmt), &pre, NULL,
- is_gimple_val, fb_rvalue);
+ gimplify_expr (gimple_omp_atomic_load_rhs_ptr (
+ as_a <gimple_omp_atomic_load> (stmt)),
+ &pre, NULL, is_gimple_val, fb_rvalue);
break;
case GIMPLE_ASM:
{
diff --git a/gcc/omp-low.c b/gcc/omp-low.c
index 23cf043..40cba5c 100644
--- a/gcc/omp-low.c
+++ b/gcc/omp-low.c
@@ -8186,7 +8186,9 @@ static void
expand_omp_atomic (struct omp_region *region)
{
basic_block load_bb = region->entry, store_bb = region->exit;
- gimple load = last_stmt (load_bb), store = last_stmt (store_bb);
+ gimple_omp_atomic_load load =
+ as_a <gimple_omp_atomic_load> (last_stmt (load_bb));
+ gimple store = last_stmt (store_bb);
tree loaded_val = gimple_omp_atomic_load_lhs (load);
tree addr = gimple_omp_atomic_load_rhs (load);
tree stored_val = gimple_omp_atomic_store_val (store);
@@ -10524,7 +10526,8 @@ lower_omp_1 (gimple_stmt_iterator *gsi_p, omp_context *ctx)
break;
case GIMPLE_OMP_ATOMIC_LOAD:
if ((ctx || task_shared_vars)
- && walk_tree (gimple_omp_atomic_load_rhs_ptr (stmt),
+ && walk_tree (gimple_omp_atomic_load_rhs_ptr (
+ as_a <gimple_omp_atomic_load> (stmt)),
lower_omp_regimplify_p, ctx ? NULL : &wi, NULL))
gimple_regimplify_operands (stmt, gsi_p);
break;
--
1.8.5.3
^ permalink raw reply [flat|nested] 93+ messages in thread
* [gimple-classes, committed 53/92] Use gimple_call for callgraph edges
2014-10-27 20:35 [gimple-classes, committed 00/92] Initial slew of commits David Malcolm
` (84 preceding siblings ...)
2014-10-27 20:57 ` [gimple-classes, committed 29/92] Use subclasses of gimple in various places David Malcolm
@ 2014-10-27 20:57 ` David Malcolm
2014-10-27 20:57 ` [gimple-classes, committed 26/92] Introduce gimple_eh_else David Malcolm
` (5 subsequent siblings)
91 siblings, 0 replies; 93+ messages in thread
From: David Malcolm @ 2014-10-27 20:57 UTC (permalink / raw)
To: gcc-patches; +Cc: David Malcolm
This corresponds to:
[PATCH 55/89] Use gimple_call for callgraph edges
https://gcc.gnu.org/ml/gcc-patches/2014-04/msg01221.html
from the original 89-patch kit
That earlier patch was approved by Jeff:
> OK once prereqs go in.
in https://gcc.gnu.org/ml/gcc-patches/2014-05/msg00867.html
gcc/
* cgraph.h (cgraph_edge::call_stmt): Strengthen field from plain
gimple to a gimple_call.
(cgraph_node::set_call_stmt_including_clones): Likewise for param
"new_stmt".
(cgraph_node::create_edge): Likewise for param "call_stmt".
(cgraph_node::create_indirect_edge): Likewise.
(cgraph_node::create_edge_including_clones): Likewise for param
"stmt".
(cgraph_edge::set_call_stmt): Likewise for param "new_stmt".
(cgraph_edge::clone): Likewise for param "call_stmt".
(symbol_table::create_edge): Likewise.
* cgraph.c (cgraph_edge::set_call_stmt): Require a gimple_call
rather than a plain gimple.
(symbol_table::create_edge): Likewise.
(cgraph_node::create_edge): Likewise.
(cgraph_node::create_indirect_edge): Likewise.
(cgraph_edge::redirect_call_stmt_to_callee): Strengthen local
"new_stmt" from gimple to gimple_call.
(cgraph_update_edges_for_call_stmt_node): Add checked casts to
gimple_call.
* cgraphbuild.c (pass_build_cgraph_edges::execute): Replace
is_gimple_call with dyn_cast<gimple_call> and new local
"call_stmt".
(cgraph_edge::rebuild_edges): Likewise.
* cgraphclones.c (cgraph_edge::clone): Require a gimple_call
rather than a plain gimple.
(cgraph_node::set_call_stmt_including_clones): Likewise.
(cgraph_node::create_edge_including_clones): Likewise.
* lto-streamer-in.c (fixup_call_stmt_edges_1): Add checked casts
to gimple_call.
* omp-low.c (simd_clone_adjust): Strengthen local "call" from
gimple to gimple_call.
* trans-mem.c (ipa_tm_insert_irr_call): Likewise for "g".
(ipa_tm_insert_gettmclone_call): Likewise; also strengthen "g2"
to gimple_assign.
* tree-emutls.c (gen_emutls_addr): Strengthen local "x" from
gimple to gimple_call.
* tree-inline.c (copy_bb): Replace is_gimple_call with
dyn_cast<gimple_call> and new local "call_stmt".
* value-prof.c (gimple_ic): Require and return a gimple_call,
rather than a plain gimple.
* value-prof.h (gimple_ic): Likewise.
---
gcc/ChangeLog.gimple-classes | 56 ++++++++++++++++++++++++++++++++++++++++++++
gcc/cgraph.c | 21 +++++++++--------
gcc/cgraph.h | 16 ++++++-------
gcc/cgraphbuild.c | 24 +++++++++----------
gcc/cgraphclones.c | 7 +++---
gcc/lto-streamer-in.c | 4 ++--
gcc/omp-low.c | 2 +-
gcc/trans-mem.c | 5 ++--
gcc/tree-emutls.c | 2 +-
gcc/tree-inline.c | 14 +++++------
gcc/value-prof.c | 8 +++----
gcc/value-prof.h | 3 ++-
12 files changed, 111 insertions(+), 51 deletions(-)
diff --git a/gcc/ChangeLog.gimple-classes b/gcc/ChangeLog.gimple-classes
index 9654b49..115f7ea 100644
--- a/gcc/ChangeLog.gimple-classes
+++ b/gcc/ChangeLog.gimple-classes
@@ -1,5 +1,61 @@
2014-10-24 David Malcolm <dmalcolm@redhat.com>
+ Use gimple_call for callgraph edges
+
+ * cgraph.h (cgraph_edge::call_stmt): Strengthen field from plain
+ gimple to a gimple_call.
+ (cgraph_node::set_call_stmt_including_clones): Likewise for param
+ "new_stmt".
+ (cgraph_node::create_edge): Likewise for param "call_stmt".
+ (cgraph_node::create_indirect_edge): Likewise.
+ (cgraph_node::create_edge_including_clones): Likewise for param
+ "stmt".
+ (cgraph_edge::set_call_stmt): Likewise for param "new_stmt".
+ (cgraph_edge::clone): Likewise for param "call_stmt".
+ (symbol_table::create_edge): Likewise.
+
+ * cgraph.c (cgraph_edge::set_call_stmt): Require a gimple_call
+ rather than a plain gimple.
+ (symbol_table::create_edge): Likewise.
+ (cgraph_node::create_edge): Likewise.
+ (cgraph_node::create_indirect_edge): Likewise.
+ (cgraph_edge::redirect_call_stmt_to_callee): Strengthen local
+ "new_stmt" from gimple to gimple_call.
+ (cgraph_update_edges_for_call_stmt_node): Add checked casts to
+ gimple_call.
+
+ * cgraphbuild.c (pass_build_cgraph_edges::execute): Replace
+ is_gimple_call with dyn_cast<gimple_call> and new local
+ "call_stmt".
+ (cgraph_edge::rebuild_edges): Likewise.
+
+ * cgraphclones.c (cgraph_edge::clone): Require a gimple_call
+ rather than a plain gimple.
+ (cgraph_node::set_call_stmt_including_clones): Likewise.
+ (cgraph_node::create_edge_including_clones): Likewise.
+
+ * lto-streamer-in.c (fixup_call_stmt_edges_1): Add checked casts
+ to gimple_call.
+
+ * omp-low.c (simd_clone_adjust): Strengthen local "call" from
+ gimple to gimple_call.
+
+ * trans-mem.c (ipa_tm_insert_irr_call): Likewise for "g".
+ (ipa_tm_insert_gettmclone_call): Likewise; also strengthen "g2"
+ to gimple_assign.
+
+ * tree-emutls.c (gen_emutls_addr): Strengthen local "x" from
+ gimple to gimple_call.
+
+ * tree-inline.c (copy_bb): Replace is_gimple_call with
+ dyn_cast<gimple_call> and new local "call_stmt".
+
+ * value-prof.c (gimple_ic): Require and return a gimple_call,
+ rather than a plain gimple.
+ * value-prof.h (gimple_ic): Likewise.
+
+2014-10-24 David Malcolm <dmalcolm@redhat.com>
+
Make gimple_call_return_slot_opt_p require a gimple_call.
* gimple.h (gimple_call_return_slot_opt_p): Require a gimple_call
diff --git a/gcc/cgraph.c b/gcc/cgraph.c
index 2694c40..947d432 100644
--- a/gcc/cgraph.c
+++ b/gcc/cgraph.c
@@ -691,7 +691,7 @@ cgraph_node::get_edge (gimple call_stmt)
edge, then update all components. */
void
-cgraph_edge::set_call_stmt (gimple new_stmt, bool update_speculative)
+cgraph_edge::set_call_stmt (gimple_call new_stmt, bool update_speculative)
{
tree decl;
@@ -744,8 +744,8 @@ cgraph_edge::set_call_stmt (gimple new_stmt, bool update_speculative)
cgraph_edge *
symbol_table::create_edge (cgraph_node *caller, cgraph_node *callee,
- gimple call_stmt, gcov_type count, int freq,
- bool indir_unknown_callee)
+ gimple_call call_stmt, gcov_type count, int freq,
+ bool indir_unknown_callee)
{
cgraph_edge *edge;
@@ -825,7 +825,7 @@ symbol_table::create_edge (cgraph_node *caller, cgraph_node *callee,
cgraph_edge *
cgraph_node::create_edge (cgraph_node *callee,
- gimple call_stmt, gcov_type count, int freq)
+ gimple_call call_stmt, gcov_type count, int freq)
{
cgraph_edge *edge = symtab->create_edge (this, callee, call_stmt, count,
freq, false);
@@ -861,7 +861,7 @@ cgraph_allocate_init_indirect_info (void)
PARAM_INDEX. */
cgraph_edge *
-cgraph_node::create_indirect_edge (gimple call_stmt, int ecf_flags,
+cgraph_node::create_indirect_edge (gimple_call call_stmt, int ecf_flags,
gcov_type count, int freq,
bool compute_indirect_info)
{
@@ -1247,7 +1247,7 @@ cgraph_edge::redirect_call_stmt_to_callee (void)
if (e->speculative)
{
cgraph_edge *e2;
- gimple new_stmt;
+ gimple_call new_stmt;
ipa_ref *ref;
e->speculative_call_info (e, e2, ref);
@@ -1375,7 +1375,7 @@ cgraph_edge::redirect_call_stmt_to_callee (void)
}
else
{
- new_stmt = as_a <gimple_call> (e->call_stmt);
+ new_stmt = e->call_stmt;
gimple_call_set_fndecl (new_stmt, e->callee->decl);
update_stmt_fn (DECL_STRUCT_FUNCTION (e->caller->decl), new_stmt);
}
@@ -1454,7 +1454,7 @@ cgraph_update_edges_for_call_stmt_node (cgraph_node *node,
if (callee->decl == new_call
|| callee->former_clone_of == new_call)
{
- e->set_call_stmt (new_stmt);
+ e->set_call_stmt (as_a <gimple_call> (new_stmt));
return;
}
callee = callee->clone_of;
@@ -1483,13 +1483,14 @@ cgraph_update_edges_for_call_stmt_node (cgraph_node *node,
if (new_call)
{
ne = node->create_edge (cgraph_node::get_create (new_call),
- new_stmt, count, frequency);
+ as_a <gimple_call> (new_stmt), count,
+ frequency);
gcc_assert (ne->inline_failed);
}
}
/* We only updated the call stmt; update pointer in cgraph edge.. */
else if (old_stmt != new_stmt)
- node->get_edge (old_stmt)->set_call_stmt (new_stmt);
+ node->get_edge (old_stmt)->set_call_stmt (as_a <gimple_call> (new_stmt));
}
/* Update or remove the corresponding cgraph edge if a GIMPLE_CALL
diff --git a/gcc/cgraph.h b/gcc/cgraph.h
index a5777c2..de66165 100644
--- a/gcc/cgraph.h
+++ b/gcc/cgraph.h
@@ -779,7 +779,7 @@ public:
When WHOLE_SPECULATIVE_EDGES is true, all three components of
speculative edge gets updated. Otherwise we update only direct
call. */
- void set_call_stmt_including_clones (gimple old_stmt, gimple new_stmt,
+ void set_call_stmt_including_clones (gimple old_stmt, gimple_call new_stmt,
bool update_speculative = true);
/* Walk the alias chain to return the function cgraph_node is alias of.
@@ -955,13 +955,13 @@ public:
/* Create edge from a given function to CALLEE in the cgraph. */
cgraph_edge *create_edge (cgraph_node *callee,
- gimple call_stmt, gcov_type count,
+ gimple_call call_stmt, gcov_type count,
int freq);
/* Create an indirect edge with a yet-undetermined callee where the call
statement destination is a formal parameter of the caller with index
PARAM_INDEX. */
- cgraph_edge *create_indirect_edge (gimple call_stmt, int ecf_flags,
+ cgraph_edge *create_indirect_edge (gimple_call call_stmt, int ecf_flags,
gcov_type count, int freq,
bool compute_indirect_info = true);
@@ -969,7 +969,7 @@ public:
same function body. If clones already have edge for OLD_STMT; only
update the edge same way as cgraph_set_call_stmt_including_clones does. */
void create_edge_including_clones (cgraph_node *callee,
- gimple old_stmt, gimple stmt,
+ gimple old_stmt, gimple_call stmt,
gcov_type count,
int freq,
cgraph_inline_failed_t reason);
@@ -1427,7 +1427,7 @@ struct GTY((chain_next ("%h.next_caller"), chain_prev ("%h.prev_caller"),
/* Change field call_stmt of edge to NEW_STMT.
If UPDATE_SPECULATIVE and E is any component of speculative
edge, then update all components. */
- void set_call_stmt (gimple new_stmt, bool update_speculative = true);
+ void set_call_stmt (gimple_call new_stmt, bool update_speculative = true);
/* Redirect callee of the edge to N. The function does not update underlying
call expression. */
@@ -1460,7 +1460,7 @@ struct GTY((chain_next ("%h.next_caller"), chain_prev ("%h.prev_caller"),
/* Create clone of edge in the node N represented
by CALL_EXPR the callgraph. */
- cgraph_edge * clone (cgraph_node *n, gimple call_stmt, unsigned stmt_uid,
+ cgraph_edge * clone (cgraph_node *n, gimple_call call_stmt, unsigned stmt_uid,
gcov_type count_scale, int freq_scale, bool update_original);
/* Return true when call of edge can not lead to return from caller
@@ -1490,7 +1490,7 @@ struct GTY((chain_next ("%h.next_caller"), chain_prev ("%h.prev_caller"),
cgraph_edge *next_caller;
cgraph_edge *prev_callee;
cgraph_edge *next_callee;
- gimple call_stmt;
+ gimple_call call_stmt;
/* Additional information about an indirect call. Not cleared when an edge
becomes direct. */
cgraph_indirect_call_info *indirect_info;
@@ -2018,7 +2018,7 @@ private:
parameters of which only CALLEE can be NULL (when creating an indirect call
edge). */
cgraph_edge *create_edge (cgraph_node *caller, cgraph_node *callee,
- gimple call_stmt, gcov_type count, int freq,
+ gimple_call call_stmt, gcov_type count, int freq,
bool indir_unknown_callee);
/* Put the edge onto the free list. */
diff --git a/gcc/cgraphbuild.c b/gcc/cgraphbuild.c
index be3e866..a97e397 100644
--- a/gcc/cgraphbuild.c
+++ b/gcc/cgraphbuild.c
@@ -337,18 +337,18 @@ pass_build_cgraph_edges::execute (function *fun)
if (is_gimple_debug (stmt))
continue;
- if (is_gimple_call (stmt))
+ if (gimple_call call_stmt = dyn_cast <gimple_call> (stmt))
{
int freq = compute_call_stmt_bb_frequency (current_function_decl,
bb);
- decl = gimple_call_fndecl (stmt);
+ decl = gimple_call_fndecl (call_stmt);
if (decl)
- node->create_edge (cgraph_node::get_create (decl), stmt, bb->count, freq);
- else if (gimple_call_internal_p (stmt))
+ node->create_edge (cgraph_node::get_create (decl), call_stmt, bb->count, freq);
+ else if (gimple_call_internal_p (call_stmt))
;
else
- node->create_indirect_edge (stmt,
- gimple_call_flags (stmt),
+ node->create_indirect_edge (call_stmt,
+ gimple_call_flags (call_stmt),
bb->count, freq);
}
node->record_stmt_references (stmt);
@@ -433,19 +433,19 @@ cgraph_edge::rebuild_edges (void)
gimple stmt = gsi_stmt (gsi);
tree decl;
- if (is_gimple_call (stmt))
+ if (gimple_call call_stmt = dyn_cast <gimple_call> (stmt))
{
int freq = compute_call_stmt_bb_frequency (current_function_decl,
bb);
- decl = gimple_call_fndecl (stmt);
+ decl = gimple_call_fndecl (call_stmt);
if (decl)
- node->create_edge (cgraph_node::get_create (decl), stmt,
+ node->create_edge (cgraph_node::get_create (decl), call_stmt,
bb->count, freq);
- else if (gimple_call_internal_p (stmt))
+ else if (gimple_call_internal_p (call_stmt))
;
else
- node->create_indirect_edge (stmt,
- gimple_call_flags (stmt),
+ node->create_indirect_edge (call_stmt,
+ gimple_call_flags (call_stmt),
bb->count, freq);
}
node->record_stmt_references (stmt);
diff --git a/gcc/cgraphclones.c b/gcc/cgraphclones.c
index c487c13..d5c2697 100644
--- a/gcc/cgraphclones.c
+++ b/gcc/cgraphclones.c
@@ -106,7 +106,7 @@ along with GCC; see the file COPYING3. If not see
the callgraph. */
cgraph_edge *
-cgraph_edge::clone (cgraph_node *n, gimple call_stmt, unsigned stmt_uid,
+cgraph_edge::clone (cgraph_node *n, gimple_call call_stmt, unsigned stmt_uid,
gcov_type count_scale, int freq_scale, bool update_original)
{
cgraph_edge *new_edge;
@@ -688,7 +688,8 @@ cgraph_node::find_replacement (void)
call. */
void
-cgraph_node::set_call_stmt_including_clones (gimple old_stmt, gimple new_stmt,
+cgraph_node::set_call_stmt_including_clones (gimple old_stmt,
+ gimple_call new_stmt,
bool update_speculative)
{
cgraph_node *node;
@@ -743,7 +744,7 @@ cgraph_node::set_call_stmt_including_clones (gimple old_stmt, gimple new_stmt,
void
cgraph_node::create_edge_including_clones (cgraph_node *callee,
- gimple old_stmt, gimple stmt,
+ gimple old_stmt, gimple_call stmt,
gcov_type count,
int freq,
cgraph_inline_failed_t reason)
diff --git a/gcc/lto-streamer-in.c b/gcc/lto-streamer-in.c
index 271b51c..150e7ba 100644
--- a/gcc/lto-streamer-in.c
+++ b/gcc/lto-streamer-in.c
@@ -788,7 +788,7 @@ fixup_call_stmt_edges_1 (struct cgraph_node *node, gimple *stmts,
{
if (gimple_stmt_max_uid (fn) < cedge->lto_stmt_uid)
fatal_error ("Cgraph edge statement index out of range");
- cedge->call_stmt = stmts[cedge->lto_stmt_uid - 1];
+ cedge->call_stmt = as_a <gimple_call> (stmts[cedge->lto_stmt_uid - 1]);
if (!cedge->call_stmt)
fatal_error ("Cgraph edge statement index not found");
}
@@ -796,7 +796,7 @@ fixup_call_stmt_edges_1 (struct cgraph_node *node, gimple *stmts,
{
if (gimple_stmt_max_uid (fn) < cedge->lto_stmt_uid)
fatal_error ("Cgraph edge statement index out of range");
- cedge->call_stmt = stmts[cedge->lto_stmt_uid - 1];
+ cedge->call_stmt = as_a <gimple_call> (stmts[cedge->lto_stmt_uid - 1]);
if (!cedge->call_stmt)
fatal_error ("Cgraph edge statement index not found");
}
diff --git a/gcc/omp-low.c b/gcc/omp-low.c
index 327c6e1..7b4e325 100644
--- a/gcc/omp-low.c
+++ b/gcc/omp-low.c
@@ -12136,7 +12136,7 @@ simd_clone_adjust (struct cgraph_node *node)
tree fn = builtin_decl_explicit (BUILT_IN_ASSUME_ALIGNED);
gimple_seq seq = NULL;
bool need_cvt = false;
- gimple call
+ gimple_call call
= gimple_build_call (fn, 2, def, size_int (alignment));
g = call;
if (!useless_type_conversion_p (TREE_TYPE (orig_arg),
diff --git a/gcc/trans-mem.c b/gcc/trans-mem.c
index 86a081a..9e90812 100644
--- a/gcc/trans-mem.c
+++ b/gcc/trans-mem.c
@@ -4965,7 +4965,7 @@ ipa_tm_insert_irr_call (struct cgraph_node *node, struct tm_region *region,
basic_block bb)
{
gimple_stmt_iterator gsi;
- gimple g;
+ gimple_call g;
transaction_subcode_ior (region, GTMA_MAY_ENTER_IRREVOCABLE);
@@ -4991,7 +4991,8 @@ ipa_tm_insert_gettmclone_call (struct cgraph_node *node,
gimple_stmt_iterator *gsi, gimple stmt)
{
tree gettm_fn, ret, old_fn, callfn;
- gimple g, g2;
+ gimple_call g;
+ gimple_assign g2;
bool safe;
old_fn = gimple_call_fn (stmt);
diff --git a/gcc/tree-emutls.c b/gcc/tree-emutls.c
index c915e33..8d62dba 100644
--- a/gcc/tree-emutls.c
+++ b/gcc/tree-emutls.c
@@ -406,7 +406,7 @@ gen_emutls_addr (tree decl, struct lower_emutls_data *d)
{
varpool_node *cvar;
tree cdecl;
- gimple x;
+ gimple_call x;
cvar = data->control_var;
cdecl = cvar->decl;
diff --git a/gcc/tree-inline.c b/gcc/tree-inline.c
index beae377..a95aa09 100644
--- a/gcc/tree-inline.c
+++ b/gcc/tree-inline.c
@@ -1811,7 +1811,7 @@ copy_bb (copy_body_data *id, basic_block bb, int frequency_scale,
/* We're duplicating a CALL_EXPR. Find any corresponding
callgraph edges and update or duplicate them. */
- if (is_gimple_call (stmt))
+ if (gimple_call call_stmt = dyn_cast <gimple_call> (stmt))
{
struct cgraph_edge *edge;
@@ -1824,7 +1824,7 @@ copy_bb (copy_body_data *id, basic_block bb, int frequency_scale,
int edge_freq = edge->frequency;
int new_freq;
struct cgraph_edge *old_edge = edge;
- edge = edge->clone (id->dst_node, stmt,
+ edge = edge->clone (id->dst_node, call_stmt,
gimple_uid (stmt),
REG_BR_PROB_BASE, CGRAPH_FREQ_BASE,
true);
@@ -1843,7 +1843,7 @@ copy_bb (copy_body_data *id, basic_block bb, int frequency_scale,
gcc_assert (!edge->indirect_unknown_callee);
old_edge->speculative_call_info (direct, indirect, ref);
- indirect = indirect->clone (id->dst_node, stmt,
+ indirect = indirect->clone (id->dst_node, call_stmt,
gimple_uid (stmt),
REG_BR_PROB_BASE, CGRAPH_FREQ_BASE,
true);
@@ -1882,14 +1882,14 @@ copy_bb (copy_body_data *id, basic_block bb, int frequency_scale,
case CB_CGE_MOVE_CLONES:
id->dst_node->set_call_stmt_including_clones (orig_stmt,
- stmt);
+ call_stmt);
edge = id->dst_node->get_edge (stmt);
break;
case CB_CGE_MOVE:
edge = id->dst_node->get_edge (orig_stmt);
if (edge)
- edge->set_call_stmt (stmt);
+ edge->set_call_stmt (call_stmt);
break;
default:
@@ -1918,12 +1918,12 @@ copy_bb (copy_body_data *id, basic_block bb, int frequency_scale,
|| !id->dst_node->definition);
if (id->transform_call_graph_edges == CB_CGE_MOVE_CLONES)
id->dst_node->create_edge_including_clones
- (dest, orig_stmt, stmt, bb->count,
+ (dest, orig_stmt, call_stmt, bb->count,
compute_call_stmt_bb_frequency (id->dst_node->decl,
copy_basic_block),
CIF_ORIGINALLY_INDIRECT_CALL);
else
- id->dst_node->create_edge (dest, stmt,
+ id->dst_node->create_edge (dest, call_stmt,
bb->count,
compute_call_stmt_bb_frequency
(id->dst_node->decl,
diff --git a/gcc/value-prof.c b/gcc/value-prof.c
index e5ccf48..a2d62e9 100644
--- a/gcc/value-prof.c
+++ b/gcc/value-prof.c
@@ -1370,11 +1370,11 @@ check_ic_target (gimple_call call_stmt, struct cgraph_node *target)
old call
*/
-gimple
-gimple_ic (gimple icall_stmt, struct cgraph_node *direct_call,
+gimple_call
+gimple_ic (gimple_call icall_stmt, struct cgraph_node *direct_call,
int prob, gcov_type count, gcov_type all)
{
- gimple dcall_stmt;
+ gimple_call dcall_stmt;
gimple_assign load_stmt;
gimple_cond cond_stmt;
tree tmp0, tmp1, tmp;
@@ -1407,7 +1407,7 @@ gimple_ic (gimple icall_stmt, struct cgraph_node *direct_call,
gimple_set_vdef (icall_stmt, NULL_TREE);
gimple_set_vuse (icall_stmt, NULL_TREE);
update_stmt (icall_stmt);
- dcall_stmt = gimple_copy (icall_stmt);
+ dcall_stmt = as_a <gimple_call> (gimple_copy (icall_stmt));
gimple_call_set_fndecl (dcall_stmt, direct_call->decl);
dflags = flags_from_decl_or_type (direct_call->decl);
if ((dflags & ECF_NORETURN) != 0)
diff --git a/gcc/value-prof.h b/gcc/value-prof.h
index 00a89fa..dec879b 100644
--- a/gcc/value-prof.h
+++ b/gcc/value-prof.h
@@ -90,7 +90,8 @@ void gimple_move_stmt_histograms (struct function *, gimple, gimple);
void verify_histograms (void);
void free_histograms (void);
void stringop_block_profile (gimple, unsigned int *, HOST_WIDE_INT *);
-gimple gimple_ic (gimple, struct cgraph_node *, int, gcov_type, gcov_type);
+gimple_call gimple_ic (gimple_call, struct cgraph_node *, int, gcov_type,
+ gcov_type);
/* In tree-profile.c. */
--
1.8.5.3
^ permalink raw reply [flat|nested] 93+ messages in thread
* [gimple-classes, committed 16/92] Update various expressions within tree-scalar-evolution.c to be gimple_phi
2014-10-27 20:35 [gimple-classes, committed 00/92] Initial slew of commits David Malcolm
` (89 preceding siblings ...)
2014-10-27 20:57 ` [gimple-classes, committed 17/92] Concretize get_loop_exit_condition et al to working on gimple_cond David Malcolm
@ 2014-10-27 20:57 ` David Malcolm
2014-10-27 21:32 ` [gimple-classes, committed 55/92] Concretize parameter to gimple_call_copy_skip_args David Malcolm
91 siblings, 0 replies; 93+ messages in thread
From: David Malcolm @ 2014-10-27 20:57 UTC (permalink / raw)
To: gcc-patches; +Cc: David Malcolm
This corresponds to:
[PATCH 17/89] Update various expressions within tree-scalar-evolution.c to be gimple_phi
https://gcc.gnu.org/ml/gcc-patches/2014-04/msg01150.html
from the original 89-patch kit
That earlier patch was approved by Jeff:
> OK when prerequisites have gone in.
> Actually that's true for #17 & #18 as well.
in https://gcc.gnu.org/ml/gcc-patches/2014-05/msg00626.html
gcc/
* tree-scalar-evolution.c (follow_ssa_edge): Require a gimple_phi,
rather than a gimple.
(follow_ssa_edge_binary): Likewise.
(follow_ssa_edge_expr): Likewise.
(follow_ssa_edge_in_rhs): Likewise.
(backedge_phi_arg_p): Likewise.
(follow_ssa_edge_in_condition_phi_branch): Likewise.
(follow_ssa_edge_in_condition_phi): Likewise.
(follow_ssa_edge_inner_loop_phi): Likewise.
(analyze_evolution_in_loop): Likewise.
(analyze_initial_condition): Likewise.
(interpret_loop_phi): Likewise.
(interpret_condition_phi): Likewise.
(follow_ssa_edge): Likewise; also, add checked casts to gimple_phi.
(analyze_scalar_evolution_1): Add checked casts to gimple_phi
within "case GIMPLE_PHI".
---
gcc/ChangeLog.gimple-classes | 22 +++++++++++++++++++++
gcc/tree-scalar-evolution.c | 46 +++++++++++++++++++++++++-------------------
2 files changed, 48 insertions(+), 20 deletions(-)
diff --git a/gcc/ChangeLog.gimple-classes b/gcc/ChangeLog.gimple-classes
index 4006f14..c28facc 100644
--- a/gcc/ChangeLog.gimple-classes
+++ b/gcc/ChangeLog.gimple-classes
@@ -1,5 +1,27 @@
2014-10-24 David Malcolm <dmalcolm@redhat.com>
+ Update various expressions within tree-scalar-evolution.c to be gimple_phi
+
+ * tree-scalar-evolution.c (follow_ssa_edge): Require a gimple_phi,
+ rather than a gimple.
+ (follow_ssa_edge_binary): Likewise.
+ (follow_ssa_edge_expr): Likewise.
+ (follow_ssa_edge_in_rhs): Likewise.
+ (backedge_phi_arg_p): Likewise.
+ (follow_ssa_edge_in_condition_phi_branch): Likewise.
+ (follow_ssa_edge_in_condition_phi): Likewise.
+ (follow_ssa_edge_inner_loop_phi): Likewise.
+ (analyze_evolution_in_loop): Likewise.
+ (analyze_initial_condition): Likewise.
+ (interpret_loop_phi): Likewise.
+ (interpret_condition_phi): Likewise.
+ (follow_ssa_edge): Likewise; also, add checked casts to gimple_phi.
+
+ (analyze_scalar_evolution_1): Add checked casts to gimple_phi
+ within "case GIMPLE_PHI".
+
+2014-10-24 David Malcolm <dmalcolm@redhat.com>
+
tree-ssa-loop-ivopts.c: use gimple_phi in a few places
* tree-ssa-loop-ivopts.c (determine_biv_step): Require a gimple_phi.
diff --git a/gcc/tree-scalar-evolution.c b/gcc/tree-scalar-evolution.c
index 0a6739f..7ffa241 100644
--- a/gcc/tree-scalar-evolution.c
+++ b/gcc/tree-scalar-evolution.c
@@ -904,7 +904,8 @@ typedef enum t_bool {
} t_bool;
-static t_bool follow_ssa_edge (struct loop *loop, gimple, gimple, tree *, int);
+static t_bool follow_ssa_edge (struct loop *loop, gimple, gimple_phi,
+ tree *, int);
/* Follow the ssa edge into the binary expression RHS0 CODE RHS1.
Return true if the strongly connected component has been found. */
@@ -912,7 +913,8 @@ static t_bool follow_ssa_edge (struct loop *loop, gimple, gimple, tree *, int);
static t_bool
follow_ssa_edge_binary (struct loop *loop, gimple at_stmt,
tree type, tree rhs0, enum tree_code code, tree rhs1,
- gimple halting_phi, tree *evolution_of_loop, int limit)
+ gimple_phi halting_phi, tree *evolution_of_loop,
+ int limit)
{
t_bool res = t_false;
tree evol;
@@ -1047,7 +1049,8 @@ follow_ssa_edge_binary (struct loop *loop, gimple at_stmt,
static t_bool
follow_ssa_edge_expr (struct loop *loop, gimple at_stmt, tree expr,
- gimple halting_phi, tree *evolution_of_loop, int limit)
+ gimple_phi halting_phi, tree *evolution_of_loop,
+ int limit)
{
enum tree_code code = TREE_CODE (expr);
tree type = TREE_TYPE (expr), rhs0, rhs1;
@@ -1137,7 +1140,8 @@ follow_ssa_edge_expr (struct loop *loop, gimple at_stmt, tree expr,
static t_bool
follow_ssa_edge_in_rhs (struct loop *loop, gimple stmt,
- gimple halting_phi, tree *evolution_of_loop, int limit)
+ gimple_phi halting_phi, tree *evolution_of_loop,
+ int limit)
{
enum tree_code code = gimple_assign_rhs_code (stmt);
tree type = gimple_expr_type (stmt), rhs1, rhs2;
@@ -1177,7 +1181,7 @@ follow_ssa_edge_in_rhs (struct loop *loop, gimple stmt,
/* Checks whether the I-th argument of a PHI comes from a backedge. */
static bool
-backedge_phi_arg_p (gimple phi, int i)
+backedge_phi_arg_p (gimple_phi phi, int i)
{
const_edge e = gimple_phi_arg_edge (phi, i);
@@ -1197,8 +1201,8 @@ backedge_phi_arg_p (gimple phi, int i)
static inline t_bool
follow_ssa_edge_in_condition_phi_branch (int i,
struct loop *loop,
- gimple condition_phi,
- gimple halting_phi,
+ gimple_phi condition_phi,
+ gimple_phi halting_phi,
tree *evolution_of_branch,
tree init_cond, int limit)
{
@@ -1232,8 +1236,8 @@ follow_ssa_edge_in_condition_phi_branch (int i,
static t_bool
follow_ssa_edge_in_condition_phi (struct loop *loop,
- gimple condition_phi,
- gimple halting_phi,
+ gimple_phi condition_phi,
+ gimple_phi halting_phi,
tree *evolution_of_loop, int limit)
{
int i, n;
@@ -1279,8 +1283,8 @@ follow_ssa_edge_in_condition_phi (struct loop *loop,
static t_bool
follow_ssa_edge_inner_loop_phi (struct loop *outer_loop,
- gimple loop_phi_node,
- gimple halting_phi,
+ gimple_phi loop_phi_node,
+ gimple_phi halting_phi,
tree *evolution_of_loop, int limit)
{
struct loop *loop = loop_containing_stmt (loop_phi_node);
@@ -1325,7 +1329,7 @@ follow_ssa_edge_inner_loop_phi (struct loop *outer_loop,
path that is analyzed on the return walk. */
static t_bool
-follow_ssa_edge (struct loop *loop, gimple def, gimple halting_phi,
+follow_ssa_edge (struct loop *loop, gimple def, gimple_phi halting_phi,
tree *evolution_of_loop, int limit)
{
struct loop *def_loop;
@@ -1348,7 +1352,8 @@ follow_ssa_edge (struct loop *loop, gimple def, gimple halting_phi,
information and set the approximation to the main
variable. */
return follow_ssa_edge_in_condition_phi
- (loop, def, halting_phi, evolution_of_loop, limit);
+ (loop, as_a <gimple_phi> (def), halting_phi, evolution_of_loop,
+ limit);
/* When the analyzed phi is the halting_phi, the
depth-first search is over: we have found a path from
@@ -1365,7 +1370,8 @@ follow_ssa_edge (struct loop *loop, gimple def, gimple halting_phi,
/* Inner loop. */
if (flow_loop_nested_p (loop, def_loop))
return follow_ssa_edge_inner_loop_phi
- (loop, def, halting_phi, evolution_of_loop, limit + 1);
+ (loop, as_a <gimple_phi> (def), halting_phi, evolution_of_loop,
+ limit + 1);
/* Outer loop. */
return t_false;
@@ -1446,7 +1452,7 @@ simplify_peeled_chrec (struct loop *loop, tree arg, tree init_cond)
function from LOOP_PHI_NODE to LOOP_PHI_NODE in the loop. */
static tree
-analyze_evolution_in_loop (gimple loop_phi_node,
+analyze_evolution_in_loop (gimple_phi loop_phi_node,
tree init_cond)
{
int i, n = gimple_phi_num_args (loop_phi_node);
@@ -1541,7 +1547,7 @@ analyze_evolution_in_loop (gimple loop_phi_node,
loop, and leaves this task to the on-demand tree reconstructor. */
static tree
-analyze_initial_condition (gimple loop_phi_node)
+analyze_initial_condition (gimple_phi loop_phi_node)
{
int i, n;
tree init_cond = chrec_not_analyzed_yet;
@@ -1612,7 +1618,7 @@ analyze_initial_condition (gimple loop_phi_node)
/* Analyze the scalar evolution for LOOP_PHI_NODE. */
static tree
-interpret_loop_phi (struct loop *loop, gimple loop_phi_node)
+interpret_loop_phi (struct loop *loop, gimple_phi loop_phi_node)
{
tree res;
struct loop *phi_loop = loop_containing_stmt (loop_phi_node);
@@ -1661,7 +1667,7 @@ interpret_loop_phi (struct loop *loop, gimple loop_phi_node)
analyzed. */
static tree
-interpret_condition_phi (struct loop *loop, gimple condition_phi)
+interpret_condition_phi (struct loop *loop, gimple_phi condition_phi)
{
int i, n = gimple_phi_num_args (condition_phi);
tree res = chrec_not_analyzed_yet;
@@ -1989,9 +1995,9 @@ analyze_scalar_evolution_1 (struct loop *loop, tree var, tree res)
case GIMPLE_PHI:
if (loop_phi_node_p (def))
- res = interpret_loop_phi (loop, def);
+ res = interpret_loop_phi (loop, as_a <gimple_phi> (def));
else
- res = interpret_condition_phi (loop, def);
+ res = interpret_condition_phi (loop, as_a <gimple_phi> (def));
break;
default:
--
1.8.5.3
^ permalink raw reply [flat|nested] 93+ messages in thread
* [gimple-classes, committed 29/92] Use subclasses of gimple in various places
2014-10-27 20:35 [gimple-classes, committed 00/92] Initial slew of commits David Malcolm
` (83 preceding siblings ...)
2014-10-27 20:57 ` [gimple-classes, committed 65/92] Make gimple_phi_arg_location require a gimple_phi David Malcolm
@ 2014-10-27 20:57 ` David Malcolm
2014-10-27 20:57 ` [gimple-classes, committed 53/92] Use gimple_call for callgraph edges David Malcolm
` (6 subsequent siblings)
91 siblings, 0 replies; 93+ messages in thread
From: David Malcolm @ 2014-10-27 20:57 UTC (permalink / raw)
To: gcc-patches; +Cc: David Malcolm
This corresponds to:
[PATCH 31/89] Use subclasses of gimple in various places
https://gcc.gnu.org/ml/gcc-patches/2014-04/msg01171.html
from the original 89-patch kit
That earlier patch was approved by Jeff:
> OK once any prerequisites are in and any renaming done.
in https://gcc.gnu.org/ml/gcc-patches/2014-05/msg00634.html
gcc/
* asan.c (insert_if_then_before_iter): Require a gimple cond
rathern than a plain gimple.
(asan_expand_check_ifn): Add a checked cast to gimple_cond.
* cfgloopmanip.c (create_empty_if_region_on_edge): Likewise.
* omp-low.c (simd_clone_adjust): Strengthen local from gimple
to gimple_phi.
* sese.c (set_ifsese_condition): Strengthen local from gimple to
gimple_cond.
* tree-call-cdce.c (gen_one_condition): Strengthen locals from
gimple to gimple_assign and gimple_cond.
* tree-ssa-phiopt.c (minmax_replacement): Likewise.
(cond_store_replacement): Strengthen locals from gimple to
gimple_phi and gimple_assign.
(cond_if_else_store_replacement_1): Likewise.
* tree-ssa-pre.c (do_regular_insertion): Strengthen local from
gimple to gimple_assign.
* tree-switch-conversion.c (hoist_edge_and_branch_if_true):
Strengthen local from gimple to gimple_cond.
(gen_def_assigns): Return a gimple_assign rather than a plain
gimple.
(gen_inbound_check): Strengthen locals from gimple to gimple_cond
and gimple_assign.
* tree-vect-loop-manip.c (slpeel_add_loop_guard): Strengthen local
from gimple to gimple_cond.
(set_prologue_iterations): Strengthen locals from gimple to
gimple_phi and gimple_cond.
* value-prof.c (gimple_ic): Strengthen local from gimple to
gimple_phi.
(gimple_stringop_fixed_value): Strengthen locals from gimple to
gimple_assign, gimple_cond, gimple_call, and gimple_phi.
---
gcc/ChangeLog.gimple-classes | 44 ++++++++++++++++++++++++++++++++++++++++++++
gcc/asan.c | 7 ++++---
gcc/cfgloopmanip.c | 2 +-
gcc/omp-low.c | 2 +-
gcc/sese.c | 2 +-
gcc/tree-call-cdce.c | 4 +++-
gcc/tree-ssa-phiopt.c | 11 +++++++----
gcc/tree-ssa-pre.c | 7 +++++--
gcc/tree-switch-conversion.c | 10 +++++-----
gcc/tree-vect-loop-manip.c | 6 +++---
gcc/value-prof.c | 10 ++++++----
11 files changed, 80 insertions(+), 25 deletions(-)
diff --git a/gcc/ChangeLog.gimple-classes b/gcc/ChangeLog.gimple-classes
index a7461cd..afdccbe 100644
--- a/gcc/ChangeLog.gimple-classes
+++ b/gcc/ChangeLog.gimple-classes
@@ -1,5 +1,49 @@
2014-10-24 David Malcolm <dmalcolm@redhat.com>
+ Use subclasses of gimple in various places
+
+ * asan.c (insert_if_then_before_iter): Require a gimple cond
+ rathern than a plain gimple.
+ (asan_expand_check_ifn): Add a checked cast to gimple_cond.
+
+ * cfgloopmanip.c (create_empty_if_region_on_edge): Likewise.
+
+ * omp-low.c (simd_clone_adjust): Strengthen local from gimple
+ to gimple_phi.
+
+ * sese.c (set_ifsese_condition): Strengthen local from gimple to
+ gimple_cond.
+
+ * tree-call-cdce.c (gen_one_condition): Strengthen locals from
+ gimple to gimple_assign and gimple_cond.
+
+ * tree-ssa-phiopt.c (minmax_replacement): Likewise.
+ (cond_store_replacement): Strengthen locals from gimple to
+ gimple_phi and gimple_assign.
+ (cond_if_else_store_replacement_1): Likewise.
+
+ * tree-ssa-pre.c (do_regular_insertion): Strengthen local from
+ gimple to gimple_assign.
+
+ * tree-switch-conversion.c (hoist_edge_and_branch_if_true):
+ Strengthen local from gimple to gimple_cond.
+ (gen_def_assigns): Return a gimple_assign rather than a plain
+ gimple.
+ (gen_inbound_check): Strengthen locals from gimple to gimple_cond
+ and gimple_assign.
+
+ * tree-vect-loop-manip.c (slpeel_add_loop_guard): Strengthen local
+ from gimple to gimple_cond.
+ (set_prologue_iterations): Strengthen locals from gimple to
+ gimple_phi and gimple_cond.
+
+ * value-prof.c (gimple_ic): Strengthen local from gimple to
+ gimple_phi.
+ (gimple_stringop_fixed_value): Strengthen locals from gimple to
+ gimple_assign, gimple_cond, gimple_call, and gimple_phi.
+
+2014-10-24 David Malcolm <dmalcolm@redhat.com>
+
Introduce gimple_eh_dispatch
* coretypes.h (gimple_eh_dispatch): New typedef.
diff --git a/gcc/asan.c b/gcc/asan.c
index ad42dd6..be890d6 100644
--- a/gcc/asan.c
+++ b/gcc/asan.c
@@ -1487,7 +1487,7 @@ create_cond_insert_point (gimple_stmt_iterator *iter,
pointing to initially. */
static void
-insert_if_then_before_iter (gimple cond,
+insert_if_then_before_iter (gimple_cond cond,
gimple_stmt_iterator *iter,
bool then_more_likely_p,
basic_block *then_bb,
@@ -2577,8 +2577,9 @@ asan_expand_check_ifn (gimple_stmt_iterator *iter, bool use_calls)
gimple_set_location (g, loc);
basic_block then_bb, fallthrough_bb;
- insert_if_then_before_iter (g, iter, /*then_more_likely_p=*/true,
- &then_bb, &fallthrough_bb);
+ insert_if_then_before_iter (as_a <gimple_cond> (g), iter,
+ /*then_more_likely_p=*/true,
+ &then_bb, &fallthrough_bb);
/* Note that fallthrough_bb starts with the statement that was
pointed to by ITER. */
diff --git a/gcc/cfgloopmanip.c b/gcc/cfgloopmanip.c
index 3fa2535..b0255a0 100644
--- a/gcc/cfgloopmanip.c
+++ b/gcc/cfgloopmanip.c
@@ -690,7 +690,7 @@ create_empty_if_region_on_edge (edge entry_edge, tree condition)
basic_block cond_bb, true_bb, false_bb, join_bb;
edge e_true, e_false, exit_edge;
- gimple cond_stmt;
+ gimple_cond cond_stmt;
tree simple_cond;
gimple_stmt_iterator gsi;
diff --git a/gcc/omp-low.c b/gcc/omp-low.c
index 2c4e992..23cf043 100644
--- a/gcc/omp-low.c
+++ b/gcc/omp-low.c
@@ -12070,7 +12070,7 @@ simd_clone_adjust (struct cgraph_node *node)
make_edge (incr_bb, latch_bb, EDGE_TRUE_VALUE); */
FALLTHRU_EDGE (incr_bb)->flags = EDGE_TRUE_VALUE;
- gimple phi = create_phi_node (iter1, body_bb);
+ gimple_phi phi = create_phi_node (iter1, body_bb);
edge preheader_edge = find_edge (entry_bb, body_bb);
edge latch_edge = single_succ_edge (latch_bb);
add_phi_arg (phi, build_zero_cst (unsigned_type_node), preheader_edge,
diff --git a/gcc/sese.c b/gcc/sese.c
index 33f90c0..5445dc0 100644
--- a/gcc/sese.c
+++ b/gcc/sese.c
@@ -726,7 +726,7 @@ set_ifsese_condition (ifsese if_region, tree condition)
basic_block bb = entry->dest;
gimple last = last_stmt (bb);
gimple_stmt_iterator gsi = gsi_last_bb (bb);
- gimple cond_stmt;
+ gimple_cond cond_stmt;
gcc_assert (gimple_code (last) == GIMPLE_COND);
diff --git a/gcc/tree-call-cdce.c b/gcc/tree-call-cdce.c
index 0a2f563..5dea8db 100644
--- a/gcc/tree-call-cdce.c
+++ b/gcc/tree-call-cdce.c
@@ -332,7 +332,9 @@ gen_one_condition (tree arg, int lbub,
{
tree lbub_real_cst, lbub_cst, float_type;
tree temp, tempn, tempc, tempcn;
- gimple stmt1, stmt2, stmt3;
+ gimple_assign stmt1;
+ gimple_assign stmt2;
+ gimple_cond stmt3;
float_type = TREE_TYPE (arg);
lbub_cst = build_int_cst (integer_type_node, lbub);
diff --git a/gcc/tree-ssa-phiopt.c b/gcc/tree-ssa-phiopt.c
index 48e717a..a767aac 100644
--- a/gcc/tree-ssa-phiopt.c
+++ b/gcc/tree-ssa-phiopt.c
@@ -910,7 +910,8 @@ minmax_replacement (basic_block cond_bb, basic_block middle_bb,
tree arg0, tree arg1)
{
tree result, type;
- gimple cond, new_stmt;
+ gimple_cond cond;
+ gimple_assign new_stmt;
edge true_edge, false_edge;
enum tree_code cmp, minmax, ass_code;
tree smaller, larger, arg_true, arg_false;
@@ -922,7 +923,7 @@ minmax_replacement (basic_block cond_bb, basic_block middle_bb,
if (HONOR_NANS (TYPE_MODE (type)))
return false;
- cond = last_stmt (cond_bb);
+ cond = as_a <gimple_cond> (last_stmt (cond_bb));
cmp = gimple_cond_code (cond);
/* This transformation is only valid for order comparisons. Record which
@@ -1638,7 +1639,8 @@ cond_store_replacement (basic_block middle_bb, basic_block join_bb,
{
gimple assign = last_and_only_stmt (middle_bb);
tree lhs, rhs, name, name2;
- gimple newphi, new_stmt;
+ gimple_phi newphi;
+ gimple_assign new_stmt;
gimple_stmt_iterator gsi;
source_location locus;
@@ -1711,7 +1713,8 @@ cond_if_else_store_replacement_1 (basic_block then_bb, basic_block else_bb,
tree lhs_base, lhs, then_rhs, else_rhs, name;
source_location then_locus, else_locus;
gimple_stmt_iterator gsi;
- gimple newphi, new_stmt;
+ gimple_phi newphi;
+ gimple_assign new_stmt;
if (then_assign == NULL
|| !gimple_assign_single_p (then_assign)
diff --git a/gcc/tree-ssa-pre.c b/gcc/tree-ssa-pre.c
index 7794501..327faa6 100644
--- a/gcc/tree-ssa-pre.c
+++ b/gcc/tree-ssa-pre.c
@@ -3313,8 +3313,11 @@ do_regular_insertion (basic_block block, basic_block dom)
tree temp = make_temp_ssa_name (get_expr_type (expr),
NULL, "pretmp");
- gimple assign = gimple_build_assign (temp,
- edoubleprime->kind == CONSTANT ? PRE_EXPR_CONSTANT (edoubleprime) : PRE_EXPR_NAME (edoubleprime));
+ gimple_assign assign =
+ gimple_build_assign (temp,
+ edoubleprime->kind == CONSTANT ?
+ PRE_EXPR_CONSTANT (edoubleprime) :
+ PRE_EXPR_NAME (edoubleprime));
gimple_stmt_iterator gsi = gsi_after_labels (block);
gsi_insert_before (&gsi, assign, GSI_NEW_STMT);
diff --git a/gcc/tree-switch-conversion.c b/gcc/tree-switch-conversion.c
index 424d196..89d4a01 100644
--- a/gcc/tree-switch-conversion.c
+++ b/gcc/tree-switch-conversion.c
@@ -85,7 +85,7 @@ hoist_edge_and_branch_if_true (gimple_stmt_iterator *gsip,
bool update_dominators)
{
tree tmp;
- gimple cond_stmt;
+ gimple_cond cond_stmt;
edge e_false;
basic_block new_bb, split_bb = gsi_bb (*gsip);
bool dominated_e_true = false;
@@ -1156,11 +1156,11 @@ build_arrays (gimple_switch swtch, struct switch_conv_info *info)
/* Generates and appropriately inserts loads of default values at the position
given by BSI. Returns the last inserted statement. */
-static gimple
+static gimple_assign
gen_def_assigns (gimple_stmt_iterator *gsi, struct switch_conv_info *info)
{
int i;
- gimple assign = NULL;
+ gimple_assign assign = NULL;
for (i = 0; i < info->phi_count; i++)
{
@@ -1247,9 +1247,9 @@ gen_inbound_check (gimple_switch swtch, struct switch_conv_info *info)
tree utype, tidx;
tree bound;
- gimple cond_stmt;
+ gimple_cond cond_stmt;
- gimple last_assign;
+ gimple_assign last_assign;
gimple_stmt_iterator gsi;
basic_block bb0, bb1, bb2, bbf, bbd;
edge e01, e02, e21, e1d, e1f, e2f;
diff --git a/gcc/tree-vect-loop-manip.c b/gcc/tree-vect-loop-manip.c
index fd60ea1..db565a4 100644
--- a/gcc/tree-vect-loop-manip.c
+++ b/gcc/tree-vect-loop-manip.c
@@ -929,7 +929,7 @@ slpeel_add_loop_guard (basic_block guard_bb, tree cond,
{
gimple_stmt_iterator gsi;
edge new_e, enter_e;
- gimple cond_stmt;
+ gimple_cond cond_stmt;
gimple_seq gimplify_stmt_list = NULL;
enter_e = EDGE_SUCC (guard_bb, 0);
@@ -1042,9 +1042,9 @@ set_prologue_iterations (basic_block bb_before_first_loop,
basic_block cond_bb, then_bb;
tree var, prologue_after_cost_adjust_name;
gimple_stmt_iterator gsi;
- gimple newphi;
+ gimple_phi newphi;
edge e_true, e_false, e_fallthru;
- gimple cond_stmt;
+ gimple_cond cond_stmt;
gimple_seq stmts = NULL;
tree cost_pre_condition = NULL_TREE;
tree scalar_loop_iters =
diff --git a/gcc/value-prof.c b/gcc/value-prof.c
index e8f9f73..0b2ec7f 100644
--- a/gcc/value-prof.c
+++ b/gcc/value-prof.c
@@ -1468,7 +1468,7 @@ gimple_ic (gimple icall_stmt, struct cgraph_node *direct_call,
&& (dflags & ECF_NORETURN) == 0)
{
tree result = gimple_call_lhs (icall_stmt);
- gimple phi = create_phi_node (result, join_bb);
+ gimple_phi phi = create_phi_node (result, join_bb);
gimple_call_set_lhs (icall_stmt,
duplicate_ssa_name (result, icall_stmt));
add_phi_arg (phi, gimple_call_lhs (icall_stmt), e_ij, UNKNOWN_LOCATION);
@@ -1636,7 +1636,9 @@ static void
gimple_stringop_fixed_value (gimple_call vcall_stmt, tree icall_size, int prob,
gcov_type count, gcov_type all)
{
- gimple tmp_stmt, cond_stmt, icall_stmt;
+ gimple_assign tmp_stmt;
+ gimple_cond cond_stmt;
+ gimple_call icall_stmt;
tree tmp0, tmp1, vcall_size, optype;
basic_block cond_bb, icall_bb, vcall_bb, join_bb;
edge e_ci, e_cv, e_iv, e_ij, e_vj;
@@ -1668,7 +1670,7 @@ gimple_stringop_fixed_value (gimple_call vcall_stmt, tree icall_size, int prob,
gimple_set_vdef (vcall_stmt, NULL);
gimple_set_vuse (vcall_stmt, NULL);
update_stmt (vcall_stmt);
- icall_stmt = gimple_copy (vcall_stmt);
+ icall_stmt = as_a <gimple_call> (gimple_copy (vcall_stmt));
gimple_call_set_arg (icall_stmt, size_arg, icall_size);
gsi_insert_before (&gsi, icall_stmt, GSI_SAME_STMT);
@@ -1708,7 +1710,7 @@ gimple_stringop_fixed_value (gimple_call vcall_stmt, tree icall_size, int prob,
&& TREE_CODE (gimple_call_lhs (vcall_stmt)) == SSA_NAME)
{
tree result = gimple_call_lhs (vcall_stmt);
- gimple phi = create_phi_node (result, join_bb);
+ gimple_phi phi = create_phi_node (result, join_bb);
gimple_call_set_lhs (vcall_stmt,
duplicate_ssa_name (result, vcall_stmt));
add_phi_arg (phi, gimple_call_lhs (vcall_stmt), e_vj, UNKNOWN_LOCATION);
--
1.8.5.3
^ permalink raw reply [flat|nested] 93+ messages in thread
* [gimple-classes, committed 17/92] Concretize get_loop_exit_condition et al to working on gimple_cond
2014-10-27 20:35 [gimple-classes, committed 00/92] Initial slew of commits David Malcolm
` (88 preceding siblings ...)
2014-10-27 20:57 ` [gimple-classes, committed 08/92] Introduce gimple_phi_iterator David Malcolm
@ 2014-10-27 20:57 ` David Malcolm
2014-10-27 20:57 ` [gimple-classes, committed 16/92] Update various expressions within tree-scalar-evolution.c to be gimple_phi David Malcolm
2014-10-27 21:32 ` [gimple-classes, committed 55/92] Concretize parameter to gimple_call_copy_skip_args David Malcolm
91 siblings, 0 replies; 93+ messages in thread
From: David Malcolm @ 2014-10-27 20:57 UTC (permalink / raw)
To: gcc-patches; +Cc: David Malcolm
This corresponds to:
[PATCH 18/89] Concretize get_loop_exit_condition et al to working on gimple_cond
https://gcc.gnu.org/ml/gcc-patches/2014-04/msg01215.html
from the original 89-patch kit
That earlier patch was approved by Jeff:
> OK when prerequisites have gone in.
> Actually that's true for #17 & #18 as well.
in https://gcc.gnu.org/ml/gcc-patches/2014-05/msg00626.html
gcc/
* tree-scalar-evolution.h (get_loop_exit_condition): Return a
gimple_cond.
* tree-scalar-evolution.c (get_loop_exit_condition): Likewise, also
concretizing local "res" from gimple to gimple_cond.
* tree-vect-loop-manip.c (slpeel_make_loop_iterate_ntimes): Convert
locals from gimple to gimple_cond.
(slpeel_can_duplicate_loop_p): Likewise.
* tree-vect-loop.c (vect_get_loop_niters): Return a gimple_cond.
(vect_analyze_loop_form): Convert local from gimple to gimple_cond.
---
gcc/ChangeLog.gimple-classes | 14 ++++++++++++++
gcc/tree-scalar-evolution.c | 8 ++++----
gcc/tree-scalar-evolution.h | 2 +-
gcc/tree-vect-loop-manip.c | 6 +++---
gcc/tree-vect-loop.c | 5 +++--
5 files changed, 25 insertions(+), 10 deletions(-)
diff --git a/gcc/ChangeLog.gimple-classes b/gcc/ChangeLog.gimple-classes
index c28facc..627e6a2 100644
--- a/gcc/ChangeLog.gimple-classes
+++ b/gcc/ChangeLog.gimple-classes
@@ -1,5 +1,19 @@
2014-10-24 David Malcolm <dmalcolm@redhat.com>
+ Concretize get_loop_exit_condition et al to working on gimple_cond
+
+ * tree-scalar-evolution.h (get_loop_exit_condition): Return a
+ gimple_cond.
+ * tree-scalar-evolution.c (get_loop_exit_condition): Likewise, also
+ concretizing local "res" from gimple to gimple_cond.
+ * tree-vect-loop-manip.c (slpeel_make_loop_iterate_ntimes): Convert
+ locals from gimple to gimple_cond.
+ (slpeel_can_duplicate_loop_p): Likewise.
+ * tree-vect-loop.c (vect_get_loop_niters): Return a gimple_cond.
+ (vect_analyze_loop_form): Convert local from gimple to gimple_cond.
+
+2014-10-24 David Malcolm <dmalcolm@redhat.com>
+
Update various expressions within tree-scalar-evolution.c to be gimple_phi
* tree-scalar-evolution.c (follow_ssa_edge): Require a gimple_phi,
diff --git a/gcc/tree-scalar-evolution.c b/gcc/tree-scalar-evolution.c
index 7ffa241..cff820f 100644
--- a/gcc/tree-scalar-evolution.c
+++ b/gcc/tree-scalar-evolution.c
@@ -867,10 +867,10 @@ add_to_evolution (unsigned loop_nb, tree chrec_before, enum tree_code code,
guards the exit edge. If the expression is too difficult to
analyze, then give up. */
-gimple
+gimple_cond
get_loop_exit_condition (const struct loop *loop)
{
- gimple res = NULL;
+ gimple_cond res = NULL;
edge exit_edge = single_exit (loop);
if (dump_file && (dump_flags & TDF_SCEV))
@@ -881,8 +881,8 @@ get_loop_exit_condition (const struct loop *loop)
gimple stmt;
stmt = last_stmt (exit_edge->src);
- if (gimple_code (stmt) == GIMPLE_COND)
- res = stmt;
+ if (gimple_cond cond_stmt = dyn_cast <gimple_cond> (stmt))
+ res = cond_stmt;
}
if (dump_file && (dump_flags & TDF_SCEV))
diff --git a/gcc/tree-scalar-evolution.h b/gcc/tree-scalar-evolution.h
index 5569976..3466a75 100644
--- a/gcc/tree-scalar-evolution.h
+++ b/gcc/tree-scalar-evolution.h
@@ -22,7 +22,7 @@ along with GCC; see the file COPYING3. If not see
#define GCC_TREE_SCALAR_EVOLUTION_H
extern tree number_of_latch_executions (struct loop *);
-extern gimple get_loop_exit_condition (const struct loop *);
+extern gimple_cond get_loop_exit_condition (const struct loop *);
extern void scev_initialize (void);
extern bool scev_initialized_p (void);
diff --git a/gcc/tree-vect-loop-manip.c b/gcc/tree-vect-loop-manip.c
index 46e18fe..fd60ea1 100644
--- a/gcc/tree-vect-loop-manip.c
+++ b/gcc/tree-vect-loop-manip.c
@@ -667,8 +667,8 @@ void
slpeel_make_loop_iterate_ntimes (struct loop *loop, tree niters)
{
tree indx_before_incr, indx_after_incr;
- gimple cond_stmt;
- gimple orig_cond;
+ gimple_cond cond_stmt;
+ gimple_cond orig_cond;
edge exit_edge = single_exit (loop);
gimple_stmt_iterator loop_cond_gsi;
gimple_stmt_iterator incr_gsi;
@@ -974,7 +974,7 @@ slpeel_can_duplicate_loop_p (const struct loop *loop, const_edge e)
{
edge exit_e = single_exit (loop);
edge entry_e = loop_preheader_edge (loop);
- gimple orig_cond = get_loop_exit_condition (loop);
+ gimple_cond orig_cond = get_loop_exit_condition (loop);
gimple_stmt_iterator loop_exit_gsi = gsi_last_bb (exit_e->src);
if (loop->inner
diff --git a/gcc/tree-vect-loop.c b/gcc/tree-vect-loop.c
index 5e56d1b..560143e 100644
--- a/gcc/tree-vect-loop.c
+++ b/gcc/tree-vect-loop.c
@@ -805,7 +805,8 @@ vect_analyze_scalar_cycles (loop_vec_info loop_vinfo)
Return the loop exit condition. */
-static gimple
+
+static gimple_cond
vect_get_loop_niters (struct loop *loop, tree *number_of_iterations,
tree *number_of_iterationsm1)
{
@@ -1085,7 +1086,7 @@ loop_vec_info
vect_analyze_loop_form (struct loop *loop)
{
loop_vec_info loop_vinfo;
- gimple loop_cond;
+ gimple_cond loop_cond;
tree number_of_iterations = NULL, number_of_iterationsm1 = NULL;
loop_vec_info inner_loop_vinfo = NULL;
--
1.8.5.3
^ permalink raw reply [flat|nested] 93+ messages in thread
* [gimple-classes, committed 08/92] Introduce gimple_phi_iterator
2014-10-27 20:35 [gimple-classes, committed 00/92] Initial slew of commits David Malcolm
` (87 preceding siblings ...)
2014-10-27 20:57 ` [gimple-classes, committed 91/92] Remove out-of-date references to typedefs David Malcolm
@ 2014-10-27 20:57 ` David Malcolm
2014-10-27 20:57 ` [gimple-classes, committed 17/92] Concretize get_loop_exit_condition et al to working on gimple_cond David Malcolm
` (2 subsequent siblings)
91 siblings, 0 replies; 93+ messages in thread
From: David Malcolm @ 2014-10-27 20:57 UTC (permalink / raw)
To: gcc-patches; +Cc: David Malcolm
This corresponds to:
[PATCH 09/89] Introduce gimple_phi_iterator
https://gcc.gnu.org/ml/gcc-patches/2014-04/msg01219.html
from the original 89-patch kit
That earlier patch was approved by Jeff:
> OK once prerequisites have gone in.
in https://gcc.gnu.org/ml/gcc-patches/2014-05/msg00630.html
gcc/
* gimple-iterator.h (struct gimple_phi_iterator): New subclass of
gimple_stmt_iterator with identical layout, but adding...
(gimple_phi_iterator::phi): ...new method, equivalent to
gsi_stmt (), but casting the underlying gimple to gimple_phi,
checking that code == GIMPLE_PHI in a checked build.
(gsi_start_phis): Return a gimple_phi_iterator, rather than just a
gimple_stmt_iterator.
* tree-if-conv.c (bb_with_exit_edge_p): Require a gimple_phi rather
than just a gimple.
(if_convertible_phi_p): Likewise.
* tree-phinodes.h (add_phi_node_to_bb): Likewise.
* tree-ssa-phiprop.c (propagate_with_phi): Likewise.
* tree-ssa-uninit.c (warn_uninitialized_phi): Require a gimple_phi
and a vec<gimple_phi> *, rather than just a gimple and
vec<gimple> *, and a hash_set<gimple_phi> * rather than a
hash_set<gimple> *.
(find_uninit_use): Likewise; add checked cast to gimple_phi when
adding to worklist.
(pass_late_warn_uninitialized::execute): Strengthen types of
various locals, "worklist" from vec<gimple> to vec<gimple_phi>,
"gsi" to a gimple_phi_iterator, "phi" and "cur_phi" to a
gimple_phi, "added_to_worklist" from hash_set<gimple> to
hash_set<gimple_phi>.
* tree-ssa-loop-manip.c (rewrite_phi_with_iv): Require a
gimple_phi_iterator * rather than a gimple_stmt_iterator *;
use it to strengthen local from a gimple to a gimple_phi.
* cfgloop.c (find_subloop_latch_edge_by_ivs): Convert local from a
gimple_stmt_iterator to a gimple_phi_iterator. Use the iterator's
"phi" method rather than gsi_stmt. Use this checked cast to convert
the type of related local from a plain gimple to a gimple_phi.
* gimple-pretty-print.c (dump_phi_nodes): Likewise.
* gimple-ssa-isolate-paths.c (find_implicit_erroneous_behaviour):
Likewise.
* sese.c (sese_add_exit_phis_edge): Likewise.
* tree-cfg.c (reinstall_phi_args): Likewise.
(gimple_make_forwarder_block): Likewise.
(add_phi_args_after_copy_edge): Likewise.
(gimple_lv_adjust_loop_header_phi): Likewise.
* tree-cfgcleanup.c (phi_alternatives_equal): Likewise.
(remove_forwarder_block_with_phi): Likewise.
(merge_phi_nodes): Likewise.
* tree-complex.c (update_phi_components): Likewise.
* tree-if-conv.c (if_convertible_loop_p_1): Likewise.
* tree-inline.c (update_ssa_across_abnormal_edges): Likewise.
(copy_phis_for_bb): Likewise.
* tree-into-ssa.c (rewrite_add_phi_arguments): Likewise.
* tree-outof-ssa.c (eliminate_build): Likewise.
(eliminate_useless_phis): Likewise.
(rewrite_trees): Likewise.
(insert_backedge_copies): Likewise.
* tree-phinodes.c (reserve_phi_args_for_new_edge): Likewise.
(remove_phi_args): Likewise.
(remove_phi_nodes): Likewise.
* tree-predcom.c (find_looparound_phi): Likewise.
(eliminate_temp_copies): Likewise.
* tree-scalar-evolution.c (loop_closed_phi_def): Likewise.
(scev_const_prop): Likewise; also, add checked cast to phi.
* tree-ssa-coalesce.c (coalesce_partitions): Likewise.
* tree-ssa-dce.c (remove_dead_phis): Likewise.
(forward_edge_to_pdom): Likewise.
* tree-ssa-dom.c (record_equivalences_from_phis): Likewise.
(cprop_into_successor_phis): Likewise.
(propagate_rhs_into_lhs): Likewise.
(eliminate_degenerate_phis_1): Likewise.
* tree-ssa-ifcombine.c (same_phi_args_p): Likewise.
* tree-ssa-live.c (calculate_live_on_exit): Likewise.
(verify_live_on_entry): Likewise.
* tree-ssa-loop-im.c
(move_computations_dom_walker::before_dom_children): Likewise.
* tree-ssa-loop-ivopts.c (find_bivs): Likewise.
(mark_bivs): Likewise.
(find_interesting_uses_outside): Likewise.
(determine_set_costs): Likewise.
* tree-ssa-loop-manip.c (split_loop_exit_edge): Likewise.
(tree_transform_and_unroll_loop): Likewise.
(rewrite_all_phi_nodes_with_iv): Likewise.
(canonicalize_loop_ivs): Likewise.
* tree-ssa-loop-niter.c (determine_value_range): Likewise.
* tree-ssa-phiopt.c (hoist_adjacent_loads): Likewise.
* tree-ssa-phiprop.c (tree_ssa_phiprop): Likewise.
* tree-ssa-reassoc.c (suitable_cond_bb): Likewise.
* tree-ssa-tail-merge.c (same_phi_alternatives_1): Likewise.
(vop_phi): Likewise.
* tree-ssa-threadedge.c (record_temporary_equivalences_from_phis):
Likewise.
* tree-ssa-threadupdate.c (copy_phi_arg_into_existing_phi): Likewise.
(copy_phi_args): Likewise.
(phi_args_equal_on_edges): Likewise.
* tree-ssa.c (ssa_redirect_edge): Likewise.
(flush_pending_stmts): Likewise.
* tree-switch-conversion.c (check_final_bb): Likewise.
(gather_default_values): Likewise.
(build_constructors): Likewise.
(fix_phi_nodes): Likewise.
* tree-tailcall.c (propagate_through_phis): Likewise.
(add_successor_phi_arg): Likewise.
* tree-vect-loop-manip.c (slpeel_update_phi_nodes_for_guard1):
Likewise.
(slpeel_update_phi_nodes_for_guard2): Likewise.
(slpeel_tree_peel_loop_to_edge): Likewise.
(vect_can_advance_ivs_p): Likewise.
(vect_update_ivs_after_vectorizer): Likewise.
* tree-vect-loop.c (vect_analyze_scalar_cycles_1): Likewise.
* tree-vrp.c (find_assert_locations): Likewise.
* value-prof.c (gimple_ic): Likewise.
* omp-low.c (expand_parallel_call): Convert local to a gimple_phi.
---
gcc/ChangeLog.gimple-classes | 116 +++++++++++++++++++++++++++++++++++++++++
gcc/cfgloop.c | 6 +--
gcc/gimple-iterator.c | 12 ++++-
gcc/gimple-iterator.h | 11 +++-
gcc/gimple-pretty-print.c | 6 +--
gcc/gimple-ssa-isolate-paths.c | 4 +-
gcc/omp-low.c | 2 +-
gcc/sese.c | 2 +-
gcc/tree-cfg.c | 26 ++++-----
gcc/tree-cfgcleanup.c | 12 ++---
gcc/tree-complex.c | 4 +-
gcc/tree-if-conv.c | 6 +--
gcc/tree-inline.c | 14 ++---
gcc/tree-into-ssa.c | 6 +--
gcc/tree-outof-ssa.c | 16 +++---
gcc/tree-phinodes.c | 12 ++---
gcc/tree-phinodes.h | 2 +-
gcc/tree-predcom.c | 14 ++---
gcc/tree-scalar-evolution.c | 17 +++---
gcc/tree-ssa-coalesce.c | 4 +-
gcc/tree-ssa-dce.c | 10 ++--
gcc/tree-ssa-dom.c | 17 +++---
gcc/tree-ssa-ifcombine.c | 6 +--
gcc/tree-ssa-live.c | 8 +--
gcc/tree-ssa-loop-im.c | 4 +-
gcc/tree-ssa-loop-ivopts.c | 20 +++----
gcc/tree-ssa-loop-manip.c | 24 +++++----
gcc/tree-ssa-loop-niter.c | 4 +-
gcc/tree-ssa-phiopt.c | 4 +-
gcc/tree-ssa-phiprop.c | 6 +--
gcc/tree-ssa-reassoc.c | 4 +-
gcc/tree-ssa-tail-merge.c | 8 +--
gcc/tree-ssa-threadedge.c | 4 +-
gcc/tree-ssa-threadupdate.c | 16 +++---
gcc/tree-ssa-uninit.c | 24 ++++-----
gcc/tree-ssa.c | 12 ++---
gcc/tree-switch-conversion.c | 16 +++---
gcc/tree-tailcall.c | 8 +--
gcc/tree-vect-loop-manip.c | 34 ++++++------
gcc/tree-vect-loop.c | 4 +-
gcc/tree-vrp.c | 4 +-
gcc/value-prof.c | 4 +-
42 files changed, 336 insertions(+), 197 deletions(-)
diff --git a/gcc/ChangeLog.gimple-classes b/gcc/ChangeLog.gimple-classes
index 7c2b168..33a4f87 100644
--- a/gcc/ChangeLog.gimple-classes
+++ b/gcc/ChangeLog.gimple-classes
@@ -1,5 +1,121 @@
2014-10-24 David Malcolm <dmalcolm@redhat.com>
+ Introduce gimple_phi_iterator
+
+ * gimple-iterator.h (struct gimple_phi_iterator): New subclass of
+ gimple_stmt_iterator with identical layout, but adding...
+ (gimple_phi_iterator::phi): ...new method, equivalent to
+ gsi_stmt (), but casting the underlying gimple to gimple_phi,
+ checking that code == GIMPLE_PHI in a checked build.
+ (gsi_start_phis): Return a gimple_phi_iterator, rather than just a
+ gimple_stmt_iterator.
+
+ * tree-if-conv.c (bb_with_exit_edge_p): Require a gimple_phi rather
+ than just a gimple.
+ (if_convertible_phi_p): Likewise.
+ * tree-phinodes.h (add_phi_node_to_bb): Likewise.
+ * tree-ssa-phiprop.c (propagate_with_phi): Likewise.
+
+ * tree-ssa-uninit.c (warn_uninitialized_phi): Require a gimple_phi
+ and a vec<gimple_phi> *, rather than just a gimple and
+ vec<gimple> *, and a hash_set<gimple_phi> * rather than a
+ hash_set<gimple> *.
+ (find_uninit_use): Likewise; add checked cast to gimple_phi when
+ adding to worklist.
+ (pass_late_warn_uninitialized::execute): Strengthen types of
+ various locals, "worklist" from vec<gimple> to vec<gimple_phi>,
+ "gsi" to a gimple_phi_iterator, "phi" and "cur_phi" to a
+ gimple_phi, "added_to_worklist" from hash_set<gimple> to
+ hash_set<gimple_phi>.
+
+ * tree-ssa-loop-manip.c (rewrite_phi_with_iv): Require a
+ gimple_phi_iterator * rather than a gimple_stmt_iterator *;
+ use it to strengthen local from a gimple to a gimple_phi.
+
+ * cfgloop.c (find_subloop_latch_edge_by_ivs): Convert local from a
+ gimple_stmt_iterator to a gimple_phi_iterator. Use the iterator's
+ "phi" method rather than gsi_stmt. Use this checked cast to convert
+ the type of related local from a plain gimple to a gimple_phi.
+ * gimple-pretty-print.c (dump_phi_nodes): Likewise.
+ * gimple-ssa-isolate-paths.c (find_implicit_erroneous_behaviour):
+ Likewise.
+ * sese.c (sese_add_exit_phis_edge): Likewise.
+ * tree-cfg.c (reinstall_phi_args): Likewise.
+ (gimple_make_forwarder_block): Likewise.
+ (add_phi_args_after_copy_edge): Likewise.
+ (gimple_lv_adjust_loop_header_phi): Likewise.
+ * tree-cfgcleanup.c (phi_alternatives_equal): Likewise.
+ (remove_forwarder_block_with_phi): Likewise.
+ (merge_phi_nodes): Likewise.
+ * tree-complex.c (update_phi_components): Likewise.
+ * tree-if-conv.c (if_convertible_loop_p_1): Likewise.
+ * tree-inline.c (update_ssa_across_abnormal_edges): Likewise.
+ (copy_phis_for_bb): Likewise.
+ * tree-into-ssa.c (rewrite_add_phi_arguments): Likewise.
+ * tree-outof-ssa.c (eliminate_build): Likewise.
+ (eliminate_useless_phis): Likewise.
+ (rewrite_trees): Likewise.
+ (insert_backedge_copies): Likewise.
+ * tree-phinodes.c (reserve_phi_args_for_new_edge): Likewise.
+ (remove_phi_args): Likewise.
+ (remove_phi_nodes): Likewise.
+ * tree-predcom.c (find_looparound_phi): Likewise.
+ (eliminate_temp_copies): Likewise.
+ * tree-scalar-evolution.c (loop_closed_phi_def): Likewise.
+ (scev_const_prop): Likewise; also, add checked cast to phi.
+ * tree-ssa-coalesce.c (coalesce_partitions): Likewise.
+ * tree-ssa-dce.c (remove_dead_phis): Likewise.
+ (forward_edge_to_pdom): Likewise.
+ * tree-ssa-dom.c (record_equivalences_from_phis): Likewise.
+ (cprop_into_successor_phis): Likewise.
+ (propagate_rhs_into_lhs): Likewise.
+ (eliminate_degenerate_phis_1): Likewise.
+ * tree-ssa-ifcombine.c (same_phi_args_p): Likewise.
+ * tree-ssa-live.c (calculate_live_on_exit): Likewise.
+ (verify_live_on_entry): Likewise.
+ * tree-ssa-loop-im.c
+ (move_computations_dom_walker::before_dom_children): Likewise.
+ * tree-ssa-loop-ivopts.c (find_bivs): Likewise.
+ (mark_bivs): Likewise.
+ (find_interesting_uses_outside): Likewise.
+ (determine_set_costs): Likewise.
+ * tree-ssa-loop-manip.c (split_loop_exit_edge): Likewise.
+ (tree_transform_and_unroll_loop): Likewise.
+ (rewrite_all_phi_nodes_with_iv): Likewise.
+ (canonicalize_loop_ivs): Likewise.
+ * tree-ssa-loop-niter.c (determine_value_range): Likewise.
+ * tree-ssa-phiopt.c (hoist_adjacent_loads): Likewise.
+ * tree-ssa-phiprop.c (tree_ssa_phiprop): Likewise.
+ * tree-ssa-reassoc.c (suitable_cond_bb): Likewise.
+ * tree-ssa-tail-merge.c (same_phi_alternatives_1): Likewise.
+ (vop_phi): Likewise.
+ * tree-ssa-threadedge.c (record_temporary_equivalences_from_phis):
+ Likewise.
+ * tree-ssa-threadupdate.c (copy_phi_arg_into_existing_phi): Likewise.
+ (copy_phi_args): Likewise.
+ (phi_args_equal_on_edges): Likewise.
+ * tree-ssa.c (ssa_redirect_edge): Likewise.
+ (flush_pending_stmts): Likewise.
+ * tree-switch-conversion.c (check_final_bb): Likewise.
+ (gather_default_values): Likewise.
+ (build_constructors): Likewise.
+ (fix_phi_nodes): Likewise.
+ * tree-tailcall.c (propagate_through_phis): Likewise.
+ (add_successor_phi_arg): Likewise.
+ * tree-vect-loop-manip.c (slpeel_update_phi_nodes_for_guard1):
+ Likewise.
+ (slpeel_update_phi_nodes_for_guard2): Likewise.
+ (slpeel_tree_peel_loop_to_edge): Likewise.
+ (vect_can_advance_ivs_p): Likewise.
+ (vect_update_ivs_after_vectorizer): Likewise.
+ * tree-vect-loop.c (vect_analyze_scalar_cycles_1): Likewise.
+ * tree-vrp.c (find_assert_locations): Likewise.
+ * value-prof.c (gimple_ic): Likewise.
+
+ * omp-low.c (expand_parallel_call): Convert local to a gimple_phi.
+
+2014-10-24 David Malcolm <dmalcolm@redhat.com>
+
Introduce gimple_phi and use it in various places
* coretypes.h (gimple_phi): New typedef.
diff --git a/gcc/cfgloop.c b/gcc/cfgloop.c
index 0eaadde..ed05d32 100644
--- a/gcc/cfgloop.c
+++ b/gcc/cfgloop.c
@@ -578,8 +578,8 @@ find_subloop_latch_edge_by_ivs (struct loop *loop ATTRIBUTE_UNUSED, vec<edge> la
{
edge e, latch = latches[0];
unsigned i;
- gimple phi;
- gimple_stmt_iterator psi;
+ gimple_phi phi;
+ gimple_phi_iterator psi;
tree lop;
basic_block bb;
@@ -597,7 +597,7 @@ find_subloop_latch_edge_by_ivs (struct loop *loop ATTRIBUTE_UNUSED, vec<edge> la
a subloop. */
for (psi = gsi_start_phis (loop->header); !gsi_end_p (psi); gsi_next (&psi))
{
- phi = gsi_stmt (psi);
+ phi = psi.phi ();
lop = PHI_ARG_DEF_FROM_EDGE (phi, latch);
/* Ignore the values that are not changed inside the subloop. */
diff --git a/gcc/gimple-iterator.c b/gcc/gimple-iterator.c
index 7077dce..ecea718 100644
--- a/gcc/gimple-iterator.c
+++ b/gcc/gimple-iterator.c
@@ -886,9 +886,17 @@ gsi_commit_one_edge_insert (edge e, basic_block *new_bb)
/* Returns iterator at the start of the list of phi nodes of BB. */
-gimple_stmt_iterator
+gimple_phi_iterator
gsi_start_phis (basic_block bb)
{
gimple_seq *pseq = phi_nodes_ptr (bb);
- return gsi_start_1 (pseq);
+
+ /* Adapted from gsi_start_1. */
+ gimple_phi_iterator i;
+
+ i.ptr = gimple_seq_first (*pseq);
+ i.seq = pseq;
+ i.bb = i.ptr ? gimple_bb (i.ptr) : NULL;
+
+ return i;
}
diff --git a/gcc/gimple-iterator.h b/gcc/gimple-iterator.h
index b117b4b..b038dfb 100644
--- a/gcc/gimple-iterator.h
+++ b/gcc/gimple-iterator.h
@@ -34,6 +34,15 @@ struct gimple_stmt_iterator
gimple_seq *seq;
basic_block bb;
};
+
+/* Iterator over GIMPLE_PHI statements. */
+struct gimple_phi_iterator : public gimple_stmt_iterator
+{
+ gimple_phi phi () const
+ {
+ return as_a <gimple_phi> (ptr);
+ }
+};
enum gsi_iterator_update
{
@@ -79,7 +88,7 @@ extern basic_block gsi_insert_on_edge_immediate (edge, gimple);
extern basic_block gsi_insert_seq_on_edge_immediate (edge, gimple_seq);
extern void gsi_commit_edge_inserts (void);
extern void gsi_commit_one_edge_insert (edge, basic_block *);
-extern gimple_stmt_iterator gsi_start_phis (basic_block);
+extern gimple_phi_iterator gsi_start_phis (basic_block);
/* Return a new iterator pointing to GIMPLE_SEQ's first statement. */
diff --git a/gcc/gimple-pretty-print.c b/gcc/gimple-pretty-print.c
index 51754c3..b5875b7 100644
--- a/gcc/gimple-pretty-print.c
+++ b/gcc/gimple-pretty-print.c
@@ -2297,15 +2297,15 @@ dump_gimple_bb_footer (FILE *outf ATTRIBUTE_UNUSED,
static void
dump_phi_nodes (pretty_printer *buffer, basic_block bb, int indent, int flags)
{
- gimple_stmt_iterator i;
+ gimple_phi_iterator i;
for (i = gsi_start_phis (bb); !gsi_end_p (i); gsi_next (&i))
{
- gimple phi = gsi_stmt (i);
+ gimple_phi phi = i.phi ();
if (!virtual_operand_p (gimple_phi_result (phi)) || (flags & TDF_VOPS))
{
INDENT (indent);
- dump_gimple_phi (buffer, as_a <gimple_phi> (phi), indent, true, flags);
+ dump_gimple_phi (buffer, phi, indent, true, flags);
pp_newline (buffer);
}
}
diff --git a/gcc/gimple-ssa-isolate-paths.c b/gcc/gimple-ssa-isolate-paths.c
index 0b62915..8016db4 100644
--- a/gcc/gimple-ssa-isolate-paths.c
+++ b/gcc/gimple-ssa-isolate-paths.c
@@ -232,7 +232,7 @@ find_implicit_erroneous_behaviour (void)
FOR_EACH_BB_FN (bb, cfun)
{
- gimple_stmt_iterator si;
+ gimple_phi_iterator si;
/* Out of an abundance of caution, do not isolate paths to a
block where the block has any abnormal outgoing edges.
@@ -251,7 +251,7 @@ find_implicit_erroneous_behaviour (void)
cases. */
for (si = gsi_start_phis (bb); !gsi_end_p (si); gsi_next (&si))
{
- gimple phi = gsi_stmt (si);
+ gimple_phi phi = si.phi ();
tree lhs = gimple_phi_result (phi);
/* If the result is not a pointer, then there is no need to
diff --git a/gcc/omp-low.c b/gcc/omp-low.c
index f084542..ffec0d0 100644
--- a/gcc/omp-low.c
+++ b/gcc/omp-low.c
@@ -4483,7 +4483,7 @@ expand_parallel_call (struct omp_region *region, basic_block bb,
if (gimple_in_ssa_p (cfun))
{
- gimple phi = create_phi_node (tmp_join, bb);
+ gimple_phi phi = create_phi_node (tmp_join, bb);
add_phi_arg (phi, tmp_then, e_then, UNKNOWN_LOCATION);
add_phi_arg (phi, tmp_else, e_else, UNKNOWN_LOCATION);
}
diff --git a/gcc/sese.c b/gcc/sese.c
index 71a752e..33f90c0 100644
--- a/gcc/sese.c
+++ b/gcc/sese.c
@@ -307,7 +307,7 @@ free_sese (sese region)
static void
sese_add_exit_phis_edge (basic_block exit, tree use, edge false_e, edge true_e)
{
- gimple phi = create_phi_node (NULL_TREE, exit);
+ gimple_phi phi = create_phi_node (NULL_TREE, exit);
create_new_def_for (use, phi, gimple_phi_result_ptr (phi));
add_phi_arg (phi, use, false_e, UNKNOWN_LOCATION);
add_phi_arg (phi, use, true_e, UNKNOWN_LOCATION);
diff --git a/gcc/tree-cfg.c b/gcc/tree-cfg.c
index 4652237..736c451 100644
--- a/gcc/tree-cfg.c
+++ b/gcc/tree-cfg.c
@@ -2588,7 +2588,7 @@ reinstall_phi_args (edge new_edge, edge old_edge)
{
edge_var_map *vm;
int i;
- gimple_stmt_iterator phis;
+ gimple_phi_iterator phis;
vec<edge_var_map> *v = redirect_edge_var_map_vector (old_edge);
if (!v)
@@ -2598,7 +2598,7 @@ reinstall_phi_args (edge new_edge, edge old_edge)
v->iterate (i, &vm) && !gsi_end_p (phis);
i++, gsi_next (&phis))
{
- gimple phi = gsi_stmt (phis);
+ gimple_phi phi = phis.phi ();
tree result = redirect_edge_var_map_result (vm);
tree arg = redirect_edge_var_map_def (vm);
@@ -5342,7 +5342,7 @@ gimple_make_forwarder_block (edge fallthru)
edge_iterator ei;
basic_block dummy, bb;
tree var;
- gimple_stmt_iterator gsi;
+ gimple_phi_iterator gsi;
dummy = fallthru->src;
bb = fallthru->dest;
@@ -5354,9 +5354,9 @@ gimple_make_forwarder_block (edge fallthru)
start of BB. */
for (gsi = gsi_start_phis (dummy); !gsi_end_p (gsi); gsi_next (&gsi))
{
- gimple phi, new_phi;
+ gimple_phi phi, new_phi;
- phi = gsi_stmt (gsi);
+ phi = gsi.phi ();
var = gimple_phi_result (phi);
new_phi = create_phi_node (var, bb);
gimple_phi_set_result (phi, copy_ssa_name (var, phi));
@@ -5823,9 +5823,9 @@ add_phi_args_after_copy_edge (edge e_copy)
basic_block bb, bb_copy = e_copy->src, dest;
edge e;
edge_iterator ei;
- gimple phi, phi_copy;
+ gimple_phi phi, phi_copy;
tree def;
- gimple_stmt_iterator psi, psi_copy;
+ gimple_phi_iterator psi, psi_copy;
if (gimple_seq_empty_p (phi_nodes (e_copy->dest)))
return;
@@ -5858,8 +5858,8 @@ add_phi_args_after_copy_edge (edge e_copy)
!gsi_end_p (psi);
gsi_next (&psi), gsi_next (&psi_copy))
{
- phi = gsi_stmt (psi);
- phi_copy = gsi_stmt (psi_copy);
+ phi = psi.phi ();
+ phi_copy = psi_copy.phi ();
def = PHI_ARG_DEF_FROM_EDGE (phi, e);
add_phi_arg (phi_copy, def, e_copy,
gimple_phi_arg_location_from_edge (phi, e));
@@ -7967,8 +7967,8 @@ static void
gimple_lv_adjust_loop_header_phi (basic_block first, basic_block second,
basic_block new_head, edge e)
{
- gimple phi1, phi2;
- gimple_stmt_iterator psi1, psi2;
+ gimple_phi phi1, phi2;
+ gimple_phi_iterator psi1, psi2;
tree def;
edge e2 = find_edge (new_head, second);
@@ -7984,8 +7984,8 @@ gimple_lv_adjust_loop_header_phi (basic_block first, basic_block second,
!gsi_end_p (psi2) && !gsi_end_p (psi1);
gsi_next (&psi2), gsi_next (&psi1))
{
- phi1 = gsi_stmt (psi1);
- phi2 = gsi_stmt (psi2);
+ phi1 = psi1.phi ();
+ phi2 = psi2.phi ();
def = PHI_ARG_DEF (phi2, e2->dest_idx);
add_phi_arg (phi1, def, e, gimple_phi_arg_location_from_edge (phi2, e2));
}
diff --git a/gcc/tree-cfgcleanup.c b/gcc/tree-cfgcleanup.c
index 451630f..3b2a107 100644
--- a/gcc/tree-cfgcleanup.c
+++ b/gcc/tree-cfgcleanup.c
@@ -367,11 +367,11 @@ phi_alternatives_equal (basic_block dest, edge e1, edge e2)
{
int n1 = e1->dest_idx;
int n2 = e2->dest_idx;
- gimple_stmt_iterator gsi;
+ gimple_phi_iterator gsi;
for (gsi = gsi_start_phis (dest); !gsi_end_p (gsi); gsi_next (&gsi))
{
- gimple phi = gsi_stmt (gsi);
+ gimple_phi phi = gsi.phi ();
tree val1 = gimple_phi_arg_def (phi, n1);
tree val2 = gimple_phi_arg_def (phi, n2);
@@ -855,7 +855,7 @@ remove_forwarder_block_with_phi (basic_block bb)
while (EDGE_COUNT (bb->preds) > 0)
{
edge e = EDGE_PRED (bb, 0), s;
- gimple_stmt_iterator gsi;
+ gimple_phi_iterator gsi;
s = find_edge (e->src, dest);
if (s)
@@ -887,7 +887,7 @@ remove_forwarder_block_with_phi (basic_block bb)
!gsi_end_p (gsi);
gsi_next (&gsi))
{
- gimple phi = gsi_stmt (gsi);
+ gimple_phi phi = gsi.phi ();
tree def = gimple_phi_arg_def (phi, succ->dest_idx);
source_location locus = gimple_phi_arg_location_from_edge (phi, succ);
@@ -1035,7 +1035,7 @@ pass_merge_phi::execute (function *fun)
}
else
{
- gimple_stmt_iterator gsi;
+ gimple_phi_iterator gsi;
unsigned int dest_idx = single_succ_edge (bb)->dest_idx;
/* BB dominates DEST. There may be many users of the PHI
@@ -1046,7 +1046,7 @@ pass_merge_phi::execute (function *fun)
for (gsi = gsi_start_phis (bb); !gsi_end_p (gsi);
gsi_next (&gsi))
{
- gimple phi = gsi_stmt (gsi);
+ gimple_phi phi = gsi.phi ();
tree result = gimple_phi_result (phi);
use_operand_p imm_use;
gimple use_stmt;
diff --git a/gcc/tree-complex.c b/gcc/tree-complex.c
index f1bba8b..9eb77e8 100644
--- a/gcc/tree-complex.c
+++ b/gcc/tree-complex.c
@@ -722,11 +722,11 @@ update_parameter_components (void)
static void
update_phi_components (basic_block bb)
{
- gimple_stmt_iterator gsi;
+ gimple_phi_iterator gsi;
for (gsi = gsi_start_phis (bb); !gsi_end_p (gsi); gsi_next (&gsi))
{
- gimple phi = gsi_stmt (gsi);
+ gimple_phi phi = gsi.phi ();
if (is_complex_reg (gimple_phi_result (phi)))
{
diff --git a/gcc/tree-if-conv.c b/gcc/tree-if-conv.c
index 1f8ef03..f7f27da 100644
--- a/gcc/tree-if-conv.c
+++ b/gcc/tree-if-conv.c
@@ -485,7 +485,7 @@ bb_with_exit_edge_p (struct loop *loop, basic_block bb)
- there is a virtual PHI in a BB other than the loop->header. */
static bool
-if_convertible_phi_p (struct loop *loop, basic_block bb, gimple phi,
+if_convertible_phi_p (struct loop *loop, basic_block bb, gimple_phi phi,
bool any_mask_load_store)
{
if (dump_file && (dump_flags & TDF_DETAILS))
@@ -1251,10 +1251,10 @@ if_convertible_loop_p_1 (struct loop *loop,
for (i = 0; i < loop->num_nodes; i++)
{
basic_block bb = ifc_bbs[i];
- gimple_stmt_iterator itr;
+ gimple_phi_iterator itr;
for (itr = gsi_start_phis (bb); !gsi_end_p (itr); gsi_next (&itr))
- if (!if_convertible_phi_p (loop, bb, gsi_stmt (itr),
+ if (!if_convertible_phi_p (loop, bb, itr.phi (),
*any_mask_load_store))
return false;
}
diff --git a/gcc/tree-inline.c b/gcc/tree-inline.c
index 96bd561..b5ba212 100644
--- a/gcc/tree-inline.c
+++ b/gcc/tree-inline.c
@@ -1970,8 +1970,8 @@ update_ssa_across_abnormal_edges (basic_block bb, basic_block ret_bb,
if (!e->dest->aux
|| ((basic_block)e->dest->aux)->index == ENTRY_BLOCK)
{
- gimple phi;
- gimple_stmt_iterator si;
+ gimple_phi phi;
+ gimple_phi_iterator si;
if (!nonlocal_goto)
gcc_assert (e->flags & EDGE_EH);
@@ -1983,7 +1983,7 @@ update_ssa_across_abnormal_edges (basic_block bb, basic_block ret_bb,
{
edge re;
- phi = gsi_stmt (si);
+ phi = si.phi ();
/* For abnormal goto/call edges the receiver can be the
ENTRY_BLOCK. Do not assert this cannot happen. */
@@ -2137,17 +2137,17 @@ copy_phis_for_bb (basic_block bb, copy_body_data *id)
{
basic_block const new_bb = (basic_block) bb->aux;
edge_iterator ei;
- gimple phi;
- gimple_stmt_iterator si;
+ gimple_phi phi;
+ gimple_phi_iterator si;
edge new_edge;
bool inserted = false;
for (si = gsi_start_phis (bb); !gsi_end_p (si); gsi_next (&si))
{
tree res, new_res;
- gimple new_phi;
+ gimple_phi new_phi;
- phi = gsi_stmt (si);
+ phi = si.phi ();
res = PHI_RESULT (phi);
new_res = res;
if (!virtual_operand_p (res))
diff --git a/gcc/tree-into-ssa.c b/gcc/tree-into-ssa.c
index b4c4aab..3150f6b 100644
--- a/gcc/tree-into-ssa.c
+++ b/gcc/tree-into-ssa.c
@@ -1395,8 +1395,8 @@ rewrite_add_phi_arguments (basic_block bb)
FOR_EACH_EDGE (e, ei, bb->succs)
{
- gimple phi;
- gimple_stmt_iterator gsi;
+ gimple_phi phi;
+ gimple_phi_iterator gsi;
for (gsi = gsi_start_phis (e->dest); !gsi_end_p (gsi);
gsi_next (&gsi))
@@ -1404,7 +1404,7 @@ rewrite_add_phi_arguments (basic_block bb)
tree currdef, res;
location_t loc;
- phi = gsi_stmt (gsi);
+ phi = gsi.phi ();
res = gimple_phi_result (phi);
currdef = get_reaching_def (SSA_NAME_VAR (res));
/* Virtual operand PHI args do not need a location. */
diff --git a/gcc/tree-outof-ssa.c b/gcc/tree-outof-ssa.c
index 2d43bc2..59236c4 100644
--- a/gcc/tree-outof-ssa.c
+++ b/gcc/tree-outof-ssa.c
@@ -581,13 +581,13 @@ eliminate_build (elim_graph g)
{
tree Ti;
int p0, pi;
- gimple_stmt_iterator gsi;
+ gimple_phi_iterator gsi;
clear_elim_graph (g);
for (gsi = gsi_start_phis (g->e->dest); !gsi_end_p (gsi); gsi_next (&gsi))
{
- gimple phi = gsi_stmt (gsi);
+ gimple_phi phi = gsi.phi ();
source_location locus;
p0 = var_to_partition (g->map, gimple_phi_result (phi));
@@ -832,14 +832,14 @@ static void
eliminate_useless_phis (void)
{
basic_block bb;
- gimple_stmt_iterator gsi;
+ gimple_phi_iterator gsi;
tree result;
FOR_EACH_BB_FN (bb, cfun)
{
for (gsi = gsi_start_phis (bb); !gsi_end_p (gsi); )
{
- gimple phi = gsi_stmt (gsi);
+ gimple_phi phi = gsi.phi ();
result = gimple_phi_result (phi);
if (virtual_operand_p (result))
{
@@ -895,10 +895,10 @@ rewrite_trees (var_map map ATTRIBUTE_UNUSED)
create incorrect code. */
FOR_EACH_BB_FN (bb, cfun)
{
- gimple_stmt_iterator gsi;
+ gimple_phi_iterator gsi;
for (gsi = gsi_start_phis (bb); !gsi_end_p (gsi); gsi_next (&gsi))
{
- gimple phi = gsi_stmt (gsi);
+ gimple_phi phi = gsi.phi ();
tree T0 = var_to_partition_to_var (map, gimple_phi_result (phi));
if (T0 == NULL_TREE)
{
@@ -1097,7 +1097,7 @@ static void
insert_backedge_copies (void)
{
basic_block bb;
- gimple_stmt_iterator gsi;
+ gimple_phi_iterator gsi;
mark_dfs_back_edges ();
@@ -1108,7 +1108,7 @@ insert_backedge_copies (void)
for (gsi = gsi_start_phis (bb); !gsi_end_p (gsi); gsi_next (&gsi))
{
- gimple phi = gsi_stmt (gsi);
+ gimple_phi phi = gsi.phi ();
tree result = gimple_phi_result (phi);
size_t i;
diff --git a/gcc/tree-phinodes.c b/gcc/tree-phinodes.c
index c075f98..d15d3b4 100644
--- a/gcc/tree-phinodes.c
+++ b/gcc/tree-phinodes.c
@@ -291,11 +291,11 @@ reserve_phi_args_for_new_edge (basic_block bb)
{
size_t len = EDGE_COUNT (bb->preds);
size_t cap = ideal_phi_node_len (len + 4);
- gimple_stmt_iterator gsi;
+ gimple_phi_iterator gsi;
for (gsi = gsi_start_phis (bb); !gsi_end_p (gsi); gsi_next (&gsi))
{
- gimple_phi stmt = as_a <gimple_phi> (gsi_stmt (gsi));
+ gimple_phi stmt = gsi.phi ();
if (len > gimple_phi_capacity (stmt))
{
@@ -326,7 +326,7 @@ reserve_phi_args_for_new_edge (basic_block bb)
/* Adds PHI to BB. */
void
-add_phi_node_to_bb (gimple phi, basic_block bb)
+add_phi_node_to_bb (gimple_phi phi, basic_block bb)
{
gimple_seq seq = phi_nodes (bb);
/* Add the new PHI node to the list of PHI nodes for block BB. */
@@ -431,10 +431,10 @@ remove_phi_arg_num (gimple_phi phi, int i)
void
remove_phi_args (edge e)
{
- gimple_stmt_iterator gsi;
+ gimple_phi_iterator gsi;
for (gsi = gsi_start_phis (e->dest); !gsi_end_p (gsi); gsi_next (&gsi))
- remove_phi_arg_num (as_a <gimple_statement_phi *> (gsi_stmt (gsi)),
+ remove_phi_arg_num (gsi.phi (),
e->dest_idx);
}
@@ -466,7 +466,7 @@ remove_phi_node (gimple_stmt_iterator *gsi, bool release_lhs_p)
void
remove_phi_nodes (basic_block bb)
{
- gimple_stmt_iterator gsi;
+ gimple_phi_iterator gsi;
for (gsi = gsi_start_phis (bb); !gsi_end_p (gsi); )
remove_phi_node (&gsi, true);
diff --git a/gcc/tree-phinodes.h b/gcc/tree-phinodes.h
index 0159d5d..fe8b32d 100644
--- a/gcc/tree-phinodes.h
+++ b/gcc/tree-phinodes.h
@@ -23,7 +23,7 @@ along with GCC; see the file COPYING3. If not see
extern void phinodes_print_statistics (void);
extern void release_phi_node (gimple);
extern void reserve_phi_args_for_new_edge (basic_block);
-extern void add_phi_node_to_bb (gimple phi, basic_block bb);
+extern void add_phi_node_to_bb (gimple_phi phi, basic_block bb);
extern gimple_phi create_phi_node (tree, basic_block);
extern void add_phi_arg (gimple, tree, edge, source_location);
extern void remove_phi_args (edge);
diff --git a/gcc/tree-predcom.c b/gcc/tree-predcom.c
index 7348985..0ce81aa 100644
--- a/gcc/tree-predcom.c
+++ b/gcc/tree-predcom.c
@@ -1116,10 +1116,11 @@ static gimple
find_looparound_phi (struct loop *loop, dref ref, dref root)
{
tree name, init, init_ref;
- gimple phi = NULL, init_stmt;
+ gimple_phi phi = NULL;
+ gimple init_stmt;
edge latch = loop_latch_edge (loop);
struct data_reference init_dr;
- gimple_stmt_iterator psi;
+ gimple_phi_iterator psi;
if (is_gimple_assign (ref->stmt))
{
@@ -1135,7 +1136,7 @@ find_looparound_phi (struct loop *loop, dref ref, dref root)
for (psi = gsi_start_phis (loop->header); !gsi_end_p (psi); gsi_next (&psi))
{
- phi = gsi_stmt (psi);
+ phi = psi.phi ();
if (PHI_ARG_DEF_FROM_EDGE (phi, latch) == name)
break;
}
@@ -1887,14 +1888,15 @@ static void
eliminate_temp_copies (struct loop *loop, bitmap tmp_vars)
{
edge e;
- gimple phi, stmt;
+ gimple_phi phi;
+ gimple stmt;
tree name, use, var;
- gimple_stmt_iterator psi;
+ gimple_phi_iterator psi;
e = loop_latch_edge (loop);
for (psi = gsi_start_phis (loop->header); !gsi_end_p (psi); gsi_next (&psi))
{
- phi = gsi_stmt (psi);
+ phi = psi.phi ();
name = PHI_RESULT (phi);
var = SSA_NAME_VAR (name);
if (!var || !bitmap_bit_p (tmp_vars, DECL_UID (var)))
diff --git a/gcc/tree-scalar-evolution.c b/gcc/tree-scalar-evolution.c
index 248bb8d..0a6739f 100644
--- a/gcc/tree-scalar-evolution.c
+++ b/gcc/tree-scalar-evolution.c
@@ -2238,8 +2238,8 @@ loop_closed_phi_def (tree var)
{
struct loop *loop;
edge exit;
- gimple phi;
- gimple_stmt_iterator psi;
+ gimple_phi phi;
+ gimple_phi_iterator psi;
if (var == NULL_TREE
|| TREE_CODE (var) != SSA_NAME)
@@ -2252,7 +2252,7 @@ loop_closed_phi_def (tree var)
for (psi = gsi_start_phis (exit->dest); !gsi_end_p (psi); gsi_next (&psi))
{
- phi = gsi_stmt (psi);
+ phi = psi.phi ();
if (PHI_ARG_DEF_FROM_EDGE (phi, exit) == var)
return PHI_RESULT (phi);
}
@@ -3338,11 +3338,12 @@ scev_const_prop (void)
{
basic_block bb;
tree name, type, ev;
- gimple phi, ass;
+ gimple_phi phi;
+ gimple ass;
struct loop *loop, *ex_loop;
bitmap ssa_names_to_remove = NULL;
unsigned i;
- gimple_stmt_iterator psi;
+ gimple_phi_iterator psi;
if (number_of_loops (cfun) <= 1)
return 0;
@@ -3353,7 +3354,7 @@ scev_const_prop (void)
for (psi = gsi_start_phis (bb); !gsi_end_p (psi); gsi_next (&psi))
{
- phi = gsi_stmt (psi);
+ phi = psi.phi ();
name = PHI_RESULT (phi);
if (virtual_operand_p (name))
@@ -3391,7 +3392,7 @@ scev_const_prop (void)
{
gimple_stmt_iterator psi;
name = ssa_name (i);
- phi = SSA_NAME_DEF_STMT (name);
+ phi = as_a <gimple_phi> (SSA_NAME_DEF_STMT (name));
gcc_assert (gimple_code (phi) == GIMPLE_PHI);
psi = gsi_for_stmt (phi);
@@ -3429,7 +3430,7 @@ scev_const_prop (void)
for (psi = gsi_start_phis (exit->dest); !gsi_end_p (psi); )
{
- phi = gsi_stmt (psi);
+ phi = psi.phi ();
rslt = PHI_RESULT (phi);
def = PHI_ARG_DEF_FROM_EDGE (phi, exit);
if (virtual_operand_p (def))
diff --git a/gcc/tree-ssa-coalesce.c b/gcc/tree-ssa-coalesce.c
index 24ed4b4..e4e2201 100644
--- a/gcc/tree-ssa-coalesce.c
+++ b/gcc/tree-ssa-coalesce.c
@@ -1189,11 +1189,11 @@ coalesce_partitions (var_map map, ssa_conflicts_p graph, coalesce_list_p cl,
FOR_EACH_EDGE (e, ei, bb->preds)
if (e->flags & EDGE_ABNORMAL)
{
- gimple_stmt_iterator gsi;
+ gimple_phi_iterator gsi;
for (gsi = gsi_start_phis (bb); !gsi_end_p (gsi);
gsi_next (&gsi))
{
- gimple phi = gsi_stmt (gsi);
+ gimple_phi phi = gsi.phi ();
tree res = PHI_RESULT (phi);
tree arg = PHI_ARG_DEF (phi, e->dest_idx);
int v1 = SSA_NAME_VERSION (res);
diff --git a/gcc/tree-ssa-dce.c b/gcc/tree-ssa-dce.c
index fd2e444..70b405c 100644
--- a/gcc/tree-ssa-dce.c
+++ b/gcc/tree-ssa-dce.c
@@ -933,13 +933,13 @@ static bool
remove_dead_phis (basic_block bb)
{
bool something_changed = false;
- gimple phi;
- gimple_stmt_iterator gsi;
+ gimple_phi phi;
+ gimple_phi_iterator gsi;
for (gsi = gsi_start_phis (bb); !gsi_end_p (gsi);)
{
stats.total_phis++;
- phi = gsi_stmt (gsi);
+ phi = gsi.phi ();
/* We do not track necessity of virtual PHI nodes. Instead do
very simple dead PHI removal here. */
@@ -991,7 +991,7 @@ remove_dead_phis (basic_block bb)
static edge
forward_edge_to_pdom (edge e, basic_block post_dom_bb)
{
- gimple_stmt_iterator gsi;
+ gimple_phi_iterator gsi;
edge e2 = NULL;
edge_iterator ei;
@@ -1015,7 +1015,7 @@ forward_edge_to_pdom (edge e, basic_block post_dom_bb)
break;
for (gsi = gsi_start_phis (post_dom_bb); !gsi_end_p (gsi);)
{
- gimple phi = gsi_stmt (gsi);
+ gimple_phi phi = gsi.phi ();
tree op;
source_location locus;
diff --git a/gcc/tree-ssa-dom.c b/gcc/tree-ssa-dom.c
index d26596b..81be88a 100644
--- a/gcc/tree-ssa-dom.c
+++ b/gcc/tree-ssa-dom.c
@@ -1189,11 +1189,11 @@ dom_opt_dom_walker::thread_across_edge (edge e)
static void
record_equivalences_from_phis (basic_block bb)
{
- gimple_stmt_iterator gsi;
+ gimple_phi_iterator gsi;
for (gsi = gsi_start_phis (bb); !gsi_end_p (gsi); gsi_next (&gsi))
{
- gimple phi = gsi_stmt (gsi);
+ gimple_phi phi = gsi.phi ();
tree lhs = gimple_phi_result (phi);
tree rhs = NULL;
@@ -1716,7 +1716,7 @@ cprop_into_successor_phis (basic_block bb)
FOR_EACH_EDGE (e, ei, bb->succs)
{
int indx;
- gimple_stmt_iterator gsi;
+ gimple_phi_iterator gsi;
/* If this is an abnormal edge, then we do not want to copy propagate
into the PHI alternative associated with this edge. */
@@ -1755,7 +1755,7 @@ cprop_into_successor_phis (basic_block bb)
tree new_val;
use_operand_p orig_p;
tree orig_val;
- gimple phi = gsi_stmt (gsi);
+ gimple_phi phi = gsi.phi ();
/* The alternative may be associated with a constant, so verify
it is an SSA_NAME before doing anything with it. */
@@ -2846,7 +2846,8 @@ propagate_rhs_into_lhs (gimple stmt, tree lhs, tree rhs, bitmap interesting_name
edge te = find_taken_edge (bb, val);
edge_iterator ei;
edge e;
- gimple_stmt_iterator gsi, psi;
+ gimple_stmt_iterator gsi;
+ gimple_phi_iterator psi;
/* Remove all outgoing edges except TE. */
for (ei = ei_start (bb->succs); (e = ei_safe_edge (ei));)
@@ -2859,7 +2860,7 @@ propagate_rhs_into_lhs (gimple stmt, tree lhs, tree rhs, bitmap interesting_name
!gsi_end_p (psi);
gsi_next (&psi))
{
- gimple phi = gsi_stmt (psi);
+ gimple_phi phi = psi.phi ();
tree result = gimple_phi_result (phi);
int version = SSA_NAME_VERSION (result);
@@ -2969,12 +2970,12 @@ eliminate_const_or_copy (gimple stmt, bitmap interesting_names)
static void
eliminate_degenerate_phis_1 (basic_block bb, bitmap interesting_names)
{
- gimple_stmt_iterator gsi;
+ gimple_phi_iterator gsi;
basic_block son;
for (gsi = gsi_start_phis (bb); !gsi_end_p (gsi); gsi_next (&gsi))
{
- gimple phi = gsi_stmt (gsi);
+ gimple_phi phi = gsi.phi ();
eliminate_const_or_copy (phi, interesting_names);
}
diff --git a/gcc/tree-ssa-ifcombine.c b/gcc/tree-ssa-ifcombine.c
index 43fd50b..0420ef3 100644
--- a/gcc/tree-ssa-ifcombine.c
+++ b/gcc/tree-ssa-ifcombine.c
@@ -158,12 +158,12 @@ same_phi_args_p (basic_block bb1, basic_block bb2, basic_block dest)
{
edge e1 = find_edge (bb1, dest);
edge e2 = find_edge (bb2, dest);
- gimple_stmt_iterator gsi;
- gimple phi;
+ gimple_phi_iterator gsi;
+ gimple_phi phi;
for (gsi = gsi_start_phis (dest); !gsi_end_p (gsi); gsi_next (&gsi))
{
- phi = gsi_stmt (gsi);
+ phi = gsi.phi ();
if (!operand_equal_p (PHI_ARG_DEF_FROM_EDGE (phi, e1),
PHI_ARG_DEF_FROM_EDGE (phi, e2), 0))
return false;
diff --git a/gcc/tree-ssa-live.c b/gcc/tree-ssa-live.c
index 23eaf26..49ddc10 100644
--- a/gcc/tree-ssa-live.c
+++ b/gcc/tree-ssa-live.c
@@ -1154,13 +1154,13 @@ calculate_live_on_exit (tree_live_info_p liveinfo)
/* Set all the live-on-exit bits for uses in PHIs. */
FOR_EACH_BB_FN (bb, cfun)
{
- gimple_stmt_iterator gsi;
+ gimple_phi_iterator gsi;
size_t i;
/* Mark the PHI arguments which are live on exit to the pred block. */
for (gsi = gsi_start_phis (bb); !gsi_end_p (gsi); gsi_next (&gsi))
{
- gimple phi = gsi_stmt (gsi);
+ gimple_phi phi = gsi.phi ();
for (i = 0; i < gimple_phi_num_args (phi); i++)
{
tree t = PHI_ARG_DEF (phi, i);
@@ -1433,12 +1433,12 @@ verify_live_on_entry (tree_live_info_p live)
if it occurs in a PHI argument of the block. */
size_t z;
bool ok = false;
- gimple_stmt_iterator gsi;
+ gimple_phi_iterator gsi;
for (gsi = gsi_start_phis (e->dest);
!gsi_end_p (gsi) && !ok;
gsi_next (&gsi))
{
- gimple phi = gsi_stmt (gsi);
+ gimple_phi phi = gsi.phi ();
for (z = 0; z < gimple_phi_num_args (phi); z++)
if (var == gimple_phi_arg_def (phi, z))
{
diff --git a/gcc/tree-ssa-loop-im.c b/gcc/tree-ssa-loop-im.c
index 325f777..339e221 100644
--- a/gcc/tree-ssa-loop-im.c
+++ b/gcc/tree-ssa-loop-im.c
@@ -1264,11 +1264,11 @@ move_computations_dom_walker::before_dom_children (basic_block bb)
{
/* The new VUSE is the one from the virtual PHI in the loop
header or the one already present. */
- gimple_stmt_iterator gsi2;
+ gimple_phi_iterator gsi2;
for (gsi2 = gsi_start_phis (e->dest);
!gsi_end_p (gsi2); gsi_next (&gsi2))
{
- gimple phi = gsi_stmt (gsi2);
+ gimple_phi phi = gsi2.phi ();
if (virtual_operand_p (gimple_phi_result (phi)))
{
gimple_set_vuse (stmt, PHI_ARG_DEF_FROM_EDGE (phi, e));
diff --git a/gcc/tree-ssa-loop-ivopts.c b/gcc/tree-ssa-loop-ivopts.c
index 400798a..8d330d9 100644
--- a/gcc/tree-ssa-loop-ivopts.c
+++ b/gcc/tree-ssa-loop-ivopts.c
@@ -1061,11 +1061,11 @@ find_bivs (struct ivopts_data *data)
tree step, type, base;
bool found = false;
struct loop *loop = data->current_loop;
- gimple_stmt_iterator psi;
+ gimple_phi_iterator psi;
for (psi = gsi_start_phis (loop->header); !gsi_end_p (psi); gsi_next (&psi))
{
- phi = gsi_stmt (psi);
+ phi = psi.phi ();
if (SSA_NAME_OCCURS_IN_ABNORMAL_PHI (PHI_RESULT (phi)))
continue;
@@ -1107,11 +1107,11 @@ mark_bivs (struct ivopts_data *data)
struct iv *iv, *incr_iv;
struct loop *loop = data->current_loop;
basic_block incr_bb;
- gimple_stmt_iterator psi;
+ gimple_phi_iterator psi;
for (psi = gsi_start_phis (loop->header); !gsi_end_p (psi); gsi_next (&psi))
{
- phi = gsi_stmt (psi);
+ phi = psi.phi ();
iv = get_iv (data, PHI_RESULT (phi));
if (!iv)
@@ -1994,13 +1994,13 @@ find_interesting_uses_stmt (struct ivopts_data *data, gimple stmt)
static void
find_interesting_uses_outside (struct ivopts_data *data, edge exit)
{
- gimple phi;
- gimple_stmt_iterator psi;
+ gimple_phi phi;
+ gimple_phi_iterator psi;
tree def;
for (psi = gsi_start_phis (exit->dest); !gsi_end_p (psi); gsi_next (&psi))
{
- phi = gsi_stmt (psi);
+ phi = psi.phi ();
def = PHI_ARG_DEF_FROM_EDGE (phi, exit);
if (!virtual_operand_p (def))
find_interesting_uses_op (data, def);
@@ -5185,8 +5185,8 @@ static void
determine_set_costs (struct ivopts_data *data)
{
unsigned j, n;
- gimple phi;
- gimple_stmt_iterator psi;
+ gimple_phi phi;
+ gimple_phi_iterator psi;
tree op;
struct loop *loop = data->current_loop;
bitmap_iterator bi;
@@ -5203,7 +5203,7 @@ determine_set_costs (struct ivopts_data *data)
n = 0;
for (psi = gsi_start_phis (loop->header); !gsi_end_p (psi); gsi_next (&psi))
{
- phi = gsi_stmt (psi);
+ phi = psi.phi ();
op = PHI_RESULT (phi);
if (virtual_operand_p (op))
diff --git a/gcc/tree-ssa-loop-manip.c b/gcc/tree-ssa-loop-manip.c
index ac96936..3acf7fb 100644
--- a/gcc/tree-ssa-loop-manip.c
+++ b/gcc/tree-ssa-loop-manip.c
@@ -630,12 +630,12 @@ split_loop_exit_edge (edge exit)
gimple phi, new_phi;
tree new_name, name;
use_operand_p op_p;
- gimple_stmt_iterator psi;
+ gimple_phi_iterator psi;
source_location locus;
for (psi = gsi_start_phis (dest); !gsi_end_p (psi); gsi_next (&psi))
{
- phi = gsi_stmt (psi);
+ phi = psi.phi ();
op_p = PHI_ARG_DEF_PTR_FROM_EDGE (phi, single_succ_edge (bb));
locus = gimple_phi_arg_location_from_edge (phi, single_succ_edge (bb));
@@ -1023,8 +1023,8 @@ tree_transform_and_unroll_loop (struct loop *loop, unsigned factor,
tree ctr_before, ctr_after;
tree enter_main_cond, exit_base, exit_step, exit_bound;
enum tree_code exit_cmp;
- gimple phi_old_loop, phi_new_loop, phi_rest;
- gimple_stmt_iterator psi_old_loop, psi_new_loop;
+ gimple_phi phi_old_loop, phi_new_loop, phi_rest;
+ gimple_phi_iterator psi_old_loop, psi_new_loop;
tree init, next, new_init;
struct loop *new_loop;
basic_block rest, exit_bb;
@@ -1131,8 +1131,8 @@ tree_transform_and_unroll_loop (struct loop *loop, unsigned factor,
!gsi_end_p (psi_old_loop);
gsi_next (&psi_old_loop), gsi_next (&psi_new_loop))
{
- phi_old_loop = gsi_stmt (psi_old_loop);
- phi_new_loop = gsi_stmt (psi_new_loop);
+ phi_old_loop = psi_old_loop.phi ();
+ phi_new_loop = psi_new_loop.phi ();
init = PHI_ARG_DEF_FROM_EDGE (phi_old_loop, old_entry);
op = PHI_ARG_DEF_PTR_FROM_EDGE (phi_new_loop, new_entry);
@@ -1248,12 +1248,13 @@ tree_unroll_loop (struct loop *loop, unsigned factor,
static void
rewrite_phi_with_iv (loop_p loop,
- gimple_stmt_iterator *psi,
+ gimple_phi_iterator *psi,
gimple_stmt_iterator *gsi,
tree main_iv)
{
affine_iv iv;
- gimple stmt, phi = gsi_stmt (*psi);
+ gimple stmt;
+ gimple_phi phi = psi->phi ();
tree atype, mtype, val, res = PHI_RESULT (phi);
if (virtual_operand_p (res) || res == main_iv)
@@ -1291,7 +1292,7 @@ rewrite_all_phi_nodes_with_iv (loop_p loop, tree main_iv)
{
unsigned i;
basic_block *bbs = get_loop_body_in_dom_order (loop);
- gimple_stmt_iterator psi;
+ gimple_phi_iterator psi;
for (i = 0; i < loop->num_nodes; i++)
{
@@ -1324,7 +1325,8 @@ canonicalize_loop_ivs (struct loop *loop, tree *nit, bool bump_in_latch)
unsigned precision = TYPE_PRECISION (TREE_TYPE (*nit));
unsigned original_precision = precision;
tree type, var_before;
- gimple_stmt_iterator gsi, psi;
+ gimple_stmt_iterator gsi;
+ gimple_phi_iterator psi;
gimple stmt;
edge exit = single_dom_exit (loop);
gimple_seq stmts;
@@ -1334,7 +1336,7 @@ canonicalize_loop_ivs (struct loop *loop, tree *nit, bool bump_in_latch)
for (psi = gsi_start_phis (loop->header);
!gsi_end_p (psi); gsi_next (&psi))
{
- gimple phi = gsi_stmt (psi);
+ gimple_phi phi = psi.phi ();
tree res = PHI_RESULT (phi);
bool uns;
diff --git a/gcc/tree-ssa-loop-niter.c b/gcc/tree-ssa-loop-niter.c
index 4da1855..6313fc8 100644
--- a/gcc/tree-ssa-loop-niter.c
+++ b/gcc/tree-ssa-loop-niter.c
@@ -147,7 +147,7 @@ determine_value_range (struct loop *loop, tree type, tree var, mpz_t off,
{
edge e = loop_preheader_edge (loop);
signop sgn = TYPE_SIGN (type);
- gimple_stmt_iterator gsi;
+ gimple_phi_iterator gsi;
/* Either for VAR itself... */
rtype = get_range_info (var, &minv, &maxv);
@@ -155,7 +155,7 @@ determine_value_range (struct loop *loop, tree type, tree var, mpz_t off,
PHI argument from the loop preheader edge. */
for (gsi = gsi_start_phis (loop->header); !gsi_end_p (gsi); gsi_next (&gsi))
{
- gimple phi = gsi_stmt (gsi);
+ gimple_phi phi = gsi.phi ();
wide_int minc, maxc;
if (PHI_ARG_DEF_FROM_EDGE (phi, e) == var
&& (get_range_info (gimple_phi_result (phi), &minc, &maxc)
diff --git a/gcc/tree-ssa-phiopt.c b/gcc/tree-ssa-phiopt.c
index f62010f..48e717a 100644
--- a/gcc/tree-ssa-phiopt.c
+++ b/gcc/tree-ssa-phiopt.c
@@ -2005,14 +2005,14 @@ hoist_adjacent_loads (basic_block bb0, basic_block bb1,
{
int param_align = PARAM_VALUE (PARAM_L1_CACHE_LINE_SIZE);
unsigned param_align_bits = (unsigned) (param_align * BITS_PER_UNIT);
- gimple_stmt_iterator gsi;
+ gimple_phi_iterator gsi;
/* Walk the phis in bb3 looking for an opportunity. We are looking
for phis of two SSA names, one each of which is defined in bb1 and
bb2. */
for (gsi = gsi_start_phis (bb3); !gsi_end_p (gsi); gsi_next (&gsi))
{
- gimple phi_stmt = gsi_stmt (gsi);
+ gimple_phi phi_stmt = gsi.phi ();
gimple def1, def2, defswap;
tree arg1, arg2, ref1, ref2, field1, field2, fieldswap;
tree tree_offset1, tree_offset2, tree_size2, next;
diff --git a/gcc/tree-ssa-phiprop.c b/gcc/tree-ssa-phiprop.c
index a549200..2105c87 100644
--- a/gcc/tree-ssa-phiprop.c
+++ b/gcc/tree-ssa-phiprop.c
@@ -247,7 +247,7 @@ phiprop_insert_phi (basic_block bb, gimple phi, gimple use_stmt,
with aliasing issues as we are moving memory reads. */
static bool
-propagate_with_phi (basic_block bb, gimple phi, struct phiprop_d *phivn,
+propagate_with_phi (basic_block bb, gimple_phi phi, struct phiprop_d *phivn,
size_t n)
{
tree ptr = PHI_RESULT (phi);
@@ -409,7 +409,7 @@ pass_phiprop::execute (function *fun)
struct phiprop_d *phivn;
bool did_something = false;
basic_block bb;
- gimple_stmt_iterator gsi;
+ gimple_phi_iterator gsi;
unsigned i;
size_t n;
@@ -424,7 +424,7 @@ pass_phiprop::execute (function *fun)
single_succ (ENTRY_BLOCK_PTR_FOR_FN (fun)));
FOR_EACH_VEC_ELT (bbs, i, bb)
for (gsi = gsi_start_phis (bb); !gsi_end_p (gsi); gsi_next (&gsi))
- did_something |= propagate_with_phi (bb, gsi_stmt (gsi), phivn, n);
+ did_something |= propagate_with_phi (bb, gsi.phi (), phivn, n);
if (did_something)
gsi_commit_edge_inserts ();
diff --git a/gcc/tree-ssa-reassoc.c b/gcc/tree-ssa-reassoc.c
index 2e8337c..524dc53 100644
--- a/gcc/tree-ssa-reassoc.c
+++ b/gcc/tree-ssa-reassoc.c
@@ -2493,7 +2493,7 @@ suitable_cond_bb (basic_block bb, basic_block test_bb, basic_block *other_bb,
edge_iterator ei, ei2;
edge e, e2;
gimple stmt;
- gimple_stmt_iterator gsi;
+ gimple_phi_iterator gsi;
bool other_edge_seen = false;
bool is_cond;
@@ -2555,7 +2555,7 @@ suitable_cond_bb (basic_block bb, basic_block test_bb, basic_block *other_bb,
e2 = find_edge (test_bb, *other_bb);
for (gsi = gsi_start_phis (e->dest); !gsi_end_p (gsi); gsi_next (&gsi))
{
- gimple phi = gsi_stmt (gsi);
+ gimple_phi phi = gsi.phi ();
/* If both BB and TEST_BB end with GIMPLE_COND, all PHI arguments
corresponding to BB and TEST_BB predecessor must be the same. */
if (!operand_equal_p (gimple_phi_arg_def (phi, e->dest_idx),
diff --git a/gcc/tree-ssa-tail-merge.c b/gcc/tree-ssa-tail-merge.c
index 37181bd..521378e 100644
--- a/gcc/tree-ssa-tail-merge.c
+++ b/gcc/tree-ssa-tail-merge.c
@@ -1285,11 +1285,11 @@ static bool
same_phi_alternatives_1 (basic_block dest, edge e1, edge e2)
{
int n1 = e1->dest_idx, n2 = e2->dest_idx;
- gimple_stmt_iterator gsi;
+ gimple_phi_iterator gsi;
for (gsi = gsi_start_phis (dest); !gsi_end_p (gsi); gsi_next (&gsi))
{
- gimple phi = gsi_stmt (gsi);
+ gimple_phi phi = gsi.phi ();
tree lhs = gimple_phi_result (phi);
tree val1 = gimple_phi_arg_def (phi, n1);
tree val2 = gimple_phi_arg_def (phi, n2);
@@ -1470,10 +1470,10 @@ static gimple
vop_phi (basic_block bb)
{
gimple stmt;
- gimple_stmt_iterator gsi;
+ gimple_phi_iterator gsi;
for (gsi = gsi_start_phis (bb); !gsi_end_p (gsi); gsi_next (&gsi))
{
- stmt = gsi_stmt (gsi);
+ stmt = gsi.phi ();
if (! virtual_operand_p (gimple_phi_result (stmt)))
continue;
return stmt;
diff --git a/gcc/tree-ssa-threadedge.c b/gcc/tree-ssa-threadedge.c
index 0a04787..da4419d 100644
--- a/gcc/tree-ssa-threadedge.c
+++ b/gcc/tree-ssa-threadedge.c
@@ -202,14 +202,14 @@ record_temporary_equivalence (tree x, tree y, vec<tree> *stack)
static bool
record_temporary_equivalences_from_phis (edge e, vec<tree> *stack)
{
- gimple_stmt_iterator gsi;
+ gimple_phi_iterator gsi;
/* Each PHI creates a temporary equivalence, record them.
These are context sensitive equivalences and will be removed
later. */
for (gsi = gsi_start_phis (e->dest); !gsi_end_p (gsi); gsi_next (&gsi))
{
- gimple phi = gsi_stmt (gsi);
+ gimple_phi phi = gsi.phi ();
tree src = PHI_ARG_DEF_FROM_EDGE (phi, e);
tree dst = gimple_phi_result (phi);
diff --git a/gcc/tree-ssa-threadupdate.c b/gcc/tree-ssa-threadupdate.c
index 125f6f8..24920ca 100644
--- a/gcc/tree-ssa-threadupdate.c
+++ b/gcc/tree-ssa-threadupdate.c
@@ -394,13 +394,13 @@ copy_phi_arg_into_existing_phi (edge src_e, edge tgt_e)
int tgt_idx = tgt_e->dest_idx;
/* Iterate over each PHI in e->dest. */
- for (gimple_stmt_iterator gsi = gsi_start_phis (src_e->dest),
- gsi2 = gsi_start_phis (tgt_e->dest);
+ for (gimple_phi_iterator gsi = gsi_start_phis (src_e->dest),
+ gsi2 = gsi_start_phis (tgt_e->dest);
!gsi_end_p (gsi);
gsi_next (&gsi), gsi_next (&gsi2))
{
- gimple src_phi = gsi_stmt (gsi);
- gimple dest_phi = gsi_stmt (gsi2);
+ gimple_phi src_phi = gsi.phi ();
+ gimple_phi dest_phi = gsi2.phi ();
tree val = gimple_phi_arg_def (src_phi, src_idx);
source_location locus = gimple_phi_arg_location (src_phi, src_idx);
@@ -463,12 +463,12 @@ static void
copy_phi_args (basic_block bb, edge src_e, edge tgt_e,
vec<jump_thread_edge *> *path, int idx)
{
- gimple_stmt_iterator gsi;
+ gimple_phi_iterator gsi;
int src_indx = src_e->dest_idx;
for (gsi = gsi_start_phis (bb); !gsi_end_p (gsi); gsi_next (&gsi))
{
- gimple phi = gsi_stmt (gsi);
+ gimple_phi phi = gsi.phi ();
tree def = gimple_phi_arg_def (phi, src_indx);
source_location locus = gimple_phi_arg_location (phi, src_indx);
@@ -2050,13 +2050,13 @@ fail:
static bool
phi_args_equal_on_edges (edge e1, edge e2)
{
- gimple_stmt_iterator gsi;
+ gimple_phi_iterator gsi;
int indx1 = e1->dest_idx;
int indx2 = e2->dest_idx;
for (gsi = gsi_start_phis (e1->dest); !gsi_end_p (gsi); gsi_next (&gsi))
{
- gimple phi = gsi_stmt (gsi);
+ gimple_phi phi = gsi.phi ();
if (!operand_equal_p (gimple_phi_arg_def (phi, indx1),
gimple_phi_arg_def (phi, indx2), 0))
diff --git a/gcc/tree-ssa-uninit.c b/gcc/tree-ssa-uninit.c
index 3b38fd4..bae72ff 100644
--- a/gcc/tree-ssa-uninit.c
+++ b/gcc/tree-ssa-uninit.c
@@ -2174,9 +2174,9 @@ is_use_properly_guarded (gimple use_stmt,
if the new phi is already in the worklist. */
static gimple
-find_uninit_use (gimple phi, unsigned uninit_opnds,
- vec<gimple> *worklist,
- hash_set<gimple> *added_to_worklist)
+find_uninit_use (gimple_phi phi, unsigned uninit_opnds,
+ vec<gimple_phi> *worklist,
+ hash_set<gimple_phi> *added_to_worklist)
{
tree phi_result;
use_operand_p use_p;
@@ -2215,7 +2215,7 @@ find_uninit_use (gimple phi, unsigned uninit_opnds,
/* Found a phi use that is not guarded,
add the phi to the worklist. */
- if (!added_to_worklist->add (use_stmt))
+ if (!added_to_worklist->add (as_a <gimple_phi> (use_stmt)))
{
if (dump_file && (dump_flags & TDF_DETAILS))
{
@@ -2223,7 +2223,7 @@ find_uninit_use (gimple phi, unsigned uninit_opnds,
print_gimple_stmt (dump_file, use_stmt, 0, 0);
}
- worklist->safe_push (use_stmt);
+ worklist->safe_push (as_a <gimple_phi> (use_stmt));
possibly_undefined_names->add (phi_result);
}
}
@@ -2240,8 +2240,8 @@ find_uninit_use (gimple phi, unsigned uninit_opnds,
a pointer set tracking if the new phi is added to the worklist or not. */
static void
-warn_uninitialized_phi (gimple phi, vec<gimple> *worklist,
- hash_set<gimple> *added_to_worklist)
+warn_uninitialized_phi (gimple_phi phi, vec<gimple_phi> *worklist,
+ hash_set<gimple_phi> *added_to_worklist)
{
unsigned uninit_opnds;
gimple uninit_use_stmt = 0;
@@ -2326,8 +2326,8 @@ unsigned int
pass_late_warn_uninitialized::execute (function *fun)
{
basic_block bb;
- gimple_stmt_iterator gsi;
- vec<gimple> worklist = vNULL;
+ gimple_phi_iterator gsi;
+ vec<gimple_phi> worklist = vNULL;
calculate_dominance_info (CDI_DOMINATORS);
calculate_dominance_info (CDI_POST_DOMINATORS);
@@ -2339,13 +2339,13 @@ pass_late_warn_uninitialized::execute (function *fun)
timevar_push (TV_TREE_UNINIT);
possibly_undefined_names = new hash_set<tree>;
- hash_set<gimple> added_to_worklist;
+ hash_set<gimple_phi> added_to_worklist;
/* Initialize worklist */
FOR_EACH_BB_FN (bb, fun)
for (gsi = gsi_start_phis (bb); !gsi_end_p (gsi); gsi_next (&gsi))
{
- gimple phi = gsi_stmt (gsi);
+ gimple_phi phi = gsi.phi ();
size_t n, i;
n = gimple_phi_num_args (phi);
@@ -2374,7 +2374,7 @@ pass_late_warn_uninitialized::execute (function *fun)
while (worklist.length () != 0)
{
- gimple cur_phi = 0;
+ gimple_phi cur_phi = 0;
cur_phi = worklist.pop ();
warn_uninitialized_phi (cur_phi, &worklist, &added_to_worklist);
}
diff --git a/gcc/tree-ssa.c b/gcc/tree-ssa.c
index f05db17..a907426 100644
--- a/gcc/tree-ssa.c
+++ b/gcc/tree-ssa.c
@@ -149,8 +149,8 @@ redirect_edge_var_map_destroy (void)
edge
ssa_redirect_edge (edge e, basic_block dest)
{
- gimple_stmt_iterator gsi;
- gimple phi;
+ gimple_phi_iterator gsi;
+ gimple_phi phi;
redirect_edge_var_map_clear (e);
@@ -160,7 +160,7 @@ ssa_redirect_edge (edge e, basic_block dest)
tree def;
source_location locus ;
- phi = gsi_stmt (gsi);
+ phi = gsi.phi ();
def = gimple_phi_arg_def (phi, e->dest_idx);
locus = gimple_phi_arg_location (phi, e->dest_idx);
@@ -182,10 +182,10 @@ ssa_redirect_edge (edge e, basic_block dest)
void
flush_pending_stmts (edge e)
{
- gimple phi;
+ gimple_phi phi;
edge_var_map *vm;
int i;
- gimple_stmt_iterator gsi;
+ gimple_phi_iterator gsi;
vec<edge_var_map> *v = redirect_edge_var_map_vector (e);
if (!v)
@@ -197,7 +197,7 @@ flush_pending_stmts (edge e)
{
tree def;
- phi = gsi_stmt (gsi);
+ phi = gsi.phi ();
def = redirect_edge_var_map_def (vm);
add_phi_arg (phi, def, e, redirect_edge_var_map_location (vm));
}
diff --git a/gcc/tree-switch-conversion.c b/gcc/tree-switch-conversion.c
index 7691aeb..424d196 100644
--- a/gcc/tree-switch-conversion.c
+++ b/gcc/tree-switch-conversion.c
@@ -773,12 +773,12 @@ check_all_empty_except_final (struct switch_conv_info *info)
static bool
check_final_bb (struct switch_conv_info *info)
{
- gimple_stmt_iterator gsi;
+ gimple_phi_iterator gsi;
info->phi_count = 0;
for (gsi = gsi_start_phis (info->final_bb); !gsi_end_p (gsi); gsi_next (&gsi))
{
- gimple phi = gsi_stmt (gsi);
+ gimple_phi phi = gsi.phi ();
unsigned int i;
info->phi_count++;
@@ -854,7 +854,7 @@ free_temp_arrays (struct switch_conv_info *info)
static void
gather_default_values (tree default_case, struct switch_conv_info *info)
{
- gimple_stmt_iterator gsi;
+ gimple_phi_iterator gsi;
basic_block bb = label_to_block (CASE_LABEL (default_case));
edge e;
int i = 0;
@@ -868,7 +868,7 @@ gather_default_values (tree default_case, struct switch_conv_info *info)
for (gsi = gsi_start_phis (info->final_bb); !gsi_end_p (gsi); gsi_next (&gsi))
{
- gimple phi = gsi_stmt (gsi);
+ gimple_phi phi = gsi.phi ();
tree val = PHI_ARG_DEF_FROM_EDGE (phi, e);
gcc_assert (val);
info->default_values[i++] = val;
@@ -891,7 +891,7 @@ build_constructors (gimple_switch swtch, struct switch_conv_info *info)
basic_block bb = label_to_block (CASE_LABEL (cs));
edge e;
tree high;
- gimple_stmt_iterator gsi;
+ gimple_phi_iterator gsi;
int j;
if (bb == info->final_bb)
@@ -926,7 +926,7 @@ build_constructors (gimple_switch swtch, struct switch_conv_info *info)
for (gsi = gsi_start_phis (info->final_bb);
!gsi_end_p (gsi); gsi_next (&gsi))
{
- gimple phi = gsi_stmt (gsi);
+ gimple_phi phi = gsi.phi ();
tree val = PHI_ARG_DEF_FROM_EDGE (phi, e);
tree low = CASE_LOW (cs);
pos = CASE_LOW (cs);
@@ -1204,13 +1204,13 @@ static void
fix_phi_nodes (edge e1f, edge e2f, basic_block bbf,
struct switch_conv_info *info)
{
- gimple_stmt_iterator gsi;
+ gimple_phi_iterator gsi;
int i;
for (gsi = gsi_start_phis (bbf), i = 0;
!gsi_end_p (gsi); gsi_next (&gsi), i++)
{
- gimple phi = gsi_stmt (gsi);
+ gimple_phi phi = gsi.phi ();
add_phi_arg (phi, info->target_inbound_names[i], e1f, UNKNOWN_LOCATION);
add_phi_arg (phi, info->target_outbound_names[i], e2f, UNKNOWN_LOCATION);
}
diff --git a/gcc/tree-tailcall.c b/gcc/tree-tailcall.c
index b5bd635..c45c89e 100644
--- a/gcc/tree-tailcall.c
+++ b/gcc/tree-tailcall.c
@@ -388,11 +388,11 @@ static tree
propagate_through_phis (tree var, edge e)
{
basic_block dest = e->dest;
- gimple_stmt_iterator gsi;
+ gimple_phi_iterator gsi;
for (gsi = gsi_start_phis (dest); !gsi_end_p (gsi); gsi_next (&gsi))
{
- gimple phi = gsi_stmt (gsi);
+ gimple_phi phi = gsi.phi ();
if (PHI_ARG_DEF_FROM_EDGE (phi, e) == var)
return PHI_RESULT (phi);
}
@@ -620,10 +620,10 @@ find_tail_calls (basic_block bb, struct tailcall **ret)
static void
add_successor_phi_arg (edge e, tree var, tree phi_arg)
{
- gimple_stmt_iterator gsi;
+ gimple_phi_iterator gsi;
for (gsi = gsi_start_phis (e->dest); !gsi_end_p (gsi); gsi_next (&gsi))
- if (PHI_RESULT (gsi_stmt (gsi)) == var)
+ if (PHI_RESULT (gsi.phi ()) == var)
break;
gcc_assert (!gsi_end_p (gsi));
diff --git a/gcc/tree-vect-loop-manip.c b/gcc/tree-vect-loop-manip.c
index 7b79ab1..46e18fe 100644
--- a/gcc/tree-vect-loop-manip.c
+++ b/gcc/tree-vect-loop-manip.c
@@ -391,8 +391,8 @@ static void
slpeel_update_phi_nodes_for_guard1 (edge guard_edge, struct loop *loop,
bool is_new_loop, basic_block *new_exit_bb)
{
- gimple orig_phi, new_phi;
- gimple update_phi, update_phi2;
+ gimple_phi orig_phi, new_phi;
+ gimple_phi update_phi, update_phi2;
tree guard_arg, loop_arg;
basic_block new_merge_bb = guard_edge->dest;
edge e = EDGE_SUCC (new_merge_bb, 0);
@@ -400,7 +400,7 @@ slpeel_update_phi_nodes_for_guard1 (edge guard_edge, struct loop *loop,
basic_block orig_bb = loop->header;
edge new_exit_e;
tree current_new_name;
- gimple_stmt_iterator gsi_orig, gsi_update;
+ gimple_phi_iterator gsi_orig, gsi_update;
/* Create new bb between loop and new_merge_bb. */
*new_exit_bb = split_edge (single_exit (loop));
@@ -414,8 +414,8 @@ slpeel_update_phi_nodes_for_guard1 (edge guard_edge, struct loop *loop,
{
source_location loop_locus, guard_locus;
tree new_res;
- orig_phi = gsi_stmt (gsi_orig);
- update_phi = gsi_stmt (gsi_update);
+ orig_phi = gsi_orig.phi ();
+ update_phi = gsi_update.phi ();
/** 1. Handle new-merge-point phis **/
@@ -531,8 +531,8 @@ static void
slpeel_update_phi_nodes_for_guard2 (edge guard_edge, struct loop *loop,
bool is_new_loop, basic_block *new_exit_bb)
{
- gimple orig_phi, new_phi;
- gimple update_phi, update_phi2;
+ gimple_phi orig_phi, new_phi;
+ gimple_phi update_phi, update_phi2;
tree guard_arg, loop_arg;
basic_block new_merge_bb = guard_edge->dest;
edge e = EDGE_SUCC (new_merge_bb, 0);
@@ -541,7 +541,7 @@ slpeel_update_phi_nodes_for_guard2 (edge guard_edge, struct loop *loop,
tree orig_def, orig_def_new_name;
tree new_name, new_name2;
tree arg;
- gimple_stmt_iterator gsi;
+ gimple_phi_iterator gsi;
/* Create new bb between loop and new_merge_bb. */
*new_exit_bb = split_edge (single_exit (loop));
@@ -551,7 +551,7 @@ slpeel_update_phi_nodes_for_guard2 (edge guard_edge, struct loop *loop,
for (gsi = gsi_start_phis (update_bb); !gsi_end_p (gsi); gsi_next (&gsi))
{
tree new_res;
- update_phi = gsi_stmt (gsi);
+ update_phi = gsi.phi ();
orig_phi = update_phi;
orig_def = PHI_ARG_DEF_FROM_EDGE (orig_phi, e);
/* This loop-closed-phi actually doesn't represent a use
@@ -1173,7 +1173,7 @@ slpeel_tree_peel_loop_to_edge (struct loop *loop, struct loop *scalar_loop,
basic_block bb_before_first_loop;
basic_block bb_between_loops;
basic_block new_exit_bb;
- gimple_stmt_iterator gsi;
+ gimple_phi_iterator gsi;
edge exit_e = single_exit (loop);
source_location loop_loc;
/* There are many aspects to how likely the first loop is going to be executed.
@@ -1205,7 +1205,7 @@ slpeel_tree_peel_loop_to_edge (struct loop *loop, struct loop *scalar_loop,
for (gsi = gsi_start_phis (loop->header); !gsi_end_p (gsi); gsi_next (&gsi))
if (virtual_operand_p (gimple_phi_result (gsi_stmt (gsi))))
{
- gimple phi = gsi_stmt (gsi);
+ gimple_phi phi = gsi.phi ();
for (gsi = gsi_start_phis (exit_e->dest);
!gsi_end_p (gsi); gsi_next (&gsi))
if (virtual_operand_p (gimple_phi_result (gsi_stmt (gsi))))
@@ -1529,7 +1529,7 @@ vect_can_advance_ivs_p (loop_vec_info loop_vinfo)
struct loop *loop = LOOP_VINFO_LOOP (loop_vinfo);
basic_block bb = loop->header;
gimple phi;
- gimple_stmt_iterator gsi;
+ gimple_phi_iterator gsi;
/* Analyze phi functions of the loop header. */
@@ -1539,7 +1539,7 @@ vect_can_advance_ivs_p (loop_vec_info loop_vinfo)
{
tree evolution_part;
- phi = gsi_stmt (gsi);
+ phi = gsi.phi ();
if (dump_enabled_p ())
{
dump_printf_loc (MSG_NOTE, vect_location, "Analyze phi: ");
@@ -1638,8 +1638,8 @@ vect_update_ivs_after_vectorizer (loop_vec_info loop_vinfo, tree niters,
{
struct loop *loop = LOOP_VINFO_LOOP (loop_vinfo);
basic_block exit_bb = single_exit (loop)->dest;
- gimple phi, phi1;
- gimple_stmt_iterator gsi, gsi1;
+ gimple_phi phi, phi1;
+ gimple_phi_iterator gsi, gsi1;
basic_block update_bb = update_e->dest;
gcc_checking_assert (vect_can_advance_ivs_p (loop_vinfo));
@@ -1658,8 +1658,8 @@ vect_update_ivs_after_vectorizer (loop_vec_info loop_vinfo, tree niters,
gimple_stmt_iterator last_gsi;
stmt_vec_info stmt_info;
- phi = gsi_stmt (gsi);
- phi1 = gsi_stmt (gsi1);
+ phi = gsi.phi ();
+ phi1 = gsi1.phi ();
if (dump_enabled_p ())
{
dump_printf_loc (MSG_NOTE, vect_location,
diff --git a/gcc/tree-vect-loop.c b/gcc/tree-vect-loop.c
index fd1166f..5e56d1b 100644
--- a/gcc/tree-vect-loop.c
+++ b/gcc/tree-vect-loop.c
@@ -622,7 +622,7 @@ vect_analyze_scalar_cycles_1 (loop_vec_info loop_vinfo, struct loop *loop)
basic_block bb = loop->header;
tree init, step;
auto_vec<gimple, 64> worklist;
- gimple_stmt_iterator gsi;
+ gimple_phi_iterator gsi;
bool double_reduc;
if (dump_enabled_p ())
@@ -634,7 +634,7 @@ vect_analyze_scalar_cycles_1 (loop_vec_info loop_vinfo, struct loop *loop)
changed. */
for (gsi = gsi_start_phis (bb); !gsi_end_p (gsi); gsi_next (&gsi))
{
- gimple phi = gsi_stmt (gsi);
+ gimple_phi phi = gsi.phi ();
tree access_fn = NULL;
tree def = PHI_RESULT (phi);
stmt_vec_info stmt_vinfo = vinfo_for_stmt (phi);
diff --git a/gcc/tree-vrp.c b/gcc/tree-vrp.c
index b75ac9c..2e19273 100644
--- a/gcc/tree-vrp.c
+++ b/gcc/tree-vrp.c
@@ -6076,10 +6076,10 @@ find_assert_locations (void)
{
i = loop->latch->index;
unsigned int j = single_succ_edge (loop->latch)->dest_idx;
- for (gimple_stmt_iterator gsi = gsi_start_phis (loop->header);
+ for (gimple_phi_iterator gsi = gsi_start_phis (loop->header);
!gsi_end_p (gsi); gsi_next (&gsi))
{
- gimple phi = gsi_stmt (gsi);
+ gimple_phi phi = gsi.phi ();
if (virtual_operand_p (gimple_phi_result (phi)))
continue;
tree arg = gimple_phi_arg_def (phi, j);
diff --git a/gcc/value-prof.c b/gcc/value-prof.c
index 37710ca..0312295 100644
--- a/gcc/value-prof.c
+++ b/gcc/value-prof.c
@@ -1378,7 +1378,7 @@ gimple_ic (gimple icall_stmt, struct cgraph_node *direct_call,
int lp_nr, dflags;
edge e_eh, e;
edge_iterator ei;
- gimple_stmt_iterator psi;
+ gimple_phi_iterator psi;
cond_bb = gimple_bb (icall_stmt);
gsi = gsi_for_stmt (icall_stmt);
@@ -1491,7 +1491,7 @@ gimple_ic (gimple icall_stmt, struct cgraph_node *direct_call,
for (psi = gsi_start_phis (e_eh->dest);
!gsi_end_p (psi); gsi_next (&psi))
{
- gimple phi = gsi_stmt (psi);
+ gimple_phi phi = psi.phi ();
SET_USE (PHI_ARG_DEF_PTR_FROM_EDGE (phi, e),
PHI_ARG_DEF_FROM_EDGE (phi, e_eh));
}
--
1.8.5.3
^ permalink raw reply [flat|nested] 93+ messages in thread
* [gimple-classes, committed 26/92] Introduce gimple_eh_else
2014-10-27 20:35 [gimple-classes, committed 00/92] Initial slew of commits David Malcolm
` (85 preceding siblings ...)
2014-10-27 20:57 ` [gimple-classes, committed 53/92] Use gimple_call for callgraph edges David Malcolm
@ 2014-10-27 20:57 ` David Malcolm
2014-10-27 20:57 ` [gimple-classes, committed 91/92] Remove out-of-date references to typedefs David Malcolm
` (4 subsequent siblings)
91 siblings, 0 replies; 93+ messages in thread
From: David Malcolm @ 2014-10-27 20:57 UTC (permalink / raw)
To: gcc-patches; +Cc: David Malcolm
This corresponds to:
[PATCH 28/89] Introduce gimple_eh_else
https://gcc.gnu.org/ml/gcc-patches/2014-04/msg01156.html
from the original 89-patch kit
That earlier patch was approved by Jeff:
> OK after fixing up the naming/const stuff as discussed for prior
> patches.
> That applies to 22-30. Make sure to take care of
> the pretty printers per Trevor's comments as well. He indicated those
> were missing in a couple of those patches.
in https://gcc.gnu.org/ml/gcc-patches/2014-05/msg00628.html
gcc/
* coretypes.h (gimple_eh_else): New typedef.
(const_gimple_eh_else): New typedef.
* gimple.h (gimple_build_eh_else): Return a gimple_eh_else rather
than a plain gimple.
(gimple_eh_else_n_body_ptr): Require a gimple_eh_else rather than
a plain gimple.
(gimple_eh_else_n_body): Likewise.
(gimple_eh_else_e_body_ptr): Likewise.
(gimple_eh_else_e_body): Likewise.
(gimple_eh_else_set_n_body): Likewise.
(gimple_eh_else_set_e_body): Likewise.
* gimple-low.c (lower_stmt): Add checked cast to gimple_eh_else
within GIMPLE_EH_ELSE case of switch statement, introducing a new
local.
(gimple_stmt_may_fallthru): Likewise.
* gimple-pretty-print.c (dump_gimple_eh_else): Require a
gimple_eh_else rather than a plain gimple.
(pp_gimple_stmt_1): Add checked cast to gimple_eh_else within
GIMPLE_EH_ELSE case of switch statement
* gimple-walk.c (walk_gimple_stmt): Add checked cast to
gimple_eh_else within GIMPLE_EH_ELSE case of switch statement,
introducing a new local.
* gimple.c (gimple_build_eh_else): Return a gimple_eh_else
rather than a plain gimple.
(gimple_copy): Add checked casts to gimple_eh_else within
GIMPLE_EH_ELSE case of switch statement, introducing new locals.
* tree-cfg.c (verify_gimple_in_seq_2): Add checked cast to
gimple_eh_else within GIMPLE_EH_ELSE case of switch statement,
introducing a new local.
* tree-eh.c (collect_finally_tree): Likewise.
(replace_goto_queue_1): Likewise.
(get_eh_else): Return a gimple_eh_else rather than a plain gimple.
(honor_protect_cleanup_actions): Convert local "eh_else" from
gimple to gimple_eh_else.
(lower_try_finally_nofallthru): Likewise.
(lower_try_finally_onedest): Introduce locals "eh_else" and
"label_stmt", using them in favor of "x" for the gimple_eh_else
and the gimple_label.
(lower_try_finally_copy): Convert local "eh_else" from gimple to
gimple_eh_else.
(lower_try_finally_switch): Likewise.
(decide_copy_try_finally): Likewise.
(refactor_eh_r): Add checked cast to gimple_eh_else within
GIMPLE_EH_ELSE case of switch statement, introducing a new local.
---
gcc/ChangeLog.gimple-classes | 56 ++++++++++++++++++++++++++++++++++++++++++++
gcc/coretypes.h | 4 ++++
gcc/gimple-low.c | 15 ++++++++----
gcc/gimple-pretty-print.c | 5 ++--
gcc/gimple-walk.c | 19 ++++++++-------
gcc/gimple.c | 16 ++++++++-----
gcc/gimple.h | 26 +++++++-------------
gcc/tree-cfg.c | 7 ++++--
gcc/tree-eh.c | 55 ++++++++++++++++++++++++++++---------------
9 files changed, 145 insertions(+), 58 deletions(-)
diff --git a/gcc/ChangeLog.gimple-classes b/gcc/ChangeLog.gimple-classes
index dd39ce6..fe3008a 100644
--- a/gcc/ChangeLog.gimple-classes
+++ b/gcc/ChangeLog.gimple-classes
@@ -1,5 +1,61 @@
2014-10-24 David Malcolm <dmalcolm@redhat.com>
+ Introduce gimple_eh_else
+
+ * coretypes.h (gimple_eh_else): New typedef.
+ (const_gimple_eh_else): New typedef.
+
+ * gimple.h (gimple_build_eh_else): Return a gimple_eh_else rather
+ than a plain gimple.
+ (gimple_eh_else_n_body_ptr): Require a gimple_eh_else rather than
+ a plain gimple.
+ (gimple_eh_else_n_body): Likewise.
+ (gimple_eh_else_e_body_ptr): Likewise.
+ (gimple_eh_else_e_body): Likewise.
+ (gimple_eh_else_set_n_body): Likewise.
+ (gimple_eh_else_set_e_body): Likewise.
+
+ * gimple-low.c (lower_stmt): Add checked cast to gimple_eh_else
+ within GIMPLE_EH_ELSE case of switch statement, introducing a new
+ local.
+ (gimple_stmt_may_fallthru): Likewise.
+
+ * gimple-pretty-print.c (dump_gimple_eh_else): Require a
+ gimple_eh_else rather than a plain gimple.
+ (pp_gimple_stmt_1): Add checked cast to gimple_eh_else within
+ GIMPLE_EH_ELSE case of switch statement
+
+ * gimple-walk.c (walk_gimple_stmt): Add checked cast to
+ gimple_eh_else within GIMPLE_EH_ELSE case of switch statement,
+ introducing a new local.
+
+ * gimple.c (gimple_build_eh_else): Return a gimple_eh_else
+ rather than a plain gimple.
+ (gimple_copy): Add checked casts to gimple_eh_else within
+ GIMPLE_EH_ELSE case of switch statement, introducing new locals.
+
+ * tree-cfg.c (verify_gimple_in_seq_2): Add checked cast to
+ gimple_eh_else within GIMPLE_EH_ELSE case of switch statement,
+ introducing a new local.
+
+ * tree-eh.c (collect_finally_tree): Likewise.
+ (replace_goto_queue_1): Likewise.
+ (get_eh_else): Return a gimple_eh_else rather than a plain gimple.
+ (honor_protect_cleanup_actions): Convert local "eh_else" from
+ gimple to gimple_eh_else.
+ (lower_try_finally_nofallthru): Likewise.
+ (lower_try_finally_onedest): Introduce locals "eh_else" and
+ "label_stmt", using them in favor of "x" for the gimple_eh_else
+ and the gimple_label.
+ (lower_try_finally_copy): Convert local "eh_else" from gimple to
+ gimple_eh_else.
+ (lower_try_finally_switch): Likewise.
+ (decide_copy_try_finally): Likewise.
+ (refactor_eh_r): Add checked cast to gimple_eh_else within
+ GIMPLE_EH_ELSE case of switch statement, introducing a new local.
+
+2014-10-24 David Malcolm <dmalcolm@redhat.com>
+
Introduce gimple_eh_must_not_throw
* coretypes.h (gimple_eh_must_not_throw): New typedef.
diff --git a/gcc/coretypes.h b/gcc/coretypes.h
index 51b73f6..ba076ec 100644
--- a/gcc/coretypes.h
+++ b/gcc/coretypes.h
@@ -146,6 +146,10 @@ struct gimple_statement_eh_mnt;
typedef struct gimple_statement_eh_mnt *gimple_eh_must_not_throw;
typedef const struct gimple_statement_eh_mnt *const_gimple_eh_must_not_throw;
+struct gimple_statement_eh_else;
+typedef struct gimple_statement_eh_else *gimple_eh_else;
+typedef const struct gimple_statement_eh_else *const_gimple_eh_else;
+
struct gimple_statement_phi;
typedef struct gimple_statement_phi *gimple_phi;
typedef const struct gimple_statement_phi *const_gimple_phi;
diff --git a/gcc/gimple-low.c b/gcc/gimple-low.c
index 9ac984e..b5dc823 100644
--- a/gcc/gimple-low.c
+++ b/gcc/gimple-low.c
@@ -288,8 +288,11 @@ lower_stmt (gimple_stmt_iterator *gsi, struct lower_data *data)
return;
case GIMPLE_EH_ELSE:
- lower_sequence (gimple_eh_else_n_body_ptr (stmt), data);
- lower_sequence (gimple_eh_else_e_body_ptr (stmt), data);
+ {
+ gimple_eh_else eh_else_stmt = as_a <gimple_eh_else> (stmt);
+ lower_sequence (gimple_eh_else_n_body_ptr (eh_else_stmt), data);
+ lower_sequence (gimple_eh_else_e_body_ptr (eh_else_stmt), data);
+ }
break;
case GIMPLE_NOP:
@@ -597,8 +600,12 @@ gimple_stmt_may_fallthru (gimple stmt)
&& gimple_seq_may_fallthru (gimple_try_cleanup (stmt)));
case GIMPLE_EH_ELSE:
- return (gimple_seq_may_fallthru (gimple_eh_else_n_body (stmt))
- || gimple_seq_may_fallthru (gimple_eh_else_e_body (stmt)));
+ {
+ gimple_eh_else eh_else_stmt = as_a <gimple_eh_else> (stmt);
+ return (gimple_seq_may_fallthru (gimple_eh_else_n_body (eh_else_stmt))
+ || gimple_seq_may_fallthru (gimple_eh_else_e_body (
+ eh_else_stmt)));
+ }
case GIMPLE_CALL:
/* Functions that do not return do not fall through. */
diff --git a/gcc/gimple-pretty-print.c b/gcc/gimple-pretty-print.c
index 42f94a3..a82049f 100644
--- a/gcc/gimple-pretty-print.c
+++ b/gcc/gimple-pretty-print.c
@@ -1038,7 +1038,8 @@ dump_gimple_eh_must_not_throw (pretty_printer *buffer,
dumpfile.h). */
static void
-dump_gimple_eh_else (pretty_printer *buffer, gimple gs, int spc, int flags)
+dump_gimple_eh_else (pretty_printer *buffer, gimple_eh_else gs, int spc,
+ int flags)
{
if (flags & TDF_RAW)
dump_gimple_fmt (buffer, spc, flags,
@@ -2209,7 +2210,7 @@ pp_gimple_stmt_1 (pretty_printer *buffer, gimple gs, int spc, int flags)
break;
case GIMPLE_EH_ELSE:
- dump_gimple_eh_else (buffer, gs, spc, flags);
+ dump_gimple_eh_else (buffer, as_a <gimple_eh_else> (gs), spc, flags);
break;
case GIMPLE_RESX:
diff --git a/gcc/gimple-walk.c b/gcc/gimple-walk.c
index fc74f49..d36263a 100644
--- a/gcc/gimple-walk.c
+++ b/gcc/gimple-walk.c
@@ -566,14 +566,17 @@ walk_gimple_stmt (gimple_stmt_iterator *gsi, walk_stmt_fn callback_stmt,
break;
case GIMPLE_EH_ELSE:
- ret = walk_gimple_seq_mod (gimple_eh_else_n_body_ptr (stmt),
- callback_stmt, callback_op, wi);
- if (ret)
- return wi->callback_result;
- ret = walk_gimple_seq_mod (gimple_eh_else_e_body_ptr (stmt),
- callback_stmt, callback_op, wi);
- if (ret)
- return wi->callback_result;
+ {
+ gimple_eh_else eh_else_stmt = as_a <gimple_eh_else> (stmt);
+ ret = walk_gimple_seq_mod (gimple_eh_else_n_body_ptr (eh_else_stmt),
+ callback_stmt, callback_op, wi);
+ if (ret)
+ return wi->callback_result;
+ ret = walk_gimple_seq_mod (gimple_eh_else_e_body_ptr (eh_else_stmt),
+ callback_stmt, callback_op, wi);
+ if (ret)
+ return wi->callback_result;
+ }
break;
case GIMPLE_TRY:
diff --git a/gcc/gimple.c b/gcc/gimple.c
index a52d989..b3c663c 100644
--- a/gcc/gimple.c
+++ b/gcc/gimple.c
@@ -660,10 +660,10 @@ gimple_build_eh_must_not_throw (tree decl)
/* Build a GIMPLE_EH_ELSE statement. */
-gimple
+gimple_eh_else
gimple_build_eh_else (gimple_seq n_body, gimple_seq e_body)
{
- gimple p = gimple_alloc (GIMPLE_EH_ELSE, 0);
+ gimple_eh_else p = as_a <gimple_eh_else> (gimple_alloc (GIMPLE_EH_ELSE, 0));
gimple_eh_else_set_n_body (p, n_body);
gimple_eh_else_set_e_body (p, e_body);
return p;
@@ -1685,10 +1685,14 @@ gimple_copy (gimple stmt)
break;
case GIMPLE_EH_ELSE:
- new_seq = gimple_seq_copy (gimple_eh_else_n_body (stmt));
- gimple_eh_else_set_n_body (copy, new_seq);
- new_seq = gimple_seq_copy (gimple_eh_else_e_body (stmt));
- gimple_eh_else_set_e_body (copy, new_seq);
+ {
+ gimple_eh_else eh_else_stmt = as_a <gimple_eh_else> (stmt);
+ gimple_eh_else eh_else_copy = as_a <gimple_eh_else> (copy);
+ new_seq = gimple_seq_copy (gimple_eh_else_n_body (eh_else_stmt));
+ gimple_eh_else_set_n_body (eh_else_copy, new_seq);
+ new_seq = gimple_seq_copy (gimple_eh_else_e_body (eh_else_stmt));
+ gimple_eh_else_set_e_body (eh_else_copy, new_seq);
+ }
break;
case GIMPLE_TRY:
diff --git a/gcc/gimple.h b/gcc/gimple.h
index 445a1c0..9b73e00 100644
--- a/gcc/gimple.h
+++ b/gcc/gimple.h
@@ -1328,7 +1328,7 @@ gimple_asm gimple_build_asm_vec (const char *, vec<tree, va_gc> *,
gimple_catch gimple_build_catch (tree, gimple_seq);
gimple_eh_filter gimple_build_eh_filter (tree, gimple_seq);
gimple_eh_must_not_throw gimple_build_eh_must_not_throw (tree);
-gimple gimple_build_eh_else (gimple_seq, gimple_seq);
+gimple_eh_else gimple_build_eh_else (gimple_seq, gimple_seq);
gimple_statement_try *gimple_build_try (gimple_seq, gimple_seq,
enum gimple_try_flags);
gimple gimple_build_wce (gimple_seq);
@@ -3669,46 +3669,38 @@ gimple_eh_must_not_throw_set_fndecl (gimple_eh_must_not_throw eh_mnt_stmt,
/* GIMPLE_EH_ELSE accessors. */
static inline gimple_seq *
-gimple_eh_else_n_body_ptr (gimple gs)
+gimple_eh_else_n_body_ptr (gimple_eh_else eh_else_stmt)
{
- gimple_statement_eh_else *eh_else_stmt =
- as_a <gimple_statement_eh_else *> (gs);
return &eh_else_stmt->n_body;
}
static inline gimple_seq
-gimple_eh_else_n_body (gimple gs)
+gimple_eh_else_n_body (gimple_eh_else eh_else_stmt)
{
- return *gimple_eh_else_n_body_ptr (gs);
+ return *gimple_eh_else_n_body_ptr (eh_else_stmt);
}
static inline gimple_seq *
-gimple_eh_else_e_body_ptr (gimple gs)
+gimple_eh_else_e_body_ptr (gimple_eh_else eh_else_stmt)
{
- gimple_statement_eh_else *eh_else_stmt =
- as_a <gimple_statement_eh_else *> (gs);
return &eh_else_stmt->e_body;
}
static inline gimple_seq
-gimple_eh_else_e_body (gimple gs)
+gimple_eh_else_e_body (gimple_eh_else eh_else_stmt)
{
- return *gimple_eh_else_e_body_ptr (gs);
+ return *gimple_eh_else_e_body_ptr (eh_else_stmt);
}
static inline void
-gimple_eh_else_set_n_body (gimple gs, gimple_seq seq)
+gimple_eh_else_set_n_body (gimple_eh_else eh_else_stmt, gimple_seq seq)
{
- gimple_statement_eh_else *eh_else_stmt =
- as_a <gimple_statement_eh_else *> (gs);
eh_else_stmt->n_body = seq;
}
static inline void
-gimple_eh_else_set_e_body (gimple gs, gimple_seq seq)
+gimple_eh_else_set_e_body (gimple_eh_else eh_else_stmt, gimple_seq seq)
{
- gimple_statement_eh_else *eh_else_stmt =
- as_a <gimple_statement_eh_else *> (gs);
eh_else_stmt->e_body = seq;
}
diff --git a/gcc/tree-cfg.c b/gcc/tree-cfg.c
index d459228..10422c6 100644
--- a/gcc/tree-cfg.c
+++ b/gcc/tree-cfg.c
@@ -4639,8 +4639,11 @@ verify_gimple_in_seq_2 (gimple_seq stmts)
break;
case GIMPLE_EH_ELSE:
- err |= verify_gimple_in_seq_2 (gimple_eh_else_n_body (stmt));
- err |= verify_gimple_in_seq_2 (gimple_eh_else_e_body (stmt));
+ {
+ gimple_eh_else eh_else = as_a <gimple_eh_else> (stmt);
+ err |= verify_gimple_in_seq_2 (gimple_eh_else_n_body (eh_else));
+ err |= verify_gimple_in_seq_2 (gimple_eh_else_e_body (eh_else));
+ }
break;
case GIMPLE_CATCH:
diff --git a/gcc/tree-eh.c b/gcc/tree-eh.c
index d22eb45..fbb40e5 100644
--- a/gcc/tree-eh.c
+++ b/gcc/tree-eh.c
@@ -273,8 +273,11 @@ collect_finally_tree (gimple stmt, gimple region)
break;
case GIMPLE_EH_ELSE:
- collect_finally_tree_1 (gimple_eh_else_n_body (stmt), region);
- collect_finally_tree_1 (gimple_eh_else_e_body (stmt), region);
+ {
+ gimple_eh_else eh_else_stmt = as_a <gimple_eh_else> (stmt);
+ collect_finally_tree_1 (gimple_eh_else_n_body (eh_else_stmt), region);
+ collect_finally_tree_1 (gimple_eh_else_e_body (eh_else_stmt), region);
+ }
break;
default:
@@ -529,8 +532,13 @@ replace_goto_queue_1 (gimple stmt, struct leh_tf_state *tf,
replace_goto_queue_stmt_list (gimple_eh_filter_failure_ptr (stmt), tf);
break;
case GIMPLE_EH_ELSE:
- replace_goto_queue_stmt_list (gimple_eh_else_n_body_ptr (stmt), tf);
- replace_goto_queue_stmt_list (gimple_eh_else_e_body_ptr (stmt), tf);
+ {
+ gimple_eh_else eh_else_stmt = as_a <gimple_eh_else> (stmt);
+ replace_goto_queue_stmt_list (gimple_eh_else_n_body_ptr (eh_else_stmt),
+ tf);
+ replace_goto_queue_stmt_list (gimple_eh_else_e_body_ptr (eh_else_stmt),
+ tf);
+ }
break;
default:
@@ -940,14 +948,14 @@ lower_try_finally_fallthru_label (struct leh_tf_state *tf)
/* A subroutine of lower_try_finally. If FINALLY consits of a
GIMPLE_EH_ELSE node, return it. */
-static inline gimple
+static inline gimple_eh_else
get_eh_else (gimple_seq finally)
{
gimple x = gimple_seq_first_stmt (finally);
if (gimple_code (x) == GIMPLE_EH_ELSE)
{
gcc_assert (gimple_seq_singleton_p (finally));
- return x;
+ return as_a <gimple_eh_else> (x);
}
return NULL;
}
@@ -981,7 +989,8 @@ honor_protect_cleanup_actions (struct leh_state *outer_state,
gimple_stmt_iterator gsi;
bool finally_may_fallthru;
gimple_seq finally;
- gimple x, eh_else;
+ gimple x;
+ gimple_eh_else eh_else;
/* First check for nothing to do. */
if (lang_hooks.eh_protect_cleanup_actions == NULL)
@@ -1049,7 +1058,8 @@ lower_try_finally_nofallthru (struct leh_state *state,
struct leh_tf_state *tf)
{
tree lab;
- gimple x, eh_else;
+ gimple x;
+ gimple_eh_else eh_else;
gimple_seq finally;
struct goto_queue_node *q, *qe;
@@ -1113,6 +1123,8 @@ static void
lower_try_finally_onedest (struct leh_state *state, struct leh_tf_state *tf)
{
struct goto_queue_node *q, *qe;
+ gimple_eh_else eh_else;
+ gimple_label label_stmt;
gimple x;
gimple_seq finally;
gimple_stmt_iterator gsi;
@@ -1125,13 +1137,13 @@ lower_try_finally_onedest (struct leh_state *state, struct leh_tf_state *tf)
/* Since there's only one destination, and the destination edge can only
either be EH or non-EH, that implies that all of our incoming edges
are of the same type. Therefore we can lower EH_ELSE immediately. */
- x = get_eh_else (finally);
- if (x)
+ eh_else = get_eh_else (finally);
+ if (eh_else)
{
if (tf->may_throw)
- finally = gimple_eh_else_e_body (x);
+ finally = gimple_eh_else_e_body (eh_else);
else
- finally = gimple_eh_else_n_body (x);
+ finally = gimple_eh_else_n_body (eh_else);
}
lower_eh_constructs_1 (state, &finally);
@@ -1166,8 +1178,8 @@ lower_try_finally_onedest (struct leh_state *state, struct leh_tf_state *tf)
}
finally_label = create_artificial_label (loc);
- x = gimple_build_label (finally_label);
- gimple_seq_add_stmt (&tf->top_p_seq, x);
+ label_stmt = gimple_build_label (finally_label);
+ gimple_seq_add_stmt (&tf->top_p_seq, label_stmt);
gimple_seq_add_seq (&tf->top_p_seq, finally);
@@ -1215,7 +1227,8 @@ lower_try_finally_copy (struct leh_state *state, struct leh_tf_state *tf)
gimple_seq finally;
gimple_seq new_stmt;
gimple_seq seq;
- gimple x, eh_else;
+ gimple x;
+ gimple_eh_else eh_else;
tree tmp;
location_t tf_loc = gimple_location (tf->try_finally_expr);
@@ -1348,7 +1361,8 @@ lower_try_finally_switch (struct leh_state *state, struct leh_tf_state *tf)
tree last_case;
vec<tree> case_label_vec;
gimple_seq switch_body = NULL;
- gimple x, eh_else;
+ gimple x;
+ gimple_eh_else eh_else;
tree tmp;
gimple switch_stmt;
gimple_seq finally;
@@ -1560,7 +1574,7 @@ static bool
decide_copy_try_finally (int ndests, bool may_throw, gimple_seq finally)
{
int f_estimate, sw_estimate;
- gimple eh_else;
+ gimple_eh_else eh_else;
/* If there's an EH_ELSE involved, the exception path is separate
and really doesn't come into play for this computation. */
@@ -3072,8 +3086,11 @@ refactor_eh_r (gimple_seq seq)
refactor_eh_r (gimple_eh_filter_failure (one));
break;
case GIMPLE_EH_ELSE:
- refactor_eh_r (gimple_eh_else_n_body (one));
- refactor_eh_r (gimple_eh_else_e_body (one));
+ {
+ gimple_eh_else eh_else_stmt = as_a <gimple_eh_else> (one);
+ refactor_eh_r (gimple_eh_else_n_body (eh_else_stmt));
+ refactor_eh_r (gimple_eh_else_e_body (eh_else_stmt));
+ }
break;
default:
break;
--
1.8.5.3
^ permalink raw reply [flat|nested] 93+ messages in thread
* [gimple-classes, committed 24/92] Introduce gimple_eh_filter
2014-10-27 20:35 [gimple-classes, committed 00/92] Initial slew of commits David Malcolm
` (81 preceding siblings ...)
2014-10-27 20:57 ` [gimple-classes, committed 32/92] Introduce gimple_omp_atomic_load David Malcolm
@ 2014-10-27 20:57 ` David Malcolm
2014-10-27 20:57 ` [gimple-classes, committed 65/92] Make gimple_phi_arg_location require a gimple_phi David Malcolm
` (8 subsequent siblings)
91 siblings, 0 replies; 93+ messages in thread
From: David Malcolm @ 2014-10-27 20:57 UTC (permalink / raw)
To: gcc-patches; +Cc: David Malcolm
This corresponds to:
[PATCH 26/89] Introduce gimple_eh_filter
https://gcc.gnu.org/ml/gcc-patches/2014-04/msg01220.html
from the original 89-patch kit
That earlier patch was approved by Jeff:
> OK after fixing up the naming/const stuff as discussed for prior
> patches.
> That applies to 22-30. Make sure to take care of
> the pretty printers per Trevor's comments as well. He indicated those
> were missing in a couple of those patches.
in https://gcc.gnu.org/ml/gcc-patches/2014-05/msg00628.html
gcc/
* coretypes.h (gimple_eh_filter): New typedef.
(const_gimple_eh_filter): New typedef.
* gimple.h (gimple_build_eh_filter): Return a gimple_eh_filter
rather than a plain gimple.
* gimple-pretty-print.c (dump_gimple_eh_filter): Require a
gimple_eh_filter rather than a plain gimple.
(pp_gimple_stmt_1): Add checked cast to gimple_eh_filter within
GIMPLE_EH_FILTER case of switch statement.
* gimple.c (gimple_build_eh_filter): Return a gimple_eh_filter
rather than a plain gimple.
---
gcc/ChangeLog.gimple-classes | 18 ++++++++++++++++++
gcc/coretypes.h | 4 ++++
gcc/gimple-pretty-print.c | 5 +++--
gcc/gimple.c | 5 +++--
gcc/gimple.h | 2 +-
5 files changed, 29 insertions(+), 5 deletions(-)
diff --git a/gcc/ChangeLog.gimple-classes b/gcc/ChangeLog.gimple-classes
index 04b611e..e91317c 100644
--- a/gcc/ChangeLog.gimple-classes
+++ b/gcc/ChangeLog.gimple-classes
@@ -1,5 +1,23 @@
2014-10-24 David Malcolm <dmalcolm@redhat.com>
+ Introduce gimple_eh_filter
+
+ * coretypes.h (gimple_eh_filter): New typedef.
+ (const_gimple_eh_filter): New typedef.
+
+ * gimple.h (gimple_build_eh_filter): Return a gimple_eh_filter
+ rather than a plain gimple.
+
+ * gimple-pretty-print.c (dump_gimple_eh_filter): Require a
+ gimple_eh_filter rather than a plain gimple.
+ (pp_gimple_stmt_1): Add checked cast to gimple_eh_filter within
+ GIMPLE_EH_FILTER case of switch statement.
+
+ * gimple.c (gimple_build_eh_filter): Return a gimple_eh_filter
+ rather than a plain gimple.
+
+2014-10-24 David Malcolm <dmalcolm@redhat.com>
+
Introduce gimple_catch
* coretypes.h (gimple_catch): New typedef.
diff --git a/gcc/coretypes.h b/gcc/coretypes.h
index bff57cc..d2d19ec 100644
--- a/gcc/coretypes.h
+++ b/gcc/coretypes.h
@@ -138,6 +138,10 @@ struct gimple_statement_catch;
typedef struct gimple_statement_catch *gimple_catch;
typedef const struct gimple_statement_catch *const_gimple_catch;
+struct gimple_statement_eh_filter;
+typedef struct gimple_statement_eh_filter *gimple_eh_filter;
+typedef const struct gimple_statement_eh_filter *const_gimple_eh_filter;
+
struct gimple_statement_phi;
typedef struct gimple_statement_phi *gimple_phi;
typedef const struct gimple_statement_phi *const_gimple_phi;
diff --git a/gcc/gimple-pretty-print.c b/gcc/gimple-pretty-print.c
index f7287f6..5876a0c 100644
--- a/gcc/gimple-pretty-print.c
+++ b/gcc/gimple-pretty-print.c
@@ -1004,7 +1004,8 @@ dump_gimple_catch (pretty_printer *buffer, gimple_catch gs, int spc, int flags)
dumpfile.h). */
static void
-dump_gimple_eh_filter (pretty_printer *buffer, gimple gs, int spc, int flags)
+dump_gimple_eh_filter (pretty_printer *buffer, gimple_eh_filter gs, int spc,
+ int flags)
{
if (flags & TDF_RAW)
dump_gimple_fmt (buffer, spc, flags, "%G <%T, %+FAILURE <%S>%->", gs,
@@ -2198,7 +2199,7 @@ pp_gimple_stmt_1 (pretty_printer *buffer, gimple gs, int spc, int flags)
break;
case GIMPLE_EH_FILTER:
- dump_gimple_eh_filter (buffer, gs, spc, flags);
+ dump_gimple_eh_filter (buffer, as_a <gimple_eh_filter> (gs), spc, flags);
break;
case GIMPLE_EH_MUST_NOT_THROW:
diff --git a/gcc/gimple.c b/gcc/gimple.c
index 61a9c83..3b1ff98 100644
--- a/gcc/gimple.c
+++ b/gcc/gimple.c
@@ -630,10 +630,11 @@ gimple_build_catch (tree types, gimple_seq handler)
TYPES are the filter's types.
FAILURE is the filter's failure action. */
-gimple
+gimple_eh_filter
gimple_build_eh_filter (tree types, gimple_seq failure)
{
- gimple p = gimple_alloc (GIMPLE_EH_FILTER, 0);
+ gimple_eh_filter p =
+ as_a <gimple_eh_filter> (gimple_alloc (GIMPLE_EH_FILTER, 0));
gimple_eh_filter_set_types (p, types);
if (failure)
gimple_eh_filter_set_failure (p, failure);
diff --git a/gcc/gimple.h b/gcc/gimple.h
index 23e6861..0d95035 100644
--- a/gcc/gimple.h
+++ b/gcc/gimple.h
@@ -1326,7 +1326,7 @@ gimple_asm gimple_build_asm_vec (const char *, vec<tree, va_gc> *,
vec<tree, va_gc> *, vec<tree, va_gc> *,
vec<tree, va_gc> *);
gimple_catch gimple_build_catch (tree, gimple_seq);
-gimple gimple_build_eh_filter (tree, gimple_seq);
+gimple_eh_filter gimple_build_eh_filter (tree, gimple_seq);
gimple gimple_build_eh_must_not_throw (tree);
gimple gimple_build_eh_else (gimple_seq, gimple_seq);
gimple_statement_try *gimple_build_try (gimple_seq, gimple_seq,
--
1.8.5.3
^ permalink raw reply [flat|nested] 93+ messages in thread
* [gimple-classes, committed 50/92] Make gimple_phi_arg_edge require a gimple_phi
2014-10-27 20:35 [gimple-classes, committed 00/92] Initial slew of commits David Malcolm
` (79 preceding siblings ...)
2014-10-27 20:56 ` [gimple-classes, committed 62/92] Concretize gimple_try_set_catch_is_cleanup David Malcolm
@ 2014-10-27 20:57 ` David Malcolm
2014-10-27 20:57 ` [gimple-classes, committed 32/92] Introduce gimple_omp_atomic_load David Malcolm
` (10 subsequent siblings)
91 siblings, 0 replies; 93+ messages in thread
From: David Malcolm @ 2014-10-27 20:57 UTC (permalink / raw)
To: gcc-patches; +Cc: David Malcolm
This corresponds to:
[PATCH 52/89] Make gimple_phi_arg_edge require a gimple_phi
https://gcc.gnu.org/ml/gcc-patches/2014-04/msg01228.html
from the original 89-patch kit
That earlier patch was approved by Jeff:
> Fine once prereqs go in.
in https://gcc.gnu.org/ml/gcc-patches/2014-05/msg00877.html
gcc/
* gimple.h (gimple_phi_arg_edge): Require a gimple_phi rather
than a plain gimple.
* gimple-ssa-strength-reduction.c (ncd_with_phi): Strengthen
param "phi" from gimple to gimple_phi. Add a checked cast.
(ncd_of_cand_and_phis): Add a checked cast.
* graphite-sese-to-poly.c (rewrite_phi_out_of_ssa): Require a
gimple_phi_iterator; strengthen local "phi" from gimple to a
gimple_phi.
(rewrite_cross_bb_scalar_deps): Strengthen local "psi" from
a gimple_stmt_iterator to a gimple_phi_iterator.
(edge_initial_value_for_loop_phi): Require a gimple phi.
(initial_value_for_loop_phi): Likewise.
* ipa-split.c (consider_split): Convert "bsi" to a
gimple_phi_iterator and "stmt" to a gimple_phi.
* predict.c (predict_extra_loop_exits): Convert "phi_stmt" to be
a gimple_phi; introduce "lhs_def_stmt" as plain gimple.
(apply_return_prediction): Convert "phi" to be a gimple_phi.
* tree-cfg.c (replace_uses_by): Add checked cast to gimple_phi.
(verify_gimple_in_cfg): Introduce gimple_phi_iterator "gpi" and use
it to convert "phi" to a gimple_phi.
* tree-eh.c (cleanup_empty_eh_merge_phis): Convert "ngsi", "ogsi"
to be gimple_phi_iterators. Convert "ophi", "nphi" to be
gimple_phi.
* tree-into-ssa.c (prepare_use_sites_for): Add checked cast to
gimple_phi.
* tree-ssa-coalesce.c (create_outofssa_var_map): Introduce
gimple_phi_iterator "gpi" and use it to convert "phi" to a
gimple_phi.
* tree-ssa-dce.c (propagate_necessity): Introduce local "phi",
from checked cast to gimple_phi.
* tree-ssa-live.c (set_var_live_on_entry): Add checked cast to
gimple_phi.
* tree-ssa-propagate.c (replace_phi_args_in): Require a gimple_phi
rather than a plain gimple.
(substitute_and_fold_dom_walker::before_dom_children): Introduce
gimple_phi_iterator "gpi".
* tree-ssa-sink.c (find_bb_for_arg): Require a gimple_phi rather
than a plain gimple.
(nearest_common_dominator_of_uses): Replace check of code against
GIMPLE_PHI with a dyn_cast<gimple_phi>, introducing a new local.
(statement_sink_location): Add checked cast to gimple_phi.
* tree-ssa-uninit.c (compute_uninit_opnds_pos): Require a
gimple_phi rather than a plain gimple.
(collect_phi_def_edges): Likewise. Add a checked cast.
(find_def_preds): Strengthen param "phi" from gimple to
gimple_phi.
(prune_uninit_phi_opnds_in_unrealizable_paths): Likewise for
params "phi" and "flag_def". Strenghen param "visited_phis" from
hash_set<gimple> * to hash_set<gimple_phi> *. Convert
"flag_arg_def", "phi_arg_def" to gimple_phi using
dyn_cast<gimple_phi>. Similarly, introduce new local
"opnd_def_phi".
(use_pred_not_overlap_with_undef_path_pred): Strengthen param
"phi" from gimple to gimple_phi, and param "visited_phis" from
hash_set<gimple> * to hash_set<gimple_phi> *. Add a checked cast.
(is_use_properly_guarded): Likewise for params.
(find_uninit_use): Replace check of code against GIMPLE_PHI with
a dyn_cast<gimple_phi>, introducing a new local "use_phi".
Strengthen local "visited_phis" from hash_set<gimple> to
hash_set<gimple_phi>.
---
gcc/ChangeLog.gimple-classes | 78 +++++++++++++++++++++++++++++++++++++
gcc/gimple-ssa-strength-reduction.c | 8 ++--
gcc/gimple.h | 6 +--
gcc/graphite-sese-to-poly.c | 10 ++---
gcc/ipa-split.c | 4 +-
gcc/predict.c | 15 ++++---
gcc/tree-cfg.c | 9 +++--
gcc/tree-eh.c | 6 +--
gcc/tree-into-ssa.c | 2 +-
gcc/tree-ssa-coalesce.c | 6 ++-
gcc/tree-ssa-dce.c | 3 +-
gcc/tree-ssa-live.c | 2 +-
gcc/tree-ssa-propagate.c | 14 ++++---
gcc/tree-ssa-sink.c | 8 ++--
gcc/tree-ssa-uninit.c | 50 ++++++++++++------------
15 files changed, 157 insertions(+), 64 deletions(-)
diff --git a/gcc/ChangeLog.gimple-classes b/gcc/ChangeLog.gimple-classes
index abee412..4a78ca0 100644
--- a/gcc/ChangeLog.gimple-classes
+++ b/gcc/ChangeLog.gimple-classes
@@ -1,5 +1,83 @@
2014-10-24 David Malcolm <dmalcolm@redhat.com>
+ Make gimple_phi_arg_edge require a gimple_phi
+
+ * gimple.h (gimple_phi_arg_edge): Require a gimple_phi rather
+ than a plain gimple.
+
+ * gimple-ssa-strength-reduction.c (ncd_with_phi): Strengthen
+ param "phi" from gimple to gimple_phi. Add a checked cast.
+ (ncd_of_cand_and_phis): Add a checked cast.
+
+ * graphite-sese-to-poly.c (rewrite_phi_out_of_ssa): Require a
+ gimple_phi_iterator; strengthen local "phi" from gimple to a
+ gimple_phi.
+ (rewrite_cross_bb_scalar_deps): Strengthen local "psi" from
+ a gimple_stmt_iterator to a gimple_phi_iterator.
+ (edge_initial_value_for_loop_phi): Require a gimple phi.
+ (initial_value_for_loop_phi): Likewise.
+
+ * ipa-split.c (consider_split): Convert "bsi" to a
+ gimple_phi_iterator and "stmt" to a gimple_phi.
+
+ * predict.c (predict_extra_loop_exits): Convert "phi_stmt" to be
+ a gimple_phi; introduce "lhs_def_stmt" as plain gimple.
+ (apply_return_prediction): Convert "phi" to be a gimple_phi.
+
+ * tree-cfg.c (replace_uses_by): Add checked cast to gimple_phi.
+ (verify_gimple_in_cfg): Introduce gimple_phi_iterator "gpi" and use
+ it to convert "phi" to a gimple_phi.
+
+ * tree-eh.c (cleanup_empty_eh_merge_phis): Convert "ngsi", "ogsi"
+ to be gimple_phi_iterators. Convert "ophi", "nphi" to be
+ gimple_phi.
+
+ * tree-into-ssa.c (prepare_use_sites_for): Add checked cast to
+ gimple_phi.
+
+ * tree-ssa-coalesce.c (create_outofssa_var_map): Introduce
+ gimple_phi_iterator "gpi" and use it to convert "phi" to a
+ gimple_phi.
+
+ * tree-ssa-dce.c (propagate_necessity): Introduce local "phi",
+ from checked cast to gimple_phi.
+
+ * tree-ssa-live.c (set_var_live_on_entry): Add checked cast to
+ gimple_phi.
+
+ * tree-ssa-propagate.c (replace_phi_args_in): Require a gimple_phi
+ rather than a plain gimple.
+ (substitute_and_fold_dom_walker::before_dom_children): Introduce
+ gimple_phi_iterator "gpi".
+
+ * tree-ssa-sink.c (find_bb_for_arg): Require a gimple_phi rather
+ than a plain gimple.
+ (nearest_common_dominator_of_uses): Replace check of code against
+ GIMPLE_PHI with a dyn_cast<gimple_phi>, introducing a new local.
+ (statement_sink_location): Add checked cast to gimple_phi.
+
+ * tree-ssa-uninit.c (compute_uninit_opnds_pos): Require a
+ gimple_phi rather than a plain gimple.
+ (collect_phi_def_edges): Likewise. Add a checked cast.
+ (find_def_preds): Strengthen param "phi" from gimple to
+ gimple_phi.
+ (prune_uninit_phi_opnds_in_unrealizable_paths): Likewise for
+ params "phi" and "flag_def". Strenghen param "visited_phis" from
+ hash_set<gimple> * to hash_set<gimple_phi> *. Convert
+ "flag_arg_def", "phi_arg_def" to gimple_phi using
+ dyn_cast<gimple_phi>. Similarly, introduce new local
+ "opnd_def_phi".
+ (use_pred_not_overlap_with_undef_path_pred): Strengthen param
+ "phi" from gimple to gimple_phi, and param "visited_phis" from
+ hash_set<gimple> * to hash_set<gimple_phi> *. Add a checked cast.
+ (is_use_properly_guarded): Likewise for params.
+ (find_uninit_use): Replace check of code against GIMPLE_PHI with
+ a dyn_cast<gimple_phi>, introducing a new local "use_phi".
+ Strengthen local "visited_phis" from hash_set<gimple> to
+ hash_set<gimple_phi>.
+
+2014-10-24 David Malcolm <dmalcolm@redhat.com>
+
Update GRAPHITE to use more concrete gimple statement classes
* graphite-scop-detection.c (canonicalize_loop_closed_ssa):
diff --git a/gcc/gimple-ssa-strength-reduction.c b/gcc/gimple-ssa-strength-reduction.c
index 4b4c213..1b6138f 100644
--- a/gcc/gimple-ssa-strength-reduction.c
+++ b/gcc/gimple-ssa-strength-reduction.c
@@ -2970,7 +2970,7 @@ ncd_for_two_cands (basic_block bb1, basic_block bb2,
candidates, return the earliest candidate in the block in *WHERE. */
static basic_block
-ncd_with_phi (slsr_cand_t c, const widest_int &incr, gimple phi,
+ncd_with_phi (slsr_cand_t c, const widest_int &incr, gimple_phi phi,
basic_block ncd, slsr_cand_t *where)
{
unsigned i;
@@ -2986,7 +2986,8 @@ ncd_with_phi (slsr_cand_t c, const widest_int &incr, gimple phi,
gimple arg_def = SSA_NAME_DEF_STMT (arg);
if (gimple_code (arg_def) == GIMPLE_PHI)
- ncd = ncd_with_phi (c, incr, arg_def, ncd, where);
+ ncd = ncd_with_phi (c, incr, as_a <gimple_phi> (arg_def), ncd,
+ where);
else
{
slsr_cand_t arg_cand = base_cand_from_table (arg);
@@ -3020,7 +3021,8 @@ ncd_of_cand_and_phis (slsr_cand_t c, const widest_int &incr, slsr_cand_t *where)
}
if (phi_dependent_cand_p (c))
- ncd = ncd_with_phi (c, incr, lookup_cand (c->def_phi)->cand_stmt,
+ ncd = ncd_with_phi (c, incr,
+ as_a <gimple_phi> (lookup_cand (c->def_phi)->cand_stmt),
ncd, where);
return ncd;
diff --git a/gcc/gimple.h b/gcc/gimple.h
index 5e49d97..96d9245 100644
--- a/gcc/gimple.h
+++ b/gcc/gimple.h
@@ -3979,12 +3979,12 @@ gimple_phi_arg_def_ptr (gimple_phi phi, size_t index)
return &gimple_phi_arg (phi, index)->def;
}
-/* Return the edge associated with argument I of phi node GS. */
+/* Return the edge associated with argument I of phi node PHI. */
static inline edge
-gimple_phi_arg_edge (gimple gs, size_t i)
+gimple_phi_arg_edge (gimple_phi phi, size_t i)
{
- return EDGE_PRED (gimple_bb (gs), i);
+ return EDGE_PRED (gimple_bb (phi), i);
}
/* Return the source location of gimple argument I of phi node GS. */
diff --git a/gcc/graphite-sese-to-poly.c b/gcc/graphite-sese-to-poly.c
index f58f750..33a661d 100644
--- a/gcc/graphite-sese-to-poly.c
+++ b/gcc/graphite-sese-to-poly.c
@@ -2235,10 +2235,10 @@ rewrite_close_phi_out_of_ssa (scop_p scop, gimple_stmt_iterator *psi)
dimension array for it. */
static void
-rewrite_phi_out_of_ssa (scop_p scop, gimple_stmt_iterator *psi)
+rewrite_phi_out_of_ssa (scop_p scop, gimple_phi_iterator *psi)
{
size_t i;
- gimple phi = gsi_stmt (*psi);
+ gimple_phi phi = psi->phi ();
basic_block bb = gimple_bb (phi);
tree res = gimple_phi_result (phi);
tree zero_dim_array = create_zero_dim_array (res, "phi_out_of_ssa");
@@ -2449,7 +2449,7 @@ rewrite_cross_bb_scalar_deps (scop_p scop, gimple_stmt_iterator *gsi)
if (gimple_code (use_stmt) == GIMPLE_PHI
&& (res = true))
{
- gimple_stmt_iterator psi = gsi_for_stmt (use_stmt);
+ gimple_phi_iterator psi = gsi_start_phis (gimple_bb (use_stmt));
if (scalar_close_phi_node_p (gsi_stmt (psi)))
rewrite_close_phi_out_of_ssa (scop, &psi);
@@ -2741,7 +2741,7 @@ follow_inital_value_to_phi (tree arg, tree lhs)
from outside the loop. */
static edge
-edge_initial_value_for_loop_phi (gimple phi)
+edge_initial_value_for_loop_phi (gimple_phi phi)
{
size_t i;
@@ -2761,7 +2761,7 @@ edge_initial_value_for_loop_phi (gimple phi)
from outside the loop. */
static tree
-initial_value_for_loop_phi (gimple phi)
+initial_value_for_loop_phi (gimple_phi phi)
{
size_t i;
diff --git a/gcc/ipa-split.c b/gcc/ipa-split.c
index 94a0337..5678251 100644
--- a/gcc/ipa-split.c
+++ b/gcc/ipa-split.c
@@ -409,7 +409,7 @@ consider_split (struct split_point *current, bitmap non_ssa_vars,
unsigned int call_overhead;
edge e;
edge_iterator ei;
- gimple_stmt_iterator bsi;
+ gimple_phi_iterator bsi;
unsigned int i;
int incoming_freq = 0;
tree retval;
@@ -466,7 +466,7 @@ consider_split (struct split_point *current, bitmap non_ssa_vars,
incoming from header are the same. */
for (bsi = gsi_start_phis (current->entry_bb); !gsi_end_p (bsi); gsi_next (&bsi))
{
- gimple stmt = gsi_stmt (bsi);
+ gimple_phi stmt = bsi.phi ();
tree val = NULL;
if (virtual_operand_p (gimple_phi_result (stmt)))
diff --git a/gcc/predict.c b/gcc/predict.c
index b5556db..bd3f138 100644
--- a/gcc/predict.c
+++ b/gcc/predict.c
@@ -1442,7 +1442,8 @@ predict_extra_loop_exits (edge exit_edge)
{
unsigned i;
bool check_value_one;
- gimple phi_stmt;
+ gimple lhs_def_stmt;
+ gimple_phi phi_stmt;
tree cmp_rhs, cmp_lhs;
gimple cmp_stmt = last_stmt (exit_edge->src);
@@ -1463,8 +1464,12 @@ predict_extra_loop_exits (edge exit_edge)
^ (gimple_cond_code (cmp_stmt) == EQ_EXPR))
^ ((exit_edge->flags & EDGE_TRUE_VALUE) != 0));
- phi_stmt = SSA_NAME_DEF_STMT (cmp_lhs);
- if (!phi_stmt || gimple_code (phi_stmt) != GIMPLE_PHI)
+ lhs_def_stmt = SSA_NAME_DEF_STMT (cmp_lhs);
+ if (!lhs_def_stmt)
+ return;
+
+ phi_stmt = dyn_cast <gimple_phi> (lhs_def_stmt);
+ if (!phi_stmt)
return;
for (i = 0; i < gimple_phi_num_args (phi_stmt); i++)
@@ -2143,7 +2148,7 @@ apply_return_prediction (void)
gimple return_stmt = NULL;
tree return_val;
edge e;
- gimple phi;
+ gimple_phi phi;
int phi_num_args, i;
enum br_predictor pred;
enum prediction direction;
@@ -2165,7 +2170,7 @@ apply_return_prediction (void)
|| !SSA_NAME_DEF_STMT (return_val)
|| gimple_code (SSA_NAME_DEF_STMT (return_val)) != GIMPLE_PHI)
return;
- phi = SSA_NAME_DEF_STMT (return_val);
+ phi = as_a <gimple_phi> (SSA_NAME_DEF_STMT (return_val));
phi_num_args = gimple_phi_num_args (phi);
pred = return_prediction (PHI_ARG_DEF (phi, 0), &direction);
diff --git a/gcc/tree-cfg.c b/gcc/tree-cfg.c
index 038e3ef..697a3f1 100644
--- a/gcc/tree-cfg.c
+++ b/gcc/tree-cfg.c
@@ -1736,7 +1736,8 @@ replace_uses_by (tree name, tree val)
if (gimple_code (stmt) == GIMPLE_PHI)
{
- e = gimple_phi_arg_edge (stmt, PHI_ARG_INDEX_FROM_USE (use));
+ e = gimple_phi_arg_edge (as_a <gimple_phi> (stmt),
+ PHI_ARG_INDEX_FROM_USE (use));
if (e->flags & EDGE_ABNORMAL)
{
/* This can only occur for virtual operands, since
@@ -4876,9 +4877,11 @@ verify_gimple_in_cfg (struct function *fn, bool verify_nothrow)
{
gimple_stmt_iterator gsi;
- for (gsi = gsi_start_phis (bb); !gsi_end_p (gsi); gsi_next (&gsi))
+ for (gimple_phi_iterator gpi = gsi_start_phis (bb);
+ !gsi_end_p (gpi);
+ gsi_next (&gpi))
{
- gimple phi = gsi_stmt (gsi);
+ gimple_phi phi = gpi.phi ();
bool err2 = false;
unsigned i;
diff --git a/gcc/tree-eh.c b/gcc/tree-eh.c
index a593cc7..1138696 100644
--- a/gcc/tree-eh.c
+++ b/gcc/tree-eh.c
@@ -4093,7 +4093,7 @@ static bool
cleanup_empty_eh_merge_phis (basic_block new_bb, basic_block old_bb,
edge old_bb_out, bool change_region)
{
- gimple_stmt_iterator ngsi, ogsi;
+ gimple_phi_iterator ngsi, ogsi;
edge_iterator ei;
edge e;
bitmap ophi_handled;
@@ -4123,7 +4123,7 @@ cleanup_empty_eh_merge_phis (basic_block new_bb, basic_block old_bb,
for the edges we're going to move. */
for (ngsi = gsi_start_phis (new_bb); !gsi_end_p (ngsi); gsi_next (&ngsi))
{
- gimple ophi, nphi = gsi_stmt (ngsi);
+ gimple_phi ophi, nphi = ngsi.phi ();
tree nresult, nop;
nresult = gimple_phi_result (nphi);
@@ -4134,7 +4134,7 @@ cleanup_empty_eh_merge_phis (basic_block new_bb, basic_block old_bb,
ophi = NULL;
for (ogsi = gsi_start_phis (old_bb); !gsi_end_p (ogsi); gsi_next (&ogsi))
{
- ophi = gsi_stmt (ogsi);
+ ophi = ogsi.phi ();
if (gimple_phi_result (ophi) == nop)
break;
ophi = NULL;
diff --git a/gcc/tree-into-ssa.c b/gcc/tree-into-ssa.c
index 3150f6b..9291105 100644
--- a/gcc/tree-into-ssa.c
+++ b/gcc/tree-into-ssa.c
@@ -2600,7 +2600,7 @@ prepare_use_sites_for (tree name, bool insert_phi_p)
if (gimple_code (stmt) == GIMPLE_PHI)
{
int ix = PHI_ARG_INDEX_FROM_USE (use_p);
- edge e = gimple_phi_arg_edge (stmt, ix);
+ edge e = gimple_phi_arg_edge (as_a <gimple_phi> (stmt), ix);
mark_use_interesting (name, stmt, e->src, insert_phi_p);
}
else
diff --git a/gcc/tree-ssa-coalesce.c b/gcc/tree-ssa-coalesce.c
index f043096..a21cea6 100644
--- a/gcc/tree-ssa-coalesce.c
+++ b/gcc/tree-ssa-coalesce.c
@@ -934,9 +934,11 @@ create_outofssa_var_map (coalesce_list_p cl, bitmap used_in_copy)
{
tree arg;
- for (gsi = gsi_start_phis (bb); !gsi_end_p (gsi); gsi_next (&gsi))
+ for (gimple_phi_iterator gpi = gsi_start_phis (bb);
+ !gsi_end_p (gpi);
+ gsi_next (&gpi))
{
- gimple phi = gsi_stmt (gsi);
+ gimple_phi phi = gpi.phi ();
size_t i;
int ver;
tree res;
diff --git a/gcc/tree-ssa-dce.c b/gcc/tree-ssa-dce.c
index 5a10d18..f853512 100644
--- a/gcc/tree-ssa-dce.c
+++ b/gcc/tree-ssa-dce.c
@@ -659,6 +659,7 @@ propagate_necessity (bool aggressive)
we also consider the control dependent edges leading to the
predecessor block associated with each PHI alternative as
necessary. */
+ gimple_phi phi = as_a <gimple_phi> (stmt);
size_t k;
for (k = 0; k < gimple_phi_num_args (stmt); k++)
@@ -741,7 +742,7 @@ propagate_necessity (bool aggressive)
{
for (k = 0; k < gimple_phi_num_args (stmt); k++)
{
- basic_block arg_bb = gimple_phi_arg_edge (stmt, k)->src;
+ basic_block arg_bb = gimple_phi_arg_edge (phi, k)->src;
if (gimple_bb (stmt)
!= get_immediate_dominator (CDI_POST_DOMINATORS, arg_bb))
diff --git a/gcc/tree-ssa-live.c b/gcc/tree-ssa-live.c
index 49ddc10..5157ff0 100644
--- a/gcc/tree-ssa-live.c
+++ b/gcc/tree-ssa-live.c
@@ -1106,7 +1106,7 @@ set_var_live_on_entry (tree ssa_name, tree_live_info_p live)
as this is where a copy would be inserted. Check to see if it is
defined in that block, or whether its live on entry. */
int index = PHI_ARG_INDEX_FROM_USE (use);
- edge e = gimple_phi_arg_edge (use_stmt, index);
+ edge e = gimple_phi_arg_edge (as_a <gimple_phi> (use_stmt), index);
if (e->src != ENTRY_BLOCK_PTR_FOR_FN (cfun))
{
if (e->src != def_bb)
diff --git a/gcc/tree-ssa-propagate.c b/gcc/tree-ssa-propagate.c
index 20f7554..986829f 100644
--- a/gcc/tree-ssa-propagate.c
+++ b/gcc/tree-ssa-propagate.c
@@ -966,7 +966,7 @@ replace_uses_in (gimple stmt, ssa_prop_get_value_fn get_value)
values from PROP_VALUE. */
static bool
-replace_phi_args_in (gimple phi, ssa_prop_get_value_fn get_value)
+replace_phi_args_in (gimple_phi phi, ssa_prop_get_value_fn get_value)
{
size_t i;
bool replaced = false;
@@ -1054,12 +1054,12 @@ public:
void
substitute_and_fold_dom_walker::before_dom_children (basic_block bb)
{
- gimple_stmt_iterator i;
-
/* Propagate known values into PHI nodes. */
- for (i = gsi_start_phis (bb); !gsi_end_p (i); gsi_next (&i))
+ for (gimple_phi_iterator i = gsi_start_phis (bb);
+ !gsi_end_p (i);
+ gsi_next (&i))
{
- gimple phi = gsi_stmt (i);
+ gimple_phi phi = i.phi ();
tree res = gimple_phi_result (phi);
if (virtual_operand_p (res))
continue;
@@ -1080,7 +1080,9 @@ substitute_and_fold_dom_walker::before_dom_children (basic_block bb)
/* Propagate known values into stmts. In some case it exposes
more trivially deletable stmts to walk backward. */
- for (i = gsi_start_bb (bb); !gsi_end_p (i); gsi_next (&i))
+ for (gimple_stmt_iterator i = gsi_start_bb (bb);
+ !gsi_end_p (i);
+ gsi_next (&i))
{
bool did_replace;
gimple stmt = gsi_stmt (i);
diff --git a/gcc/tree-ssa-sink.c b/gcc/tree-ssa-sink.c
index d7fd159..325d9d9 100644
--- a/gcc/tree-ssa-sink.c
+++ b/gcc/tree-ssa-sink.c
@@ -85,7 +85,7 @@ static struct
we return NULL. */
static basic_block
-find_bb_for_arg (gimple phi, tree def)
+find_bb_for_arg (gimple_phi phi, tree def)
{
size_t i;
bool foundone = false;
@@ -149,11 +149,11 @@ nearest_common_dominator_of_uses (def_operand_p def_p, bool *debug_stmts)
gimple usestmt = USE_STMT (use_p);
basic_block useblock;
- if (gimple_code (usestmt) == GIMPLE_PHI)
+ if (gimple_phi phi = dyn_cast <gimple_phi> (usestmt))
{
int idx = PHI_ARG_INDEX_FROM_USE (use_p);
- useblock = gimple_phi_arg_edge (usestmt, idx)->src;
+ useblock = gimple_phi_arg_edge (phi, idx)->src;
}
else if (is_gimple_debug (usestmt))
{
@@ -446,7 +446,7 @@ statement_sink_location (gimple stmt, basic_block frombb,
}
}
- sinkbb = find_bb_for_arg (use, DEF_FROM_PTR (def_p));
+ sinkbb = find_bb_for_arg (as_a <gimple_phi> (use), DEF_FROM_PTR (def_p));
/* This can happen if there are multiple uses in a PHI. */
if (!sinkbb)
diff --git a/gcc/tree-ssa-uninit.c b/gcc/tree-ssa-uninit.c
index bae72ff..6822bc6 100644
--- a/gcc/tree-ssa-uninit.c
+++ b/gcc/tree-ssa-uninit.c
@@ -294,7 +294,7 @@ can_skip_redundant_opnd (tree opnd, gimple phi)
that have empty (or possibly empty) definitions. */
static unsigned
-compute_uninit_opnds_pos (gimple phi)
+compute_uninit_opnds_pos (gimple_phi phi)
{
size_t i, n;
unsigned uninit_opnds = 0;
@@ -646,7 +646,7 @@ find_predicates (pred_chain_union *preds,
VISITED_PHIS is a pointer set for detecting cycles. */
static void
-collect_phi_def_edges (gimple phi, basic_block cd_root,
+collect_phi_def_edges (gimple_phi phi, basic_block cd_root,
vec<edge> *edges,
hash_set<gimple> *visited_phis)
{
@@ -679,7 +679,7 @@ collect_phi_def_edges (gimple phi, basic_block cd_root,
if (gimple_code (def) == GIMPLE_PHI
&& dominated_by_p (CDI_DOMINATORS,
gimple_bb (def), cd_root))
- collect_phi_def_edges (def, cd_root, edges,
+ collect_phi_def_edges (as_a <gimple_phi> (def), cd_root, edges,
visited_phis);
else if (!uninit_undefined_value_p (opnd))
{
@@ -699,7 +699,7 @@ collect_phi_def_edges (gimple phi, basic_block cd_root,
composite predicates pointed to by PREDS. */
static bool
-find_def_preds (pred_chain_union *preds, gimple phi)
+find_def_preds (pred_chain_union *preds, gimple_phi phi)
{
size_t num_chains = 0, i, n;
vec<edge> dep_chains[MAX_NUM_CHAINS];
@@ -937,9 +937,9 @@ find_matching_predicate_in_rest_chains (pred_info pred,
static bool
is_use_properly_guarded (gimple use_stmt,
basic_block use_bb,
- gimple phi,
+ gimple_phi phi,
unsigned uninit_opnds,
- hash_set<gimple> *visited_phis);
+ hash_set<gimple_phi> *visited_phis);
/* Returns true if all uninitialized opnds are pruned. Returns false
otherwise. PHI is the phi node with uninitialized operands,
@@ -976,12 +976,12 @@ is_use_properly_guarded (gimple use_stmt,
*/
static bool
-prune_uninit_phi_opnds_in_unrealizable_paths (gimple phi,
+prune_uninit_phi_opnds_in_unrealizable_paths (gimple_phi phi,
unsigned uninit_opnds,
- gimple flag_def,
+ gimple_phi flag_def,
tree boundary_cst,
enum tree_code cmp_code,
- hash_set<gimple> *visited_phis,
+ hash_set<gimple_phi> *visited_phis,
bitmap *visited_flag_phis)
{
unsigned i;
@@ -996,22 +996,22 @@ prune_uninit_phi_opnds_in_unrealizable_paths (gimple phi,
flag_arg = gimple_phi_arg_def (flag_def, i);
if (!is_gimple_constant (flag_arg))
{
- gimple flag_arg_def, phi_arg_def;
+ gimple_phi flag_arg_def, phi_arg_def;
tree phi_arg;
unsigned uninit_opnds_arg_phi;
if (TREE_CODE (flag_arg) != SSA_NAME)
return false;
- flag_arg_def = SSA_NAME_DEF_STMT (flag_arg);
- if (gimple_code (flag_arg_def) != GIMPLE_PHI)
+ flag_arg_def = dyn_cast <gimple_phi> (SSA_NAME_DEF_STMT (flag_arg));
+ if (!flag_arg_def)
return false;
phi_arg = gimple_phi_arg_def (phi, i);
if (TREE_CODE (phi_arg) != SSA_NAME)
return false;
- phi_arg_def = SSA_NAME_DEF_STMT (phi_arg);
- if (gimple_code (phi_arg_def) != GIMPLE_PHI)
+ phi_arg_def = dyn_cast <gimple_phi> (SSA_NAME_DEF_STMT (phi_arg));
+ if (!phi_arg_def)
return false;
if (gimple_bb (phi_arg_def) != gimple_bb (flag_arg_def))
@@ -1052,16 +1052,16 @@ prune_uninit_phi_opnds_in_unrealizable_paths (gimple phi,
opnd = gimple_phi_arg_def (phi, i);
opnd_def = SSA_NAME_DEF_STMT (opnd);
- if (gimple_code (opnd_def) == GIMPLE_PHI)
+ if (gimple_phi opnd_def_phi = dyn_cast <gimple_phi> (opnd_def))
{
edge opnd_edge;
unsigned uninit_opnds2
- = compute_uninit_opnds_pos (opnd_def);
+ = compute_uninit_opnds_pos (opnd_def_phi);
gcc_assert (!MASK_EMPTY (uninit_opnds2));
opnd_edge = gimple_phi_arg_edge (phi, i);
if (!is_use_properly_guarded (phi,
opnd_edge->src,
- opnd_def,
+ opnd_def_phi,
uninit_opnds2,
visited_phis))
return false;
@@ -1150,8 +1150,8 @@ prune_uninit_phi_opnds_in_unrealizable_paths (gimple phi,
static bool
use_pred_not_overlap_with_undef_path_pred (pred_chain_union preds,
- gimple phi, unsigned uninit_opnds,
- hash_set<gimple> *visited_phis)
+ gimple_phi phi, unsigned uninit_opnds,
+ hash_set<gimple_phi> *visited_phis)
{
unsigned int i, n;
gimple flag_def = 0;
@@ -1224,7 +1224,7 @@ use_pred_not_overlap_with_undef_path_pred (pred_chain_union preds,
all_pruned = prune_uninit_phi_opnds_in_unrealizable_paths (phi,
uninit_opnds,
- flag_def,
+ as_a <gimple_phi> (flag_def),
boundary_cst,
cmp_code,
visited_phis,
@@ -2105,9 +2105,9 @@ normalize_preds (pred_chain_union preds, gimple use_or_def, bool is_use)
static bool
is_use_properly_guarded (gimple use_stmt,
basic_block use_bb,
- gimple phi,
+ gimple_phi phi,
unsigned uninit_opnds,
- hash_set<gimple> *visited_phis)
+ hash_set<gimple_phi> *visited_phis)
{
basic_block phi_bb;
pred_chain_union preds = vNULL;
@@ -2193,13 +2193,13 @@ find_uninit_use (gimple_phi phi, unsigned uninit_opnds,
if (is_gimple_debug (use_stmt))
continue;
- if (gimple_code (use_stmt) == GIMPLE_PHI)
- use_bb = gimple_phi_arg_edge (use_stmt,
+ if (gimple_phi use_phi = dyn_cast <gimple_phi> (use_stmt))
+ use_bb = gimple_phi_arg_edge (use_phi,
PHI_ARG_INDEX_FROM_USE (use_p))->src;
else
use_bb = gimple_bb (use_stmt);
- hash_set<gimple> visited_phis;
+ hash_set<gimple_phi> visited_phis;
if (is_use_properly_guarded (use_stmt, use_bb, phi, uninit_opnds,
&visited_phis))
continue;
--
1.8.5.3
^ permalink raw reply [flat|nested] 93+ messages in thread
* [gimple-classes, committed 65/92] Make gimple_phi_arg_location require a gimple_phi.
2014-10-27 20:35 [gimple-classes, committed 00/92] Initial slew of commits David Malcolm
` (82 preceding siblings ...)
2014-10-27 20:57 ` [gimple-classes, committed 24/92] Introduce gimple_eh_filter David Malcolm
@ 2014-10-27 20:57 ` David Malcolm
2014-10-27 20:57 ` [gimple-classes, committed 29/92] Use subclasses of gimple in various places David Malcolm
` (7 subsequent siblings)
91 siblings, 0 replies; 93+ messages in thread
From: David Malcolm @ 2014-10-27 20:57 UTC (permalink / raw)
To: gcc-patches; +Cc: David Malcolm
This corresponds to:
[PATCH 67/89] Make gimple_phi_arg_location require a gimple_phi.
https://gcc.gnu.org/ml/gcc-patches/2014-04/msg01182.html
from the original 89-patch kit
That earlier patch was approved by Jeff:
> OK once prerequisites go in.
in https://gcc.gnu.org/ml/gcc-patches/2014-05/msg00848.html
gcc/
* gimple.h (gimple_phi_arg_location): Require a gimple_phi.
* tree-into-ssa.c (rewrite_update_phi_arguments): Replace a check
for code GIMPLE_PHI with a dyn_cast and a new local.
* tree-ssa-ter.c (ter_is_replaceable_p): Likewise.
* tree-ssa-live.c (remove_unused_locals): Replace a
gimple_stmt_iterator with a gimple_phi_iterator, using it to make
local "phi" be a gimple_phi.
* tree-ssa-phiopt.c (tree_ssa_phiopt_worker): Likewise.
* tree-ssa-phiopt.c (conditional_replacement): Require a gimple_phi.
(single_non_singleton_phi_for_edges): Return a gimple_phi; update
local to be a gimple_phi, adding checked casts since we're working
on a sequence of gimple_phi.
(conditional_replacement): Require a gimple_phi.
* tree-ssa-threadupdate.c (get_value_locus_in_path): Strengthen
type of local "def_phi" to gimple_phi by replacing a check of the
code for GIMPLE_PHI with a dyn_cast<gimple_phi>.
---
gcc/ChangeLog.gimple-classes | 25 +++++++++++++++++++++++++
gcc/gimple.h | 6 +++---
gcc/tree-into-ssa.c | 7 ++++---
gcc/tree-ssa-live.c | 6 ++++--
gcc/tree-ssa-phiopt.c | 17 +++++++++--------
gcc/tree-ssa-ter.c | 4 ++--
gcc/tree-ssa-threadupdate.c | 6 +++---
7 files changed, 50 insertions(+), 21 deletions(-)
diff --git a/gcc/ChangeLog.gimple-classes b/gcc/ChangeLog.gimple-classes
index 5a271ca..f2f9a05 100644
--- a/gcc/ChangeLog.gimple-classes
+++ b/gcc/ChangeLog.gimple-classes
@@ -1,5 +1,30 @@
2014-10-24 David Malcolm <dmalcolm@redhat.com>
+ Make gimple_phi_arg_location require a gimple_phi.
+
+ * gimple.h (gimple_phi_arg_location): Require a gimple_phi.
+
+ * tree-into-ssa.c (rewrite_update_phi_arguments): Replace a check
+ for code GIMPLE_PHI with a dyn_cast and a new local.
+ * tree-ssa-ter.c (ter_is_replaceable_p): Likewise.
+
+ * tree-ssa-live.c (remove_unused_locals): Replace a
+ gimple_stmt_iterator with a gimple_phi_iterator, using it to make
+ local "phi" be a gimple_phi.
+ * tree-ssa-phiopt.c (tree_ssa_phiopt_worker): Likewise.
+
+ * tree-ssa-phiopt.c (conditional_replacement): Require a gimple_phi.
+ (single_non_singleton_phi_for_edges): Return a gimple_phi; update
+ local to be a gimple_phi, adding checked casts since we're working
+ on a sequence of gimple_phi.
+ (conditional_replacement): Require a gimple_phi.
+
+ * tree-ssa-threadupdate.c (get_value_locus_in_path): Strengthen
+ type of local "def_phi" to gimple_phi by replacing a check of the
+ code for GIMPLE_PHI with a dyn_cast<gimple_phi>.
+
+2014-10-24 David Malcolm <dmalcolm@redhat.com>
+
Make gimple_phi_arg_location_from_edge require a gimple_phi
* gimple.h (gimple_phi_arg_location_from_edge): Require a
diff --git a/gcc/gimple.h b/gcc/gimple.h
index 0c8db97..688c375 100644
--- a/gcc/gimple.h
+++ b/gcc/gimple.h
@@ -3972,12 +3972,12 @@ gimple_phi_arg_edge (gimple_phi phi, size_t i)
return EDGE_PRED (gimple_bb (phi), i);
}
-/* Return the source location of gimple argument I of phi node GS. */
+/* Return the source location of gimple argument I of phi node PHI. */
static inline source_location
-gimple_phi_arg_location (gimple gs, size_t i)
+gimple_phi_arg_location (gimple_phi phi, size_t i)
{
- return gimple_phi_arg (gs, i)->locus;
+ return gimple_phi_arg (phi, i)->locus;
}
/* Return the source location of the argument on edge E of phi node PHI. */
diff --git a/gcc/tree-into-ssa.c b/gcc/tree-into-ssa.c
index 9291105..b4e0e4b 100644
--- a/gcc/tree-into-ssa.c
+++ b/gcc/tree-into-ssa.c
@@ -2045,12 +2045,13 @@ rewrite_update_phi_arguments (basic_block bb)
else
{
gimple stmt = SSA_NAME_DEF_STMT (reaching_def);
+ gimple_phi other_phi = dyn_cast <gimple_phi> (stmt);
/* Single element PHI nodes behave like copies, so get the
location from the phi argument. */
- if (gimple_code (stmt) == GIMPLE_PHI
- && gimple_phi_num_args (stmt) == 1)
- locus = gimple_phi_arg_location (stmt, 0);
+ if (other_phi
+ && gimple_phi_num_args (other_phi) == 1)
+ locus = gimple_phi_arg_location (other_phi, 0);
else
locus = gimple_location (stmt);
}
diff --git a/gcc/tree-ssa-live.c b/gcc/tree-ssa-live.c
index 5157ff0..00fcbc3 100644
--- a/gcc/tree-ssa-live.c
+++ b/gcc/tree-ssa-live.c
@@ -819,12 +819,14 @@ remove_unused_locals (void)
mark_all_vars_used (gimple_op_ptr (gsi_stmt (gsi), i));
}
- for (gsi = gsi_start_phis (bb); !gsi_end_p (gsi); gsi_next (&gsi))
+ for (gimple_phi_iterator gpi = gsi_start_phis (bb);
+ !gsi_end_p (gpi);
+ gsi_next (&gpi))
{
use_operand_p arg_p;
ssa_op_iter i;
tree def;
- gimple phi = gsi_stmt (gsi);
+ gimple_phi phi = gpi.phi ();
if (virtual_operand_p (gimple_phi_result (phi)))
continue;
diff --git a/gcc/tree-ssa-phiopt.c b/gcc/tree-ssa-phiopt.c
index dfeefbe..df15a45 100644
--- a/gcc/tree-ssa-phiopt.c
+++ b/gcc/tree-ssa-phiopt.c
@@ -62,7 +62,7 @@ along with GCC; see the file COPYING3. If not see
static unsigned int tree_ssa_phiopt_worker (bool, bool);
static bool conditional_replacement (basic_block, basic_block,
- edge, edge, gimple, tree, tree);
+ edge, edge, gimple_phi, tree, tree);
static int value_replacement (basic_block, basic_block,
edge, edge, gimple, tree, tree);
static bool minmax_replacement (basic_block, basic_block,
@@ -138,16 +138,16 @@ tree_ssa_cs_elim (void)
/* Return the singleton PHI in the SEQ of PHIs for edges E0 and E1. */
-static gimple
+static gimple_phi
single_non_singleton_phi_for_edges (gimple_seq seq, edge e0, edge e1)
{
gimple_stmt_iterator i;
- gimple phi = NULL;
+ gimple_phi phi = NULL;
if (gimple_seq_singleton_p (seq))
- return gsi_stmt (gsi_start (seq));
+ return as_a <gimple_phi> (gsi_stmt (gsi_start (seq)));
for (i = gsi_start (seq); !gsi_end_p (i); gsi_next (&i))
{
- gimple p = gsi_stmt (i);
+ gimple_phi p = as_a <gimple_phi> (gsi_stmt (i));
/* If the PHI arguments are equal then we can skip this PHI. */
if (operand_equal_for_phi_arg_p (gimple_phi_arg_def (p, e0->dest_idx),
gimple_phi_arg_def (p, e1->dest_idx)))
@@ -211,7 +211,8 @@ tree_ssa_phiopt_worker (bool do_store_elim, bool do_hoist_loads)
for (i = 0; i < n; i++)
{
- gimple cond_stmt, phi;
+ gimple cond_stmt;
+ gimple_phi phi;
basic_block bb1, bb2;
edge e1, e2;
tree arg0, arg1;
@@ -322,7 +323,7 @@ tree_ssa_phiopt_worker (bool do_store_elim, bool do_hoist_loads)
so try that first. */
for (gsi = gsi_start (phis); !gsi_end_p (gsi); gsi_next (&gsi))
{
- phi = gsi_stmt (gsi);
+ phi = as_a <gimple_phi> (gsi_stmt (gsi));
arg0 = gimple_phi_arg_def (phi, e1->dest_idx);
arg1 = gimple_phi_arg_def (phi, e2->dest_idx);
if (value_replacement (bb, bb1, e1, e2, phi, arg0, arg1) == 2)
@@ -433,7 +434,7 @@ replace_phi_edge_with_variable (basic_block cond_block,
static bool
conditional_replacement (basic_block cond_bb, basic_block middle_bb,
- edge e0, edge e1, gimple phi,
+ edge e0, edge e1, gimple_phi phi,
tree arg0, tree arg1)
{
tree result;
diff --git a/gcc/tree-ssa-ter.c b/gcc/tree-ssa-ter.c
index 78bedfc..d8ab499 100644
--- a/gcc/tree-ssa-ter.c
+++ b/gcc/tree-ssa-ter.c
@@ -428,8 +428,8 @@ ter_is_replaceable_p (gimple stmt)
block1 = LOCATION_BLOCK (locus1);
locus1 = LOCATION_LOCUS (locus1);
- if (gimple_code (use_stmt) == GIMPLE_PHI)
- locus2 = gimple_phi_arg_location (use_stmt,
+ if (gimple_phi phi = dyn_cast <gimple_phi> (use_stmt))
+ locus2 = gimple_phi_arg_location (phi,
PHI_ARG_INDEX_FROM_USE (use_p));
else
locus2 = gimple_location (use_stmt);
diff --git a/gcc/tree-ssa-threadupdate.c b/gcc/tree-ssa-threadupdate.c
index 24920ca..883574c 100644
--- a/gcc/tree-ssa-threadupdate.c
+++ b/gcc/tree-ssa-threadupdate.c
@@ -419,14 +419,14 @@ get_value_locus_in_path (tree def, vec<jump_thread_edge *> *path,
basic_block bb, int idx, source_location *locus)
{
tree arg;
- gimple def_phi;
+ gimple_phi def_phi;
basic_block def_bb;
if (path == NULL || idx == 0)
return def;
- def_phi = SSA_NAME_DEF_STMT (def);
- if (gimple_code (def_phi) != GIMPLE_PHI)
+ def_phi = dyn_cast <gimple_phi> (SSA_NAME_DEF_STMT (def));
+ if (!def_phi)
return def;
def_bb = gimple_bb (def_phi);
--
1.8.5.3
^ permalink raw reply [flat|nested] 93+ messages in thread
* [gimple-classes, committed 91/92] Remove out-of-date references to typedefs
2014-10-27 20:35 [gimple-classes, committed 00/92] Initial slew of commits David Malcolm
` (86 preceding siblings ...)
2014-10-27 20:57 ` [gimple-classes, committed 26/92] Introduce gimple_eh_else David Malcolm
@ 2014-10-27 20:57 ` David Malcolm
2014-10-27 20:57 ` [gimple-classes, committed 08/92] Introduce gimple_phi_iterator David Malcolm
` (3 subsequent siblings)
91 siblings, 0 replies; 93+ messages in thread
From: David Malcolm @ 2014-10-27 20:57 UTC (permalink / raw)
To: gcc-patches; +Cc: David Malcolm
gcc/ChangeLog.gimple-classes:
* gimple.h (struct gdebug): Remove out-of-date references to
typedefs.
(struct ggoto): Likewise.
(struct glabel): Likewise.
---
gcc/ChangeLog.gimple-classes | 7 +++++++
gcc/gimple.h | 18 +++---------------
2 files changed, 10 insertions(+), 15 deletions(-)
diff --git a/gcc/ChangeLog.gimple-classes b/gcc/ChangeLog.gimple-classes
index e925118..b0c61d1 100644
--- a/gcc/ChangeLog.gimple-classes
+++ b/gcc/ChangeLog.gimple-classes
@@ -1,5 +1,12 @@
2014-10-27 David Malcolm <dmalcolm@redhat.com>
+ * gimple.h (struct gdebug): Remove out-of-date references to
+ typedefs.
+ (struct ggoto): Likewise.
+ (struct glabel): Likewise.
+
+2014-10-27 David Malcolm <dmalcolm@redhat.com>
+
Patch autogenerated by rename_gimple_subclasses.py from
https://github.com/davidmalcolm/gcc-refactoring-scripts
revision 7d754b63ff2bf47226a67b2c0af5d74b54d4709f
diff --git a/gcc/gimple.h b/gcc/gimple.h
index eed2d7f..3bbfdec 100644
--- a/gcc/gimple.h
+++ b/gcc/gimple.h
@@ -777,11 +777,7 @@ struct GTY((tag("GSS_WITH_OPS")))
/* A statement with the invariant that
stmt->code == GIMPLE_DEBUG
- i.e. a debug statement.
-
- This type will normally be accessed via the gdebug *and
- const gdebug *typedefs (in coretypes.h), *which are pointers to
- this type. */
+ i.e. a debug statement. */
struct GTY((tag("GSS_WITH_OPS")))
gdebug : public gimple_statement_with_ops
@@ -791,11 +787,7 @@ struct GTY((tag("GSS_WITH_OPS")))
/* A statement with the invariant that
stmt->code == GIMPLE_GOTO
- i.e. a goto statement.
-
- This type will normally be accessed via the ggoto *and
- const ggoto *typedefs (in coretypes.h), *which are pointers to
- this type. */
+ i.e. a goto statement. */
struct GTY((tag("GSS_WITH_OPS")))
ggoto : public gimple_statement_with_ops
@@ -805,11 +797,7 @@ struct GTY((tag("GSS_WITH_OPS")))
/* A statement with the invariant that
stmt->code == GIMPLE_LABEL
- i.e. a label statement.
-
- This type will normally be accessed via the glabel *and
- const glabel *typedefs (in coretypes.h), *which are pointers to
- this type. */
+ i.e. a label statement. */
struct GTY((tag("GSS_WITH_OPS")))
glabel : public gimple_statement_with_ops
--
1.8.5.3
^ permalink raw reply [flat|nested] 93+ messages in thread
* [gimple-classes, committed 55/92] Concretize parameter to gimple_call_copy_skip_args
2014-10-27 20:35 [gimple-classes, committed 00/92] Initial slew of commits David Malcolm
` (90 preceding siblings ...)
2014-10-27 20:57 ` [gimple-classes, committed 16/92] Update various expressions within tree-scalar-evolution.c to be gimple_phi David Malcolm
@ 2014-10-27 21:32 ` David Malcolm
91 siblings, 0 replies; 93+ messages in thread
From: David Malcolm @ 2014-10-27 21:32 UTC (permalink / raw)
To: gcc-patches; +Cc: David Malcolm
This corresponds to:
[PATCH 57/89] Concretize parameter to gimple_call_copy_skip_args
https://gcc.gnu.org/ml/gcc-patches/2014-04/msg01213.html
from the original 89-patch kit
That earlier patch was approved by Jeff:
> OK once prerequisites have gone in.
in https://gcc.gnu.org/ml/gcc-patches/2014-05/msg00813.html
gcc/
* gimple.c (gimple_call_copy_skip_args): Require a gimple_call.
* gimple.h (gimple_call_copy_skip_args): Likewise.
---
gcc/ChangeLog.gimple-classes | 7 +++++++
gcc/gimple.c | 2 +-
gcc/gimple.h | 2 +-
3 files changed, 9 insertions(+), 2 deletions(-)
diff --git a/gcc/ChangeLog.gimple-classes b/gcc/ChangeLog.gimple-classes
index 6fd5738..63e5a8c 100644
--- a/gcc/ChangeLog.gimple-classes
+++ b/gcc/ChangeLog.gimple-classes
@@ -1,5 +1,12 @@
2014-10-24 David Malcolm <dmalcolm@redhat.com>
+ Concretize parameter to gimple_call_copy_skip_args
+
+ * gimple.c (gimple_call_copy_skip_args): Require a gimple_call.
+ * gimple.h (gimple_call_copy_skip_args): Likewise.
+
+2014-10-24 David Malcolm <dmalcolm@redhat.com>
+
Various gimple to gimple_call conversions in IPA
* ipa-prop.c (detect_type_change_from_memory_writes): Require a
diff --git a/gcc/gimple.c b/gcc/gimple.c
index c2b4588..f99ee0f 100644
--- a/gcc/gimple.c
+++ b/gcc/gimple.c
@@ -2064,7 +2064,7 @@ canonicalize_cond_expr_cond (tree t)
the positions marked by the set ARGS_TO_SKIP. */
gimple_call
-gimple_call_copy_skip_args (gimple stmt, bitmap args_to_skip)
+gimple_call_copy_skip_args (gimple_call stmt, bitmap args_to_skip)
{
int i;
int nargs = gimple_call_num_args (stmt);
diff --git a/gcc/gimple.h b/gcc/gimple.h
index 4c4afb5..c457bc2 100644
--- a/gcc/gimple.h
+++ b/gcc/gimple.h
@@ -1392,7 +1392,7 @@ bool gimple_assign_rhs_could_trap_p (gimple);
extern void dump_gimple_statistics (void);
unsigned get_gimple_rhs_num_ops (enum tree_code);
extern tree canonicalize_cond_expr_cond (tree);
-gimple_call gimple_call_copy_skip_args (gimple, bitmap);
+gimple_call gimple_call_copy_skip_args (gimple_call, bitmap);
extern bool gimple_compare_field_offset (tree, tree);
extern tree gimple_unsigned_type (tree);
extern tree gimple_signed_type (tree);
--
1.8.5.3
^ permalink raw reply [flat|nested] 93+ messages in thread
end of thread, other threads:[~2014-10-27 20:57 UTC | newest]
Thread overview: 93+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-10-27 20:35 [gimple-classes, committed 00/92] Initial slew of commits David Malcolm
2014-10-27 20:35 ` [gimple-classes, committed 45/92] omp-low.c: Use more concrete types of gimple statement for various locals David Malcolm
2014-10-27 20:35 ` [gimple-classes, committed 33/92] Introduce gimple_omp_atomic_store David Malcolm
2014-10-27 20:35 ` [gimple-classes, committed 06/92] Introduce gimple_debug and use it in a few places David Malcolm
2014-10-27 20:35 ` [gimple-classes, committed 20/92] Introduce gimple_goto David Malcolm
2014-10-27 20:35 ` [gimple-classes, committed 14/92] tree-ssa-loop-manip.c: use gimple_phi in three places David Malcolm
2014-10-27 20:35 ` [gimple-classes, committed 27/92] Introduce gimple_resx David Malcolm
2014-10-27 20:35 ` [gimple-classes, committed 22/92] Introduce gimple_transaction David Malcolm
2014-10-27 20:35 ` [gimple-classes, committed 19/92] Introduce gimple_return David Malcolm
2014-10-27 20:35 ` [gimple-classes, committed 38/92] tree-cfg.c: Make verify_gimple_call require a gimple_call David Malcolm
2014-10-27 20:35 ` [gimple-classes, committed 03/92] Introduce gimple_cond and use it in various places David Malcolm
2014-10-27 20:36 ` [gimple-classes, committed 40/92] Introduce gimple_omp_single David Malcolm
2014-10-27 20:36 ` [gimple-classes, committed 05/92] Introduce gimple_label and use it in a few places David Malcolm
2014-10-27 20:36 ` [gimple-classes, committed 39/92] Introduce gimple_omp_task David Malcolm
2014-10-27 20:36 ` [gimple-classes, committed 69/92] Concretize gimple_cond_make_{false|true} David Malcolm
2014-10-27 20:36 ` [gimple-classes, committed 82/92] Concretize gimple_call_arg_flags David Malcolm
2014-10-27 20:36 ` [gimple-classes, committed 51/92] More gimple_phi David Malcolm
2014-10-27 20:36 ` [gimple-classes, committed 43/92] Introduce gimple_omp_sections David Malcolm
2014-10-27 20:36 ` [gimple-classes, committed 71/92] Concretize gimple_cond_{true|false}_label David Malcolm
2014-10-27 20:36 ` [gimple-classes, committed 61/92] Concretize gimple_eh_filter_set_types and gimple_eh_filter_set_failure David Malcolm
2014-10-27 20:36 ` [gimple-classes, committed 57/92] Make gimple_goto_set_dest require a gimple_goto David Malcolm
2014-10-27 20:36 ` [gimple-classes, committed 66/92] Concretize three gimple_return_ accessors David Malcolm
2014-10-27 20:36 ` [gimple-classes, committed 92/92] Update gimple.texi class hierarchy diagram David Malcolm
2014-10-27 20:36 ` [gimple-classes, committed 01/92] Introduce gimple_switch and use it in various places David Malcolm
2014-10-27 20:36 ` [gimple-classes, committed 04/92] Introduce gimple_assign " David Malcolm
2014-10-27 20:36 ` [gimple-classes, committed 87/92] Convert various gimple to gimple_phi within ssa-iterators.h David Malcolm
2014-10-27 20:36 ` [gimple-classes, committed 70/92] Concretize gimple_switch_index and gimple_switch_index_ptr David Malcolm
2014-10-27 20:36 ` [gimple-classes, committed 25/92] Introduce gimple_eh_must_not_throw David Malcolm
2014-10-27 20:37 ` [gimple-classes, committed 83/92] Concretize gimple_assign_nontemporal_move_p David Malcolm
2014-10-27 20:38 ` [gimple-classes, committed 73/92] Concretize gimple_cond_set_{lhs|rhs} David Malcolm
2014-10-27 20:38 ` [gimple-classes, committed 80/92] Concretize gimple_call_set_fntype David Malcolm
2014-10-27 20:38 ` [gimple-classes, committed 84/92] Concretize gimple_call_copy_flags and ipa_modify_call_arguments David Malcolm
2014-10-27 20:38 ` [gimple-classes, committed 54/92] Various gimple to gimple_call conversions in IPA David Malcolm
2014-10-27 20:38 ` [gimple-classes, committed 02/92] Introduce gimple_bind and use it for accessors David Malcolm
2014-10-27 20:38 ` [gimple-classes, committed 74/92] Concretize gimple_cond_{lhs|rhs}_ptr David Malcolm
2014-10-27 20:38 ` [gimple-classes, committed 72/92] Concretize gimple_cond_set_code David Malcolm
2014-10-27 20:38 ` [gimple-classes, committed 31/92] Use more concrete types for various gimple statements David Malcolm
2014-10-27 20:38 ` [gimple-classes, committed 75/92] Concretize various expressions from gimple to gimple_cond David Malcolm
2014-10-27 20:38 ` [gimple-classes, committed 49/92] Update GRAPHITE to use more concrete gimple statement classes David Malcolm
2014-10-27 20:38 ` [gimple-classes, committed 85/92] Use gimple_call in some places within tree-ssa-dom.c David Malcolm
2014-10-27 20:38 ` [gimple-classes, committed 68/92] Concretize locals within expand_omp_for_init_counts David Malcolm
2014-10-27 20:38 ` [gimple-classes, committed 86/92] Use gimple_phi in many more places David Malcolm
2014-10-27 20:38 ` [gimple-classes, committed 88/92] Preparatory work before subclass renaming David Malcolm
2014-10-27 20:38 ` [gimple-classes, committed 77/92] Concretize gimple_call_nothrow_p David Malcolm
2014-10-27 20:38 ` [gimple-classes, committed 90/92] Automated renaming of gimple subclasses David Malcolm
2014-10-27 20:38 ` [gimple-classes, committed 63/92] Concretize three gimple_try_set_ accessors David Malcolm
2014-10-27 20:40 ` [gimple-classes, committed 09/92] Update ssa_prop_visit_phi_fn callbacks to take a gimple_phi David Malcolm
2014-10-27 20:47 ` [gimple-classes, committed 89/92] Eliminate subclass typedefs from coretypes.h David Malcolm
2014-10-27 20:52 ` [gimple-classes, committed 37/92] Introduce gimple_omp_parallel David Malcolm
2014-10-27 20:52 ` [gimple-classes, committed 15/92] tree-ssa-loop-ivopts.c: use gimple_phi in a few places David Malcolm
2014-10-27 20:52 ` [gimple-classes, committed 28/92] Introduce gimple_eh_dispatch David Malcolm
2014-10-27 20:52 ` [gimple-classes, committed 78/92] Tweak to gimplify_modify_expr David Malcolm
2014-10-27 20:52 ` [gimple-classes, committed 64/92] Make gimple_phi_arg_location_from_edge require a gimple_phi David Malcolm
2014-10-27 20:52 ` [gimple-classes, committed 10/92] tree-parloops.c: use gimple_phi in various places David Malcolm
2014-10-27 20:53 ` [gimple-classes, committed 58/92] Concretize gimple_catch_types David Malcolm
2014-10-27 20:53 ` [gimple-classes, committed 23/92] Introduce gimple_catch David Malcolm
2014-10-27 20:53 ` [gimple-classes, committed 35/92] Introduce gimple_omp_critical David Malcolm
2014-10-27 20:53 ` [gimple-classes, committed 13/92] tree-ssa-loop-niter.c: use gimple_phi in a few places David Malcolm
2014-10-27 20:53 ` [gimple-classes, committed 34/92] Introduce gimple_omp_continue David Malcolm
2014-10-27 20:53 ` [gimple-classes, committed 42/92] Introduce gimple_omp_teams David Malcolm
2014-10-27 20:53 ` [gimple-classes, committed 60/92] Concretize gimple_label_label David Malcolm
2014-10-27 20:54 ` [gimple-classes, committed 21/92] Introduce gimple_asm David Malcolm
2014-10-27 20:54 ` [gimple-classes, committed 67/92] Make gimple_cond_set_{true|false}_label require gimple_cond David Malcolm
2014-10-27 20:54 ` [gimple-classes, committed 79/92] Concretize gimple_call_set_fn David Malcolm
2014-10-27 20:54 ` [gimple-classes, committed 11/92] tree-predcom.c: use gimple_phi in various places David Malcolm
2014-10-27 20:54 ` [gimple-classes, committed 12/92] tree-ssa-phiprop.c: use gimple_phi David Malcolm
2014-10-27 20:54 ` [gimple-classes, committed 47/92] Make add_phi_arg require a gimple_phi David Malcolm
2014-10-27 20:54 ` [gimple-classes, committed 56/92] Make gimple_label_set_label require a gimple_label David Malcolm
2014-10-27 20:55 ` [gimple-classes, committed 46/92] Make gimple_phi_arg_def_ptr and gimple_phi_arg_has_location require a gimple_phi David Malcolm
2014-10-27 20:55 ` [gimple-classes, committed 41/92] Introduce gimple_omp_target David Malcolm
2014-10-27 20:55 ` [gimple-classes, committed 44/92] tree-parloops.c: Use gimple_phi in various places David Malcolm
2014-10-27 20:55 ` [gimple-classes, committed 36/92] Introduce gimple_omp_for David Malcolm
2014-10-27 20:55 ` [gimple-classes, committed 48/92] Make gimple_phi_arg_set_location require a gimple_phi David Malcolm
2014-10-27 20:55 ` [gimple-classes, committed 59/92] Concretize gimple_call_use_set and gimple_call_clobber_set David Malcolm
2014-10-27 20:55 ` [gimple-classes, committed 18/92] Introduce gimple_call David Malcolm
2014-10-27 20:56 ` [gimple-classes, committed 52/92] Make gimple_call_return_slot_opt_p require a gimple_call David Malcolm
2014-10-27 20:56 ` [gimple-classes, committed 07/92] Introduce gimple_phi and use it in various places David Malcolm
2014-10-27 20:56 ` [gimple-classes, committed 30/92] Introduce gimple_try David Malcolm
2014-10-27 20:56 ` [gimple-classes, committed 76/92] Concretize gimple_call_set_nothrow David Malcolm
2014-10-27 20:56 ` [gimple-classes, committed 81/92] Concretize gimple_call_set_tail and gimple_call_tail_p David Malcolm
2014-10-27 20:56 ` [gimple-classes, committed 62/92] Concretize gimple_try_set_catch_is_cleanup David Malcolm
2014-10-27 20:57 ` [gimple-classes, committed 50/92] Make gimple_phi_arg_edge require a gimple_phi David Malcolm
2014-10-27 20:57 ` [gimple-classes, committed 32/92] Introduce gimple_omp_atomic_load David Malcolm
2014-10-27 20:57 ` [gimple-classes, committed 24/92] Introduce gimple_eh_filter David Malcolm
2014-10-27 20:57 ` [gimple-classes, committed 65/92] Make gimple_phi_arg_location require a gimple_phi David Malcolm
2014-10-27 20:57 ` [gimple-classes, committed 29/92] Use subclasses of gimple in various places David Malcolm
2014-10-27 20:57 ` [gimple-classes, committed 53/92] Use gimple_call for callgraph edges David Malcolm
2014-10-27 20:57 ` [gimple-classes, committed 26/92] Introduce gimple_eh_else David Malcolm
2014-10-27 20:57 ` [gimple-classes, committed 91/92] Remove out-of-date references to typedefs David Malcolm
2014-10-27 20:57 ` [gimple-classes, committed 08/92] Introduce gimple_phi_iterator David Malcolm
2014-10-27 20:57 ` [gimple-classes, committed 17/92] Concretize get_loop_exit_condition et al to working on gimple_cond David Malcolm
2014-10-27 20:57 ` [gimple-classes, committed 16/92] Update various expressions within tree-scalar-evolution.c to be gimple_phi David Malcolm
2014-10-27 21:32 ` [gimple-classes, committed 55/92] Concretize parameter to gimple_call_copy_skip_args David Malcolm
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).