From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-ej1-x62b.google.com (mail-ej1-x62b.google.com [IPv6:2a00:1450:4864:20::62b]) by sourceware.org (Postfix) with ESMTPS id C3BB83858D28 for ; Mon, 7 Aug 2023 10:04:04 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org C3BB83858D28 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-ej1-x62b.google.com with SMTP id a640c23a62f3a-99cdb0fd093so92046166b.1 for ; Mon, 07 Aug 2023 03:04:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1691402643; x=1692007443; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=3BaX7bgfAsDAL0tmg6ZSQzzA3ADZhq/8UrBdxtOAiz0=; b=TsdpwyhJ3x6su9E6X+I5y/9CsuwH1UvnC3hBFxRX6g/ampaVNW8dldoSKdqoPZmh6M Zdecq7P4TtaKh9GhUw3itt8/wuzgVwRtphr43bdM6QMR04YlCJ3q4vAY4ANnsuCx/zJO NeXlb7iutAzuMvoQoj1qkPKS4q+INsmqXFOqmYOhwWDIA8KgtNX++wxNmQhRfqqeVbYo iEQj9J/eeR5TmGHbSkNlPUxq8uRSi7EZf7obaYp+dr4BEVtJJqPJO1CpDGQcajCkHhUa iqHDOxb4BKQGAup1NHKGqG3F3wT8xBt47TlMj51M3+wXe/Gck6YHCMymHhCM0gol36EZ 3ksg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1691402643; x=1692007443; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=3BaX7bgfAsDAL0tmg6ZSQzzA3ADZhq/8UrBdxtOAiz0=; b=RIIlUeqcD9mzMKmDjPt08cMsOwAmoOc0ASE+1YZmQS5PdV/sTxW+ksr31la7yPwrpp 5qsS46Q1kuMZCG476YTNdRhk4680VIXaCtp0YAvvWax5DYDALd365sF0Xf3fELR+nvE3 7kncssVjJGJYzC311I4ErrHIAzSrfAaA1GTOwaupl66TzhNDyYOByevm86J5Xc8bJMGv rHfbVWVa+e4lyQmgVlA3vHYAgF4sLZWwhmJV0vhqfv1oUOVbQXSAC9gmF5nZr2eUNSB6 e8ZjHfjsm21ErI43B/Z9sjoFCsMGccDI7UUd8L0wDShq6bcMN8xFygDo9mNsxxsdePzH JHeA== X-Gm-Message-State: AOJu0YzDQTVHuJSwV2TIaOmMqejlPoo11EcEegdr8EtbOCYF/VMz+ogA 8Fr7gvcHdbalfl60MaN3Bckxzs1usS5SnXfrbkk= X-Google-Smtp-Source: AGHT+IGnfUO2jHzBUG5G3iDTMPrcD9fTEUL4BngcTKiV/PJub6diYnncToKYRTRtsiigWgUe2g7nkg== X-Received: by 2002:a17:906:8a53:b0:991:cd1f:e67a with SMTP id gx19-20020a1709068a5300b00991cd1fe67amr7685514ejc.29.1691402642948; Mon, 07 Aug 2023 03:04:02 -0700 (PDT) Received: from amwld-aturko1.us.drwholdings.com ([149.14.21.6]) by smtp.gmail.com with ESMTPSA id la4-20020a170906ad8400b0099bd682f317sm4881305ejb.206.2023.08.07.03.04.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 07 Aug 2023 03:04:02 -0700 (PDT) From: Andrzej Turko To: gcc-patches@gcc.gnu.org, Richard Biener Cc: Andrzej Turko Subject: [PATCH 0/3 v4] genmatch: Speed up recompilation after changes to match.pd Date: Mon, 7 Aug 2023 11:58:58 +0200 Message-Id: <20230807095901.267099-1-andrzej.turko@gmail.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-6.1 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,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 List-Id: The following reduces the number of object files that need to be rebuilt after match.pd has been modified. Right now a change to match.pd which adds/removes a line almost always forces recompilation of all files that genmatch generates from it. This is because of unnecessary changes to the generated .cc files: 1. Function names and ordering change as does the way the functions are distributed across multiple source files. 2. Code locations from match.pd are quoted directly (including line numbers) by logging fprintf calls. This patch addresses the those issues without changing the behaviour of the generated code. The first one is solved by making sure that minor changes to match.pd do not influence the order in which functions are generated. The second one by using a lookup table with line numbers. Now a change to a single function will trigger a rebuild of 4 object files (one with the function and the one with the lookup table both for gimple and generic) instead all of them (20 by default). For reference, this decreased the rebuild time with 48 threads from 3.5 minutes to 1.5 minutes on my machine. V2: * Placed the change in Makefile.in in the correct commit. * Used a separate logging function to reduce size of the executable. V3: * Fix a bug from 'genmatch: Log line numbers indirectly', which was introduced in V2. V4: * Remove duplicate line numbers in the lookup table. * Do not define dump_log functions if they are not called. Note for reviewers: I do not have write access. Andrzej Turko (3): Support get_or_insert in ordered_hash_map genmatch: Reduce variability of generated code genmatch: Log line numbers indirectly gcc/Makefile.in | 4 +- gcc/genmatch.cc | 98 +++++++++++++++++++++++++++++------ gcc/ordered-hash-map-tests.cc | 19 +++++-- gcc/ordered-hash-map.h | 26 ++++++++++ 4 files changed, 125 insertions(+), 22 deletions(-) -- 2.34.1