From patchwork Wed Nov 19 22:24:04 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Malcolm X-Patchwork-Id: 412533 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id DB585140142 for ; Thu, 20 Nov 2014 09:28:48 +1100 (AEDT) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender :message-id:subject:from:to:cc:date:in-reply-to:references :content-type:mime-version; q=dns; s=default; b=XCpaNgkhY6hgydDd +WtJLG6PT7jiBMkeUIzkHg43omvXb4vzHEezs8gAOYH0klITsaItDse/dvWO86sw psUvHHAnAHTQ1WJdkU/ORX3CArJadJIvvgfYyrhEGKkZ8BUy5lTmZAC4t+XgoNkS W62kG2CfZz8J5DGOONK1BNipvrE= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender :message-id:subject:from:to:cc:date:in-reply-to:references :content-type:mime-version; s=default; bh=M7yznbwIxVMau3XMdZb42V Z3kXg=; b=MFtSR/d+B/ZjScywkLVcsn3Bz3cKPKIwfEVkVyfMiuFKo7aktNs6Ja zbcHKZ0/KyLrO5SjANTQpaOy4KNu1zKbwpGOGyB09GTUYgaPw7/5dFC02xUCLZpR /Fj0jmLYaE8hxqiTz7QvlV65Y8llxMgmIXS6nKy5ybcKOEi6DwAg8= Received: (qmail 21982 invoked by alias); 19 Nov 2014 22:28:40 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org Received: (qmail 21957 invoked by uid 89); 19 Nov 2014 22:28:38 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.0 required=5.0 tests=AWL, BAYES_00, SPF_HELO_PASS, SPF_PASS, T_RP_MATCHES_RCVD autolearn=ham version=3.3.2 X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-GCM-SHA384 encrypted) ESMTPS; Wed, 19 Nov 2014 22:28:35 +0000 Received: from int-mx11.intmail.prod.int.phx2.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id sAJMSXNB008421 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Wed, 19 Nov 2014 17:28:33 -0500 Received: from [10.3.237.203] (vpn-237-203.phx2.redhat.com [10.3.237.203]) by int-mx11.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id sAJMSW2m005722; Wed, 19 Nov 2014 17:28:33 -0500 Message-ID: <1416435844.3562.78.camel@surprise> Subject: Re: "gimple-classes-v2-option-3" git branch committed to svn trunk as r217787 From: David Malcolm To: Richard Biener Cc: Andrew MacLeod , gcc-patches@gcc.gnu.org Date: Wed, 19 Nov 2014 17:24:04 -0500 In-Reply-To: References: <1416420732.3562.49.camel@surprise> <546CEEDF.10007@redhat.com> <8C1B6C93-EAA6-4F10-84BB-743499104758@gmail.com> <546D0724.3080006@redhat.com> Mime-Version: 1.0 X-IsSubscribed: yes On Wed, 2014-11-19 at 22:36 +0100, Richard Biener wrote: > On November 19, 2014 10:09:56 PM CET, Andrew MacLeod wrote: > >On 11/19/2014 03:43 PM, Richard Biener wrote: > >> On November 19, 2014 8:26:23 PM CET, Andrew MacLeod > > wrote: > >>> On 11/19/2014 01:12 PM, David Malcolm wrote: > >>> > >>>> (A) could become: > >>>> > >>>> greturn *stmt = gsi->as_a_greturn (); > >>>> > >>>> (B) could become: > >>>> > >>>> stmt = gsi->dyn_cast (); > >>>> if (!stmt) > >>>> or: > >>>> > >>>> stmt = gsi->dyn_cast_gcall (); > >>>> if (!stmt) > >>>> > >>>> or maybe: > >>>> > >>>> stmt = gsi->is_a_gcall (); > >>>> if (!stmt) > >>>> > >>>> An earlier version of my patches had casting methods within the > >>>> gimple_statement_base class, which were rejected; the above > >proposals > >>>> would instead put them within gimple_stmt_iterator. > >>>> > >>> I would like all gsi routines to be consistent, not a mix of > >functions > >>> and methods. > >>> so something like > >>> > >>> stmt = gsi_as_call (gsi); > >>> stmt = gsi_dyn_call (gsi); > >>> > >>> or we need to change gsi_stmt() and friends into methods and access > >>> them > >>> as gsi->stmt ().. which is possibly better, but that much more > >>> intrusive again (another 2000+ locations). > >>> If we switched to methods everywhere for gsi, I'd prefer something > >like > >>> gsi->as_a_call () > >>> gsi->is_a_call () > >>> gsi->dyn_cast_call () > >>> > >>> I think its more readable... and it removes a dependency on the > >>> implementation.. so if we ever decide to change the name of 'gcall' > >>> down > >>> the road to using a namespace, and make it gimple::call or whatever, > >we > >>> > >>> wont have to change every single gsi-> location which has a > >templated > >>> use of the type. > >>> > >>> I'm also think this sort of thing could probably wait until next > >stage > >>> 1.. > >>> > >>> my 2 cents... > >> Why not as_a (*gsi)? It would > >> Add operator* to gsi of course. > >> > >> Richard. > >> > >> > > > >I could live with that form too. > > > >we often have an instance of gimple_stmt_iterator rather than a pointer > > > >to it, so wouldn't "operator gimple *()" to implicitly call gsi_stmt() > > > >when needed work better? (or "operator gimple ()" before the next > >change) .. > > Not sure. The * matches how iterators work in STL... > > Note that for the cases where we pass a pointer to an iterator we can change those to use references to avoid writing **gsi. > > Richard. > > >Andrew I had a go at adding an operator * to gimple_stmt_iterator, using it everywhere that we do an as_a<> or dyn_cast<> on the result of a gsi_stmt, to abbreviate the gsi_stmt call down to one character. Patch attached; only lightly smoketested; am posting it for the sake of discussion. I don't think this API will make the non-C++-fans happier; I think the objection to the work I just merged is that it's adding more C++ than those people are comfortable with. So although the attached patch makes things shorter (good), it's taking things in a "more C++" direction (questionable). I'd hoped to paper over the C++ somewhat. I suspect that any API which requires the of < > characters within the implementation of a gimple pass to mean a template is going to give those less happy with C++ a visceral "ugh" reaction. I wonder if there's a way to spell these things that's concise and which doesn't involve <> ? diff --git a/gcc/asan.c b/gcc/asan.c index be28ede..d06d60c 100644 --- a/gcc/asan.c +++ b/gcc/asan.c @@ -1902,7 +1902,7 @@ instrument_builtin_call (gimple_stmt_iterator *iter) return false; bool iter_advanced_p = false; - gcall *call = as_a (gsi_stmt (*iter)); + gcall *call = as_a (**iter); gcc_checking_assert (gimple_call_builtin_p (call, BUILT_IN_NORMAL)); diff --git a/gcc/auto-profile.c b/gcc/auto-profile.c index 7055c4a..c6a17d7 100644 --- a/gcc/auto-profile.c +++ b/gcc/auto-profile.c @@ -1433,7 +1433,7 @@ afdo_vpt_for_early_inline (stmt_set *promoted_stmts) for (gsi = gsi_start_bb (bb); !gsi_end_p (gsi); gsi_next (&gsi)) { - gcall *stmt = dyn_cast (gsi_stmt (gsi)); + gcall *stmt = dyn_cast (*gsi); /* IC_promotion and early_inline_2 is done in multiple iterations. No need to promoted the stmt if its in promoted_stmts (means it is already been promoted in the previous iterations). */ diff --git a/gcc/cfgexpand.c b/gcc/cfgexpand.c index 45c13b4..15b7c5c 100644 --- a/gcc/cfgexpand.c +++ b/gcc/cfgexpand.c @@ -2015,7 +2015,7 @@ label_rtx_for_bb (basic_block bb ATTRIBUTE_UNUSED) { glabel *lab_stmt; - lab_stmt = dyn_cast (gsi_stmt (gsi)); + lab_stmt = dyn_cast (*gsi); if (!lab_stmt) break; @@ -4985,7 +4985,7 @@ expand_gimple_basic_block (basic_block bb, bool disable_tail_calls) if (!gsi_end_p (gsi) && gimple_code (gsi_stmt (gsi)) == GIMPLE_RETURN) { - greturn *ret_stmt = as_a (gsi_stmt (gsi)); + greturn *ret_stmt = as_a (*gsi); gcc_assert (single_succ_p (bb)); gcc_assert (single_succ (bb) == EXIT_BLOCK_PTR_FOR_FN (cfun)); diff --git a/gcc/gimple-fold.c b/gcc/gimple-fold.c index 8e0c9e0..1e325a8 100644 --- a/gcc/gimple-fold.c +++ b/gcc/gimple-fold.c @@ -2024,7 +2024,7 @@ static bool gimple_fold_builtin_snprintf_chk (gimple_stmt_iterator *gsi, enum built_in_function fcode) { - gcall *stmt = as_a (gsi_stmt (*gsi)); + gcall *stmt = as_a (**gsi); tree dest, size, len, fn, fmt, flag; const char *fmt_str; @@ -2104,7 +2104,7 @@ static bool gimple_fold_builtin_sprintf_chk (gimple_stmt_iterator *gsi, enum built_in_function fcode) { - gcall *stmt = as_a (gsi_stmt (*gsi)); + gcall *stmt = as_a (**gsi); tree dest, size, len, fn, fmt, flag; const char *fmt_str; unsigned nargs = gimple_call_num_args (stmt); @@ -2327,7 +2327,7 @@ gimple_fold_builtin_sprintf (gimple_stmt_iterator *gsi) static bool gimple_fold_builtin_snprintf (gimple_stmt_iterator *gsi) { - gcall *stmt = as_a (gsi_stmt (*gsi)); + gcall *stmt = as_a (**gsi); tree dest = gimple_call_arg (stmt, 0); tree destsize = gimple_call_arg (stmt, 1); tree fmt = gimple_call_arg (stmt, 2); @@ -2621,7 +2621,7 @@ arith_overflowed_p (enum tree_code code, const_tree type, static bool gimple_fold_call (gimple_stmt_iterator *gsi, bool inplace) { - gcall *stmt = as_a (gsi_stmt (*gsi)); + gcall *stmt = as_a (**gsi); tree callee; bool changed = false; unsigned i; diff --git a/gcc/gimple-iterator.h b/gcc/gimple-iterator.h index fb6cc07..eb4ae40 100644 --- a/gcc/gimple-iterator.h +++ b/gcc/gimple-iterator.h @@ -33,6 +33,8 @@ struct gimple_stmt_iterator block/sequence is removed. */ gimple_seq *seq; basic_block bb; + + gimple operator * (); }; /* Iterator over GIMPLE_PHI statements. */ @@ -331,4 +333,11 @@ gsi_seq (gimple_stmt_iterator i) return *i.seq; } +inline gimple +gimple_stmt_iterator::operator * () +{ + return gsi_stmt (*this); +} + + #endif /* GCC_GIMPLE_ITERATOR_H */ diff --git a/gcc/gimple-low.c b/gcc/gimple-low.c index 402a921..63215fd 100644 --- a/gcc/gimple-low.c +++ b/gcc/gimple-low.c @@ -400,7 +400,7 @@ static void lower_gimple_bind (gimple_stmt_iterator *gsi, struct lower_data *data) { tree old_block = data->block; - gbind *stmt = as_a (gsi_stmt (*gsi)); + gbind *stmt = as_a (**gsi); tree new_block = gimple_bind_block (stmt); if (new_block) @@ -473,8 +473,7 @@ 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 ( - as_a (gsi_stmt (i))), + lower_sequence (gimple_catch_handler_ptr (as_a (*i)), data); if (!data->cannot_fallthru) cannot_fallthru = false; @@ -538,7 +537,7 @@ gimple_try_catch_may_fallthru (gtry *stmt) for (; !gsi_end_p (i); gsi_next (&i)) { if (gimple_seq_may_fallthru (gimple_catch_handler ( - as_a (gsi_stmt (i))))) + as_a (*i)))) return true; } return false; @@ -648,7 +647,7 @@ gimple_seq_may_fallthru (gimple_seq seq) static void lower_gimple_return (gimple_stmt_iterator *gsi, struct lower_data *data) { - greturn *stmt = as_a (gsi_stmt (*gsi)); + greturn *stmt = as_a (**gsi); gimple t; int i; return_statements_t tmp_rs; diff --git a/gcc/gimple-ssa-isolate-paths.c b/gcc/gimple-ssa-isolate-paths.c index 6dc63fd..ad194b1 100644 --- a/gcc/gimple-ssa-isolate-paths.c +++ b/gcc/gimple-ssa-isolate-paths.c @@ -216,7 +216,7 @@ isolate_path (basic_block bb, basic_block duplicate, { if (ret_zero) { - greturn *ret = as_a (gsi_stmt (si2)); + greturn *ret = as_a (*si2); tree zero = build_zero_cst (TREE_TYPE (gimple_return_retval (ret))); gimple_return_set_retval (ret, zero); update_stmt (ret); diff --git a/gcc/ipa-split.c b/gcc/ipa-split.c index 134b33f..dc909cf 100644 --- a/gcc/ipa-split.c +++ b/gcc/ipa-split.c @@ -320,7 +320,7 @@ 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 (glabel *label_stmt = dyn_cast (gsi_stmt (bsi))) + if (glabel *label_stmt = dyn_cast (*bsi)) { if (test_nonssa_use (label_stmt, gimple_label_label (label_stmt), @@ -787,7 +787,7 @@ 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 (greturn *return_stmt = dyn_cast (gsi_stmt (bsi))) + if (greturn *return_stmt = dyn_cast (*bsi)) return gimple_return_retval (return_stmt); else if (gimple_code (gsi_stmt (bsi)) == GIMPLE_ASSIGN && !gimple_clobber_p (gsi_stmt (bsi))) @@ -1541,8 +1541,7 @@ 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 (greturn *return_stmt - = dyn_cast (gsi_stmt (bsi))) + if (greturn *return_stmt = dyn_cast (*bsi)) { gimple_return_set_retval (return_stmt, retval); break; diff --git a/gcc/omp-low.c b/gcc/omp-low.c index 15aa140..fe00974 100644 --- a/gcc/omp-low.c +++ b/gcc/omp-low.c @@ -2074,7 +2074,7 @@ scan_omp_parallel (gimple_stmt_iterator *gsi, omp_context *outer_ctx) { omp_context *ctx; tree name; - gomp_parallel *stmt = as_a (gsi_stmt (*gsi)); + gomp_parallel *stmt = as_a (**gsi); /* Ignore parallel directives with empty bodies, unless there are copyin clauses. */ @@ -2151,7 +2151,7 @@ scan_omp_task (gimple_stmt_iterator *gsi, omp_context *outer_ctx) { omp_context *ctx; tree name, t; - gomp_task *stmt = as_a (gsi_stmt (*gsi)); + gomp_task *stmt = as_a (**gsi); /* Ignore task directives with empty bodies. */ if (optimize > 0 @@ -5867,7 +5867,7 @@ 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); - gomp_continue *cont_stmt = as_a (gsi_stmt (gsi)); + gomp_continue *cont_stmt = as_a (*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); @@ -6287,7 +6287,7 @@ 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); - gomp_continue *cont_stmt = as_a (gsi_stmt (gsi)); + gomp_continue *cont_stmt = as_a (*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); @@ -6677,7 +6677,7 @@ 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); - gomp_continue *cont_stmt = as_a (gsi_stmt (gsi)); + gomp_continue *cont_stmt = as_a (*gsi); vmain = gimple_omp_continue_control_use (cont_stmt); vback = gimple_omp_continue_control_def (cont_stmt); @@ -7498,7 +7498,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 = as_a (gsi_stmt (si)); + sections_stmt = as_a (*si); gcc_assert (gimple_code (sections_stmt) == GIMPLE_OMP_SECTIONS); vin = gimple_omp_sections_control (sections_stmt); if (!is_combined_parallel (region)) @@ -8955,7 +8955,7 @@ lower_omp_sections (gimple_stmt_iterator *gsi_p, omp_context *ctx) gbind *new_stmt, *bind; gimple_seq ilist, dlist, olist, new_body; - stmt = as_a (gsi_stmt (*gsi_p)); + stmt = as_a (**gsi_p); push_gimplify_context (); @@ -9163,7 +9163,7 @@ lower_omp_single (gimple_stmt_iterator *gsi_p, omp_context *ctx) { tree block; gimple t; - gomp_single *single_stmt = as_a (gsi_stmt (*gsi_p)); + gomp_single *single_stmt = as_a (**gsi_p); gbind *bind; gimple_seq bind_body, bind_body_tail = NULL, dlist; @@ -9338,7 +9338,7 @@ lower_omp_critical (gimple_stmt_iterator *gsi_p, omp_context *ctx) { tree block; tree name, lock, unlock; - gomp_critical *stmt = as_a (gsi_stmt (*gsi_p)); + gomp_critical *stmt = as_a (**gsi_p); gbind *bind; location_t loc = gimple_location (stmt); gimple_seq tbody; @@ -9492,7 +9492,7 @@ lower_omp_for (gimple_stmt_iterator *gsi_p, omp_context *ctx) { tree *rhs_p, block; struct omp_for_data fd, *fdp = NULL; - gomp_for *stmt = as_a (gsi_stmt (*gsi_p)); + gomp_for *stmt = as_a (**gsi_p); gbind *new_stmt; gimple_seq omp_for_body, body, dlist; size_t i; @@ -10134,7 +10134,7 @@ lower_omp_target (gimple_stmt_iterator *gsi_p, omp_context *ctx) { tree clauses; tree child_fn, t, c; - gomp_target *stmt = as_a (gsi_stmt (*gsi_p)); + gomp_target *stmt = as_a (**gsi_p); gbind *tgt_bind = NULL, *bind; gimple_seq tgt_body = NULL, olist, ilist, new_body; location_t loc = gimple_location (stmt); @@ -10444,7 +10444,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) { - gomp_teams *teams_stmt = as_a (gsi_stmt (*gsi_p)); + gomp_teams *teams_stmt = as_a (**gsi_p); push_gimplify_context (); tree block = make_node (BLOCK); diff --git a/gcc/predict.c b/gcc/predict.c index 779af11..0825341 100644 --- a/gcc/predict.c +++ b/gcc/predict.c @@ -2246,7 +2246,7 @@ 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)) { - glabel *label_stmt = dyn_cast (gsi_stmt (gi)); + glabel *label_stmt = dyn_cast (*gi); tree decl; if (!label_stmt) diff --git a/gcc/trans-mem.c b/gcc/trans-mem.c index d3a6f10..6261731 100644 --- a/gcc/trans-mem.c +++ b/gcc/trans-mem.c @@ -1612,7 +1612,7 @@ static void lower_transaction (gimple_stmt_iterator *gsi, struct walk_stmt_info *wi) { gimple g; - gtransaction *stmt = as_a (gsi_stmt (*gsi)); + gtransaction *stmt = as_a (**gsi); unsigned int *outer_state = (unsigned int *) wi->info; unsigned int this_state = 0; struct walk_stmt_info this_wi; @@ -2362,7 +2362,7 @@ static bool expand_call_tm (struct tm_region *region, gimple_stmt_iterator *gsi) { - gcall *stmt = as_a (gsi_stmt (*gsi)); + gcall *stmt = as_a (**gsi); tree lhs = gimple_call_lhs (stmt); tree fn_decl; struct cgraph_node *node; @@ -5106,7 +5106,7 @@ ipa_tm_transform_calls_redirect (struct cgraph_node *node, gimple_stmt_iterator *gsi, bool *need_ssa_rename_p) { - gcall *stmt = as_a (gsi_stmt (*gsi)); + gcall *stmt = as_a (**gsi); struct cgraph_node *new_node; struct cgraph_edge *e = node->get_edge (stmt); tree fndecl = gimple_call_fndecl (stmt); diff --git a/gcc/tree-call-cdce.c b/gcc/tree-call-cdce.c index 188a295..1321274 100644 --- a/gcc/tree-call-cdce.c +++ b/gcc/tree-call-cdce.c @@ -927,7 +927,7 @@ pass_call_cdce::execute (function *fun) /* Collect dead call candidates. */ for (i = gsi_start_bb (bb); !gsi_end_p (i); gsi_next (&i)) { - gcall *stmt = dyn_cast (gsi_stmt (i)); + gcall *stmt = dyn_cast (*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 e78554f..f664ee6 100644 --- a/gcc/tree-cfg.c +++ b/gcc/tree-cfg.c @@ -943,7 +943,7 @@ make_edges (void) { for (gsi = gsi_start_bb (bb); !gsi_end_p (gsi); gsi_next (&gsi)) { - glabel *label_stmt = dyn_cast (gsi_stmt (gsi)); + glabel *label_stmt = dyn_cast (*gsi); tree target; if (!label_stmt) @@ -1407,7 +1407,7 @@ cleanup_dead_labels (void) for (i = gsi_start_bb (bb); !gsi_end_p (i); gsi_next (&i)) { tree label; - glabel *label_stmt = dyn_cast (gsi_stmt (i)); + glabel *label_stmt = dyn_cast (*i); if (!label_stmt) break; @@ -1550,7 +1550,7 @@ cleanup_dead_labels (void) for (i = gsi_start_bb (bb); !gsi_end_p (i); ) { tree label; - glabel *label_stmt = dyn_cast (gsi_stmt (i)); + glabel *label_stmt = dyn_cast (*i); if (!label_stmt) break; @@ -1706,7 +1706,7 @@ gimple_can_merge_blocks_p (basic_block a, basic_block b) gsi_next (&gsi)) { tree lab; - glabel *label_stmt = dyn_cast (gsi_stmt (gsi)); + glabel *label_stmt = dyn_cast (*gsi); if (!label_stmt) break; lab = gimple_label_label (label_stmt); @@ -5422,7 +5422,7 @@ gimple_block_label (basic_block bb) for (i = s; !gsi_end_p (i); first = false, gsi_next (&i)) { - stmt = dyn_cast (gsi_stmt (i)); + stmt = dyn_cast (*i); if (!stmt) break; label = gimple_label_label (stmt); diff --git a/gcc/tree-chkp.c b/gcc/tree-chkp.c index 3e38691..ee784be 100644 --- a/gcc/tree-chkp.c +++ b/gcc/tree-chkp.c @@ -1195,7 +1195,7 @@ chkp_get_registered_bounds (tree ptr) static void chkp_add_bounds_to_ret_stmt (gimple_stmt_iterator *gsi) { - greturn *ret = as_a (gsi_stmt (*gsi)); + greturn *ret = as_a (**gsi); tree retval = gimple_return_retval (ret); tree ret_decl = DECL_RESULT (cfun->decl); tree bounds; @@ -1634,7 +1634,7 @@ chkp_instrument_normal_builtin (tree fndecl) static void chkp_add_bounds_to_call_stmt (gimple_stmt_iterator *gsi) { - gcall *call = as_a (gsi_stmt (*gsi)); + gcall *call = as_a (**gsi); unsigned arg_no = 0; tree fndecl = gimple_call_fndecl (call); tree fntype; diff --git a/gcc/tree-complex.c b/gcc/tree-complex.c index a2d3639..fb69511 100644 --- a/gcc/tree-complex.c +++ b/gcc/tree-complex.c @@ -1435,7 +1435,7 @@ expand_complex_comparison (gimple_stmt_iterator *gsi, tree ar, tree ai, static void expand_complex_asm (gimple_stmt_iterator *gsi) { - gasm *stmt = as_a (gsi_stmt (*gsi)); + gasm *stmt = as_a (**gsi); unsigned int i; for (i = 0; i < gimple_asm_noutputs (stmt); ++i) diff --git a/gcc/tree-eh.c b/gcc/tree-eh.c index 8180ff7..575294a 100644 --- a/gcc/tree-eh.c +++ b/gcc/tree-eh.c @@ -1806,7 +1806,7 @@ lower_catch (struct leh_state *state, gtry *tp) gcatch *catch_stmt; gimple_seq handler; - catch_stmt = as_a (gsi_stmt (gsi)); + catch_stmt = as_a (*gsi); c = gen_eh_region_catch (try_region, gimple_catch_types (catch_stmt)); handler = gimple_catch_handler (catch_stmt); @@ -4011,7 +4011,7 @@ 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)) { - glabel *label_stmt = dyn_cast (gsi_stmt (gsi)); + glabel *label_stmt = dyn_cast (*gsi); tree lab; int lp_nr; @@ -4283,7 +4283,7 @@ 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)) { - glabel *stmt = dyn_cast (gsi_stmt (gsi)); + glabel *stmt = dyn_cast (*gsi); int lp_nr; if (!stmt) diff --git a/gcc/tree-inline.c b/gcc/tree-inline.c index 835edd1..f4ba9d7 100644 --- a/gcc/tree-inline.c +++ b/gcc/tree-inline.c @@ -5003,7 +5003,7 @@ mark_local_labels_stmt (gimple_stmt_iterator *gsip, struct walk_stmt_info *wi) { copy_body_data *id = (copy_body_data *) wi->info; - glabel *stmt = dyn_cast (gsi_stmt (*gsip)); + glabel *stmt = dyn_cast (**gsip); if (stmt) { diff --git a/gcc/tree-nested.c b/gcc/tree-nested.c index 4d31837..9e25049 100644 --- a/gcc/tree-nested.c +++ b/gcc/tree-nested.c @@ -2146,7 +2146,7 @@ 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; - glabel *stmt = dyn_cast (gsi_stmt (*gsi)); + glabel *stmt = dyn_cast (**gsi); if (!stmt) { diff --git a/gcc/tree-nrv.c b/gcc/tree-nrv.c index 182039e..28a8e04 100644 --- a/gcc/tree-nrv.c +++ b/gcc/tree-nrv.c @@ -394,7 +394,7 @@ pass_return_slot::execute (function *fun) gcall *stmt; bool slot_opt_p; - stmt = dyn_cast (gsi_stmt (gsi)); + stmt = dyn_cast (*gsi); if (stmt && gimple_call_lhs (stmt) && !gimple_call_return_slot_opt_p (stmt) diff --git a/gcc/tree-sra.c b/gcc/tree-sra.c index 8e4b94c..3822516 100644 --- a/gcc/tree-sra.c +++ b/gcc/tree-sra.c @@ -4900,7 +4900,7 @@ convert_callers (struct cgraph_node *node, tree old_decl, { gcall *stmt; tree call_fndecl; - stmt = dyn_cast (gsi_stmt (gsi)); + stmt = dyn_cast (*gsi); if (!stmt) continue; call_fndecl = gimple_call_fndecl (stmt); diff --git a/gcc/tree-ssa-loop-im.c b/gcc/tree-ssa-loop-im.c index 0e806f4..67e3fcb 100644 --- a/gcc/tree-ssa-loop-im.c +++ b/gcc/tree-ssa-loop-im.c @@ -891,7 +891,7 @@ rewrite_reciprocal (gimple_stmt_iterator *bsi) tree real_one; gimple_stmt_iterator gsi; - stmt = as_a (gsi_stmt (*bsi)); + stmt = as_a (**bsi); lhs = gimple_assign_lhs (stmt); type = TREE_TYPE (lhs); @@ -929,7 +929,7 @@ rewrite_bittest (gimple_stmt_iterator *bsi) tree lhs, name, t, a, b; use_operand_p use; - stmt = as_a (gsi_stmt (*bsi)); + stmt = as_a (**bsi); lhs = gimple_assign_lhs (stmt); /* Verify that the single use of lhs is a comparison against zero. */ diff --git a/gcc/tree-ssa-loop-manip.c b/gcc/tree-ssa-loop-manip.c index db6f25f..550ab42 100644 --- a/gcc/tree-ssa-loop-manip.c +++ b/gcc/tree-ssa-loop-manip.c @@ -1229,7 +1229,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 = as_a (gsi_stmt (bsi)); + exit_if = as_a (*bsi); create_iv (exit_base, exit_step, NULL_TREE, loop, &bsi, false, &ctr_before, &ctr_after); gimple_cond_set_code (exit_if, exit_cmp); diff --git a/gcc/tree-ssa-phiopt.c b/gcc/tree-ssa-phiopt.c index 6ee2c39..c6b7861 100644 --- a/gcc/tree-ssa-phiopt.c +++ b/gcc/tree-ssa-phiopt.c @@ -155,10 +155,10 @@ single_non_singleton_phi_for_edges (gimple_seq seq, edge e0, edge e1) gimple_stmt_iterator i; gphi *phi = NULL; if (gimple_seq_singleton_p (seq)) - return as_a (gsi_stmt (gsi_start (seq))); + return as_a (*gsi_start (seq)); for (i = gsi_start (seq); !gsi_end_p (i); gsi_next (&i)) { - gphi *p = as_a (gsi_stmt (i)); + gphi *p = as_a (*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))) @@ -334,7 +334,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 = as_a (gsi_stmt (gsi)); + phi = as_a (*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) diff --git a/gcc/tree-ssa-propagate.c b/gcc/tree-ssa-propagate.c index 94a34ee..be0bf53 100644 --- a/gcc/tree-ssa-propagate.c +++ b/gcc/tree-ssa-propagate.c @@ -748,7 +748,7 @@ bool update_gimple_call (gimple_stmt_iterator *si_p, tree fn, int nargs, ...) { va_list ap; - gcall *new_stmt, *stmt = as_a (gsi_stmt (*si_p)); + gcall *new_stmt, *stmt = as_a (**si_p); gcc_assert (is_gimple_call (stmt)); va_start (ap, nargs); diff --git a/gcc/tree-ssa-structalias.c b/gcc/tree-ssa-structalias.c index e065f1a..71fa304 100644 --- a/gcc/tree-ssa-structalias.c +++ b/gcc/tree-ssa-structalias.c @@ -6842,7 +6842,7 @@ compute_points_to_sets (void) gcall *stmt; struct pt_solution *pt; - stmt = dyn_cast (gsi_stmt (gsi)); + stmt = dyn_cast (*gsi); if (!stmt) continue; @@ -7255,7 +7255,7 @@ ipa_pta_execute (void) varinfo_t vi, fi; tree decl; - stmt = dyn_cast (gsi_stmt (gsi)); + stmt = dyn_cast (*gsi); if (!stmt) continue; diff --git a/gcc/tree-tailcall.c b/gcc/tree-tailcall.c index 037dfbc..b20942e 100644 --- a/gcc/tree-tailcall.c +++ b/gcc/tree-tailcall.c @@ -932,7 +932,7 @@ optimize_tail_call (struct tailcall *t, bool opt_tailcalls) if (opt_tailcalls) { - gcall *stmt = as_a (gsi_stmt (t->call_gsi)); + gcall *stmt = as_a (*t->call_gsi); gimple_call_set_tail (stmt, true); cfun->tail_call_marked = true; diff --git a/gcc/tree-vect-generic.c b/gcc/tree-vect-generic.c index 246ca62..3089731 100644 --- a/gcc/tree-vect-generic.c +++ b/gcc/tree-vect-generic.c @@ -846,7 +846,7 @@ expand_vector_divmod (gimple_stmt_iterator *gsi, tree type, tree op0, static void expand_vector_condition (gimple_stmt_iterator *gsi) { - gassign *stmt = as_a (gsi_stmt (*gsi)); + gassign *stmt = as_a (**gsi); tree type = gimple_expr_type (stmt); tree a = gimple_assign_rhs1 (stmt); tree a1 = a; @@ -1015,7 +1015,7 @@ expand_vector_operation (gimple_stmt_iterator *gsi, tree type, tree compute_type static void optimize_vector_constructor (gimple_stmt_iterator *gsi) { - gassign *stmt = as_a (gsi_stmt (*gsi)); + gassign *stmt = as_a (**gsi); tree lhs = gimple_assign_lhs (stmt); tree rhs = gimple_assign_rhs1 (stmt); tree type = TREE_TYPE (rhs); @@ -1230,7 +1230,7 @@ vector_element (gimple_stmt_iterator *gsi, tree vect, tree idx, tree *ptmpvec) static void lower_vec_perm (gimple_stmt_iterator *gsi) { - gassign *stmt = as_a (gsi_stmt (*gsi)); + gassign *stmt = as_a (**gsi); tree mask = gimple_assign_rhs3 (stmt); tree vec0 = gimple_assign_rhs1 (stmt); tree vec1 = gimple_assign_rhs2 (stmt); @@ -1410,7 +1410,7 @@ expand_vector_operations_1 (gimple_stmt_iterator *gsi) tree new_rhs; /* Only consider code == GIMPLE_ASSIGN. */ - gassign *stmt = dyn_cast (gsi_stmt (*gsi)); + gassign *stmt = dyn_cast (**gsi); if (!stmt) return; diff --git a/gcc/ubsan.c b/gcc/ubsan.c index 5da0b18..a371e2c 100644 --- a/gcc/ubsan.c +++ b/gcc/ubsan.c @@ -1435,7 +1435,7 @@ instrument_nonnull_arg (gimple_stmt_iterator *gsi) static void instrument_nonnull_return (gimple_stmt_iterator *gsi) { - greturn *stmt = as_a (gsi_stmt (*gsi)); + greturn *stmt = as_a (**gsi); location_t loc[2]; tree arg = gimple_return_retval (stmt); /* infer_nonnull_range needs flag_delete_null_pointer_checks set, diff --git a/gcc/value-prof.c b/gcc/value-prof.c index 7aac67d..72801e6 100644 --- a/gcc/value-prof.c +++ b/gcc/value-prof.c @@ -831,7 +831,7 @@ gimple_divmod_fixed_value_transform (gimple_stmt_iterator *si) gcov_type prob; gassign *stmt; - stmt = dyn_cast (gsi_stmt (*si)); + stmt = dyn_cast (**si); if (!stmt) return false; @@ -994,7 +994,7 @@ gimple_mod_pow2_value_transform (gimple_stmt_iterator *si) gcov_type prob; gassign *stmt; - stmt = dyn_cast (gsi_stmt (*si)); + stmt = dyn_cast (**si); if (!stmt) return false; @@ -1168,7 +1168,7 @@ gimple_mod_subtract_transform (gimple_stmt_iterator *si) gcov_type count1, count2; gassign *stmt; - stmt = dyn_cast (gsi_stmt (*si)); + stmt = dyn_cast (**si); if (!stmt) return false; @@ -1582,7 +1582,7 @@ gimple_ic_transform (gimple_stmt_iterator *gsi) gcov_type val, count, all, bb_all; struct cgraph_node *direct_call; - stmt = dyn_cast (gsi_stmt (*gsi)); + stmt = dyn_cast (**gsi); if (!stmt) return false; @@ -1810,7 +1810,7 @@ gimple_stringops_transform (gimple_stmt_iterator *gsi) tree tree_val; int size_arg; - stmt = dyn_cast (gsi_stmt (*gsi)); + stmt = dyn_cast (**gsi); if (!stmt) return false; fndecl = gimple_call_fndecl (stmt);