This is the mail archive of the gdb-patches@sources.redhat.com mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [RFA/mips] Remove mips16 code that seems redundant


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]