This is the mail archive of the gcc-patches@gcc.gnu.org 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]

Add statistics code to RTL generators


Hi,
currently the gen_rtx_fmt_* are output as sources of all memory
allocated by RTL.  This makes it a bit dificult to trace down where the
memory is comming from.  This patch adds necesary instrumentation
to gengenrtl.  Bootstrapped/regtested i686-linux, OK?

:ADDPATCH middle-end:

Honza

2006-08-02  Jan Hubicka  <jh@suse.cz>
	* gengenrtl.c (gendecl, gendef): Output the gens annotated for
	statistics.
	(genheader): Include statistics.h.
Index: gengenrtl.c
===================================================================
*** gengenrtl.c	(revision 115838)
--- gengenrtl.c	(working copy)
*************** gendecl (const char *format)
*** 191,197 ****
    const char *p;
    int i, pos;
  
!   printf ("extern rtx gen_rtx_fmt_%s\t (RTX_CODE, ", format);
    printf ("enum machine_mode mode");
  
    /* Write each parameter that is needed and start a new line when the line
--- 191,197 ----
    const char *p;
    int i, pos;
  
!   printf ("extern rtx gen_rtx_fmt_%s_stat\t (RTX_CODE, ", format);
    printf ("enum machine_mode mode");
  
    /* Write each parameter that is needed and start a new line when the line
*************** gendecl (const char *format)
*** 208,215 ****
--- 208,225 ----
  	printf (" %sarg%d", type_from_format (*p), i++);
  	pos += ourlen;
        }
+   printf (" MEM_STAT_DECL");
  
    printf (");\n");
+   printf ("#define gen_rtx_fmt_%s(c, m", format);
+   for (p = format, i = 0; *p != 0; p++)
+     if (*p != '0')
+       printf (", p%i",i++);
+   printf (")\\\n        gen_rtx_fmt_%s_stat (c, m", format);
+   for (p = format, i = 0; *p != 0; p++)
+     if (*p != '0')
+       printf (", p%i",i++);
+   printf (" MEM_STAT_INFO)\n\n");
  }
  
  /* Generate macros to generate RTL of code IDX using the functions we
*************** gendef (const char *format)
*** 257,274 ****
    /* Start by writing the definition of the function name and the types
       of the arguments.  */
  
!   printf ("rtx\ngen_rtx_fmt_%s (RTX_CODE code, enum machine_mode mode", format);
    for (p = format, i = 0; *p != 0; p++)
      if (*p != '0')
        printf (",\n\t%sarg%d", type_from_format (*p), i++);
  
!   puts (")");
  
    /* Now write out the body of the function itself, which allocates
       the memory and initializes it.  */
    puts ("{");
    puts ("  rtx rt;");
!   puts ("  rt = rtx_alloc (code);\n");
  
    puts ("  PUT_MODE (rt, mode);");
  
--- 267,284 ----
    /* Start by writing the definition of the function name and the types
       of the arguments.  */
  
!   printf ("rtx\ngen_rtx_fmt_%s_stat (RTX_CODE code, enum machine_mode mode", format);
    for (p = format, i = 0; *p != 0; p++)
      if (*p != '0')
        printf (",\n\t%sarg%d", type_from_format (*p), i++);
  
!   puts (" MEM_STAT_DECL)");
  
    /* Now write out the body of the function itself, which allocates
       the memory and initializes it.  */
    puts ("{");
    puts ("  rtx rt;");
!   puts ("  rt = rtx_alloc_stat (code PASS_MEM_STAT);\n");
  
    puts ("  PUT_MODE (rt, mode);");
  
*************** genheader (void)
*** 299,304 ****
--- 309,315 ----
  
    puts ("#ifndef GCC_GENRTL_H");
    puts ("#define GCC_GENRTL_H\n");
+   puts ("#include \"statistics.h\"\n");
  
    for (fmt = formats; *fmt; ++fmt)
      gendecl (*fmt);


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