From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 106779 invoked by alias); 14 Aug 2015 18:25:22 -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 106761 invoked by uid 89); 14 Aug 2015 18:25:22 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.7 required=5.0 tests=AWL,BAYES_00,RP_MATCHES_RCVD,SPF_PASS autolearn=ham version=3.3.2 X-HELO: fencepost.gnu.org Received: from fencepost.gnu.org (HELO fencepost.gnu.org) (208.118.235.10) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-SHA encrypted) ESMTPS; Fri, 14 Aug 2015 18:25:21 +0000 Received: from eggs.gnu.org ([2001:4830:134:3::10]:51010) by fencepost.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1ZQJfL-00016h-0O for gcc-patches@gnu.org; Fri, 14 Aug 2015 14:25:19 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZQJfF-0003jU-LI for gcc-patches@gnu.org; Fri, 14 Aug 2015 14:25:18 -0400 Received: from mx1.redhat.com ([209.132.183.28]:51791) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZQJfF-0003jO-Fr for gcc-patches@gnu.org; Fri, 14 Aug 2015 14:25:13 -0400 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by mx1.redhat.com (Postfix) with ESMTPS id 1AFB98EFDA; Fri, 14 Aug 2015 18:25:13 +0000 (UTC) Received: from localhost.localdomain (ovpn-113-104.phx2.redhat.com [10.3.113.104]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id t7EIPCna018293; Fri, 14 Aug 2015 14:25:12 -0400 Subject: Re: [PATCH 2/2] Get rid of global state accesses in dominance.c To: Richard Biener , Mikhail Maltsev References: <55CD3C87.40101@gmail.com> <55CD3EA1.1050104@gmail.com> Cc: gcc-patches From: Jeff Law Message-ID: <55CE3288.5000806@redhat.com> Date: Fri, 14 Aug 2015 18:28:00 -0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.1.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 209.132.183.28 X-IsSubscribed: yes X-SW-Source: 2015-08/txt/msg00822.txt.bz2 On 08/14/2015 02:02 AM, Richard Biener wrote: > On Fri, Aug 14, 2015 at 3:04 AM, Mikhail Maltsev wrote: >> The second part removes all global state accesses (i.e. accesses to cfun and >> it's members) from dominance.c. This requires to change lots of code, but I hope >> that this is a step in right direction (if my understanding of ongoing >> re-architecture w.r.t. to global state is correct). >> >> For now this second part lacks a changelog entry, but it's very "mechanical". I >> will, of course, write it if the patch gets approved. > > So the last time I did similar refactoring I wondered if we can somehow avoid > the "noise" in non-IPA passes. Ideas I came up with are > > a) Inherit gimple/rtl pass classes from a class which is initialized with the > function the pass operates on and provides methods like > > bool dom_info_available_p (..) { return dom_info_available_p (fn, ...); } > > thus wraps APIs working on a specific function. > > b) Do sth similar but make it work with overloads and clever (no idea what!) > C++ that disables them if this_fn cannot be looked up > > template > bool dom_info_available_p (..., struct function *fn = this_fn); > > all of the above would of course require that passes make all their > implementation > be methods of their pass class. So even more refactoring. > > Note that we do not have any IPA pass which accesses dominators, so the > implicit 'cfun' use was ok. The cases I refactored were those where we had > to push/pop_cfun () in IPA passes (which can be expensive) because it > used APIs with implicit cfun. > > Overall I'm not sure we want all APIs using 'cfun' to be refactored. > It is after > all useless noise to callers if all callers are effectively using 'cfun'. And since the main driver for eliminating global state is David's work on the JIT, perhaps see if any of this helps David in a noticeable way before giving it a yea/nea. Jeff