From patchwork Fri Aug 16 17:57:43 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jakub Jelinek X-Patchwork-Id: 1973347 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=UJrZ3RaC; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=2620:52:3:1:0:246e:9693:128c; helo=server2.sourceware.org; envelope-from=gcc-patches-bounces~incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=patchwork.ozlabs.org) Received: from server2.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 ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4WlqV12pyCz1yfB for ; Sat, 17 Aug 2024 03:58:14 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id AB1E23858C5F for ; Fri, 16 Aug 2024 17:58:10 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by sourceware.org (Postfix) with ESMTP id 5F3543858D39 for ; Fri, 16 Aug 2024 17:57:51 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 5F3543858D39 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=redhat.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 5F3543858D39 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=170.10.133.124 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1723831073; cv=none; b=w+jJRqhXR9CwofCN52qDBQb6elJOnpsH1td+Jl3QSgL1o3keqnv9ASRHVPZ3ZJ+WwPOiWcTK6fn0U5hRZUmoZYoh9z9eSXPqU65L8tQ+/X/byz/6LjjToajnA8ByvzF7jzPSDM9wwE1n8PSXpkldok1NTGK5et3WsbRfs9XJk/Q= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1723831073; c=relaxed/simple; bh=zcVMFJZD4ism1y0GVcr0Hys1uwCCmAJqMPNXhFHQ0+s=; h=DKIM-Signature:Date:From:To:Subject:Message-ID:MIME-Version; b=oxZU3fEwqEcPzhzLy0AiDgdToyc5RL8yUS32FXC2Jqomxj/eHGfqqMK9b+3lIBNtLHK2VCtnZamYQse3ViKvzScZCa7wCVKo3SKHYuWe2o+8w4qJoDLZbpMFs0hZW9olXQuqQ2OaZvxQVKghR4TEOnnfpPSHxq26LtCwunmwhyg= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1723831071; h=from:from:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type; bh=ZfstDXCzGarTzkNIvOUqPHEhM7Y6tkEdYcZSkjaX1U8=; b=UJrZ3RaCho8D3Py4/8Fx/7hZYTObdqDCqF2CIvhGlT0mB3nPQLG5aTopVyJt7+7J7xg7ar i+wYC989b0nMwZ7lWnnWuLegM4AhaplrIVSJ0tD0c/FXRs/2qVuPqh2VDPJ9r9p8Foh1tt bsWg4mLgzaMG2IepXJUldhtlUcYRki0= Received: from mx-prod-mc-03.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-594-LVnm-HRkNDO4O6c8hxaS_A-1; Fri, 16 Aug 2024 13:57:49 -0400 X-MC-Unique: LVnm-HRkNDO4O6c8hxaS_A-1 Received: from mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.12]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id D645B1955D58 for ; Fri, 16 Aug 2024 17:57:47 +0000 (UTC) Received: from tucnak.zalov.cz (unknown [10.45.224.45]) by mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id D498D1955F38; Fri, 16 Aug 2024 17:57:46 +0000 (UTC) Received: from tucnak.zalov.cz (localhost [127.0.0.1]) by tucnak.zalov.cz (8.17.1/8.17.1) with ESMTPS id 47GHvhgF011903 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT); Fri, 16 Aug 2024 19:57:43 +0200 Received: (from jakub@localhost) by tucnak.zalov.cz (8.17.1/8.17.1/Submit) id 47GHvhKJ011902; Fri, 16 Aug 2024 19:57:43 +0200 Date: Fri, 16 Aug 2024 19:57:43 +0200 From: Jakub Jelinek To: "Joseph S. Myers" , Jason Merrill Cc: gcc-patches@gcc.gnu.org Subject: [PATCH] libcpp: Adjust lang_defaults Message-ID: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.0 on 10.30.177.12 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Disposition: inline X-Spam-Status: No, score=-0.5 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H4, RCVD_IN_MSPIKE_WL, SCC_10_SHORT_WORD_LINES, SCC_20_SHORT_WORD_LINES, SCC_35_SHORT_WORD_LINES, SCC_5_SHORT_WORD_LINES, SPF_HELO_NONE, SPF_NONE, TXREP, T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: Jakub Jelinek Errors-To: gcc-patches-bounces~incoming=patchwork.ozlabs.org@gcc.gnu.org Hi! Here it is in patch form, at the same time I've turned it into bit-fields. On x86_64-linux, this reduced .rodata by 532 bytes (so 5.75x reduction of the variable) and grew the cpp_set_lang function by 26 bytes (8.4% growth). So far smoke tested, ok for trunk if it passes full bootstrap/regtest? Jakub --- libcpp/init.cc.jj 2024-08-15 12:03:35.880901322 +0200 +++ libcpp/init.cc 2024-08-16 19:37:31.564755070 +0200 @@ -77,61 +77,67 @@ END requires. */ struct lang_flags { - char c99; - char cplusplus; - char extended_numbers; - char extended_identifiers; - char c11_identifiers; - char xid_identifiers; - char std; - char digraphs; - char uliterals; - char rliterals; - char user_literals; - char binary_constants; - char digit_separators; - char trigraphs; - char utf8_char_literals; - char va_opt; - char scope; - char dfp_constants; - char size_t_literals; - char elifdef; - char warning_directive; - char delimited_escape_seqs; - char true_false; + unsigned int c99 : 1; + unsigned int cplusplus : 1; + unsigned int extended_numbers : 1; + unsigned int extended_identifiers : 1; + unsigned int c11_identifiers : 1; + unsigned int xid_identifiers : 1; + unsigned int std : 1; + unsigned int digraphs : 1; + unsigned int uliterals : 1; + unsigned int rliterals : 1; + unsigned int user_literals : 1; + unsigned int binary_constants : 1; + unsigned int digit_separators : 1; + unsigned int trigraphs : 1; + unsigned int utf8_char_literals : 1; + unsigned int va_opt : 1; + unsigned int scope : 1; + unsigned int dfp_constants : 1; + unsigned int size_t_literals : 1; + unsigned int elifdef : 1; + unsigned int warning_directive : 1; + unsigned int delimited_escape_seqs : 1; + unsigned int true_false : 1; }; -static const struct lang_flags lang_defaults[] = -{ /* c99 c++ xnum xid c11 xidid std digr ulit rlit udlit bincst digsep trig u8chlit vaopt scope dfp szlit elifdef warndir delim trufal */ - /* GNUC89 */ { 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0 }, - /* GNUC99 */ { 1, 0, 1, 1, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0 }, - /* GNUC11 */ { 1, 0, 1, 1, 1, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0 }, - /* GNUC17 */ { 1, 0, 1, 1, 1, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0 }, - /* GNUC23 */ { 1, 0, 1, 1, 1, 1, 0, 1, 1, 1, 0, 1, 1, 0, 1, 1, 1, 1, 0, 1, 1, 0, 1 }, - /* GNUC2Y */ { 1, 0, 1, 1, 1, 1, 0, 1, 1, 1, 0, 1, 1, 0, 1, 1, 1, 1, 0, 1, 1, 0, 1 }, - /* STDC89 */ { 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, - /* STDC94 */ { 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, - /* STDC99 */ { 1, 0, 1, 1, 0, 0, 1, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, - /* STDC11 */ { 1, 0, 1, 1, 1, 0, 1, 1, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0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 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 0, 0, 0, 0, 0, 1 }, - /* GNUCXX23 */ { 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 0, 1, 1, 1, 1, 1 }, - /* CXX23 */ { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 0, 1, 1, 1, 1, 1 }, - /* GNUCXX26 */ { 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 0, 1, 1, 1, 1, 1 }, - /* CXX26 */ { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 0, 1, 1, 1, 1, 1 }, - /* ASM */ { 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } +static const struct lang_flags lang_defaults[] = { + /* u e w + b d 8 l a t + x u i i c v s s i r d r + x i d u r d n g t h a c z f n e u + c c n x c d s i l l l c s r l o o d l d d l f + 9 + u i 1 i t g i i i s e i i p p f i e i i a + 9 + m d 1 d d r t t t t p g t t e p t f r m l */ + /* GNUC89 */ { 0,0,1,0,0,0,0,1,0,0,0,0,0,0,0,1,1,0,0,0,0,0,0 }, + /* GNUC99 */ { 1,0,1,1,0,0,0,1,1,1,0,0,0,0,0,1,1,0,0,0,0,0,0 }, + /* GNUC11 */ { 1,0,1,1,1,0,0,1,1,1,0,0,0,0,0,1,1,0,0,0,0,0,0 }, + /* GNUC17 */ { 1,0,1,1,1,0,0,1,1,1,0,0,0,0,0,1,1,0,0,0,0,0,0 }, + /* GNUC23 */ { 1,0,1,1,1,1,0,1,1,1,0,1,1,0,1,1,1,1,0,1,1,0,1 }, + /* GNUC2Y */ { 1,0,1,1,1,1,0,1,1,1,0,1,1,0,1,1,1,1,0,1,1,0,1 }, + /* STDC89 */ { 0,0,0,0,0,0,1,0,0,0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1,1,1,0,1,1,1,1,1,1,0,1,1,1,0,1,1,1,1,1 }, + /* CXX23 */ { 1,1,1,1,1,1,1,1,1,1,1,1,1,0,1,1,1,0,1,1,1,1,1 }, + /* GNUCXX26 */ { 1,1,1,1,1,1,0,1,1,1,1,1,1,0,1,1,1,0,1,1,1,1,1 }, + /* CXX26 */ { 1,1,1,1,1,1,1,1,1,1,1,1,1,0,1,1,1,0,1,1,1,1,1 }, + /* ASM */ { 0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 } }; /* Sets internal flags correctly for a given language. */