From patchwork Fri Nov 8 23:45:57 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ian Rogers X-Patchwork-Id: 13869089 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 30C81D64076 for ; Sat, 9 Nov 2024 00:08:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Type:To:From:Subject :References:Mime-Version:Message-Id:In-Reply-To:Date:Reply-To:Cc: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=a2OyjjDbRvyutbZalHm47RzbC3FdZ2Ys1+/kav0Gy1o=; b=PzoW0Y632F4YCkAXZTAwOP9zsN lKhvZ//QErzLjcj5YKamkuiuUu5TxBzl/Vhy7jQFhLAt3b5wGmUR+08PdOJa3uaIzhtBJLzTq4qxp LNPTH2CLhVC7mI/w5ow5zpaco3afPd3L8pmeYL/lVfk51qutNBK+UR+zKVTgUD6TTLIeG446Sb9zZ dALVcUCH3vC9b4VqoM72LEiBHSaPwJuMt0HhcIIV21S6X/RaUupPim1qboSNfLh3nfqMc/NzZcEmJ G7oRToUdSh8hUkrBj/03CFQlNbnSKIW7cudcDwGH5mlD7EvggHpJ9FzGvFlG6ckeukQ71/jmtx5yS xC7uDC2g==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1t9Z1j-0000000CImM-2Oii; Sat, 09 Nov 2024 00:08:31 +0000 Received: from mail-yb1-xb4a.google.com ([2607:f8b0:4864:20::b4a]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1t9YgY-0000000CFBp-3KCv for linux-arm-kernel@lists.infradead.org; Fri, 08 Nov 2024 23:46:40 +0000 Received: by mail-yb1-xb4a.google.com with SMTP id 3f1490d57ef6-e28fea2adb6so3743990276.3 for ; Fri, 08 Nov 2024 15:46:38 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1731109597; x=1731714397; darn=lists.infradead.org; h=to:from:subject:references:mime-version:message-id:in-reply-to:date :from:to:cc:subject:date:message-id:reply-to; bh=a2OyjjDbRvyutbZalHm47RzbC3FdZ2Ys1+/kav0Gy1o=; b=V3+gsCvPU36E7Ski60QmlQLXDw8+/IN6K4J5x8Cn/EQKqdRNwKEN7yK436XVywa4Il bGNNx5V2leUjFUQCC/GyESn9pgn8t73bjCP+HCDPQkKPGY2HpayaHZ11mYIrGO/OZuZg uBvSSnhIJYsa798sk/AfjTr3ZBEHE3+mJHbeCr72A6qTC+n0EfCgbocSU+9olS1IlNqB SpSqpDNhFIW+/6LaaP66MqXOjVdT6/2hUTtDYo7i7YbQNo5blhr10tfzNZ+f3NI61MCA y+AiilQeMX2k3nvWH5kqYjLhxSpLCcH2O0lGaesi+koEjaz+t+45+MDApFpsZ3FuH3hR V4ww== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1731109597; x=1731714397; h=to:from:subject:references:mime-version:message-id:in-reply-to:date :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=a2OyjjDbRvyutbZalHm47RzbC3FdZ2Ys1+/kav0Gy1o=; b=f+84G6hlMpwIroOm7KfDnJVAg30agTVUJejUQsM68luKB7ABdFSGQ2H+9I9eVL+t7H 9Um4ACyk8ivGTZVl8bMosX1g0cyX91LW6B+6SNOTpk2/3ZZW5hHo8Rjufd8vCR1maeAv tcceeJjvknaMPjqIsb2CrqfsIGzWS2tuG1Fwa9XLQF1K2uFVoV+pAxfkdYHyhQwLVXJF iqPA83a94xw6XqweA+6gXkXu/3PVBawLBjmq72e1zEVlnO6HbTypamuMxdR+phXaxJoi eebw2zJaM0Gv+i0hivR89cALs5BNCQwgTkI4x9y+ml6vO28OE48eUz30z4MaW7bs7bwT P4WQ== X-Forwarded-Encrypted: i=1; AJvYcCW+zbVMOKG3lq49K94LfMEG8AlKD8N/+QalTazclBGGdb8CwxJP3C+fgj75AQsGCzZcFo35upBLGk5ZKZZ9B75T@lists.infradead.org X-Gm-Message-State: AOJu0Yzm3GBgcYA2kG5caq2TFMaJi+zATOSuSbids77OdPOnQlP9b7Ek VV+g7NNcXCfoT3gyMrYcBg2xgMRbKflOP2I+EkdumHUgA8hB3ZeU/uPA43iUYrhR6/U8lEGix28 5jR4b7Q== X-Google-Smtp-Source: AGHT+IGqhTm7YFbGcx/el+7wHNXMpRCyEyd2cOJXBQ6mHFUtI003Rx1t09AGgdDw/1NDsX/UK2nFtyoLebaj X-Received: from irogers.svl.corp.google.com ([2620:15c:2c5:11:6fd2:1e36:6d8c:7c49]) (user=irogers job=sendgmr) by 2002:a25:c7cf:0:b0:e28:fb8b:9155 with SMTP id 3f1490d57ef6-e337f8e8d9fmr8052276.9.1731109597298; Fri, 08 Nov 2024 15:46:37 -0800 (PST) Date: Fri, 8 Nov 2024 15:45:57 -0800 In-Reply-To: <20241108234606.429459-1-irogers@google.com> Message-Id: <20241108234606.429459-13-irogers@google.com> Mime-Version: 1.0 References: <20241108234606.429459-1-irogers@google.com> X-Mailer: git-send-email 2.47.0.277.g8800431eea-goog Subject: [PATCH v4 12/20] perf mips: Remove dwarf-regs.c From: Ian Rogers To: Peter Zijlstra , Ingo Molnar , Arnaldo Carvalho de Melo , Namhyung Kim , Mark Rutland , Alexander Shishkin , Jiri Olsa , Ian Rogers , Adrian Hunter , Kan Liang , John Garry , Will Deacon , James Clark , Mike Leach , Leo Yan , Guo Ren , Paul Walmsley , Palmer Dabbelt , Albert Ou , Nick Terrell , "Masami Hiramatsu (Google)" , Changbin Du , Guilherme Amadio , Yang Jihong , Aditya Gupta , Athira Rajeev , Masahiro Yamada , Bibo Mao , Huacai Chen , Kajol Jain , Atish Patra , Shenlin Liang , Anup Patel , Oliver Upton , "Steinar H. Gunderson" , "Dr. David Alan Gilbert" , Chen Pei , Dima Kogan , Przemek Kitszel , "David S. Miller" , Alexander Lobakin , linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-csky@vger.kernel.org, linux-riscv@lists.infradead.org X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20241108_154639_032464_F0D9B340 X-CRM114-Status: GOOD ( 21.89 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org The file just provides the function get_arch_regstr, however, if in the only caller get_dwarf_regstr EM_HOST is used for the EM_NONE case the function can never be called. So remove as dead code. Tidy up the EM_NONE cases for mips in dwarf-regs.c. Reviewed-by: Masami Hiramatsu (Google) Signed-off-by: Ian Rogers --- tools/perf/arch/mips/util/Build | 1 - tools/perf/arch/mips/util/dwarf-regs.c | 38 -------------------------- tools/perf/util/dwarf-regs.c | 4 +-- tools/perf/util/include/dwarf-regs.h | 2 +- 4 files changed, 3 insertions(+), 42 deletions(-) delete mode 100644 tools/perf/arch/mips/util/dwarf-regs.c diff --git a/tools/perf/arch/mips/util/Build b/tools/perf/arch/mips/util/Build index b328109fc16c..691fa2051958 100644 --- a/tools/perf/arch/mips/util/Build +++ b/tools/perf/arch/mips/util/Build @@ -1,3 +1,2 @@ perf-util-y += perf_regs.o -perf-util-$(CONFIG_LIBDW) += dwarf-regs.o perf-util-$(CONFIG_LOCAL_LIBUNWIND) += unwind-libunwind.o diff --git a/tools/perf/arch/mips/util/dwarf-regs.c b/tools/perf/arch/mips/util/dwarf-regs.c deleted file mode 100644 index 25c13a91c2a7..000000000000 --- a/tools/perf/arch/mips/util/dwarf-regs.c +++ /dev/null @@ -1,38 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0 -/* - * dwarf-regs.c : Mapping of DWARF debug register numbers into register names. - * - * Copyright (C) 2013 Cavium, Inc. - * - * This program 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 2 of the License, or - * (at your option) any later version. - * - * This program 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. - * - */ - -#include -#include - -static const char *mips_gpr_names[32] = { - "$0", "$1", "$2", "$3", "$4", "$5", "$6", "$7", "$8", "$9", - "$10", "$11", "$12", "$13", "$14", "$15", "$16", "$17", "$18", "$19", - "$20", "$21", "$22", "$23", "$24", "$25", "$26", "$27", "$28", "$29", - "$30", "$31" -}; - -const char *get_arch_regstr(unsigned int n) -{ - if (n < 32) - return mips_gpr_names[n]; - if (n == 64) - return "hi"; - if (n == 65) - return "lo"; - return NULL; -} diff --git a/tools/perf/util/dwarf-regs.c b/tools/perf/util/dwarf-regs.c index efc41d0fbee9..d536964df43c 100644 --- a/tools/perf/util/dwarf-regs.c +++ b/tools/perf/util/dwarf-regs.c @@ -32,7 +32,7 @@ const char *get_dwarf_regstr(unsigned int n, unsigned int machine, unsigned int flags) { #if EM_HOST == EM_X86_64 || EM_HOST == EM_386 || EM_HOST == EM_AARCH64 || EM_HOST == EM_ARM \ - || EM_HOST == EM_CSKY || EM_HOST == EM_LOONGARCH + || EM_HOST == EM_CSKY || EM_HOST == EM_LOONGARCH || EM_HOST == EM_MIPS if (machine == EM_NONE) { /* Generic arch - use host arch */ machine = EM_HOST; @@ -40,7 +40,7 @@ const char *get_dwarf_regstr(unsigned int n, unsigned int machine, unsigned int #endif switch (machine) { #if EM_HOST != EM_X86_64 && EM_HOST != EM_386 && EM_HOST != EM_AARCH64 && EM_HOST != EM_ARM \ - && EM_HOST != EM_CSKY && EM_HOST != EM_LOONGARCH + && EM_HOST != EM_CSKY && EM_HOST != EM_LOONGARCH && EM_HOST != EM_MIPS case EM_NONE: /* Generic arch - use host arch */ return get_arch_regstr(n); #endif diff --git a/tools/perf/util/include/dwarf-regs.h b/tools/perf/util/include/dwarf-regs.h index 4e591379f367..55f21d8082a2 100644 --- a/tools/perf/util/include/dwarf-regs.h +++ b/tools/perf/util/include/dwarf-regs.h @@ -90,7 +90,7 @@ #ifdef HAVE_LIBDW_SUPPORT #if !defined(__x86_64__) && !defined(__i386__) && !defined(__aarch64__) && !defined(__arm__) \ - && !defined(__loongarch__) + && !defined(__loongarch__) && !defined(__mips__) const char *get_arch_regstr(unsigned int n); #endif