From patchwork Fri Nov 8 23:45:56 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ian Rogers X-Patchwork-Id: 13869077 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 7041AD64076 for ; Sat, 9 Nov 2024 00:06:46 +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=azojZIK4P+JI8rufI/R8xa4D5fUVVVyAlbNpxVfvbC4=; b=avOKTeSvy+flapW+8kTjP0jfRa 5pXfZGZsIS9G4gScD8mDuFW4n0JkpnUtUuQIu7s1KEZ6Hr6+sFIRqVABwL9kTvWoQjXW8K9ujwp1/ 76WffEexH9fqL+4w9Hgxh6KUcLOQmiRcTETZpxsCA+VQJ+9ktouLe+6SBZZSRdHP5DHFS65tCMXJd 3rrWx83Kb20XuQQLuqE/5EJmh2WbOurYHIijBiwCtbLsFVX8W690HRdIiAk5eVA4i2T9zsv2z3ZN/ wrZEg0X2EpzAw1rhhEbGm1JBQ8MPEZ32kuCGxZ9ipBYPiakGEuVK8Zs3X8jdRDzLMnZEyRiinfd/3 ATuMKKoA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1t9Yzq-0000000CIT5-0ZQq; Sat, 09 Nov 2024 00:06:34 +0000 Received: from mail-yw1-x114a.google.com ([2607:f8b0:4864:20::114a]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1t9YgW-0000000CFAT-2rut for linux-arm-kernel@lists.infradead.org; Fri, 08 Nov 2024 23:46:39 +0000 Received: by mail-yw1-x114a.google.com with SMTP id 00721157ae682-6ea8d6fb2ffso52376567b3.2 for ; Fri, 08 Nov 2024 15:46:36 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1731109595; x=1731714395; 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=azojZIK4P+JI8rufI/R8xa4D5fUVVVyAlbNpxVfvbC4=; b=xi5Cj33lWic0tKyUfWzyBdvhhns6Xm3ZC9NdVbf/bcdX6OubiMoQ0kN/W9ad55gXb3 YwAjb2pba959TO9eAG4SM2iMCzWA3TUf/+v8kVGD3bdNzlYPI3BkEMronUDMzRfFs4Yl sITN3zb5XlWiiIWm43r71OGSBCvwDzQxqW34Ph0PHWLAIiyjVvII+ROdjB+uRVQAcAMX Y9ps9NqKKK9y5BB4jbtbYEGWBlt5TDzfQN1p7aXttO4+PDNh7cMgEIXT/BF02/gJqdCn RvewKOdvuM94zTAYOGB3im7m1uuMAIlkuIbu8Nr5Zy3BUM6VVnma7FpuTKPdq+UIgZmL C93w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1731109595; x=1731714395; 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=azojZIK4P+JI8rufI/R8xa4D5fUVVVyAlbNpxVfvbC4=; b=GPe8/og6/oZYAwtCQwojE95Q3N3jLNgqeFFiMVCIlJLeoN4KxEUB7crcC7DeWAak0j qsaBv2F3SiPALuLCSbuZqhrztTH3cKXx9QH/F569V0ImBqxXQw+doozySp9mngZ/8W31 6Zq272J1O9i5e5ZzaCtytWFrUx/1IjWeMQKJaTOVA2j8XgMQCfOwMS1QqauyqBZnHCnj +LlcYh70GMAO697dDzDu0kZj8skrCfMTTWdvaThE3vEnUxzYRvVLKnWi1CdBKcN0MF2C WJQOIPB9D1KXl/50sfUjCOVfdfCbCx2EHAnmrXkGh6PYp5e9CUfb/msjeZ1k5vYSwaG4 oqQw== X-Forwarded-Encrypted: i=1; AJvYcCW9t974Tqqkd4E0Z7vnRXNAw2/PQnyULoB+Nur+oO/747vTXY6UBtRH6TRSpGTj5bBVFbKheiZPr7+Kjo0N17+E@lists.infradead.org X-Gm-Message-State: AOJu0Yxcn2Rwdn38wm2SwLVhqE8sbf1g1q9HhFtkd29dvZedpIpYzE0R lB5IPgK6txzf9zRBg3J+6NN4BkyhDpeTL0rQR5+BGRBANqYQfHX+M6hRnG6H7+DS4RkoQvIsZ1A /UnA/rQ== X-Google-Smtp-Source: AGHT+IHvxaz+IUsygm0KRuAKCEHm0Hu0ZezrckPWQ5vrrDTKrO7SMIdnfNdCCVlp0iIRJj3j38NKn+fR9CMz X-Received: from irogers.svl.corp.google.com ([2620:15c:2c5:11:6fd2:1e36:6d8c:7c49]) (user=irogers job=sendgmr) by 2002:a25:d856:0:b0:e30:c868:1eba with SMTP id 3f1490d57ef6-e337f845652mr9447276.2.1731109595364; Fri, 08 Nov 2024 15:46:35 -0800 (PST) Date: Fri, 8 Nov 2024 15:45:56 -0800 In-Reply-To: <20241108234606.429459-1-irogers@google.com> Message-Id: <20241108234606.429459-12-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 11/20] perf loongarch: 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_154636_842540_240D423C X-CRM114-Status: GOOD ( 18.95 ) 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 loongarch in dwarf-regs.c. Reviewed-by: Masami Hiramatsu (Google) Signed-off-by: Ian Rogers --- tools/perf/arch/loongarch/util/Build | 1 - tools/perf/arch/loongarch/util/dwarf-regs.c | 34 --------------------- tools/perf/util/dwarf-regs.c | 4 +-- tools/perf/util/include/dwarf-regs.h | 3 +- 4 files changed, 4 insertions(+), 38 deletions(-) delete mode 100644 tools/perf/arch/loongarch/util/dwarf-regs.c diff --git a/tools/perf/arch/loongarch/util/Build b/tools/perf/arch/loongarch/util/Build index 06ff95394921..0aa31986ecb5 100644 --- a/tools/perf/arch/loongarch/util/Build +++ b/tools/perf/arch/loongarch/util/Build @@ -1,7 +1,6 @@ perf-util-y += header.o perf-util-y += perf_regs.o -perf-util-$(CONFIG_LIBDW) += dwarf-regs.o perf-util-$(CONFIG_LOCAL_LIBUNWIND) += unwind-libunwind.o perf-util-$(CONFIG_LIBDW_DWARF_UNWIND) += unwind-libdw.o perf-util-$(CONFIG_LIBTRACEEVENT) += kvm-stat.o diff --git a/tools/perf/arch/loongarch/util/dwarf-regs.c b/tools/perf/arch/loongarch/util/dwarf-regs.c deleted file mode 100644 index bee08fdcf2fd..000000000000 --- a/tools/perf/arch/loongarch/util/dwarf-regs.c +++ /dev/null @@ -1,34 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0 -/* - * dwarf-regs.c : Mapping of DWARF debug register numbers into register names. - * - * Copyright (C) 2020-2023 Loongson Technology Corporation Limited - */ - -#include -#include /* for EINVAL */ -#include /* for strcmp */ -#include - -struct pt_regs_dwarfnum { - const char *name; - unsigned int dwarfnum; -}; - -static struct pt_regs_dwarfnum loongarch_gpr_table[] = { - {"%r0", 0}, {"%r1", 1}, {"%r2", 2}, {"%r3", 3}, - {"%r4", 4}, {"%r5", 5}, {"%r6", 6}, {"%r7", 7}, - {"%r8", 8}, {"%r9", 9}, {"%r10", 10}, {"%r11", 11}, - {"%r12", 12}, {"%r13", 13}, {"%r14", 14}, {"%r15", 15}, - {"%r16", 16}, {"%r17", 17}, {"%r18", 18}, {"%r19", 19}, - {"%r20", 20}, {"%r21", 21}, {"%r22", 22}, {"%r23", 23}, - {"%r24", 24}, {"%r25", 25}, {"%r26", 26}, {"%r27", 27}, - {"%r28", 28}, {"%r29", 29}, {"%r30", 30}, {"%r31", 31}, - {NULL, 0} -}; - -const char *get_arch_regstr(unsigned int n) -{ - n %= 32; - return loongarch_gpr_table[n].name; -} diff --git a/tools/perf/util/dwarf-regs.c b/tools/perf/util/dwarf-regs.c index 9a76f83af62c..efc41d0fbee9 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_CSKY || EM_HOST == EM_LOONGARCH 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_CSKY && EM_HOST != EM_LOONGARCH 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 0641c2942b01..4e591379f367 100644 --- a/tools/perf/util/include/dwarf-regs.h +++ b/tools/perf/util/include/dwarf-regs.h @@ -89,7 +89,8 @@ #define DWARF_REG_FB 0xd3affb /* random number */ #ifdef HAVE_LIBDW_SUPPORT -#if !defined(__x86_64__) && !defined(__i386__) && !defined(__aarch64__) && !defined(__arm__) +#if !defined(__x86_64__) && !defined(__i386__) && !defined(__aarch64__) && !defined(__arm__) \ + && !defined(__loongarch__) const char *get_arch_regstr(unsigned int n); #endif