public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Luis Machado <luis.machado@arm.com>
To: Yvan Roux <yvan.roux@foss.st.com>, gdb-patches@sourceware.org
Cc: Torbjorn SVENSSON <torbjorn.svensson@st.com>
Subject: Re: [PATCH] gdb/arm: Simplify logic for updating addresses
Date: Tue, 7 Jun 2022 13:41:35 +0100	[thread overview]
Message-ID: <eba32f3c-dfc6-ee74-dbbf-f8c7a2c6b9ae@arm.com> (raw)
In-Reply-To: <20220602142100.GB23363@gnbcxd0114.gnb.st.com>

On 6/2/22 15:21, Yvan Roux wrote:
> Hi,
> 
> Small performance improvment by fetching the previous SP value only

improvment -> improvement

> once before the loop and reuse it to avoid fetching at every
> iteration.
> 
> Signed-off-by: Torbj�rn SVENSSON <torbjorn.svensson@st.com>
> Signed-off-by: Yvan Roux <yvan.roux@foss.st.com>
> ---
>   gdb/arm-tdep.c | 9 +++++----
>   1 file changed, 5 insertions(+), 4 deletions(-)
> 
> diff --git a/gdb/arm-tdep.c b/gdb/arm-tdep.c
> index 50ec41a66b1..23e3ad4a072 100644
> --- a/gdb/arm-tdep.c
> +++ b/gdb/arm-tdep.c
> @@ -2177,7 +2177,7 @@ arm_make_prologue_cache (struct frame_info *this_frame)
>   {
>     int reg;
>     struct arm_prologue_cache *cache;
> -  CORE_ADDR unwound_fp;
> +  CORE_ADDR unwound_fp, prev_sp;
>   
>     cache = FRAME_OBSTACK_ZALLOC (struct arm_prologue_cache);
>     arm_cache_init (cache, this_frame);
> @@ -2191,14 +2191,15 @@ arm_make_prologue_cache (struct frame_info *this_frame)
>     arm_gdbarch_tdep *tdep =
>       (arm_gdbarch_tdep *) gdbarch_tdep (get_frame_arch (this_frame));
>   
> -  arm_cache_set_active_sp_value (cache, tdep, unwound_fp + cache->framesize);
> +  prev_sp = unwound_fp + cache->framesize;
> +  arm_cache_set_active_sp_value (cache, tdep, prev_sp);
>   
>     /* Calculate actual addresses of saved registers using offsets
>        determined by arm_scan_prologue.  */
>     for (reg = 0; reg < gdbarch_num_regs (get_frame_arch (this_frame)); reg++)
>       if (cache->saved_regs[reg].is_addr ())
> -      cache->saved_regs[reg].set_addr (cache->saved_regs[reg].addr ()
> -				       + arm_cache_get_prev_sp_value (cache, tdep));
> +      cache->saved_regs[reg].set_addr (cache->saved_regs[reg].addr () +
> +				       prev_sp);
>   
>     return cache;
>   }

Thanks. This is OK.

      reply	other threads:[~2022-06-07 12:41 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-02 14:21 Yvan Roux
2022-06-07 12:41 ` Luis Machado [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=eba32f3c-dfc6-ee74-dbbf-f8c7a2c6b9ae@arm.com \
    --to=luis.machado@arm.com \
    --cc=gdb-patches@sourceware.org \
    --cc=torbjorn.svensson@st.com \
    --cc=yvan.roux@foss.st.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).