From patchwork Wed Dec 2 19:25:00 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nathan Sidwell X-Patchwork-Id: 1409924 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=2620:52:3:1:0:246e:9693:128c; helo=sourceware.org; envelope-from=gcc-patches-bounces@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=acm.org Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20161025 header.b=u/JHNAJs; dkim-atps=neutral Received: from sourceware.org (server2.sourceware.org [IPv6:2620:52:3:1:0:246e:9693:128c]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4CmTSk6Vk0z9ryj for ; Thu, 3 Dec 2020 06:25:10 +1100 (AEDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id F3839395C03C; Wed, 2 Dec 2020 19:25:07 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-qv1-xf33.google.com (mail-qv1-xf33.google.com [IPv6:2607:f8b0:4864:20::f33]) by sourceware.org (Postfix) with ESMTPS id 8FCB53851C07 for ; Wed, 2 Dec 2020 19:25:03 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 8FCB53851C07 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=acm.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=nathanmsidwell@gmail.com Received: by mail-qv1-xf33.google.com with SMTP id g19so1272688qvy.2 for ; Wed, 02 Dec 2020 11:25:03 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:to:cc:from:subject:message-id:date:user-agent:mime-version :content-language; bh=Dgcb1WpJYmNEsOnqmiQTxpC5qJufGfVwbb/rCWj4fk0=; b=u/JHNAJs11AnklMbB2CoQ7JSNdRgbhAZbq2EMTADZ3hdD/uPHXfpXa+zLctjGREGKa qyOjaY3NNoKYDbkpLPvaem4/aHLJbxPzDxM3PYHBbFf0KEihGazFR1pnNu/LMDwwYdkN K+/lvMfzMZC+/qzWD/QW+bihkTvWMw30zlCdQv14ahY2OGp6A1bVCGUlKzLZbMS8064U 1i2a1ZXT/PQkMdwfvXlrlMBSbkerMqLkreEUj3jIq0orjw18l/CIamcou7XIYOPrAz3C AuisaxHZu0ElaXtCcNIeX7vxoyg8vBC+tcymu/I+VLNl3BT8Y1IcFsXqqnml7cwuc7H/ B3bw== 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=Dgcb1WpJYmNEsOnqmiQTxpC5qJufGfVwbb/rCWj4fk0=; b=W744Ay84VbRx+EoATciXAOLKpbv1sTS0bE6Qrb2LO6Na8XIyXv/hJslqwCgdDQOGEP s+qVzhzi6qmjVJ2aRRXqaBAv8SJtnKUZ7qVWUSBOpF1/Tg1M+Na2Dcjue5E1sXb1m0Ib ZvUUblkB0fVpyHFglgx+FPTFcX7X45szI0WnaVilelFsNZG9VU7vTZqxxwIqG08prSHq +N135QvrDjtlAaUrTQzbl1kWVTe5xxPHbGx19ck8+Lj54IzIh2urvm6re3YCTd7Nog5U rY02aCR/xkDD5ZIdPCNkVsbdytqnMdfNX3d20pSrzxxC08PgcOM/jtH5KdgEEUKcy0ZE hVsA== X-Gm-Message-State: AOAM5338VIhdVqPKH9LuH+iIlLS23xkwswX5VEzS+/cjzsw2P/iiVLEb 3OPD8JtuUES4JjA8y4RYym0= X-Google-Smtp-Source: ABdhPJykjQBSxcGQJd1btbCVHsePAPQMD30jYLke5VExkp5guBkibXdNzta6HbkfBo3biS2ZvcF1xg== X-Received: by 2002:a05:6214:13c3:: with SMTP id cg3mr3999604qvb.42.1606937102971; Wed, 02 Dec 2020 11:25:02 -0800 (PST) Received: from ?IPv6:2620:10d:c0a8:1102:fd8c:7733:5cca:4143? ([2620:10d:c091:480::1:6627]) by smtp.googlemail.com with ESMTPSA id h142sm2825932qke.104.2020.12.02.11.25.01 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 02 Dec 2020 11:25:01 -0800 (PST) To: GCC Patches From: Nathan Sidwell Subject: C++: Module-specific tree flags Message-ID: <76e11bb7-17f8-e678-6ddb-a43aa9c1df94@acm.org> Date: Wed, 2 Dec 2020 14:25:00 -0500 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.5.0 MIME-Version: 1.0 Content-Language: en-US X-Spam-Status: No, score=-11.4 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_EF, FREEMAIL_FORGED_FROMDOMAIN, FREEMAIL_FROM, GIT_PATCH_0, HEADER_FROM_DIFFERENT_DOMAINS, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gcc-patches-bounces@gcc.gnu.org Sender: "Gcc-patches" This is an updated patch for the new tree flags needed for modules. Inspired by Richard's desire for documenting the flags, I realized that three of them could already be merged. So that's done here. Nothing uses these flags yet. gcc/cp/ * cp-tree.h (DECL_MODULE_PURVIEW_P, DECL_MODULE_IMPORT_P) (DECL_MODULE_ENTITY_P): New. (DECL_MODULE_PENDING_SPECIALIZATIONS_P): New. (DECL_MODULE_PENDING_MEMBERS_P): New. (DECL_MODULE_ATTACHMENTS_P): New. (DECL_MODULE_EXPORT_P): New. (struct lang_decl_base): Shrink sel field. Add new module-specific fields. pushing to trunk diff --git i/gcc/cp/cp-tree.h w/gcc/cp/cp-tree.h index d69110f7ab6..3b67e7ae76a 100644 --- i/gcc/cp/cp-tree.h +++ w/gcc/cp/cp-tree.h @@ -488,6 +488,7 @@ extern GTY(()) tree cp_global_trees[CPTI_MAX]; CALL_EXPR_ORDERED_ARGS (in CALL_EXPR, AGGR_INIT_EXPR) DECLTYPE_FOR_REF_CAPTURE (in DECLTYPE_TYPE) CONSTRUCTOR_C99_COMPOUND_LITERAL (in CONSTRUCTOR) + DECL_MODULE_EXPORT_P (in _DECL) OVL_NESTED_P (in OVERLOAD) LAMBDA_EXPR_INSTANTIATED (in LAMBDA_EXPR) Reserved for DECL_MODULE_EXPORT (in DECL_) @@ -1644,6 +1645,46 @@ check_constraint_info (tree t) #define CONSTRAINED_PARM_PROTOTYPE(NODE) \ DECL_INITIAL (TYPE_DECL_CHECK (NODE)) +/* Module defines. */ +// Too many _DECLS: FUNCTION,VAR,TYPE,TEMPLATE,CONCEPT or NAMESPACE +#define DECL_MODULE_CHECK(NODE) (NODE) + +/* In the purview of a module (including header unit). */ +#define DECL_MODULE_PURVIEW_P(N) \ + (DECL_LANG_SPECIFIC (DECL_MODULE_CHECK (N))->u.base.module_purview_p) + +/* True if the live version of the decl was imported. */ +#define DECL_MODULE_IMPORT_P(NODE) \ + (DECL_LANG_SPECIFIC (DECL_MODULE_CHECK (NODE))->u.base.module_import_p) + +/* True if this decl is in the entity hash & array. This means that + some variant was imported, even if DECL_MODULE_IMPORT_P is false. */ +#define DECL_MODULE_ENTITY_P(NODE) \ + (DECL_LANG_SPECIFIC (DECL_MODULE_CHECK (NODE))->u.base.module_entity_p) + +/* True if there are unloaded specializations keyed to this template. */ +#define DECL_MODULE_PENDING_SPECIALIZATIONS_P(NODE) \ + (DECL_LANG_SPECIFIC (TEMPLATE_DECL_CHECK (NODE)) \ + ->u.base.module_pending_p) + +/* True if this class has unloaded members. These should be loaded + before we do member lookups. */ +#define DECL_MODULE_PENDING_MEMBERS_P(NODE) \ + (DECL_LANG_SPECIFIC (TYPE_DECL_CHECK (NODE)) \ + ->u.base.module_pending_p) + +/* DECL that has attached decls for ODR-relatedness. */ +#define DECL_MODULE_ATTACHMENTS_P(NODE) \ + (DECL_LANG_SPECIFIC (TREE_CHECK2(NODE,FUNCTION_DECL,VAR_DECL))\ + ->u.base.module_pending_p) + +/* Whether this is an exported DECL. Held on any decl that can appear + at namespace scope (function, var, type, template, const or + namespace). templates copy from their template_result, consts have + it for unscoped enums. */ +#define DECL_MODULE_EXPORT_P(NODE) TREE_LANG_FLAG_3 (NODE) + + /* The list of local parameters introduced by this requires-expression, in the form of a chain of PARM_DECLs. */ #define REQUIRES_EXPR_PARMS(NODE) \ @@ -2655,15 +2696,15 @@ enum lang_decl_selector /* Flags shared by all forms of DECL_LANG_SPECIFIC. Some of the flags live here only to make lang_decl_min/fn smaller. Do - not make this struct larger than 32 bits; instead, make sel smaller. */ + not make this struct larger than 32 bits. */ struct GTY(()) lang_decl_base { - /* Larger than necessary for faster access. */ - ENUM_BITFIELD(lang_decl_selector) selector : 16; + ENUM_BITFIELD(lang_decl_selector) selector : 3; ENUM_BITFIELD(languages) language : 1; unsigned use_template : 2; unsigned not_really_extern : 1; /* var or fn */ unsigned initialized_in_class : 1; /* var or fn */ + unsigned threadprivate_or_deleted_p : 1; /* var or fn */ /* anticipated_p is no longer used for anticipated_decls (fn, type or template). It is used as DECL_OMP_PRIVATIZED_MEMBER in @@ -2672,11 +2713,22 @@ struct GTY(()) lang_decl_base { unsigned friend_or_tls : 1; /* var, fn, type or template */ unsigned unknown_bound_p : 1; /* var */ unsigned odr_used : 1; /* var or fn */ - unsigned spare : 1; unsigned concept_p : 1; /* applies to vars and functions */ unsigned var_declared_inline_p : 1; /* var */ unsigned dependent_init_p : 1; /* var */ - /* 2 spare bits */ + + /* The following apply to VAR, FUNCTION, TYPE, CONCEPT, TEMPLATE, + NAMESPACE decls. */ + unsigned module_purview_p : 1; /* in module purview (not GMF) */ + unsigned module_import_p : 1; /* from an import */ + unsigned module_entity_p : 1; /* is in the entitity ary & + hash. */ + /* TEMPLATE_DECL has specializations or, + TYPE_DECL has class members yet to load, or + VAR_DECL or FUNCTION_DECL has attached decls. */ + unsigned module_pending_p : 1; + + /* 12 spare bits. */ }; /* True for DECL codes which have template info and access. */