public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Jan Hubicka <hubicka@ucw.cz>
To: Sriraman Tallam <tmsriram@google.com>
Cc: Jan Hubicka <hubicka@ucw.cz>, Diego Novillo <dnovillo@google.com>,
	Jason Merrill <jason@redhat.com>, Jan Hubicka <jh@suse.cz>,
	Xinliang David Li <davidxl@google.com>,
	Mark Mitchell <mark@codesourcery.com>,
	Nathan Sidwell <nathan@codesourcery.com>,
	"H.J. Lu" <hjl.tools@gmail.com>,
	Richard Guenther <richard.guenther@gmail.com>,
	Uros Bizjak <ubizjak@gmail.com>,
	reply@codereview.appspotmail.com,
	GCC Patches <gcc-patches@gcc.gnu.org>
Subject: Re: User directed Function Multiversioning via Function Overloading (issue5752064)
Date: Mon, 29 Oct 2012 13:05:00 -0000	[thread overview]
Message-ID: <20121029125515.GH3200@atrey.karlin.mff.cuni.cz> (raw)
In-Reply-To: <CAAs8Hmw0KBhKp_3qe0gzVi1jw=LVg6GD1cv-++=Kh3OjThwB+A@mail.gmail.com>

> Index: gcc/cgraph.c
> ===================================================================
> --- gcc/cgraph.c	(revision 192623)
> +++ gcc/cgraph.c	(working copy)
> @@ -132,6 +132,74 @@ static GTY(()) struct cgraph_edge *free_edges;
>  /* Did procss_same_body_aliases run?  */
>  bool same_body_aliases_done;
>  
> +/* Map a cgraph_node to cgraph_function_version_info using this htab.
> +   The cgraph_function_version_info has a THIS_NODE field that is the
> +   corresponding cgraph_node..  */
> +htab_t GTY((param_is (struct cgraph_function_version_info *)))
> +  cgraph_fnver_htab = NULL;

I think you want declare the htab static and arrange it to be freed after
cgraph construction, so you don't need to take care of nodes being removed
via the hooks.

OK with this change.

I have few other comments:
> +  /* IFUNC resolvers have to be externally visible.  */
> +  TREE_PUBLIC (decl) = 1;
> +  DECL_UNINLINABLE (decl) = 1;

Why the resolvers can not be inlined?
> +
> +  DECL_EXTERNAL (decl) = 0;
> +  DECL_EXTERNAL (dispatch_decl) = 0;
> +
> +  DECL_CONTEXT (decl) = NULL_TREE;
> +  DECL_INITIAL (decl) = make_node (BLOCK);
> +  DECL_STATIC_CONSTRUCTOR (decl) = 0;
> +  TREE_READONLY (decl) = 0;
> +  DECL_PURE_P (decl) = 0;

I think those can be copied from the functions you are resolving. (well as well
as many attributes and properties)
> +
> +  if (DECL_COMDAT_GROUP (default_decl))
> +    {
> +      DECL_COMDAT (decl) = DECL_COMDAT (default_decl);
> +      make_decl_one_only (decl, DECL_COMDAT_GROUP (default_decl));
> +    }
> +  else if (TREE_PUBLIC (default_decl))
> +    {
> +      /* In this case, each translation unit with a call to this
> +	 versioned function will put out a resolver.  Ensure it
> +	 is comdat to keep just one copy.  */
> +      DECL_COMDAT (decl) = 1;
> +      make_decl_one_only (decl, DECL_ASSEMBLER_NAME (decl));
> +    }
> +  /* Build result decl and add to function_decl. */
> +  t = build_decl (UNKNOWN_LOCATION, RESULT_DECL, NULL_TREE, ptr_type_node);
> +  DECL_ARTIFICIAL (t) = 1;
> +  DECL_IGNORED_P (t) = 1;
> +  DECL_RESULT (decl) = t;
> +
> +  gimplify_function_tree (decl);
> +  push_cfun (DECL_STRUCT_FUNCTION (decl));
> +  gimple_register_cfg_hooks ();
> +  init_empty_tree_cfg_for_function (DECL_STRUCT_FUNCTION (decl));
> +  cfun->curr_properties |=
> +    (PROP_gimple_lcf | PROP_gimple_leh | PROP_cfg | PROP_ssa
> +     | PROP_gimple_any);
> +  cfun->curr_properties = 15;
> +  new_bb = create_empty_bb (ENTRY_BLOCK_PTR);
> +  make_edge (ENTRY_BLOCK_PTR, new_bb, EDGE_FALLTHRU);
> +  make_edge (new_bb, EXIT_BLOCK_PTR, 0);
> +  *empty_bb = new_bb;

You can simplify this by init_lowered_empty_function.

Honza

  reply	other threads:[~2012-10-29 12:55 UTC|newest]

Thread overview: 93+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-03-07  0:47 Sriraman Tallam
2012-03-07 14:05 ` Richard Guenther
2012-03-07 19:08   ` Sriraman Tallam
2012-03-08 21:37     ` Xinliang David Li
2012-03-08 21:00   ` Xinliang David Li
2012-03-09 20:04   ` Sriraman Tallam
2012-04-27  5:09     ` Sriraman Tallam
2012-04-27 13:39       ` H.J. Lu
2012-04-27 14:35         ` Sriraman Tallam
2012-04-27 14:39           ` H.J. Lu
2012-04-27 14:53             ` Sriraman Tallam
2012-04-27 15:36               ` H.J. Lu
2012-04-27 15:45                 ` Sriraman Tallam
2012-05-01 23:51                 ` Sriraman Tallam
2012-05-02  0:09                   ` H.J. Lu
2012-05-02  2:45                     ` Sriraman Tallam
2012-05-02 13:42                       ` H.J. Lu
2012-05-02 15:08                         ` Sriraman Tallam
2012-05-02 16:06                           ` H.J. Lu
2012-05-02 17:44                             ` Sriraman Tallam
2012-05-02 18:04                               ` H.J. Lu
2012-05-07 16:58                                 ` Sriraman Tallam
2012-05-09 19:01                                   ` Sriraman Tallam
2012-05-10 17:55                                     ` H.J. Lu
2012-05-12  2:04                                       ` Sriraman Tallam
2012-05-12 13:38                                         ` H.J. Lu
2012-05-14 18:29                                           ` Sriraman Tallam
2012-05-26  0:07                                             ` H.J. Lu
2012-05-26  0:16                                               ` Sriraman Tallam
2012-05-26  0:27                                                 ` H.J. Lu
2012-05-26  1:54                                                   ` Sriraman Tallam
     [not found]                                                     ` <CAMe9rOowm9K7r1xnRdRjW5Y4Ay+WxgSsBLTgGvq24z=i42AS+g@mail.gmail.com>
     [not found]                                                       ` <CAAs8HmzeQigcLQyfkC02u=6gCTLkjLLa_jYmp+b1HEtpMCrYWw@mail.gmail.com>
2012-05-26  5:06                                                         ` H.J. Lu
2012-05-26 22:35                                                           ` Sriraman Tallam
2012-05-26 23:56                                                             ` H.J. Lu
2012-05-27  0:24                                                               ` Sriraman Tallam
2012-05-27  2:06                                                                 ` H.J. Lu
2012-05-27  2:23                                                                   ` Sriraman Tallam
2012-05-27  2:31                                                                     ` H.J. Lu
2012-05-27 19:02                                                                     ` Ian Lance Taylor
2012-06-04 19:01                                             ` Sriraman Tallam
2012-06-04 21:36                                               ` H.J. Lu
2012-06-04 22:29                                                 ` Sriraman Tallam
2012-06-05 13:56                                                   ` H.J. Lu
2012-06-14 20:35                                               ` Sriraman Tallam
2012-06-20  1:10                                                 ` Sriraman Tallam
2012-07-06  9:14                                                 ` Richard Guenther
2012-07-06 17:38                                                   ` Sriraman Tallam
2012-07-07  6:06                                                 ` Jason Merrill
2012-07-07 18:38                                                   ` Xinliang David Li
2012-07-08 11:21                                                     ` Jason Merrill
2012-07-09 21:27                                                       ` Xinliang David Li
2012-07-10  9:46                                                         ` Jason Merrill
2012-07-10 16:09                                                           ` Xinliang David Li
     [not found]                                                             ` <CAAs8HmxHF38ktt6syjWp-MpjiX+6NcXh7_8Xn6iKnAiF2vRymQ@mail.gmail.com>
2012-07-19 20:40                                                               ` Jason Merrill
2012-07-30 19:16                                                                 ` Sriraman Tallam
2012-08-25  0:34                                                                   ` Sriraman Tallam
2012-09-18 16:29                                                                     ` Sriraman Tallam
2012-10-05 17:07                                                                       ` Xinliang David Li
2012-10-05 17:44                                                                     ` Jason Merrill
2012-10-05 18:14                                                                       ` Jason Merrill
2012-10-05 21:58                                                                       ` Sriraman Tallam
2012-10-05 22:50                                                                         ` Jason Merrill
2012-10-05 23:45                                                                           ` Sriraman Tallam
2012-10-05 18:32                                                                     ` Jason Merrill
2012-10-11  0:13                                                                       ` Sriraman Tallam
2012-10-12 22:41                                                                         ` Sriraman Tallam
2012-10-19 15:23                                                                           ` Diego Novillo
2012-10-20  4:29                                                                             ` Sriraman Tallam
2012-10-23 21:21                                                                               ` Sriraman Tallam
2012-10-26 16:53                                                                                 ` Jan Hubicka
2012-10-28  4:31                                                                                   ` Sriraman Tallam
2012-10-29 13:05                                                                                     ` Jan Hubicka [this message]
2012-10-29 17:56                                                                                       ` Sriraman Tallam
2012-10-30 19:18                                                                                     ` Jason Merrill
2012-10-31  0:58                                                                                       ` Sriraman Tallam
     [not found]                                                                                       ` <CAAs8Hmw09giv-5_v0irhByTjTJV=kD58rCAD2SAz7M8zrwjBOA@mail.gmail.com>
2012-10-31 14:27                                                                                         ` Jason Merrill
2012-11-02  2:53                                                                                           ` Sriraman Tallam
2012-11-06  2:38                                                                                             ` Sriraman Tallam
2012-11-06 15:52                                                                                               ` Jason Merrill
2012-11-06 18:17                                                                                                 ` Sriraman Tallam
2012-11-10  1:33                                                                                                 ` Sriraman Tallam
2012-11-12  5:04                                                                                                   ` Jason Merrill
2012-11-13  1:11                                                                                                     ` Sriraman Tallam
2012-11-13  2:39                                                                                                       ` Jason Merrill
2012-11-13 21:57                                                                                                         ` Sriraman Tallam
2012-11-17 22:23                                                                                                           ` H.J. Lu
2012-11-06 22:15                                                                                               ` Gerald Pfeifer
2012-10-26 14:11                                                                               ` Diego Novillo
2012-10-26 16:54 Xinliang David Li
2012-10-26 17:28 ` Sriraman Tallam
2012-11-06 22:17 Dominique Dhumieres
2012-11-07  1:16 ` Gerald Pfeifer
2012-11-07  8:53   ` Dominique Dhumieres

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=20121029125515.GH3200@atrey.karlin.mff.cuni.cz \
    --to=hubicka@ucw.cz \
    --cc=davidxl@google.com \
    --cc=dnovillo@google.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=hjl.tools@gmail.com \
    --cc=jason@redhat.com \
    --cc=jh@suse.cz \
    --cc=mark@codesourcery.com \
    --cc=nathan@codesourcery.com \
    --cc=reply@codereview.appspotmail.com \
    --cc=richard.guenther@gmail.com \
    --cc=tmsriram@google.com \
    --cc=ubizjak@gmail.com \
    /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).