From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 126826 invoked by alias); 8 Jan 2018 18:02:41 -0000 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 Received: (qmail 126816 invoked by uid 89); 8 Jan 2018 18:02:41 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_PASS,T_RP_MATCHES_RCVD autolearn=ham version=3.3.2 spammy=Hx-languages-length:1932, H*f:sk:c3061ee, H*i:sk:c3061ee 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 ESMTP; Mon, 08 Jan 2018 18:02:40 +0000 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 150DD4E90A; Mon, 8 Jan 2018 18:02:39 +0000 (UTC) Received: from ovpn-116-33.phx2.redhat.com (ovpn-116-33.phx2.redhat.com [10.3.116.33]) by smtp.corp.redhat.com (Postfix) with ESMTP id 5DE065EDE6; Mon, 8 Jan 2018 18:02:38 +0000 (UTC) Message-ID: <1515434557.24844.60.camel@redhat.com> Subject: Re: Location wrappers vs decls that change type (was Re: [v2 of PATCH 03/14] C++: add location_t wrapper nodes during parsing (minimal impl)) From: David Malcolm To: Nathan Sidwell , Jakub Jelinek Cc: Jason Merrill , Richard Biener , gcc-patches List Date: Mon, 08 Jan 2018 18:08:00 -0000 In-Reply-To: References: <1514567206-13093-1-git-send-email-dmalcolm@redhat.com> <1a3db854-830d-516c-61ed-ef503b47b946@redhat.com> <1515190808.24844.23.camel@redhat.com> <1515430963.24844.56.camel@redhat.com> <20180108171451.GU1833@tucnak> Content-Type: text/plain; charset="UTF-8" Mime-Version: 1.0 Content-Transfer-Encoding: 7bit X-IsSubscribed: yes X-SW-Source: 2018-01/txt/msg00522.txt.bz2 On Mon, 2018-01-08 at 12:25 -0500, Nathan Sidwell wrote: > On 01/08/2018 12:14 PM, Jakub Jelinek wrote: > > On Mon, Jan 08, 2018 at 12:10:50PM -0500, Nathan Sidwell wrote: > > > > Both "_S_terminal" VAR_DECLs have a "_CharT" > > > > TEMPLATE_TYPE_PARM, but > > > > these types are different tree nodes. > > > > > > correct. they are not EQ but are EQUAL (same_type_p will be > > > true). > > > > So perhaps location_wrapper_p could use that instead of pointer > > comparison. > > Though it would be expensive. > > If TYPE_STRUCTURAL_COMPARISON_P (or however it's spelt) is true, > it'll > be expensive. Otherwise it's a function call, a couple of > indirections > and a pointer compare. But still more expensive than ... > > > > Add a flag on the VIEW_CONVERT/NON_LVALUE expr explicitly noting > > > its > > > wrapperness (rather than infer it from TREE_TYPE == TREE_TYPE > > > (TREE_OPERAND)). TREE_LANG_FLAG_0 looks available? > > > > Yeah, I think most if not all lang flags are still available for > > those two > > tree codes and checking that should be quite cheap. > > ... a bit test on the node itself. > > location_wrapper_p could contain something like > bool result = TREE_LANG_FLAG_$FOO (t); > gcc_checking_assert (result == same_type_p (TREE_TYPE (t), > TREE_TYPE > (TREE_OPERAND (t, 0))); > return result; > > for the paranoid. > > nathan Thanks Nathan and Jakub: a quick smoketest using TREE_LANG_FLAG_0 worked, and fixes this issue. However, should I be using a TREE_LANG_FLAG for something that's in tree.h/c, rather than just in the "cp" subdir? (the wrapper nodes are only added to C++ in this patch kit, but given that e.g. STRIP_NOPS needs to remove them, the lang-independent code needs to handle them, and ultimately we may want wrapper nodes in other FEs). Dave