From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-ed1-x542.google.com (mail-ed1-x542.google.com [IPv6:2a00:1450:4864:20::542]) by sourceware.org (Postfix) with ESMTPS id 167D93857013 for ; Tue, 6 Oct 2020 16:42:31 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 167D93857013 Received: by mail-ed1-x542.google.com with SMTP id l17so14236480edq.12 for ; Tue, 06 Oct 2020 09:42:31 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=cNO+/4mY8Y/d2UaKmwNXlXtUEtE0pKyIMxt3WsK4Tsc=; b=hXFn+OL4wOCkpUpLSeJ92x6CGloiuw3a/DxM4svvMA6NUH9xJF4ZgVowCU0Ktk9Djk 5TEviwtgq9VRpC86MXDNYxby+DNNUp2rZZvef3jTxBEMmnM6lDNq9IKfRjEgGSNhdpj1 hG5llSD/F+SwiW00w15idwJl0gcD5KrmgZc3t9x4gpov4lIeBv161mOXnTDtSeYP5hAq rT73T3+2ExrunI/swEPG11GErfAm6P9licRbnQhbyrlIGVySIqIkAFSktdV7dVA4huAf Z/Wipnr20GCclHE7fbsc4r+QimyjLBMKKZNA1vDoNmalepRJ0Ia0P5CSKv5kLp+qRNdO vZwQ== X-Gm-Message-State: AOAM5332jrHmjQ4A65XzXamIE7vONMYIj7oULJMSgtSWec/CfPWf7/lC i3KCLlfhE9o+gagyKtijEtNpJ9xdaDxK7w== X-Google-Smtp-Source: ABdhPJxe24/n/+sycFBz/5PRqqt2RaZE/qKFJ4i0hBaGztMXB39x2Pup2RV4MXstdfQ6TQpNoaGrDQ== X-Received: by 2002:a05:6402:651:: with SMTP id u17mr6298667edx.206.1602002549696; Tue, 06 Oct 2020 09:42:29 -0700 (PDT) Received: from atlantis.home ([2a03:1b20:3:f011::6d]) by smtp.gmail.com with ESMTPSA id a12sm2194049edy.87.2020.10.06.09.42.28 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Tue, 06 Oct 2020 09:42:29 -0700 (PDT) From: Shahab Vahedi To: gdb-patches@sourceware.org Cc: Shahab Vahedi , Shahab Vahedi , Simon Marchi , Baris Aktemur , Francois Bedard Subject: [PATCH v2 1/2] arc: Rename "arc_gdbarch_features" struct Date: Tue, 6 Oct 2020 18:42:08 +0200 Message-Id: <20201006164209.2443-1-shahab.vahedi@gmail.com> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20200826165647.5221-1-shahab.vahedi@gmail.com> References: <20200826165647.5221-1-shahab.vahedi@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-10.6 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 06 Oct 2020 16:42:33 -0000 From: Shahab Vahedi "arc_gdbarch_features" is a data structure containing information about the ARC architecture: ISA version, register size, etc. This name is misleading, because although it carries the phrase "gdbarch", it has nothing to do with the type/interface in GDB. Traditionaly, "gdbarch" structures are only used for that purpose. To rectify this, this patch changes the name to "arc_arch_features". gdb/ChangeLog: * arch/arc.h: Rename "arc_gdbarch_features" to "arc_arch_features". * arc-tdep.h: Likewise. * arc-tdep.c: Likewise. --- gdb/arc-tdep.c | 14 +++++++------- gdb/arch/arc.c | 12 ++++++------ gdb/arch/arc.h | 12 ++++++------ 3 files changed, 19 insertions(+), 19 deletions(-) diff --git a/gdb/arc-tdep.c b/gdb/arc-tdep.c index 6f544bff78d..60c76af3352 100644 --- a/gdb/arc-tdep.c +++ b/gdb/arc-tdep.c @@ -1883,11 +1883,11 @@ mach_type_to_arc_isa (const unsigned long mach) } } -/* Common construction code for ARC_GDBARCH_FEATURES struct. If there +/* Common construction code for ARC_ARCH_FEATURES struct. If there is no ABFD, then a FEATURE with default values is returned. */ -static arc_gdbarch_features -arc_gdbarch_features_create (const bfd *abfd, const unsigned long mach) +static arc_arch_features +arc_arch_features_create (const bfd *abfd, const unsigned long mach) { /* Use 4 as a fallback value. */ int reg_size = 4; @@ -1915,7 +1915,7 @@ arc_gdbarch_features_create (const bfd *abfd, const unsigned long mach) case). */ arc_isa isa = mach_type_to_arc_isa (mach); - return arc_gdbarch_features (reg_size, isa); + return arc_arch_features (reg_size, isa); } /* Look for obsolete core feature names in TDESC. */ @@ -2085,9 +2085,9 @@ arc_tdesc_init (struct gdbarch_info info, const struct target_desc **tdesc, /* If target doesn't provide a description, use the default ones. */ if (!tdesc_has_registers (tdesc_loc)) { - arc_gdbarch_features features - = arc_gdbarch_features_create (info.abfd, - info.bfd_arch_info->mach); + arc_arch_features features + = arc_arch_features_create (info.abfd, + info.bfd_arch_info->mach); tdesc_loc = arc_lookup_target_description (features); } gdb_assert (tdesc_loc != nullptr); diff --git a/gdb/arch/arc.c b/gdb/arch/arc.c index 8e126ca5a82..3808f9fe292 100644 --- a/gdb/arch/arc.c +++ b/gdb/arch/arc.c @@ -35,7 +35,7 @@ #endif STATIC_IN_GDB target_desc * -arc_create_target_description (const struct arc_gdbarch_features &features) +arc_create_target_description (const struct arc_arch_features &features) { /* Create a new target description. */ target_desc *tdesc = allocate_target_description (); @@ -84,10 +84,10 @@ arc_create_target_description (const struct arc_gdbarch_features &features) #ifndef GDBSERVER /* Wrapper used by std::unordered_map to generate hash for features set. */ -struct arc_gdbarch_features_hasher +struct arc_arch_features_hasher { std::size_t - operator() (const arc_gdbarch_features &features) const noexcept + operator() (const arc_arch_features &features) const noexcept { return features.hash (); } @@ -95,14 +95,14 @@ struct arc_gdbarch_features_hasher /* Cache of previously created target descriptions, indexed by the hash of the features set used to create them. */ -static std::unordered_map arc_tdesc_cache; + arc_arch_features_hasher> arc_tdesc_cache; /* See arch/arc.h. */ const target_desc * -arc_lookup_target_description (const struct arc_gdbarch_features &features) +arc_lookup_target_description (const struct arc_arch_features &features) { /* Lookup in the cache first. If found, return the pointer from the "target_desc_up" type which is a "unique_ptr". This should be fine diff --git a/gdb/arch/arc.h b/gdb/arch/arc.h index a5313b1fee6..16257596748 100644 --- a/gdb/arch/arc.h +++ b/gdb/arch/arc.h @@ -27,9 +27,9 @@ enum arc_isa ARC_ISA_ARCV2 /* such as ARC EM and ARC HS */ }; -struct arc_gdbarch_features +struct arc_arch_features { - arc_gdbarch_features (int reg_size, arc_isa isa) + arc_arch_features (int reg_size, arc_isa isa) : reg_size (reg_size), isa (isa) {} @@ -41,13 +41,13 @@ struct arc_gdbarch_features const arc_isa isa; /* Equality operator. */ - bool operator== (const struct arc_gdbarch_features &rhs) const + bool operator== (const struct arc_arch_features &rhs) const { return (reg_size == rhs.reg_size && isa == rhs.isa); } /* Inequality operator. */ - bool operator!= (const struct arc_gdbarch_features &rhs) const + bool operator!= (const struct arc_arch_features &rhs) const { return !(*this == rhs); } @@ -71,7 +71,7 @@ struct arc_gdbarch_features the returned data. */ target_desc *arc_create_target_description - (const struct arc_gdbarch_features &features); + (const struct arc_arch_features &features); #else @@ -79,7 +79,7 @@ target_desc *arc_create_target_description If nothing is found, then create one and return it. */ const target_desc *arc_lookup_target_description - (const struct arc_gdbarch_features &features); + (const struct arc_arch_features &features); #endif /* GDBSERVER */ -- 2.28.0