From patchwork Fri Dec 13 18:10:50 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Malcolm X-Patchwork-Id: 1209336 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=209.132.180.131; helo=sourceware.org; envelope-from=gcc-patches-return-515922-incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b="s+KxSj2z"; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.b="KDcnf4Di"; dkim-atps=neutral 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 47ZJgH0BcBz9sPJ for ; Sat, 14 Dec 2019 05:12:58 +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:from :to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-type:content-transfer-encoding; q=dns; s= default; b=Z9kYtu1I0CtQGbBPeb2GlRoR3eF8Bs5gTm6MBJME8CAYucp+4fRge sb8q8sOpsmcaSQvvwvz6kqaSe/2OgK6dclzDlQfQiK7wMWMy8xo0ewnAMw0m2hXt S/NoerX4fqwRuok7ms2ZR/vWXUBL3xUpRQ8BtKCiN2Ysh6qh/HwJT4= 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:from :to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-type:content-transfer-encoding; s=default; bh=/sK67ajRUpykmKntGZ3rs1PHmDo=; b=s+KxSj2zpnxAjL7O73+hkl6ov4mD ZGM89EF2cQ9pju+0DaHyfhQAND7ECyHcfhSD7vwP7qjAJjeoO5SEdkWgc9XpYd9F 6cLBQD5mM9M3QlURSl6r27M32snRAB9sJ2lFl+e2Yb44rbXqG2CXsYenoQ4NnVDe 0RgiKZmvovLarIk= Received: (qmail 99790 invoked by alias); 13 Dec 2019 18:11:49 -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 99628 invoked by uid 89); 13 Dec 2019 18:11:48 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-22.5 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3 autolearn=ham version=3.3.1 spammy=sk:gimple, 7127, UD:gimple-pretty-print.c, sk:is_gimp X-HELO: us-smtp-delivery-1.mimecast.com Received: from us-smtp-2.mimecast.com (HELO us-smtp-delivery-1.mimecast.com) (207.211.31.81) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Fri, 13 Dec 2019 18:11:42 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1576260700; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=rCtSTPcrRQ05kHNHJePYJuxaXGi4VccOsp+/qWNPPjs=; b=KDcnf4Di/fPSPoNXJG1oteffbUk/M3TS/pFCVCKyHBvQjJ/3y+Cwz3fN/sKqsJ+DqYwLvK 0GNwuxWfpzDJofSu4/PDVCCVBUyiF9fCZ2XRnMf/21NbtZrQP6usAZ9WPcTfq2AtbYWstd t4ozwPwbocJjp1GxY5FRrS+F0fC63Kg= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-341-Qh8MZkt2PoiyURSLw6ECDQ-1; Fri, 13 Dec 2019 13:11:39 -0500 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 4D589800D4C for ; Fri, 13 Dec 2019 18:11:38 +0000 (UTC) Received: from t470.redhat.com (ovpn-117-164.phx2.redhat.com [10.3.117.164]) by smtp.corp.redhat.com (Postfix) with ESMTP id CA8365C54A; Fri, 13 Dec 2019 18:11:37 +0000 (UTC) From: David Malcolm To: gcc-patches@gcc.gnu.org Cc: David Malcolm Subject: [PATCH 01/45] gimple const-correctness fixes Date: Fri, 13 Dec 2019 13:10:50 -0500 Message-Id: <20191213181134.1830-2-dmalcolm@redhat.com> In-Reply-To: <20191213181134.1830-1-dmalcolm@redhat.com> References: <20191213181134.1830-1-dmalcolm@redhat.com> MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-IsSubscribed: yes This patch converts various "gimple *" to "const gimple *" and similar fixes for gimple subclasses, adding is_a_helper for gimple subclasses to support the const form of as_a, and adding a few "const" overloads of accessors. This is enough to make pp_gimple_stmt_1's stmt const. gcc/ChangeLog: * gimple-predict.h (gimple_predict_predictor): Make "gs" param const. (gimple_predict_outcome): Likewise. * gimple-pretty-print.c (do_niy): Likewise. (dump_unary_rhs): Likewise. (dump_binary_rhs): Likewise. (dump_ternary_rhs): Likewise. (dump_gimple_assign): Likewise. (dump_gimple_return): Likewise. (dump_gimple_call_args): Likewise. (pp_points_to_solution): Make "pt" param const. (dump_gimple_call): Make "gs" param const. (dump_gimple_switch): Likewise. (dump_gimple_cond): Likewise. (dump_gimple_label): Likewise. (dump_gimple_goto): Likewise. (dump_gimple_bind): Likewise. (dump_gimple_try): Likewise. (dump_gimple_catch): Likewise. (dump_gimple_eh_filter): Likewise. (dump_gimple_eh_must_not_throw): Likewise. (dump_gimple_eh_else): Likewise. (dump_gimple_resx): Likewise. (dump_gimple_eh_dispatch): Likewise. (dump_gimple_debug): Likewise. (dump_gimple_omp_for): Likewise. (dump_gimple_omp_continue): Likewise. (dump_gimple_omp_single): Likewise. (dump_gimple_omp_taskgroup): Likewise. (dump_gimple_omp_target): Likewise. (dump_gimple_omp_teams): Likewise. (dump_gimple_omp_sections): Likewise. (dump_gimple_omp_block): Likewise. (dump_gimple_omp_critical): Likewise. (dump_gimple_omp_ordered): Likewise. (dump_gimple_omp_scan): Likewise. (dump_gimple_omp_return): Likewise. (dump_gimple_transaction): Likewise. (dump_gimple_asm): Likewise. (dump_gimple_phi): Make "phi" param const. (dump_gimple_omp_parallel): Make "gs" param const. (dump_gimple_omp_task): Likewise. (dump_gimple_omp_atomic_load): Likewise. (dump_gimple_omp_atomic_store): Likewise. (dump_gimple_mem_ops): Likewise. (pp_gimple_stmt_1): Likewise. Add "const" to the various as_a <> casts throughout. * gimple-pretty-print.h (gimple_stmt_1): Make gimple * param const. * gimple.h (is_a_helper ::test): New. (is_a_helper ::test): New. (is_a_helper ::test): New. (is_a_helper ::test): New. (is_a_helper ::test): New. (is_a_helper ::test): New. (is_a_helper ::test): New. (is_a_helper ::test): New. (gimple_call_tail_p): Make param const. (gimple_call_return_slot_opt_p): Likewise. (gimple_call_va_arg_pack_p): Likewise. (gimple_call_use_set): Add const overload. (gimple_call_clobber_set): Likewise. (gimple_has_lhs): Make param const. (gimple_bind_body): Likewise. (gimple_catch_handler): Likewise. (gimple_eh_filter_failure): Likewise. (gimple_eh_must_not_throw_fndecl): Likewise. (gimple_eh_else_n_body): Likewise. (gimple_eh_else_e_body): Likewise. (gimple_try_eval): Likewise. (gimple_try_cleanup): Likewise. (gimple_phi_arg): Add const overload. (gimple_phi_arg_def): Make param const. (gimple_phi_arg_edge): Likewise. (gimple_phi_arg_location): Likewise. (gimple_phi_arg_has_location): Likewise. (gimple_debug_bind_get_var): Likewise. (gimple_debug_bind_get_value): Likewise. (gimple_debug_source_bind_get_var): Likewise. (gimple_debug_source_bind_get_value): Likewise. (gimple_omp_body): Likewise. (gimple_omp_for_collapse): Likewise. (gimple_omp_for_pre_body): Likewise. (gimple_transaction_body): Likewise. * tree-eh.c (lookup_stmt_eh_lp_fn): Make param "t" const. (lookup_stmt_eh_lp): Likewise. * tree-eh.h (lookup_stmt_eh_lp_fn): Make param const. (lookup_stmt_eh_lp): Likewise. * tree-ssa-alias.h (pt_solution_empty_p): Make param const. * tree-ssa-structalias.c (pt_solution_empty_p): Likewise. --- gcc/gimple-predict.h | 4 +- gcc/gimple-pretty-print.c | 159 +++++++++++++++++++------------------ gcc/gimple-pretty-print.h | 3 +- gcc/gimple.h | 156 ++++++++++++++++++++++++++++-------- gcc/tree-eh.c | 6 +- gcc/tree-eh.h | 4 +- gcc/tree-ssa-alias.h | 2 +- gcc/tree-ssa-structalias.c | 2 +- 8 files changed, 213 insertions(+), 123 deletions(-) diff --git a/gcc/gimple-predict.h b/gcc/gimple-predict.h index 761098b3ceb5..d9763175b8a1 100644 --- a/gcc/gimple-predict.h +++ b/gcc/gimple-predict.h @@ -26,7 +26,7 @@ along with GCC; see the file COPYING3. If not see /* Return the predictor of GIMPLE_PREDICT statement GS. */ static inline enum br_predictor -gimple_predict_predictor (gimple *gs) +gimple_predict_predictor (const gimple *gs) { GIMPLE_CHECK (gs, GIMPLE_PREDICT); return (enum br_predictor) (gs->subcode & ~GF_PREDICT_TAKEN); @@ -47,7 +47,7 @@ gimple_predict_set_predictor (gimple *gs, enum br_predictor predictor) /* Return the outcome of GIMPLE_PREDICT statement GS. */ static inline enum prediction -gimple_predict_outcome (gimple *gs) +gimple_predict_outcome (const gimple *gs) { GIMPLE_CHECK (gs, GIMPLE_PREDICT); return (gs->subcode & GF_PREDICT_TAKEN) ? TAKEN : NOT_TAKEN; diff --git a/gcc/gimple-pretty-print.c b/gcc/gimple-pretty-print.c index f59cc2aa3188..9ec435fc56fe 100644 --- a/gcc/gimple-pretty-print.c +++ b/gcc/gimple-pretty-print.c @@ -59,7 +59,7 @@ along with GCC; see the file COPYING3. If not see gimple statement GS. */ static void -do_niy (pretty_printer *buffer, gimple *gs) +do_niy (pretty_printer *buffer, const gimple *gs) { pp_printf (buffer, "<<< Unknown GIMPLE statement: %s >>>\n", gimple_code_name[(int) gimple_code (gs)]); @@ -327,7 +327,7 @@ dump_gimple_fmt (pretty_printer *buffer, int spc, dump_flags_t flags, assignment GS. BUFFER, SPC and FLAGS are as in pp_gimple_stmt_1. */ static void -dump_unary_rhs (pretty_printer *buffer, gassign *gs, int spc, +dump_unary_rhs (pretty_printer *buffer, const gassign *gs, int spc, dump_flags_t flags) { enum tree_code rhs_code = gimple_assign_rhs_code (gs); @@ -423,7 +423,7 @@ dump_unary_rhs (pretty_printer *buffer, gassign *gs, int spc, assignment GS. BUFFER, SPC and FLAGS are as in pp_gimple_stmt_1. */ static void -dump_binary_rhs (pretty_printer *buffer, gassign *gs, int spc, +dump_binary_rhs (pretty_printer *buffer, const gassign *gs, int spc, dump_flags_t flags) { const char *p; @@ -495,7 +495,7 @@ dump_binary_rhs (pretty_printer *buffer, gassign *gs, int spc, assignment GS. BUFFER, SPC and FLAGS are as in pp_gimple_stmt_1. */ static void -dump_ternary_rhs (pretty_printer *buffer, gassign *gs, int spc, +dump_ternary_rhs (pretty_printer *buffer, const gassign *gs, int spc, dump_flags_t flags) { const char *p; @@ -625,7 +625,7 @@ dump_ternary_rhs (pretty_printer *buffer, gassign *gs, int spc, pp_gimple_stmt_1. */ static void -dump_gimple_assign (pretty_printer *buffer, gassign *gs, int spc, +dump_gimple_assign (pretty_printer *buffer, const gassign *gs, int spc, dump_flags_t flags) { if (flags & TDF_RAW) @@ -687,7 +687,7 @@ dump_gimple_assign (pretty_printer *buffer, gassign *gs, int spc, pp_gimple_stmt_1. */ static void -dump_gimple_return (pretty_printer *buffer, greturn *gs, int spc, +dump_gimple_return (pretty_printer *buffer, const greturn *gs, int spc, dump_flags_t flags) { tree t; @@ -712,7 +712,8 @@ dump_gimple_return (pretty_printer *buffer, greturn *gs, int spc, dump_gimple_call. */ static void -dump_gimple_call_args (pretty_printer *buffer, gcall *gs, dump_flags_t flags) +dump_gimple_call_args (pretty_printer *buffer, const gcall *gs, + dump_flags_t flags) { size_t i = 0; @@ -795,7 +796,7 @@ dump_gimple_call_args (pretty_printer *buffer, gcall *gs, dump_flags_t flags) /* Dump the points-to solution *PT to BUFFER. */ static void -pp_points_to_solution (pretty_printer *buffer, struct pt_solution *pt) +pp_points_to_solution (pretty_printer *buffer, const pt_solution *pt) { if (pt->anything) { @@ -868,7 +869,7 @@ pp_points_to_solution (pretty_printer *buffer, struct pt_solution *pt) pp_gimple_stmt_1. */ static void -dump_gimple_call (pretty_printer *buffer, gcall *gs, int spc, +dump_gimple_call (pretty_printer *buffer, const gcall *gs, int spc, dump_flags_t flags) { tree lhs = gimple_call_lhs (gs); @@ -876,7 +877,7 @@ dump_gimple_call (pretty_printer *buffer, gcall *gs, int spc, if (flags & TDF_ALIAS) { - struct pt_solution *pt; + const pt_solution *pt; pt = gimple_call_use_set (gs); if (!pt_solution_empty_p (pt)) { @@ -1006,7 +1007,7 @@ dump_gimple_call (pretty_printer *buffer, gcall *gs, int spc, pp_gimple_stmt_1. */ static void -dump_gimple_switch (pretty_printer *buffer, gswitch *gs, int spc, +dump_gimple_switch (pretty_printer *buffer, const gswitch *gs, int spc, dump_flags_t flags) { unsigned int i; @@ -1064,7 +1065,7 @@ dump_gimple_switch (pretty_printer *buffer, gswitch *gs, int spc, pp_gimple_stmt_1. */ static void -dump_gimple_cond (pretty_printer *buffer, gcond *gs, int spc, +dump_gimple_cond (pretty_printer *buffer, const gcond *gs, int spc, dump_flags_t flags) { if (flags & TDF_RAW) @@ -1131,7 +1132,7 @@ dump_gimple_cond (pretty_printer *buffer, gcond *gs, int spc, TDF_* in dumpfils.h). */ static void -dump_gimple_label (pretty_printer *buffer, glabel *gs, int spc, +dump_gimple_label (pretty_printer *buffer, const glabel *gs, int spc, dump_flags_t flags) { tree label = gimple_label_label (gs); @@ -1155,7 +1156,7 @@ dump_gimple_label (pretty_printer *buffer, glabel *gs, int spc, TDF_* in dumpfile.h). */ static void -dump_gimple_goto (pretty_printer *buffer, ggoto *gs, int spc, +dump_gimple_goto (pretty_printer *buffer, const ggoto *gs, int spc, dump_flags_t flags) { tree label = gimple_goto_dest (gs); @@ -1171,7 +1172,7 @@ dump_gimple_goto (pretty_printer *buffer, ggoto *gs, int spc, TDF_* in dumpfile.h). */ static void -dump_gimple_bind (pretty_printer *buffer, gbind *gs, int spc, +dump_gimple_bind (pretty_printer *buffer, const gbind *gs, int spc, dump_flags_t flags) { if (flags & TDF_RAW) @@ -1205,7 +1206,7 @@ dump_gimple_bind (pretty_printer *buffer, gbind *gs, int spc, dumpfile.h). */ static void -dump_gimple_try (pretty_printer *buffer, gtry *gs, int spc, +dump_gimple_try (pretty_printer *buffer, const gtry *gs, int spc, dump_flags_t flags) { if (flags & TDF_RAW) @@ -1280,7 +1281,7 @@ dump_gimple_try (pretty_printer *buffer, gtry *gs, int spc, dumpfile.h). */ static void -dump_gimple_catch (pretty_printer *buffer, gcatch *gs, int spc, +dump_gimple_catch (pretty_printer *buffer, const gcatch *gs, int spc, dump_flags_t flags) { if (flags & TDF_RAW) @@ -1297,7 +1298,7 @@ dump_gimple_catch (pretty_printer *buffer, gcatch *gs, int spc, dumpfile.h). */ static void -dump_gimple_eh_filter (pretty_printer *buffer, geh_filter *gs, int spc, +dump_gimple_eh_filter (pretty_printer *buffer, const geh_filter *gs, int spc, dump_flags_t flags) { if (flags & TDF_RAW) @@ -1315,7 +1316,7 @@ dump_gimple_eh_filter (pretty_printer *buffer, geh_filter *gs, int spc, static void dump_gimple_eh_must_not_throw (pretty_printer *buffer, - geh_mnt *gs, int spc, dump_flags_t flags) + const geh_mnt *gs, int spc, dump_flags_t flags) { if (flags & TDF_RAW) dump_gimple_fmt (buffer, spc, flags, "%G <%T>", gs, @@ -1331,7 +1332,7 @@ dump_gimple_eh_must_not_throw (pretty_printer *buffer, dumpfile.h). */ static void -dump_gimple_eh_else (pretty_printer *buffer, geh_else *gs, int spc, +dump_gimple_eh_else (pretty_printer *buffer, const geh_else *gs, int spc, dump_flags_t flags) { if (flags & TDF_RAW) @@ -1350,7 +1351,7 @@ dump_gimple_eh_else (pretty_printer *buffer, geh_else *gs, int spc, dumpfile.h). */ static void -dump_gimple_resx (pretty_printer *buffer, gresx *gs, int spc, +dump_gimple_resx (pretty_printer *buffer, const gresx *gs, int spc, dump_flags_t flags) { if (flags & TDF_RAW) @@ -1363,8 +1364,8 @@ dump_gimple_resx (pretty_printer *buffer, gresx *gs, int spc, /* Dump a GIMPLE_EH_DISPATCH tuple on the pretty_printer BUFFER. */ static void -dump_gimple_eh_dispatch (pretty_printer *buffer, geh_dispatch *gs, int spc, - dump_flags_t flags) +dump_gimple_eh_dispatch (pretty_printer *buffer, const geh_dispatch *gs, + int spc, dump_flags_t flags) { if (flags & TDF_RAW) dump_gimple_fmt (buffer, spc, flags, "%G <%d>", gs, @@ -1379,7 +1380,7 @@ dump_gimple_eh_dispatch (pretty_printer *buffer, geh_dispatch *gs, int spc, in dumpfile.h). */ static void -dump_gimple_debug (pretty_printer *buffer, gdebug *gs, int spc, +dump_gimple_debug (pretty_printer *buffer, const gdebug *gs, int spc, dump_flags_t flags) { switch (gs->subcode) @@ -1433,7 +1434,7 @@ dump_gimple_debug (pretty_printer *buffer, gdebug *gs, int spc, /* Dump a GIMPLE_OMP_FOR tuple on the pretty_printer BUFFER. */ static void -dump_gimple_omp_for (pretty_printer *buffer, gomp_for *gs, int spc, +dump_gimple_omp_for (pretty_printer *buffer, const gomp_for *gs, int spc, dump_flags_t flags) { size_t i; @@ -1566,7 +1567,7 @@ dump_gimple_omp_for (pretty_printer *buffer, gomp_for *gs, int spc, /* Dump a GIMPLE_OMP_CONTINUE tuple on the pretty_printer BUFFER. */ static void -dump_gimple_omp_continue (pretty_printer *buffer, gomp_continue *gs, +dump_gimple_omp_continue (pretty_printer *buffer, const gomp_continue *gs, int spc, dump_flags_t flags) { if (flags & TDF_RAW) @@ -1591,7 +1592,7 @@ dump_gimple_omp_continue (pretty_printer *buffer, gomp_continue *gs, /* Dump a GIMPLE_OMP_SINGLE tuple on the pretty_printer BUFFER. */ static void -dump_gimple_omp_single (pretty_printer *buffer, gomp_single *gs, +dump_gimple_omp_single (pretty_printer *buffer, const gomp_single *gs, int spc, dump_flags_t flags) { if (flags & TDF_RAW) @@ -1620,7 +1621,7 @@ dump_gimple_omp_single (pretty_printer *buffer, gomp_single *gs, /* Dump a GIMPLE_OMP_TASKGROUP tuple on the pretty_printer BUFFER. */ static void -dump_gimple_omp_taskgroup (pretty_printer *buffer, gimple *gs, +dump_gimple_omp_taskgroup (pretty_printer *buffer, const gimple *gs, int spc, dump_flags_t flags) { if (flags & TDF_RAW) @@ -1649,7 +1650,7 @@ dump_gimple_omp_taskgroup (pretty_printer *buffer, gimple *gs, /* Dump a GIMPLE_OMP_TARGET tuple on the pretty_printer BUFFER. */ static void -dump_gimple_omp_target (pretty_printer *buffer, gomp_target *gs, +dump_gimple_omp_target (pretty_printer *buffer, const gomp_target *gs, int spc, dump_flags_t flags) { const char *kind; @@ -1745,7 +1746,7 @@ dump_gimple_omp_target (pretty_printer *buffer, gomp_target *gs, /* Dump a GIMPLE_OMP_TEAMS tuple on the pretty_printer BUFFER. */ static void -dump_gimple_omp_teams (pretty_printer *buffer, gomp_teams *gs, int spc, +dump_gimple_omp_teams (pretty_printer *buffer, const gomp_teams *gs, int spc, dump_flags_t flags) { if (flags & TDF_RAW) @@ -1774,7 +1775,7 @@ dump_gimple_omp_teams (pretty_printer *buffer, gomp_teams *gs, int spc, /* Dump a GIMPLE_OMP_SECTIONS tuple on the pretty_printer BUFFER. */ static void -dump_gimple_omp_sections (pretty_printer *buffer, gomp_sections *gs, +dump_gimple_omp_sections (pretty_printer *buffer, const gomp_sections *gs, int spc, dump_flags_t flags) { if (flags & TDF_RAW) @@ -1811,7 +1812,7 @@ dump_gimple_omp_sections (pretty_printer *buffer, gomp_sections *gs, pretty_printer BUFFER. */ static void -dump_gimple_omp_block (pretty_printer *buffer, gimple *gs, int spc, +dump_gimple_omp_block (pretty_printer *buffer, const gimple *gs, int spc, dump_flags_t flags) { if (flags & TDF_RAW) @@ -1848,7 +1849,7 @@ dump_gimple_omp_block (pretty_printer *buffer, gimple *gs, int spc, /* Dump a GIMPLE_OMP_CRITICAL tuple on the pretty_printer BUFFER. */ static void -dump_gimple_omp_critical (pretty_printer *buffer, gomp_critical *gs, +dump_gimple_omp_critical (pretty_printer *buffer, const gomp_critical *gs, int spc, dump_flags_t flags) { if (flags & TDF_RAW) @@ -1880,7 +1881,7 @@ dump_gimple_omp_critical (pretty_printer *buffer, gomp_critical *gs, /* Dump a GIMPLE_OMP_ORDERED tuple on the pretty_printer BUFFER. */ static void -dump_gimple_omp_ordered (pretty_printer *buffer, gomp_ordered *gs, +dump_gimple_omp_ordered (pretty_printer *buffer, const gomp_ordered *gs, int spc, dump_flags_t flags) { if (flags & TDF_RAW) @@ -1905,7 +1906,7 @@ dump_gimple_omp_ordered (pretty_printer *buffer, gomp_ordered *gs, /* Dump a GIMPLE_OMP_SCAN tuple on the pretty_printer BUFFER. */ static void -dump_gimple_omp_scan (pretty_printer *buffer, gomp_scan *gs, +dump_gimple_omp_scan (pretty_printer *buffer, const gomp_scan *gs, int spc, dump_flags_t flags) { if (flags & TDF_RAW) @@ -1933,7 +1934,7 @@ dump_gimple_omp_scan (pretty_printer *buffer, gomp_scan *gs, /* Dump a GIMPLE_OMP_RETURN tuple on the pretty_printer BUFFER. */ static void -dump_gimple_omp_return (pretty_printer *buffer, gimple *gs, int spc, +dump_gimple_omp_return (pretty_printer *buffer, const gimple *gs, int spc, dump_flags_t flags) { if (flags & TDF_RAW) @@ -1964,7 +1965,7 @@ dump_gimple_omp_return (pretty_printer *buffer, gimple *gs, int spc, /* Dump a GIMPLE_TRANSACTION tuple on the pretty_printer BUFFER. */ static void -dump_gimple_transaction (pretty_printer *buffer, gtransaction *gs, +dump_gimple_transaction (pretty_printer *buffer, const gtransaction *gs, int spc, dump_flags_t flags) { unsigned subcode = gimple_transaction_subcode (gs); @@ -2066,7 +2067,8 @@ dump_gimple_transaction (pretty_printer *buffer, gtransaction *gs, dumpfile.h). */ static void -dump_gimple_asm (pretty_printer *buffer, gasm *gs, int spc, dump_flags_t flags) +dump_gimple_asm (pretty_printer *buffer, const gasm *gs, int spc, + dump_flags_t flags) { unsigned int i, n, f, fields; @@ -2285,7 +2287,7 @@ dump_ssaname_info_to_file (FILE *file, tree node, int spc) pretty printer. If COMMENT is true, print this after #. */ static void -dump_gimple_phi (pretty_printer *buffer, gphi *phi, int spc, bool comment, +dump_gimple_phi (pretty_printer *buffer, const gphi *phi, int spc, bool comment, dump_flags_t flags) { size_t i; @@ -2342,7 +2344,7 @@ dump_gimple_phi (pretty_printer *buffer, gphi *phi, int spc, bool comment, dumpfile.h). */ static void -dump_gimple_omp_parallel (pretty_printer *buffer, gomp_parallel *gs, +dump_gimple_omp_parallel (pretty_printer *buffer, const gomp_parallel *gs, int spc, dump_flags_t flags) { if (flags & TDF_RAW) @@ -2396,7 +2398,7 @@ dump_gimple_omp_parallel (pretty_printer *buffer, gomp_parallel *gs, dumpfile.h). */ static void -dump_gimple_omp_task (pretty_printer *buffer, gomp_task *gs, int spc, +dump_gimple_omp_task (pretty_printer *buffer, const gomp_task *gs, int spc, dump_flags_t flags) { if (flags & TDF_RAW) @@ -2458,7 +2460,7 @@ dump_gimple_omp_task (pretty_printer *buffer, gomp_task *gs, int spc, in dumpfile.h). */ static void -dump_gimple_omp_atomic_load (pretty_printer *buffer, gomp_atomic_load *gs, +dump_gimple_omp_atomic_load (pretty_printer *buffer, const gomp_atomic_load *gs, int spc, dump_flags_t flags) { if (flags & TDF_RAW) @@ -2492,7 +2494,7 @@ dump_gimple_omp_atomic_load (pretty_printer *buffer, gomp_atomic_load *gs, static void dump_gimple_omp_atomic_store (pretty_printer *buffer, - gomp_atomic_store *gs, int spc, + const gomp_atomic_store *gs, int spc, dump_flags_t flags) { if (flags & TDF_RAW) @@ -2520,7 +2522,7 @@ dump_gimple_omp_atomic_store (pretty_printer *buffer, FLAGS are as in pp_gimple_stmt_1. */ static void -dump_gimple_mem_ops (pretty_printer *buffer, gimple *gs, int spc, +dump_gimple_mem_ops (pretty_printer *buffer, const gimple *gs, int spc, dump_flags_t flags) { tree vdef = gimple_vdef (gs); @@ -2551,14 +2553,14 @@ dump_gimple_mem_ops (pretty_printer *buffer, gimple *gs, int spc, pp_flush on BUFFER to finalize the pretty printer. */ void -pp_gimple_stmt_1 (pretty_printer *buffer, gimple *gs, int spc, +pp_gimple_stmt_1 (pretty_printer *buffer, const gimple *gs, int spc, dump_flags_t flags) { if (!gs) return; if (flags & TDF_STMTADDR) - pp_printf (buffer, "<&%p> ", (void *) gs); + pp_printf (buffer, "<&%p> ", (const void *) gs); if ((flags & TDF_LINENO) && gimple_has_location (gs)) dump_location (buffer, gimple_location (gs)); @@ -2583,31 +2585,31 @@ pp_gimple_stmt_1 (pretty_printer *buffer, gimple *gs, int spc, switch (gimple_code (gs)) { case GIMPLE_ASM: - dump_gimple_asm (buffer, as_a (gs), spc, flags); + dump_gimple_asm (buffer, as_a (gs), spc, flags); break; case GIMPLE_ASSIGN: - dump_gimple_assign (buffer, as_a (gs), spc, flags); + dump_gimple_assign (buffer, as_a (gs), spc, flags); break; case GIMPLE_BIND: - dump_gimple_bind (buffer, as_a (gs), spc, flags); + dump_gimple_bind (buffer, as_a (gs), spc, flags); break; case GIMPLE_CALL: - dump_gimple_call (buffer, as_a (gs), spc, flags); + dump_gimple_call (buffer, as_a (gs), spc, flags); break; case GIMPLE_COND: - dump_gimple_cond (buffer, as_a (gs), spc, flags); + dump_gimple_cond (buffer, as_a (gs), spc, flags); break; case GIMPLE_LABEL: - dump_gimple_label (buffer, as_a (gs), spc, flags); + dump_gimple_label (buffer, as_a (gs), spc, flags); break; case GIMPLE_GOTO: - dump_gimple_goto (buffer, as_a (gs), spc, flags); + dump_gimple_goto (buffer, as_a (gs), spc, flags); break; case GIMPLE_NOP: @@ -2615,62 +2617,62 @@ pp_gimple_stmt_1 (pretty_printer *buffer, gimple *gs, int spc, break; case GIMPLE_RETURN: - dump_gimple_return (buffer, as_a (gs), spc, flags); + dump_gimple_return (buffer, as_a (gs), spc, flags); break; case GIMPLE_SWITCH: - dump_gimple_switch (buffer, as_a (gs), spc, flags); + dump_gimple_switch (buffer, as_a (gs), spc, flags); break; case GIMPLE_TRY: - dump_gimple_try (buffer, as_a (gs), spc, flags); + dump_gimple_try (buffer, as_a (gs), spc, flags); break; case GIMPLE_PHI: - dump_gimple_phi (buffer, as_a (gs), spc, false, flags); + dump_gimple_phi (buffer, as_a (gs), spc, false, flags); break; case GIMPLE_OMP_PARALLEL: - dump_gimple_omp_parallel (buffer, as_a (gs), spc, + dump_gimple_omp_parallel (buffer, as_a (gs), spc, flags); break; case GIMPLE_OMP_TASK: - dump_gimple_omp_task (buffer, as_a (gs), spc, flags); + dump_gimple_omp_task (buffer, as_a (gs), spc, flags); break; case GIMPLE_OMP_ATOMIC_LOAD: - dump_gimple_omp_atomic_load (buffer, as_a (gs), + dump_gimple_omp_atomic_load (buffer, as_a (gs), spc, flags); break; case GIMPLE_OMP_ATOMIC_STORE: dump_gimple_omp_atomic_store (buffer, - as_a (gs), + as_a (gs), spc, flags); break; case GIMPLE_OMP_FOR: - dump_gimple_omp_for (buffer, as_a (gs), spc, flags); + dump_gimple_omp_for (buffer, as_a (gs), spc, flags); break; case GIMPLE_OMP_CONTINUE: - dump_gimple_omp_continue (buffer, as_a (gs), spc, + dump_gimple_omp_continue (buffer, as_a (gs), spc, flags); break; case GIMPLE_OMP_SINGLE: - dump_gimple_omp_single (buffer, as_a (gs), spc, + dump_gimple_omp_single (buffer, as_a (gs), spc, flags); break; case GIMPLE_OMP_TARGET: - dump_gimple_omp_target (buffer, as_a (gs), spc, + dump_gimple_omp_target (buffer, as_a (gs), spc, flags); break; case GIMPLE_OMP_TEAMS: - dump_gimple_omp_teams (buffer, as_a (gs), spc, + dump_gimple_omp_teams (buffer, as_a (gs), spc, flags); break; @@ -2679,7 +2681,7 @@ pp_gimple_stmt_1 (pretty_printer *buffer, gimple *gs, int spc, break; case GIMPLE_OMP_SECTIONS: - dump_gimple_omp_sections (buffer, as_a (gs), + dump_gimple_omp_sections (buffer, as_a (gs), spc, flags); break; @@ -2698,49 +2700,50 @@ pp_gimple_stmt_1 (pretty_printer *buffer, gimple *gs, int spc, break; case GIMPLE_OMP_ORDERED: - dump_gimple_omp_ordered (buffer, as_a (gs), spc, + dump_gimple_omp_ordered (buffer, as_a (gs), spc, flags); break; case GIMPLE_OMP_SCAN: - dump_gimple_omp_scan (buffer, as_a (gs), spc, + dump_gimple_omp_scan (buffer, as_a (gs), spc, flags); break; case GIMPLE_OMP_CRITICAL: - dump_gimple_omp_critical (buffer, as_a (gs), spc, + dump_gimple_omp_critical (buffer, as_a (gs), spc, flags); break; case GIMPLE_CATCH: - dump_gimple_catch (buffer, as_a (gs), spc, flags); + dump_gimple_catch (buffer, as_a (gs), spc, flags); break; case GIMPLE_EH_FILTER: - dump_gimple_eh_filter (buffer, as_a (gs), spc, flags); + dump_gimple_eh_filter (buffer, as_a (gs), spc, + flags); break; case GIMPLE_EH_MUST_NOT_THROW: dump_gimple_eh_must_not_throw (buffer, - as_a (gs), + as_a (gs), spc, flags); break; case GIMPLE_EH_ELSE: - dump_gimple_eh_else (buffer, as_a (gs), spc, flags); + dump_gimple_eh_else (buffer, as_a (gs), spc, flags); break; case GIMPLE_RESX: - dump_gimple_resx (buffer, as_a (gs), spc, flags); + dump_gimple_resx (buffer, as_a (gs), spc, flags); break; case GIMPLE_EH_DISPATCH: - dump_gimple_eh_dispatch (buffer, as_a (gs), spc, + dump_gimple_eh_dispatch (buffer, as_a (gs), spc, flags); break; case GIMPLE_DEBUG: - dump_gimple_debug (buffer, as_a (gs), spc, flags); + dump_gimple_debug (buffer, as_a (gs), spc, flags); break; case GIMPLE_PREDICT: @@ -2754,7 +2757,7 @@ pp_gimple_stmt_1 (pretty_printer *buffer, gimple *gs, int spc, break; case GIMPLE_TRANSACTION: - dump_gimple_transaction (buffer, as_a (gs), spc, + dump_gimple_transaction (buffer, as_a (gs), spc, flags); break; diff --git a/gcc/gimple-pretty-print.h b/gcc/gimple-pretty-print.h index 8d8e105d5ade..186f2cfc9fc7 100644 --- a/gcc/gimple-pretty-print.h +++ b/gcc/gimple-pretty-print.h @@ -31,7 +31,8 @@ extern void print_gimple_stmt (FILE *, gimple *, int, dump_flags_t = TDF_NONE); extern void debug (gimple &ref); extern void debug (gimple *ptr); extern void print_gimple_expr (FILE *, gimple *, int, dump_flags_t = TDF_NONE); -extern void pp_gimple_stmt_1 (pretty_printer *, gimple *, int, dump_flags_t); +extern void pp_gimple_stmt_1 (pretty_printer *, const gimple *, int, + dump_flags_t); extern void gimple_dump_bb (FILE *, basic_block, int, dump_flags_t); extern void gimple_dump_bb_for_graph (pretty_printer *, basic_block); extern void dump_ssaname_info_to_file (FILE *, tree, int); diff --git a/gcc/gimple.h b/gcc/gimple.h index 5a190b1714dc..cc6bbd603a10 100644 --- a/gcc/gimple.h +++ b/gcc/gimple.h @@ -1015,6 +1015,14 @@ is_a_helper ::test (gimple *gs) return gs->code == GIMPLE_DEBUG; } +template <> +template <> +inline bool +is_a_helper ::test (const gimple *gs) +{ + return gs->code == GIMPLE_DEBUG; +} + template <> template <> inline bool @@ -1023,6 +1031,14 @@ is_a_helper ::test (gimple *gs) return gs->code == GIMPLE_GOTO; } +template <> +template <> +inline bool +is_a_helper ::test (const gimple *gs) +{ + return gs->code == GIMPLE_GOTO; +} + template <> template <> inline bool @@ -1031,6 +1047,14 @@ is_a_helper ::test (gimple *gs) return gs->code == GIMPLE_LABEL; } +template <> +template <> +inline bool +is_a_helper ::test (const gimple *gs) +{ + return gs->code == GIMPLE_LABEL; +} + template <> template <> inline bool @@ -1055,6 +1079,14 @@ is_a_helper ::test (gimple *gs) return gs->code == GIMPLE_EH_ELSE; } +template <> +template <> +inline bool +is_a_helper ::test (const gimple *gs) +{ + return gs->code == GIMPLE_EH_ELSE; +} + template <> template <> inline bool @@ -1071,6 +1103,14 @@ is_a_helper ::test (gimple *gs) return gs->code == GIMPLE_EH_MUST_NOT_THROW; } +template <> +template <> +inline bool +is_a_helper ::test (const gimple *gs) +{ + return gs->code == GIMPLE_EH_MUST_NOT_THROW; +} + template <> template <> inline bool @@ -1217,6 +1257,14 @@ is_a_helper ::test (gimple *gs) return gs->code == GIMPLE_SWITCH; } +template <> +template <> +inline bool +is_a_helper ::test (const gimple *gs) +{ + return gs->code == GIMPLE_SWITCH; +} + template <> template <> inline bool @@ -1233,6 +1281,14 @@ is_a_helper ::test (gimple *gs) return gs->code == GIMPLE_TRY; } +template <> +template <> +inline bool +is_a_helper ::test (const gimple *gs) +{ + return gs->code == GIMPLE_TRY; +} + template <> template <> inline bool @@ -1427,6 +1483,14 @@ is_a_helper ::test (const gimple *gs) return gs->code == GIMPLE_PHI; } +template <> +template <> +inline bool +is_a_helper ::test (const gimple *gs) +{ + return gs->code == GIMPLE_RETURN; +} + template <> template <> inline bool @@ -3255,7 +3319,7 @@ gimple_call_set_tail (gcall *s, bool tail_p) /* Return true if GIMPLE_CALL S is marked as a tail call. */ static inline bool -gimple_call_tail_p (gcall *s) +gimple_call_tail_p (const gcall *s) { return (s->subcode & GF_CALL_TAILCALL) != 0; } @@ -3297,7 +3361,7 @@ gimple_call_set_return_slot_opt (gcall *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 (gcall *s) +gimple_call_return_slot_opt_p (const gcall *s) { return (s->subcode & GF_CALL_RETURN_SLOT_OPT) != 0; } @@ -3342,7 +3406,7 @@ gimple_call_set_va_arg_pack (gcall *s, bool pass_arg_pack_p) argument pack in its argument list. */ static inline bool -gimple_call_va_arg_pack_p (gcall *s) +gimple_call_va_arg_pack_p (const gcall *s) { return (s->subcode & GF_CALL_VA_ARG_PACK) != 0; } @@ -3444,6 +3508,13 @@ gimple_call_use_set (gcall *call_stmt) return &call_stmt->call_used; } +/* As above, but const. */ + +static inline const pt_solution * +gimple_call_use_set (const gcall *call_stmt) +{ + return &call_stmt->call_used; +} /* Return a pointer to the points-to solution for the set of call-used variables of the call CALL_STMT. */ @@ -3454,16 +3525,24 @@ gimple_call_clobber_set (gcall *call_stmt) return &call_stmt->call_clobbered; } +/* As above, but const. */ + +static inline const pt_solution * +gimple_call_clobber_set (const gcall *call_stmt) +{ + return &call_stmt->call_clobbered; +} + /* Returns true if this is a GIMPLE_ASSIGN or a GIMPLE_CALL with a non-NULL lhs. */ static inline bool -gimple_has_lhs (gimple *stmt) +gimple_has_lhs (const gimple *stmt) { if (is_gimple_assign (stmt)) return true; - if (gcall *call = dyn_cast (stmt)) + if (const gcall *call = dyn_cast (stmt)) return gimple_call_lhs (call) != NULL_TREE; return false; } @@ -3761,9 +3840,9 @@ gimple_bind_body_ptr (gbind *bind_stmt) /* Return the GIMPLE sequence contained in the GIMPLE_BIND statement GS. */ static inline gimple_seq -gimple_bind_body (gbind *gs) +gimple_bind_body (const gbind *gs) { - return *gimple_bind_body_ptr (gs); + return *gimple_bind_body_ptr (const_cast (gs)); } @@ -4035,9 +4114,9 @@ gimple_catch_handler_ptr (gcatch *catch_stmt) GIMPLE_CATCH statement CATCH_STMT. */ static inline gimple_seq -gimple_catch_handler (gcatch *catch_stmt) +gimple_catch_handler (const gcatch *catch_stmt) { - return *gimple_catch_handler_ptr (catch_stmt); + return *gimple_catch_handler_ptr (const_cast (catch_stmt)); } @@ -4095,9 +4174,9 @@ gimple_eh_filter_failure_ptr (gimple *gs) statement fails. */ static inline gimple_seq -gimple_eh_filter_failure (gimple *gs) +gimple_eh_filter_failure (const gimple *gs) { - return *gimple_eh_filter_failure_ptr (gs); + return *gimple_eh_filter_failure_ptr (const_cast (gs)); } @@ -4124,7 +4203,7 @@ gimple_eh_filter_set_failure (geh_filter *eh_filter_stmt, /* Get the function decl to be called by the MUST_NOT_THROW region. */ static inline tree -gimple_eh_must_not_throw_fndecl (geh_mnt *eh_mnt_stmt) +gimple_eh_must_not_throw_fndecl (const geh_mnt *eh_mnt_stmt) { return eh_mnt_stmt->fndecl; } @@ -4147,9 +4226,9 @@ gimple_eh_else_n_body_ptr (geh_else *eh_else_stmt) } static inline gimple_seq -gimple_eh_else_n_body (geh_else *eh_else_stmt) +gimple_eh_else_n_body (const geh_else *eh_else_stmt) { - return *gimple_eh_else_n_body_ptr (eh_else_stmt); + return *gimple_eh_else_n_body_ptr (const_cast (eh_else_stmt)); } static inline gimple_seq * @@ -4159,9 +4238,9 @@ gimple_eh_else_e_body_ptr (geh_else *eh_else_stmt) } static inline gimple_seq -gimple_eh_else_e_body (geh_else *eh_else_stmt) +gimple_eh_else_e_body (const geh_else *eh_else_stmt) { - return *gimple_eh_else_e_body_ptr (eh_else_stmt); + return *gimple_eh_else_e_body_ptr (const_cast (eh_else_stmt)); } static inline void @@ -4225,9 +4304,9 @@ gimple_try_eval_ptr (gimple *gs) /* Return the sequence of statements used as the body for GIMPLE_TRY GS. */ static inline gimple_seq -gimple_try_eval (gimple *gs) +gimple_try_eval (const gimple *gs) { - return *gimple_try_eval_ptr (gs); + return *gimple_try_eval_ptr (const_cast (gs)); } @@ -4246,9 +4325,9 @@ gimple_try_cleanup_ptr (gimple *gs) GIMPLE_TRY GS. */ static inline gimple_seq -gimple_try_cleanup (gimple *gs) +gimple_try_cleanup (const gimple *gs) { - return *gimple_try_cleanup_ptr (gs); + return *gimple_try_cleanup_ptr (const_cast (gs)); } @@ -4407,6 +4486,13 @@ gimple_phi_arg (gphi *gs, unsigned index) return &(gs->args[index]); } +static inline const phi_arg_d * +gimple_phi_arg (const gphi *gs, unsigned index) +{ + gcc_gimple_checking_assert (index < gs->nargs); + return &(gs->args[index]); +} + static inline struct phi_arg_d * gimple_phi_arg (gimple *gs, unsigned index) { @@ -4446,7 +4532,7 @@ phi_nodes_ptr (basic_block bb) /* Return the tree operand for argument I of PHI node GS. */ static inline tree -gimple_phi_arg_def (gphi *gs, size_t index) +gimple_phi_arg_def (const gphi *gs, size_t index) { return gimple_phi_arg (gs, index)->def; } @@ -4469,7 +4555,7 @@ gimple_phi_arg_def_ptr (gphi *phi, size_t index) /* Return the edge associated with argument I of phi node PHI. */ static inline edge -gimple_phi_arg_edge (gphi *phi, size_t i) +gimple_phi_arg_edge (const gphi *phi, size_t i) { return EDGE_PRED (gimple_bb (phi), i); } @@ -4477,7 +4563,7 @@ gimple_phi_arg_edge (gphi *phi, size_t i) /* Return the source location of gimple argument I of phi node PHI. */ static inline location_t -gimple_phi_arg_location (gphi *phi, size_t i) +gimple_phi_arg_location (const gphi *phi, size_t i) { return gimple_phi_arg (phi, i)->locus; } @@ -4501,7 +4587,7 @@ gimple_phi_arg_set_location (gphi *phi, size_t i, location_t loc) /* Return TRUE if argument I of phi node PHI has a location record. */ static inline bool -gimple_phi_arg_has_location (gphi *phi, size_t i) +gimple_phi_arg_has_location (const gphi *phi, size_t i) { return gimple_phi_arg_location (phi, i) != UNKNOWN_LOCATION; } @@ -4669,7 +4755,7 @@ gimple_debug_bind_p (const gimple *s) /* Return the variable bound in a GIMPLE_DEBUG bind statement. */ static inline tree -gimple_debug_bind_get_var (gimple *dbg) +gimple_debug_bind_get_var (const gimple *dbg) { GIMPLE_CHECK (dbg, GIMPLE_DEBUG); gcc_gimple_checking_assert (gimple_debug_bind_p (dbg)); @@ -4680,7 +4766,7 @@ gimple_debug_bind_get_var (gimple *dbg) statement. */ static inline tree -gimple_debug_bind_get_value (gimple *dbg) +gimple_debug_bind_get_value (const gimple *dbg) { GIMPLE_CHECK (dbg, GIMPLE_DEBUG); gcc_gimple_checking_assert (gimple_debug_bind_p (dbg)); @@ -4761,7 +4847,7 @@ gimple_debug_source_bind_p (const gimple *s) /* Return the variable bound in a GIMPLE_DEBUG source bind statement. */ static inline tree -gimple_debug_source_bind_get_var (gimple *dbg) +gimple_debug_source_bind_get_var (const gimple *dbg) { GIMPLE_CHECK (dbg, GIMPLE_DEBUG); gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg)); @@ -4772,7 +4858,7 @@ gimple_debug_source_bind_get_var (gimple *dbg) statement. */ static inline tree -gimple_debug_source_bind_get_value (gimple *dbg) +gimple_debug_source_bind_get_value (const gimple *dbg) { GIMPLE_CHECK (dbg, GIMPLE_DEBUG); gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg)); @@ -4873,9 +4959,9 @@ gimple_omp_body_ptr (gimple *gs) /* Return the body for the OMP statement GS. */ static inline gimple_seq -gimple_omp_body (gimple *gs) +gimple_omp_body (const gimple *gs) { - return *gimple_omp_body_ptr (gs); + return *gimple_omp_body_ptr (const_cast (gs)); } /* Set BODY to be the body for the OMP statement GS. */ @@ -5140,9 +5226,9 @@ gimple_omp_for_set_clauses (gimple *gs, tree clauses) /* Get the collapse count of the OMP_FOR statement GS. */ static inline size_t -gimple_omp_for_collapse (gimple *gs) +gimple_omp_for_collapse (const gimple *gs) { - gomp_for *omp_for_stmt = as_a (gs); + const gomp_for *omp_for_stmt = as_a (gs); return omp_for_stmt->collapse; } @@ -5317,9 +5403,9 @@ gimple_omp_for_pre_body_ptr (gimple *gs) statement GS starts. */ static inline gimple_seq -gimple_omp_for_pre_body (gimple *gs) +gimple_omp_for_pre_body (const gimple *gs) { - return *gimple_omp_for_pre_body_ptr (gs); + return *gimple_omp_for_pre_body_ptr (const_cast (gs)); } @@ -6304,7 +6390,7 @@ gimple_transaction_body_ptr (gtransaction *transaction_stmt) /* Return the body for the GIMPLE_TRANSACTION statement TRANSACTION_STMT. */ static inline gimple_seq -gimple_transaction_body (gtransaction *transaction_stmt) +gimple_transaction_body (const gtransaction *transaction_stmt) { return transaction_stmt->body; } diff --git a/gcc/tree-eh.c b/gcc/tree-eh.c index 54502e6f93c6..b996f49096a3 100644 --- a/gcc/tree-eh.c +++ b/gcc/tree-eh.c @@ -139,19 +139,19 @@ remove_stmt_from_eh_lp (gimple *t) statement is not recorded in the region table. */ int -lookup_stmt_eh_lp_fn (struct function *ifun, gimple *t) +lookup_stmt_eh_lp_fn (struct function *ifun, const gimple *t) { if (ifun->eh->throw_stmt_table == NULL) return 0; - int *lp_nr = ifun->eh->throw_stmt_table->get (t); + int *lp_nr = ifun->eh->throw_stmt_table->get (const_cast (t)); return lp_nr ? *lp_nr : 0; } /* Likewise, but always use the current function. */ int -lookup_stmt_eh_lp (gimple *t) +lookup_stmt_eh_lp (const gimple *t) { /* We can get called from initialized data when -fnon-call-exceptions is on; prevent crash. */ diff --git a/gcc/tree-eh.h b/gcc/tree-eh.h index 511bb84aefb0..ca3b521816da 100644 --- a/gcc/tree-eh.h +++ b/gcc/tree-eh.h @@ -27,8 +27,8 @@ extern void using_eh_for_cleanups (void); extern void add_stmt_to_eh_lp (gimple *, int); 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 int lookup_stmt_eh_lp_fn (struct function *, const gimple *); +extern int lookup_stmt_eh_lp (const gimple *); extern bool make_eh_dispatch_edges (geh_dispatch *); extern void make_eh_edges (gimple *); extern edge redirect_eh_edge (edge, basic_block); diff --git a/gcc/tree-ssa-alias.h b/gcc/tree-ssa-alias.h index 6d72c2fcdc27..de853127df6e 100644 --- a/gcc/tree-ssa-alias.h +++ b/gcc/tree-ssa-alias.h @@ -162,7 +162,7 @@ extern void dump_alias_stats (FILE *); /* In tree-ssa-structalias.c */ extern unsigned int compute_may_aliases (void); -extern bool pt_solution_empty_p (struct pt_solution *); +extern bool pt_solution_empty_p (const pt_solution *); extern bool pt_solution_singleton_or_null_p (struct pt_solution *, unsigned *); extern bool pt_solution_includes_global (struct pt_solution *); extern bool pt_solution_includes (struct pt_solution *, const_tree); diff --git a/gcc/tree-ssa-structalias.c b/gcc/tree-ssa-structalias.c index f7a17eb74d3e..bc50a9be6cf0 100644 --- a/gcc/tree-ssa-structalias.c +++ b/gcc/tree-ssa-structalias.c @@ -6804,7 +6804,7 @@ pt_solution_ior_into (struct pt_solution *dest, struct pt_solution *src) /* Return true if the points-to solution *PT is empty. */ bool -pt_solution_empty_p (struct pt_solution *pt) +pt_solution_empty_p (const pt_solution *pt) { if (pt->anything || pt->nonlocal)