public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Richard Biener <rguenther@suse.de>
To: Martin Jambor <mjambor@suse.cz>
Cc: Prathamesh Kulkarni <prathamesh.kulkarni@linaro.org>,
	 GCC Patches <gcc-patches@gcc.gnu.org>
Subject: Re: [PATCH] Introduce build_debug_expr_decl
Date: Tue, 9 Nov 2021 12:02:37 +0100 (CET)	[thread overview]
Message-ID: <p462on8-o317-o0s5-6sq9-17qs6qr16917@fhfr.qr> (raw)
In-Reply-To: <ri61r3p1tpm.fsf@suse.cz>

On Tue, 9 Nov 2021, Martin Jambor wrote:

> Hi,
> 
> On Mon, Nov 08 2021, Prathamesh Kulkarni wrote:
> > On Mon, 8 Nov 2021 at 23:24, Martin Jambor <mjambor@suse.cz> wrote:
> >>
> >> Hi,
> >>
> >> this patch introduces a helper function build_debug_expr_decl to build
> >> DEBUG_EXPR_DECL tree nodes in the most common way and replaces with a
> >> call of this function all code pieces which build such a DECL itself
> >> and sets its mode to the TYPE_MODE of its type.
> >>
> >> There still remain 11 instances of open-coded creation of a
> >> DEBUG_EXPR_DECL which set the mode of the DECL to something else.  It
> >> would probably be a good idea to figure out that has any effect and if
> >> not, convert them to calls of build_debug_expr_decl too.  But this
> >> patch deliberately does not introduce any functional changes.
> >>
> >> Bootstrapped and tested on x86_64-linux, OK for trunk?
> >>
> >> Thanks,
> >>
> >> Martin
> >>
> >>
> >> gcc/ChangeLog:
> >>
> >> 2021-11-08  Martin Jambor  <mjambor@suse.cz>
> >>
> >>         * tree.h (build_debug_expr_decl): Declare.
> >>         * tree.c (build_debug_expr_decl): New function.
> >>         * cfgexpand.c (avoid_deep_ter_for_debug): Use build_debug_expr_decl
> >>         instead of building a DEBUG_EXPR_DECL.
> >>         * ipa-param-manipulation.c
> >>         (ipa_param_body_adjustments::prepare_debug_expressions): Likewise.
> >>         * omp-simd-clone.c (ipa_simd_modify_stmt_ops): Likewise.
> >>         * tree-ssa-ccp.c (optimize_atomic_bit_test_and): Likewise.
> >>         * tree-ssa-phiopt.c (spaceship_replacement): Likewise.
> >>         * tree-ssa-reassoc.c (make_new_ssa_for_def): Likewise.
> [...]
> >> diff --git a/gcc/tree.c b/gcc/tree.c
> >> index 7bfd64160f4..845228a055b 100644
> >> --- a/gcc/tree.c
> >> +++ b/gcc/tree.c
> >> @@ -5280,6 +5280,18 @@ build_decl (location_t loc, enum tree_code code, tree name,
> >>    return t;
> >>  }
> >>
> >> +/* Create and return a DEBUG_EXPR_DECL node of the given TYPE.  */
> >> +
> >> +tree
> >> +build_debug_expr_decl (tree type)
> > Hi, sorry to nitpick, but would it be slightly better to use
> > const_tree type instead ?
> >
> > Thanks,
> > Prathamesh
> >> +{
> >> +  tree vexpr = make_node (DEBUG_EXPR_DECL);
> >> +  DECL_ARTIFICIAL (vexpr) = 1;
> >> +  TREE_TYPE (vexpr) = type;
> 
> I like the idea but the assignment to TREE_TYPE above could not be done
> without discarding the const qualifier somehow.  Do we really want to do
> that?  Do we have some canonical way of doing that?  (I searched only
> for a minute but did not find any.)

Probably not worth the trouble then (adding some form of const_cast).

Richard.

  reply	other threads:[~2021-11-09 11:02 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-08 17:54 Martin Jambor
2021-11-08 18:23 ` Prathamesh Kulkarni
2021-11-09 10:58   ` Martin Jambor
2021-11-09 11:02     ` Richard Biener [this message]
2021-11-09  7:39 ` Richard Biener
2021-11-12 14:39   ` [PATCH] Replace more DEBUG_EXPR_DECL creations with build_debug_expr_decl Martin Jambor
2021-11-12 19:17     ` Richard Biener
2021-11-12 14:37 ` [PATCH] Fortran: Use build_debug_expr_decl to create DEBUG_DECL_EXPRs Martin Jambor

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=p462on8-o317-o0s5-6sq9-17qs6qr16917@fhfr.qr \
    --to=rguenther@suse.de \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=mjambor@suse.cz \
    --cc=prathamesh.kulkarni@linaro.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).