From patchwork Fri Dec 9 02:43:48 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Icenowy Zheng X-Patchwork-Id: 31608 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp544750wrr; Thu, 8 Dec 2022 18:44:55 -0800 (PST) X-Google-Smtp-Source: AA0mqf7HsN2AWh9yDfkWmPX4tlRwSZsB4ZY3789YDJKl/LPkE20l8MifAhtiwKlhP033hHs252+o X-Received: by 2002:a17:906:1e4d:b0:7c1:ac8:73a0 with SMTP id i13-20020a1709061e4d00b007c10ac873a0mr3606734ejj.51.1670553895497; Thu, 08 Dec 2022 18:44:55 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1670553895; cv=pass; d=google.com; s=arc-20160816; b=lJXKvLgXINACXKHLHTZaAR0SqmWqZdp5JKqiBHTua3bTI+mdpu3r8/tVSE5aKw0GIM E+hVzO9lqKuFvyvYm70NwJakCcDvzjHhnnSf4T8nLxe2tiqXgOtII+yJl36MleDGp+KV qjLViDzk/ZpyGuIVXE7IYL2CXfkHQRSc0OJGrPBvKjGpRfvJ2Bsk1urQjCQklT8tElTZ QrCdK380T+wCF6oDKuJoj0cLGDVUfS3hyZHJwnLYO0tT5d7lM9Rtk3QDXFffNkehBkeA jlZn2JTEciWIyhZGi7WzISDmDYMycJdHR2D79Dkg0RiFEOYKFX0P1blR1ygxlkacdCki 0iyA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature:dmarc-filter:delivered-to; bh=9wyLrlcSZYuaDXWO0i54AonP0H/qWWpnK8pGp0GaRjg=; b=ISC2pQJozeGHKAs9aY6t21Qo+BjsiJeFYU08BRi7/WL2rvK5uBNlOkeVSpyeSf2Rhi Dn7leFIYDr6TTrb2KlLGYTGfAmGRqZ7GPRz8HcneJHURmynOOiC107/g6OVQZ1vPDDmA PJu/q4oM6jj6jax1U2c4KTzcrlmfEDO8hN+WtpGmmfec3m782z9X2yKno5UfjCT6UKsX EDH3T8dsQQU4OZ7aKrDEJ9B5DffF9jIE1+nGUFLbC8lRiuxda6eAKoEpkMwrdsi9WRHL szx2ZviKfYxrYmCMhdDmzAkWmGP3eS2Nq1Jt2XnRg9jeYCuwRefm24Uc7oKcgqG3MmKv 1zJg== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@icenowy.me header.s=zmail header.b=cZeAmWsn; arc=pass (i=1 spf=pass spfdomain=icenowy.me dkim=pass dkdomain=icenowy.me dmarc=pass fromdomain=icenowy.me>); spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org" Received: from sourceware.org (server2.sourceware.org. [8.43.85.97]) by mx.google.com with ESMTPS id xh8-20020a170906da8800b007813b1924ccsi102407ejb.934.2022.12.08.18.44.55 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 08 Dec 2022 18:44:55 -0800 (PST) Received-SPF: pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) client-ip=8.43.85.97; Authentication-Results: mx.google.com; dkim=pass header.i=@icenowy.me header.s=zmail header.b=cZeAmWsn; arc=pass (i=1 spf=pass spfdomain=icenowy.me dkim=pass dkdomain=icenowy.me dmarc=pass fromdomain=icenowy.me>); spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org" Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id DABBF384E7A7 for ; Fri, 9 Dec 2022 02:44:44 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from sender4-op-o16.zoho.com (sender4-op-o16.zoho.com [136.143.188.16]) by sourceware.org (Postfix) with ESMTPS id 3B01D3870549; Fri, 9 Dec 2022 02:44:11 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 3B01D3870549 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=icenowy.me Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=icenowy.me ARC-Seal: i=1; a=rsa-sha256; t=1670553845; cv=none; d=zohomail.com; s=zohoarc; b=BUXNBdLg+3L9fCRdqEoKgbN4cn4pIBiDxC0/YVmrLsKDd6u+KpV3uTRRxH0yti8gfNbohnMkGjyBPd09p/vH7RLO4zudZNSWLCbFXB36brdmMt07J1P9PsT4dwNeLNhA+z5lenTJFMSDu3VVbXB2TobwOe9bU2T5MRnbuvK39vE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1670553845; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:MIME-Version:Message-ID:References:Subject:To; bh=9wyLrlcSZYuaDXWO0i54AonP0H/qWWpnK8pGp0GaRjg=; b=HFFrLtlIIx6tNZb76zayRfHlf78re/N5EaeYb4IUtFJWqk+J1OaOqkUGGPTDpDnKb9GavTg9FU8/m2bnNTVVbBaE1iBpIvBLt/bv8Rz8wCWcaBOaIAEJkIXLKw3UoDkoSc4XqOf9rXKaFR1rwIyQNHg6mWYc/rXQKRH581LJ+LE= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass header.i=icenowy.me; spf=pass smtp.mailfrom=uwu@icenowy.me; dmarc=pass header.from= DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; t=1670553845; s=zmail; d=icenowy.me; i=uwu@icenowy.me; h=From:From:To:To:Cc:Cc:Subject:Subject:Date:Date:Message-Id:Message-Id:In-Reply-To:References:MIME-Version:Content-Transfer-Encoding:Reply-To; bh=9wyLrlcSZYuaDXWO0i54AonP0H/qWWpnK8pGp0GaRjg=; b=cZeAmWsnzSBn5vLNHbKCLpOqVKeajLjUQXunX9h0btC8kAOi8ce6Afx4ATKSRmUP oCoKfYHlzcQE5WBbc65Ac1oONZxiD4j4GLo0Hk6Fn8yKomF54i5Me2K8FFVSG9LA+ub NrtCKQgzQ2a4l4mmFqHEeyjvZ1IkzZXtAuDJGf0I= Received: from edelgard.fodlan.icenowy.me (120.85.99.143 [120.85.99.143]) by mx.zohomail.com with SMTPS id 1670553845388481.79994099910596; Thu, 8 Dec 2022 18:44:05 -0800 (PST) From: Icenowy Zheng To: gcc-patches@gcc.gnu.org Cc: Xi Ruoyao , jit@gcc.gnu.org, Icenowy Zheng Subject: [PATCH 1/2] LoongArch: respect the with values in config.gcc Date: Fri, 9 Dec 2022 10:43:48 +0800 Message-Id: <20221209024349.845948-2-uwu@icenowy.me> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221209024349.845948-1-uwu@icenowy.me> References: <20221209024349.845948-1-uwu@icenowy.me> MIME-Version: 1.0 X-ZohoMailClient: External X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, KAM_INFOUSMEBIZ, RCVD_IN_BARRACUDACENTRAL, RCVD_IN_BL_SPAMCOP_NET, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, SPF_HELO_NONE, SPF_PASS, TXREP, URIBL_BLACK 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.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org Sender: "Gcc-patches" X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1751702721973288775?= X-GMAIL-MSGID: =?utf-8?q?1751702721973288775?= In config.gcc, there's a long code snippet that handles --with-{arch,tune,abi,fpu} and give them default values; however these "with" values are not used at all. Use these "with" values to initialize these variables in specs. gcc/ChangeLog: * config/loongarch/loongarch.h (OPTION_DEFAULT_SPECS): New macro that simply injects configure --with values. Signed-off-by: Icenowy Zheng --- gcc/config/loongarch/loongarch.h | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/gcc/config/loongarch/loongarch.h b/gcc/config/loongarch/loongarch.h index a402d3ba35a..5e2f4158f70 100644 --- a/gcc/config/loongarch/loongarch.h +++ b/gcc/config/loongarch/loongarch.h @@ -50,6 +50,17 @@ along with GCC; see the file COPYING3. If not see /* Driver native functions for SPEC processing in the GCC driver. */ #include "loongarch-driver.h" +/* Support for a compile-time default CPU, et cetera. The rules are: + --with-arch is ignored if -march is specified. + --with-tune is ignored if -mtune is specified. + --with-abi is ignored if -mabi is specified. + --with-fpu is ignored if -mfpu is specified. */ +#define OPTION_DEFAULT_SPECS \ + {"arch", "%{!march=*:-march=%(VALUE)}" }, \ + {"tune", "%{!mtune=*:-mtune=%(VALUE)}" }, \ + {"abi", "%{!mabi=*:-mabi=%(VALUE)}" }, \ + {"fpu", "%{!mfpu=*:-mfpu=%(VALUE)}" }, \ + /* This definition replaces the formerly used 'm' constraint with a different constraint letter in order to avoid changing semantics of the 'm' constraint when accepting new address formats in From patchwork Fri Dec 9 02:43:49 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Icenowy Zheng X-Patchwork-Id: 31609 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp544924wrr; Thu, 8 Dec 2022 18:45:30 -0800 (PST) X-Google-Smtp-Source: AA0mqf47w0P2d3lDmLxUEa162+Gglz+ZgmPLneqd/YptcbE7x5kQg7/iTLZaIOdSjtz/pXeVRCQQ X-Received: by 2002:a17:906:3781:b0:7ac:8e6a:a674 with SMTP id n1-20020a170906378100b007ac8e6aa674mr3293772ejc.2.1670553930805; Thu, 08 Dec 2022 18:45:30 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1670553930; cv=pass; d=google.com; s=arc-20160816; b=vjIdMt5VqwBm402B/Vydfe8fraBlxu2UVAZlSxezB+1H2blzcKokRwhMrWEdLyuL+S q57VVL9R3rb5bTr55w4zI9LAzcl5czrH6yOIN9EyW9UwEe0DxEohz8DXqepQSVF7o2MV lPqu+Fei+8RawnuE+IG7wLyhuvAOqvGPVGvkIebPA2ravh5/LAnHpQr1XSpu5pP5i7mq EMDIVkz3C1nu15+/3UDwdZV/6Q09EmlceOCauTU4M2g3mVsaE1MB7uV1Fje9xzo4e4Ji 6WgE2Cx8x0bC/I5v2CcOcDmt2glPKdDlKPoZnHhFA53VRxXEZI6i/bF8ADUg4geMIteI L79A== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature:dmarc-filter:delivered-to; bh=+PA6/OhoJmH4b1jTd72kVKHOXcGMxkp6DP8RSNB3qVE=; b=k4onDjqD3JwhIoFzP3ISDPfvBVPLR7MSId4vtRAouUttB+oFgQ3e1GMG6rHt49lljk ghOPx5uEne3WobNHFt1netTMGJzwdMzw8kg6fcNxWwSEwFPeQ4GxK+eKjro9n0UOT4MK yOrJXLeHN3NepWX9KzwWWxpYu7O3O9W3PsxjaVhVF5R9mkEvbKOS6x0BOQjWqvWwaVhK /OIOnQYVxl3rPO9cr895ccBpZSDzZOQHDH8OzCRGJVoC58/qqftBKdRtHT5lVgolZOMI 3hg/gT5QfHWJ6kfyfc7MVRyU2YdlZ3x9xRjXUy2fAwtL8eUQKzaAfTIFwDzHfjMjpBgv MMbw== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@icenowy.me header.s=zmail header.b=MEbOfKRA; arc=pass (i=1 spf=pass spfdomain=icenowy.me dkim=pass dkdomain=icenowy.me dmarc=pass fromdomain=icenowy.me>); spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org" Received: from sourceware.org (server2.sourceware.org. [2620:52:3:1:0:246e:9693:128c]) by mx.google.com with ESMTPS id gn11-20020a1709070d0b00b0078315844537si182414ejc.378.2022.12.08.18.45.30 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 08 Dec 2022 18:45:30 -0800 (PST) Received-SPF: pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) client-ip=2620:52:3:1:0:246e:9693:128c; Authentication-Results: mx.google.com; dkim=pass header.i=@icenowy.me header.s=zmail header.b=MEbOfKRA; arc=pass (i=1 spf=pass spfdomain=icenowy.me dkim=pass dkdomain=icenowy.me dmarc=pass fromdomain=icenowy.me>); spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org" Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id D222838923CC for ; Fri, 9 Dec 2022 02:45:16 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from sender4-op-o16.zoho.com (sender4-op-o16.zoho.com [136.143.188.16]) by sourceware.org (Postfix) with ESMTPS id C345D38378CB; Fri, 9 Dec 2022 02:44:14 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org C345D38378CB Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=icenowy.me Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=icenowy.me ARC-Seal: i=1; a=rsa-sha256; t=1670553849; cv=none; d=zohomail.com; s=zohoarc; b=LbvE37APLuQzSp3ywRu1kg+Xnl1AHqlH7gq8LBiy/d/pS+QmmNftkD3ER8YBTjfMW0u6WTclwweGyNrVOhCF02IxsrmHEnCBR6X3zt4PuuGucCkMvxjj4OC5A+6lf155/WqG4naUbXJFLBcpTs48wgO/tS1NM5JoyAYDzlM6gNk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1670553849; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:MIME-Version:Message-ID:References:Subject:To; bh=+PA6/OhoJmH4b1jTd72kVKHOXcGMxkp6DP8RSNB3qVE=; b=idmJ7mfeF23D5eh+Rg7VXJppnvUzOVM+ZtD269H8nbGQVLK4QgrMYUITrm2c6n9l852xIwRgV5MkZHqxbNG7Qq99sQIIw/0LpM9/2WVQpDKe8YbcsR6/VbbEyhCc4/dwqcZ0l5wflLetWAV1IDey3JF5/vncGR9h2MtoaRkHq1Y= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass header.i=icenowy.me; spf=pass smtp.mailfrom=uwu@icenowy.me; dmarc=pass header.from= DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; t=1670553849; s=zmail; d=icenowy.me; i=uwu@icenowy.me; h=From:From:To:To:Cc:Cc:Subject:Subject:Date:Date:Message-Id:Message-Id:In-Reply-To:References:MIME-Version:Content-Transfer-Encoding:Reply-To; bh=+PA6/OhoJmH4b1jTd72kVKHOXcGMxkp6DP8RSNB3qVE=; b=MEbOfKRAKDWOnt8W0y4Wo5NQfGR4GfHlIp5FjC+RsXdGn4Hu4WH02BKM3/FWPQg3 FM9jyop+nll5GPNUaxAyQJ9IjF45F+uJuTbe8J697VWsf9I3rLSvAGygQYmOTDCBmdZ WON/p/MkVxkMTcznBM2cyBImSq8ZynKRsaVEBpO8= Received: from edelgard.fodlan.icenowy.me (120.85.99.143 [120.85.99.143]) by mx.zohomail.com with SMTPS id 1670553848345595.5200839822688; Thu, 8 Dec 2022 18:44:08 -0800 (PST) From: Icenowy Zheng To: gcc-patches@gcc.gnu.org Cc: Xi Ruoyao , jit@gcc.gnu.org, Icenowy Zheng Subject: [PATCH 2/2] LoongArch: drop loongarch-driver Date: Fri, 9 Dec 2022 10:43:49 +0800 Message-Id: <20221209024349.845948-3-uwu@icenowy.me> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221209024349.845948-1-uwu@icenowy.me> References: <20221209024349.845948-1-uwu@icenowy.me> MIME-Version: 1.0 X-ZohoMailClient: External X-Spam-Status: No, score=-3.3 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, KAM_INFOUSMEBIZ, KAM_SHORT, RCVD_IN_BARRACUDACENTRAL, RCVD_IN_BL_SPAMCOP_NET, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, SPF_HELO_NONE, SPF_PASS, TXREP, URIBL_BLACK 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.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org Sender: "Gcc-patches" X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1751702758493347344?= X-GMAIL-MSGID: =?utf-8?q?1751702758493347344?= Currently the loongarch-driver code tries to parse the values of some -m flags to numeric representation, and then output the strings corresponding to the numeric representations. This is mostly an no-op, and it leads to duplication of these flags' parse code, which makes building libgccjit fail by having multiple copies of this code to link. However, this driver code is previously used to generate default values for these -m flags, which is now obsoleted by respecting the values of --with-* build-time configure flags (or their default values determined in config.gcc). Some other architectures include driver code to handle -m{arch,tune}=native by converting it to the current CPU type. However as the LoongArch compiler itself can handle native value, such a driver is not necessary on LoongArch. Drop loongarch-driver now as it's mostly useless. The specs snippets that handles -mabi values are moved to loongarch.h as they're still useful and does not depend on the driver. gcc/ChangeLog: * config/loongarch/loongarch.h (ABI_GRLEN_SPEC): Moved from loongarch-driver.h. * config/loongarch/loongarch.h (ABI_SPEC): Ditto. * config/loongarch/loongarch-driver.h: Removed. * config/loongarch/loongarch-driver.cc: Removed. Signed-off-by: Icenowy Zheng --- gcc/config.gcc | 1 - gcc/config/loongarch/loongarch-driver.cc | 187 ----------------------- gcc/config/loongarch/loongarch-driver.h | 68 --------- gcc/config/loongarch/loongarch.h | 10 +- 4 files changed, 8 insertions(+), 258 deletions(-) delete mode 100644 gcc/config/loongarch/loongarch-driver.cc delete mode 100644 gcc/config/loongarch/loongarch-driver.h diff --git a/gcc/config.gcc b/gcc/config.gcc index b5eda046033..dc1b1cdaa9d 100644 --- a/gcc/config.gcc +++ b/gcc/config.gcc @@ -459,7 +459,6 @@ loongarch*-*-*) cpu_type=loongarch extra_headers="larchintrin.h" extra_objs="loongarch-c.o loongarch-builtins.o loongarch-cpu.o loongarch-opts.o loongarch-def.o" - extra_gcc_objs="loongarch-driver.o loongarch-cpu.o loongarch-opts.o loongarch-def.o" extra_options="${extra_options} g.opt fused-madd.opt" ;; nds32*) diff --git a/gcc/config/loongarch/loongarch-driver.cc b/gcc/config/loongarch/loongarch-driver.cc deleted file mode 100644 index 0adcc923b7d..00000000000 --- a/gcc/config/loongarch/loongarch-driver.cc +++ /dev/null @@ -1,187 +0,0 @@ -/* Subroutines for the gcc driver. - Copyright (C) 2021-2022 Free Software Foundation, Inc. - Contributed by Loongson Ltd. - -This file is part of GCC. - -GCC is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 3, or (at your option) -any later version. - -GCC is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with GCC; see the file COPYING3. If not see -. */ - -#define IN_TARGET_CODE 1 - -#include "config.h" -#include "system.h" -#include "coretypes.h" -#include "tm.h" -#include "obstack.h" -#include "diagnostic-core.h" - -#include "loongarch-opts.h" -#include "loongarch-driver.h" - -static int - opt_arch_driver = M_OPTION_NOT_SEEN, - opt_tune_driver = M_OPTION_NOT_SEEN, - opt_fpu_driver = M_OPTION_NOT_SEEN, - opt_abi_base_driver = M_OPTION_NOT_SEEN, - opt_abi_ext_driver = M_OPTION_NOT_SEEN, - opt_cmodel_driver = M_OPTION_NOT_SEEN; - -int opt_switches = 0; - -/* This flag is set to 1 if we believe that the user might be avoiding - linking (implicitly) against something from the startfile search paths. */ -static int no_link = 0; - -#define LARCH_DRIVER_SET_M_FLAG(OPTS_ARRAY, N_OPTS, FLAG, STR) \ - for (int i = 0; i < (N_OPTS); i++) \ - { \ - if ((OPTS_ARRAY)[i] != 0) \ - if (strcmp ((STR), (OPTS_ARRAY)[i]) == 0) \ - (FLAG) = i; \ - } - -/* Use the public obstack from the gcc driver (defined in gcc.c). - This is for allocating space for the returned string. */ -extern struct obstack opts_obstack; - -#define APPEND_LTR(S) \ - obstack_grow (&opts_obstack, (const void*) (S), \ - sizeof ((S)) / sizeof (char) -1) - -#define APPEND_VAL(S) \ - obstack_grow (&opts_obstack, (const void*) (S), strlen ((S))) - - -const char* -driver_set_m_flag (int argc, const char **argv) -{ - int parm_off = 0; - - if (argc != 1) - return "%eset_m_flag requires exactly 1 argument."; - -#undef PARM -#define PARM (argv[0] + parm_off) - -/* Note: sizeof (OPTSTR_##NAME) equals the length of "