Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Andrew Cagney <cagney@gnu.org>
To: Joel Brobecker <brobecker@gnat.com>
Cc: gdb-patches@sources.redhat.com
Subject: Re: [RFA/mips] Remove mips16 code that seems redundant
Date: Mon, 11 Oct 2004 01:35:00 -0000	[thread overview]
Message-ID: <4169E35C.2050007@gnu.org> (raw)
In-Reply-To: <20041011011652.GW26446@gnat.com>

This?


   /* The entry instruction is typically the first instruction in a 
function,
      and it stores registers at offsets relative to the value of the old SP
      (before the prologue).  But the value of the sp parameter to this
      function is the new SP (after the prologue has been executed).  So we
      can't calculate those offsets until we've seen the entire prologue,
      and can calculate what the old SP must have been. */
   if (entry_inst != 0)
     {
       int areg_count = (entry_inst >> 8) & 7;
       int sreg_count = (entry_inst >> 6) & 3;

       /* The entry instruction always subtracts 32 from the SP.  */
       PROC_FRAME_OFFSET (&temp_proc_desc) += 32;

       /* Now we can calculate what the SP must have been at the
          start of the function prologue.  */
       sp += PROC_FRAME_OFFSET (&temp_proc_desc);

       /* Check if a0-a3 were saved in the caller's argument save area.  */
       for (reg = 4, offset = 0; reg < areg_count + 4; reg++)
         {
           PROC_REG_MASK (&temp_proc_desc) |= 1 << reg;
           set_reg_offset (this_cache, reg, sp + offset);
           offset += mips_abi_regsize (current_gdbarch);
         }

       /* Check if the ra register was pushed on the stack.  */
       offset = -4;
       if (entry_inst & 0x20)
         {
           PROC_REG_MASK (&temp_proc_desc) |= 1 << RA_REGNUM;
           set_reg_offset (this_cache, RA_REGNUM, sp + offset);
           offset -= mips_abi_regsize (current_gdbarch);
         }

       /* Check if the s0 and s1 registers were pushed on the stack.  */
       for (reg = 16; reg < sreg_count + 16; reg++)
         {
           PROC_REG_MASK (&temp_proc_desc) |= 1 << reg;
           set_reg_offset (this_cache, reg, sp + offset);
           offset -= mips_abi_regsize (current_gdbarch);
         }
     }

yes, the code should have only one loop.

Andrew


  reply	other threads:[~2004-10-11  1:35 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-10-11  1:16 Joel Brobecker
2004-10-11  1:35 ` Andrew Cagney [this message]
2004-10-11  1:39   ` Joel Brobecker
2004-10-11  1:59     ` Andrew Cagney
2004-10-11  2:28       ` Joel Brobecker

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=4169E35C.2050007@gnu.org \
    --to=cagney@gnu.org \
    --cc=brobecker@gnat.com \
    --cc=gdb-patches@sources.redhat.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