This is the mail archive of the mailing list for the GCC 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]

Mips profiling

I've been looking at the following chunk of code from gcc/config/mips/mips.h
and something is puzzling me.  The bit about 'mcount pops 2 words from
stack' seems wrong.  I believe the first four arguments to a function in
mips will be passed in registers and the stack won't be involved.  If I read
this correctly, we're leaking 8 bytes of stack memory per function call.
The other question would be 'why don't we have something in the branch delay
slot of jal _mcount'?  Wouldn't this cause problems depending on what this
code was inserted before?  Or did removing the '.set noreorder' which used
to be in front of '.set noat' take care of this?



/* Output assembler code to FILE to increment profiler label # LABELNO
   for profiling a function entry.  */

{         \
  if (TARGET_MIPS16)       \
    sorry ("mips16 function profiling");    \
  fprintf (FILE, "\t.set\tnoat\n");     \
  fprintf (FILE, "\tmove\t%s,%s\t\t# save current return address\n", \
    reg_names[GP_REG_FIRST + 1], reg_names[GP_REG_FIRST + 31]); \
  fprintf (FILE,       \
    "\t%s\t%s,%s,%d\t\t# _mcount pops 2 words from  stack\n", \
    TARGET_64BIT ? "dsubu" : "subu",    \
    reg_names[STACK_POINTER_REGNUM],    \
    reg_names[STACK_POINTER_REGNUM],    \
    Pmode == DImode ? 16 : 8);     \
  fprintf (FILE, "\tjal\t_mcount\n");                                   \
  fprintf (FILE, "\t.set\tat\n");     \

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