From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca (simark.ca [158.69.221.121]) by sourceware.org (Postfix) with ESMTPS id 0323D3858D35 for ; Sat, 1 Aug 2020 14:53:46 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 0323D3858D35 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=simark.ca Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=simark@simark.ca Received: from [10.0.0.11] (173-246-6-90.qc.cable.ebox.net [173.246.6.90]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by simark.ca (Postfix) with ESMTPSA id 59EEF1E792; Sat, 1 Aug 2020 10:53:45 -0400 (EDT) From: Simon Marchi Subject: Re: [PATCH v4 2/3] arc: Add hardware loop detection To: Shahab Vahedi , gdb-patches@sourceware.org Cc: Shahab Vahedi , Tom Tromey , Anton Kolesov , Francois Bedard References: <20200713154527.13430-1-shahab.vahedi@gmail.com> <20200723193532.25812-1-shahab.vahedi@gmail.com> <20200723193532.25812-3-shahab.vahedi@gmail.com> Message-ID: <7f7c4518-ef40-4ff0-d7c2-05bc6463a926@simark.ca> Date: Sat, 1 Aug 2020 10:53:38 -0400 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0 MIME-Version: 1.0 In-Reply-To: <20200723193532.25812-3-shahab.vahedi@gmail.com> Content-Type: text/plain; charset=utf-8 Content-Language: fr Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-9.2 required=5.0 tests=BAYES_00, GIT_PATCH_0, KAM_DMARC_STATUS, NICE_REPLY_A, SPF_HELO_PASS, 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: Sat, 01 Aug 2020 14:53:47 -0000 This patch is also OK with these nits fixed. On 2020-07-23 3:35 p.m., Shahab Vahedi wrote: > diff --git a/gdb/arc-tdep.c b/gdb/arc-tdep.c > index 0c7e045e54b..59e698bb18b 100644 > --- a/gdb/arc-tdep.c > +++ b/gdb/arc-tdep.c > @@ -2006,6 +2006,35 @@ arc_check_tdesc_feature (struct tdesc_arch_data *tdesc_data, > return true; > } > > +/* Check for the existance of "lp_start" and "lp_end" in target description. > + If both are present, assume there is hardware loop support in the target. > + This can be improved by looking into "lpc_size" field of "isa_config" > + auxiliary register. */ > + > +static bool > +arc_check_for_hw_loops (const struct target_desc *tdesc, > + struct tdesc_arch_data *data) > +{ > + const auto feature_aux = tdesc_find_feature (tdesc, ARC_AUX_FEATURE_NAME); > + const auto *aux_regset = determine_aux_reg_feature_set (); To be consistent, I'd suggest using the star in both places or not use it in both places. > + > + if (feature_aux == nullptr || aux_regset == nullptr) > + return false; If a function (I'm thinking of determine_aux_reg_feature_set) can't (according to its contract) return nullptr, don't check for nullptr, that's: (1) unnecessary (2) confusing, since by reading this code my mind goes searching for a reason why determine_aux_reg_feature_set might return nullptr I suppose that tdesc_find_feature can return nullptr, if the feature is not present. > diff --git a/gdb/arc-tdep.h b/gdb/arc-tdep.h > index 6ca759a661d..e752348a262 100644 > --- a/gdb/arc-tdep.h > +++ b/gdb/arc-tdep.h > @@ -23,6 +23,7 @@ > > /* Need disassemble_info. */ > #include "dis-asm.h" > +#include "gdbarch.h" I suppose that adding this is correct, as this file uses some things from gdbarch.h. It's a change unrelated to the topic of this patch, so it's preferable to send it as a separate patch, with its own explanation. Simon