@@ -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
new file mode 100644
@@ -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.
@@ -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))
@@ -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;
@@ -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)
@@ -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)
@@ -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:
@@ -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;
@@ -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:
@@ -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;
@@ -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;
@@ -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 *,
new file mode 100644
@@ -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.
@@ -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. */
@@ -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:
@@ -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));
@@ -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);
@@ -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