From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 25370 invoked by alias); 7 Jul 2012 18:38:24 -0000 Received: (qmail 25358 invoked by uid 22791); 7 Jul 2012 18:38:23 -0000 X-SWARE-Spam-Status: No, hits=-5.7 required=5.0 tests=AWL,BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,KHOP_RCVD_TRUST,KHOP_THREADED,RCVD_IN_DNSWL_LOW,RCVD_IN_HOSTKARMA_YE,T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from mail-lb0-f175.google.com (HELO mail-lb0-f175.google.com) (209.85.217.175) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Sat, 07 Jul 2012 18:38:10 +0000 Received: by lbol5 with SMTP id l5so2394186lbo.20 for ; Sat, 07 Jul 2012 11:38:09 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:x-system-of-record:x-gm-message-state; bh=MDxPBXQGXKy8cjaZgTHC1gEr3w/bjkq98D2lxNDkPDI=; b=dj5Ldvp79JD56hxMzLIhJkvxklzFWpFeJOQsuvZp2HLEFoUgxvzrvyR0SpgFd8D1A5 fH/l0dkNeNEGQv3zxdh9+uGh6CYiyy3PQWYVRXmS7ARlZAgS/55lCbqkB49MhAaFs2jj 3fro66wPNut4HI/I8QIxj5+9SPzFgra1Ud8en0j0iEWrgKvPCTn6OnNuHSldwI0F42u8 jUPKuFI5nS47PpcfJxL8dveWSs1pRkJ6CpGkkr5Mm5XydHE9fM77yLm9sU9qtTwBFisj +bWRc88s2SpHKq+1rlSbmFd7EAK7fheYU5F5fx7eBpRSiQeOHqfrZSeUKF+yHz43VGlF y+Ow== Received: by 10.152.148.195 with SMTP id tu3mr34564430lab.16.1341686289215; Sat, 07 Jul 2012 11:38:09 -0700 (PDT) MIME-Version: 1.0 Received: by 10.152.148.195 with SMTP id tu3mr34564402lab.16.1341686288956; Sat, 07 Jul 2012 11:38:08 -0700 (PDT) Received: by 10.152.130.102 with HTTP; Sat, 7 Jul 2012 11:38:08 -0700 (PDT) In-Reply-To: <4FF7D1C6.90407@redhat.com> References: <20120307004630.A503DB21B6@azwildcat.mtv.corp.google.com> <4FF7D1C6.90407@redhat.com> Date: Sat, 07 Jul 2012 18:38:00 -0000 Message-ID: Subject: Re: User directed Function Multiversioning via Function Overloading (issue5752064) From: Xinliang David Li To: Jason Merrill Cc: Sriraman Tallam , mark@codesourcery.com, nathan@codesourcery.com, "H.J. Lu" , Richard Guenther , Jan Hubicka , Uros Bizjak , reply@codereview.appspotmail.com, gcc-patches@gcc.gnu.org Content-Type: text/plain; charset=ISO-8859-1 X-System-Of-Record: true X-Gm-Message-State: ALoCoQlaBuUfFsrVsWHRhJB0lxcdNQd1sWSTl3S9JaKiOK8pZwWzLBDoukhmX5Yl3N/7GFBfpj2yqQZboU86tIOa1MfbmsASCScYYE1fJDD5Oa1TRuZbizGH3NO+a5ife8xenJFRqlgNGE139COIO4fHO6Yuu/9ia378TVnpgwm3CUg2Dj65EX/ygAv20oYxikmQhE5HgXNg X-IsSubscribed: yes Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org X-SW-Source: 2012-07/txt/msg00277.txt.bz2 On Fri, Jul 6, 2012 at 11:05 PM, Jason Merrill wrote: > On 06/14/2012 04:13 PM, Sriraman Tallam wrote: >> >> C++ Frontend maintainers, Could you please take a look at the >> front-end part when you find the time? > > > It seems to me that what you have here are target-specific attributes that > affect the signature of a function such that they make two declarations > different that would otherwise declare the same function. Stepping away from > the specific notion of versioning, it seems that these are the questions > that you want the front end to be able to ask about these attributes: > > * Does this attribute affect a function signature? The question becomes if a caller 'bar' with target attribute 'x' can make a call to a function 'foo' with an incompatible target attribute 'y'. If the answer is no, then the target attribute is part of 'foo's signature. I think the answer is yes -- the attribute affects a function signature. > * Do the attributes on these two declarations make them different? yes. > * Do the attributes on these two declarations make one a better match? yes -- and there are rules defined for that. > * Given a call to function X, should I call another function instead? The binding can happen at compile time (given caller/callee attribute) or at the runtime. > * Return a string representation of the attributes on this function that > affect its signature. yes. > > Does this seem like a worthwhile direction to other people, or do you like > better the approach the patch takes, handling versioning directly? There are prior discussions about this. The direct way of handling it is to use __builtin_dispatch, but we concluded that using function overloading is much more user friendly. Note that Intel's icc has a similar feature to the overloading approach implemented by Sri here. thanks, David > > Jason