From patchwork Tue May 16 15:26:26 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nathan Sidwell X-Patchwork-Id: 763020 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3wS1Wl305hz9s7B for ; Wed, 17 May 2017 01:26:42 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b="Yn1mZknh"; dkim-atps=neutral DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:to:cc :from:subject:message-id:date:mime-version:content-type; q=dns; s=default; b=akJSqNTz7CIn18KKaEOUU+Yg/Ped9Hkf7gNv1AWr4hnhK2m/yL eSpgVsY2qN1FurxODG8DzgOyabe2kW7t3HQOEhq4wqeoaVIgzCWh/EqG0cfgvLrh 2pUjnfDpZajcn+RHtXcL+hba0FAoAh0YJEI8MLPz2O0Qe/vTrdHAb5tgY= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:to:cc :from:subject:message-id:date:mime-version:content-type; s= default; bh=uzU9v7MLODxEezcXDXrgYR6qfLc=; b=Yn1mZknh3AErUE5Z8z8s 5pAlqiPhyHX6skksFmxKtbuzth8t9O8KA6ZIC1I+q1DVbiWDORP3SM958SJo0E/Z CRHI7ARo6QIB+swoAq2NmpB/tTtLtvHqhwPGExlXKT9IlVA2rKm8IanS/lnUk1Nt 8MlsKlqlmLllelB2EOT+pDs= Received: (qmail 98530 invoked by alias); 16 May 2017 15:26:30 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org Received: (qmail 97686 invoked by uid 89); 16 May 2017 15:26:29 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-11.1 required=5.0 tests=BAYES_00, FREEMAIL_FROM, GIT_PATCH_2, GIT_PATCH_3, KAM_ASCII_DIVIDERS, RCVD_IN_DNSWL_NONE, SPF_PASS autolearn=ham version=3.3.2 spammy= X-HELO: mail-yw0-f172.google.com Received: from mail-yw0-f172.google.com (HELO mail-yw0-f172.google.com) (209.85.161.172) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 16 May 2017 15:26:27 +0000 Received: by mail-yw0-f172.google.com with SMTP id 203so54484909ywe.0 for ; Tue, 16 May 2017 08:26:30 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:to:cc:from:subject:message-id:date :user-agent:mime-version:content-language; bh=eWlNKOT4Ukv3wb9UL5NjLILBVRY9mPTLe3/mOcWdwGk=; b=T/fzEMA34denn7Rb2gIzGsPu3z7h2SvbQofDgvrUDYogqSlpVIpqS3XtWbQ1/bSX6w TwlvMjBvD2svED9V5IYJj1ZmLHbZqnZXW8OeOI/eR1eRNhyBkESCYRXkNI3zTEBFKS1F N/enkq07CfeESJEKr1sdr2273639LERN6LRHbhFgf4X5fZ+zrRi7dl+ilkVM0ue2iTSC fcWnIY47pdU7GLSLkoPXvIQV3oGhYW6jAbkxYJt80bh03LmJ+ZaG+OaURSZNvRd2BTAR 0003WJ0t439Ydx9yQN7GLjHLG690Nhr2Hd9SPGywq0oz5FJ3x32zN5qQs4ppijgnyHS9 5AUw== X-Gm-Message-State: AODbwcDiEp//RbOm4xWTYVQtdgfAZTkfM7+D5y5APEefKDFSfgNxkgAh LMF4EEon8ZalNA== X-Received: by 10.129.108.215 with SMTP id h206mr9823538ywc.329.1494948389315; Tue, 16 May 2017 08:26:29 -0700 (PDT) Received: from ?IPv6:2620:10d:c0a3:20fb:f6d0:5ac5:64cd:f102? ([2620:10d:c091:200::7:4a1a]) by smtp.googlemail.com with ESMTPSA id w192sm7430369yww.56.2017.05.16.08.26.28 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 16 May 2017 08:26:28 -0700 (PDT) To: GCC Patches , Richard Biener Cc: =?UTF-8?Q?mliska@suse.cz_>>_Martin_Li=c5=a1ka?= From: Nathan Sidwell Subject: [PATCH] gcc::context creation Message-ID: <7f7f64a5-f820-a19a-d4ea-77b05f746499@acm.org> Date: Tue, 16 May 2017 11:26:26 -0400 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.1.0 MIME-Version: 1.0 This patch breaks apart the creation of the pass manager from gcc::context's ctor. This will allow us to register additional dumps between the dumpfile manager creation and the pass manager. As I described in https://gcc.gnu.org/ml/gcc-patches/2017-05/msg01164.html when I tried to do this for the language-specific dumps, the existing LANG_HOOKS_INIT_OPTIONS ran too late, and I had to create a new hook and call it from gcc::context's constructor to get it done before the passes were created. That's ugly. Calling the hook from toplev seems better. Also, I noticed that we were passing a pointer to the not-yet-fully-constructed context to the pass manager, which smells funny. ok? nathan 2017-05-16 Nathan Sidwell * context.h (context::set_passes): New. * context.c (context::context): Do not create pass manager. * toplev.c (general_init): Create pass manager here. Index: context.c =================================================================== --- context.c (revision 248110) +++ context.c (working copy) @@ -29,14 +29,9 @@ along with GCC; see the file COPYING3. gcc::context *g; gcc::context::context () + : m_passes (NULL), m_dumps (new gcc::dump_manager ()) { have_offload = false; - - /* The pass manager's constructor uses the dump manager (to set up - dumps for the various passes), so the dump manager must be set up - before the pass manager. */ - m_dumps = new gcc::dump_manager (); - m_passes = new gcc::pass_manager (this); } gcc::context::~context () Index: context.h =================================================================== --- context.h (revision 248110) +++ context.h (working copy) @@ -39,6 +39,12 @@ public: /* Pass-management. */ + void set_passes (pass_manager *m) + { + gcc_assert (!m_passes); + m_passes = m; + } + pass_manager *get_passes () { gcc_assert (m_passes); return m_passes; } /* Handling dump files. */ Index: toplev.c =================================================================== --- toplev.c (revision 248110) +++ toplev.c (working copy) @@ -1154,9 +1154,13 @@ general_init (const char *argv0, bool in processing. */ init_ggc_heuristics (); - /* Create the singleton holder for global state. - Doing so also creates the pass manager and with it the passes. */ + /* Create the singleton holder for global state. This creates the + dump manager. */ g = new gcc::context (); + + /* Create the passes. */ + g->set_passes (new gcc::pass_manager (g)); + symtab = new (ggc_cleared_alloc ()) symbol_table (); statistics_early_init ();