From patchwork Fri Jun 28 12:13:35 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Thomas Schwinge X-Patchwork-Id: 1953913 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=baylibre-com.20230601.gappssmtp.com header.i=@baylibre-com.20230601.gappssmtp.com header.a=rsa-sha256 header.s=20230601 header.b=piLDSXfN; 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 4W9Z9f4FGpz20Zy for ; Fri, 28 Jun 2024 22:14:12 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id D47A9382DB25 for ; Fri, 28 Jun 2024 12:14:09 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-wm1-x335.google.com (mail-wm1-x335.google.com [IPv6:2a00:1450:4864:20::335]) by sourceware.org (Postfix) with ESMTPS id 68A4E382FADF for ; Fri, 28 Jun 2024 12:13:46 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 68A4E382FADF Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=baylibre.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=baylibre.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 68A4E382FADF Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2a00:1450:4864:20::335 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1719576829; cv=none; b=jYZu8yix7ioB1AGwkKDwOGDSUzUTqNgfCcMlkNeUQ3RqzSthM39KAvn2EyNoqmhH5GalQyLgqnqzPrBZg1rbYzeQiVQnaVcxs+kd702ZgsT8L52/cgOExVVX8p6Dr+R7yAJ/CLAG/tiC8igTeJFm1KzHSZ+JvB25XMzfrB5Jl6o= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1719576829; c=relaxed/simple; bh=kcyQbo/Skj0J8+ozt1xQWxGptw9zUTbbJZgMl0EJ1LI=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=FBn1kZDfqFn2pAfrBeKZokgAaAfO5AlV9KD8ULM8AXw6C23ni5bQ7r8KtqUqVi2mId7wh+OkKBelWOWxNpRW+nM2XVicKfQz0d4YQSDEP8FuNWVb2BHB1CVaSWee9F81tIYUH/ZXtJFmrC85kP5Jr5Gnw6q7mqe5ma3sYsQMka0= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-wm1-x335.google.com with SMTP id 5b1f17b1804b1-425624255f3so3529555e9.0 for ; Fri, 28 Jun 2024 05:13:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20230601.gappssmtp.com; s=20230601; t=1719576825; x=1720181625; darn=gcc.gnu.org; h=mime-version:message-id:date:user-agent:references:in-reply-to :subject:to:from:from:to:cc:subject:date:message-id:reply-to; bh=GR+nHtPz4U/SKxJZhywVt7D1a/T4woPf7sL3MAUHEWA=; b=piLDSXfNZGbOS5tstdM1zkRSWRlOejTvrZQMeZi7PK9kQeuCHg7KFEhINlk3cRXE5X RkqNbSuVFTh1oMrKDZOAmnZPI5lGx2iXTYFMQMt5oUmhhWFHvVYIylXko/e6XpF6l4QC LEsDpFQWdULy5h4hBEP5E8CfDLAYB9YMcTunIz+TUBQY+dVCvFnFZKoq6SCgKhpv1ylI ZAx1kNZCJAZpy2yoQa58RkY/PLKLAZtFqM599faqn40qdpDttuykLDBNuJg6tSwnV//B 9WLcnS4C5AWVGm5/N/UhcoDvx0NM4X2xV+DjK9BDULTJ4WnWOrqGKryez4wrUb+q9Dkl eSZA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719576825; x=1720181625; h=mime-version:message-id:date:user-agent:references:in-reply-to :subject:to:from:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=GR+nHtPz4U/SKxJZhywVt7D1a/T4woPf7sL3MAUHEWA=; b=coGhplrYwHo8NrBRQfa/o26o7CawGJl5oUriY9WJj568Vd+qow99RlfWKEEml6DDWE SXv+2bubS35Kzp/SlWgtAQthOaE6Sjt8QzSHbGsCMyq5HQ0li1GduQdcu4GUiyWdfVpv p/9kpGmGDR7it282A5wihmP+huCN3HqsGBzhqQMLA8adMRKj3CHUMbUo7GjOiEmzimdH s9JIeAymNbsB1mTv+dKQwStb4h11Js7aWIBEQ1OuED69iZ4tzrUkZerds5xg/JE5g/Zw 53BPzeRIJjKcUvqBvmQevD8CsSV+sHQwdYo4hY3zc/sjz8Co2fPfK48TTh7XhuDgULEb ToDQ== X-Forwarded-Encrypted: i=1; AJvYcCURHYCmpmi/rl7v8W1yNFBEaZmNmcZUGYGH070u5kSu5vMC7KhfFSjLKJ+OSFZ9Yz7hXNU5Fbj9iI0YyO5RQelFZAwbc+aS6w== X-Gm-Message-State: AOJu0YxwNA3y8isVjRffnim4QCfnmeTaoYvGU4JDSDzdxOkELRlPeeQp 4bJVfWfeBNJYEOjLuBlyoce4KwZqxCkShezoBkv+/T8RCYiGw7xjKQ4PNfZHvvQ= X-Google-Smtp-Source: AGHT+IF8kg1iW53edIpuKcTjg4Bpqu98ZQu+RZ8Ep3xVLMcTvbYO4dsmRTEnvi5MCuMdr/xCWFQNqw== X-Received: by 2002:a05:600c:1994:b0:424:ade3:c6b7 with SMTP id 5b1f17b1804b1-4256d4c1b1dmr15077135e9.2.1719576825051; Fri, 28 Jun 2024 05:13:45 -0700 (PDT) Received: from euler.schwinge.ddns.net (p200300c8b733b9005e8fc6f38b6af531.dip0.t-ipconnect.de. [2003:c8:b733:b900:5e8f:c6f3:8b6a:f531]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4256b097b77sm32275255e9.33.2024.06.28.05.13.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 28 Jun 2024 05:13:44 -0700 (PDT) From: Thomas Schwinge To: David Malcolm , gcc-patches@gcc.gnu.org Subject: Rewrite usage comment at the top of 'gcc/passes.def' (was: [PATCH 02/11] Generate pass-instances.def) In-Reply-To: <1374851081-32153-3-git-send-email-dmalcolm@redhat.com> References: <1374851081-32153-1-git-send-email-dmalcolm@redhat.com> <1374851081-32153-3-git-send-email-dmalcolm@redhat.com> User-Agent: Notmuch/0.30+8~g47a4bad (https://notmuchmail.org) Emacs/29.3 (x86_64-pc-linux-gnu) Date: Fri, 28 Jun 2024 14:13:35 +0200 Message-ID: <87jzi9tgcw.fsf@euler.schwinge.ddns.net> MIME-Version: 1.0 X-Spam-Status: No, score=-11.3 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, GIT_PATCH_0, KAM_SHORT, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham 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: , Errors-To: gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org Hi! On 2013-07-26T11:04:32-0400, David Malcolm wrote: > Introduce a new gen-pass-instances.awk script, and use it at build time > to make a pass-instances.def from passes.def. (The script has later been rewritten and extended, but the issue I'm discussing is relevant already in its original version.) > The generated pass-instances.def contains similar content to passes.def, > but the pass instances within it are explicitly numbered, so that e.g. > the third instance of: > > NEXT_PASS (pass_copy_prop) > > becomes: > > NEXT_PASS (pass_copy_prop, 3) > --- a/gcc/passes.c > +++ b/gcc/passes.c > @@ -1315,12 +1315,12 @@ pipeline::pipeline (context *ctxt) > #define POP_INSERT_PASSES() \ > } > > -#define NEXT_PASS(PASS) (p = next_pass_1 (p, &((PASS).pass))) > +#define NEXT_PASS(PASS, NUM) (p = next_pass_1 (p, &((PASS).pass))) > > #define TERMINATE_PASS_LIST() \ > *p = NULL; > > -#include "passes.def" > +#include "pass-instances.def" Given this, the usage comment at the top of 'gcc/passes.def' (see below) no longer is accurate (even if that latter file does continue to use the 'NEXT_PASS' form without 'NUM') -- and, worse, the 'NEXT_PASS' etc. in that usage comment are processed by the 'gcc/gen-pass-instances.awk' script: --- source-gcc/gcc/passes.def 2024-06-24 18:55:15.132561641 +0200 +++ build-gcc/gcc/pass-instances.def 2024-06-24 18:55:27.768562714 +0200 [...] @@ -20,546 +22,578 @@ /* Macros that should be defined when using this file: INSERT_PASSES_AFTER (PASS) PUSH_INSERT_PASSES_WITHIN (PASS) POP_INSERT_PASSES () - NEXT_PASS (PASS) + NEXT_PASS (PASS, 1) TERMINATE_PASS_LIST (PASS) */ [...] (That is, this is 'NEXT_PASS' for the first instance of pass 'PASS'.) That's benign so far, but with another thing that I'll be extending, I'd then run into an error while the script handles this comment block. ;-\ OK to push "Rewrite usage comment at the top of 'gcc/passes.def'", see attached? Grüße Thomas From 072cdf7d9cf86fb2b0553b93365648e153b4376b Mon Sep 17 00:00:00 2001 From: Thomas Schwinge Date: Fri, 28 Jun 2024 14:05:04 +0200 Subject: [PATCH] Rewrite usage comment at the top of 'gcc/passes.def' Since Subversion r201359 (Git commit a167b052dfe9a8509bb23c374ffaeee953df0917) "Introduce gen-pass-instances.awk and pass-instances.def", the usage comment at the top of 'gcc/passes.def' no longer is accurate (even if that latter file does continue to use the 'NEXT_PASS' form without 'NUM') -- and, worse, the 'NEXT_PASS' etc. in that usage comment are processed by the 'gcc/gen-pass-instances.awk' script: --- source-gcc/gcc/passes.def 2024-06-24 18:55:15.132561641 +0200 +++ build-gcc/gcc/pass-instances.def 2024-06-24 18:55:27.768562714 +0200 [...] @@ -20,546 +22,578 @@ /* Macros that should be defined when using this file: INSERT_PASSES_AFTER (PASS) PUSH_INSERT_PASSES_WITHIN (PASS) POP_INSERT_PASSES () - NEXT_PASS (PASS) + NEXT_PASS (PASS, 1) TERMINATE_PASS_LIST (PASS) */ [...] (That is, this is 'NEXT_PASS' for the first instance of pass 'PASS'.) That's benign so far, but with another thing that I'll be extending, I'd then run into an error while the script handles this comment block. ;-\ gcc/ * passes.def: Rewrite usage comment at the top. --- gcc/passes.def | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/gcc/passes.def b/gcc/passes.def index 1f222729d39..3f65fcf71d6 100644 --- a/gcc/passes.def +++ b/gcc/passes.def @@ -17,14 +17,11 @@ You should have received a copy of the GNU General Public License along with GCC; see the file COPYING3. If not see . */ -/* - Macros that should be defined when using this file: - INSERT_PASSES_AFTER (PASS) - PUSH_INSERT_PASSES_WITHIN (PASS) - POP_INSERT_PASSES () - NEXT_PASS (PASS) - TERMINATE_PASS_LIST (PASS) - */ +/* Note that this file is processed by a simple parser: + 'gen-pass-instances.awk', so carefully verify the generated + 'pass-instances.def' if you deviate from the syntax otherwise used in + here. */ + /* All passes needed to lower the function into shape optimizers can operate on. These passes are always run first on the function, but -- 2.34.1