Changes: Stefan Ring
Christian Thalinger
- $Id: reg.inc 1753 2004-12-13 08:40:16Z twisti $
+ $Id: reg.inc 1954 2005-02-17 19:47:23Z christian $
*/
}
+#ifdef STATISTICS
+void reg_make_statistics( methodinfo *m, codegendata *cd, registerdata *rd) {
+ int i,type;
+ s4 len;
+ stackptr src, src_old;
+ stackptr dst;
+ instruction *iptr;
+ basicblock *bptr;
+ int size_interface; /* == maximum size of in/out stack at basic block boundaries */
+ bool in_register;
+
+ in_register = true;
+
+ size_interface = 0;
+
+ /* count how many local variables are held in memory or register */
+ for(i=0; i < cd->maxlocals; i++)
+ for (type=0; type <=4; type++)
+ if (rd->locals[i][type].type != -1) { /* valid local */
+ if (rd->locals[i][type].flags & INMEMORY) {
+ count_locals_spilled++;
+ in_register=false;
+ }
+ else
+ count_locals_register++;
+ }
+ /* count how many stack slots are held in memory or register */
+
+ bptr = m->basicblocks;
+ while (bptr != NULL) {
+ if (bptr->flags >= BBREACHED) {
+
+#ifdef LSRA
+ if (!opt_lsra) {
+#endif
+ /* check for memory moves from interface to BB instack */
+ dst = bptr->instack;
+ len = bptr->indepth;
+
+ if (len > size_interface) size_interface = len;
+
+ while (dst != NULL) {
+ len--;
+ if (dst->varkind != STACKVAR) {
+ if ( (dst->flags & INMEMORY) ||
+ (rd->interfaces[len][dst->type].flags & INMEMORY) ||
+ ( (dst->flags & INMEMORY) &&
+ (rd->interfaces[len][dst->type].flags & INMEMORY) &&
+ (dst->regoff != rd->interfaces[len][dst->type].regoff) ))
+ {
+ /* one in memory or both inmemory at different offsets */
+ count_mem_move_bb++;
+ in_register=false;
+ }
+ }
+
+ dst = dst->prev;
+ }
+
+ /* check for memory moves from BB outstack to interface */
+ dst = bptr->outstack;
+ len = bptr->outdepth;
+ if (len > size_interface) size_interface = len;
+
+ while (dst) {
+ len--;
+ if (dst->varkind != STACKVAR) {
+ if ( (dst->flags & INMEMORY) || \
+ (rd->interfaces[len][dst->type].flags & INMEMORY) || \
+ ( (dst->flags & INMEMORY) && \
+ (rd->interfaces[len][dst->type].flags & INMEMORY) && \
+ (dst->regoff != rd->interfaces[len][dst->type].regoff) ))
+ {
+ /* one in memory or both inmemory at different offsets */
+ count_mem_move_bb++;
+ in_register=false;
+ }
+ }
+
+ dst = dst->prev;
+ }
+#ifdef LSRA
+ }
+#endif
+
+
+ dst = bptr->instack;
+ iptr = bptr->iinstr;
+ len = bptr->icount;
+ src_old = NULL;
+
+ while (--len >= 0) {
+ src = dst;
+ dst = iptr->dst;
+
+ if ((src!= NULL) && (src != src_old)) { /* new stackslot */
+ switch (src->varkind) {
+ case TEMPVAR:
+ case STACKVAR:
+ if (!(src->flags & INMEMORY))
+ count_ss_register++;
+ else {
+ count_ss_spilled++;
+ in_register=false;
+ }
+ break;
+ /* case LOCALVAR: */
+ /* if (!(rd->locals[src->varnum][src->type].flags & INMEMORY)) */
+ /* count_ss_register++; */
+ /* else */
+ /* count_ss_spilled++; */
+ /* break; */
+ case ARGVAR:
+ if (!(src->flags & INMEMORY))
+ count_argument_mem_ss++;
+ else
+ count_argument_reg_ss++;
+ break;
+
+
+ /* if (IS_FLT_DBL_TYPE(src->type)) { */
+ /* if (src->varnum < FLT_ARG_CNT) { */
+ /* count_ss_register++; */
+ /* break; */
+ /* } */
+ /* } else { */
+ /* #if defined(__POWERPC__) */
+ /* if (src->varnum < INT_ARG_CNT - (IS_2_WORD_TYPE(src->type) != 0)) { */
+ /* #else */
+ /* if (src->varnum < INT_ARG_CNT) { */
+ /* #endif */
+ /* count_ss_register++; */
+ /* break; */
+ /* } */
+ /* } */
+ /* count_ss_spilled++; */
+ /* break; */
+ }
+ }
+ src_old = src;
+
+ iptr++;
+ } /* while instructions */
+ } /* if */
+ bptr = bptr->next;
+ } /* while blocks */
+ count_interface_size += size_interface; /* accummulate the size of the interface (between bb boundaries) */
+ if (in_register) count_method_in_register++;
+}
+#endif
/*
* These are local overrides for various environment variables in Emacs.
* Please do not remove this and leave it at the end of the file, where
Authors: Christian Thalinger
- $Id: statistics.c 1953 2005-02-17 13:42:23Z christian $
+ $Id: statistics.c 1954 2005-02-17 19:47:23Z christian $
*/
int count_ss_register = 0;
int count_methods_allocated_by_lsra = 0;
int count_mem_move_bb = 0;
+int count_interface_size = 0;
+int count_argument_mem_ss = 0;
+int count_argument_reg_ss = 0;
+int count_method_in_register = 0;
int count_jit_calls = 0;
int count_methods = 0;
log_text(logtext);
sprintf(logtext, "Stackslots held in Registers: %6d",count_ss_register );
log_text(logtext);
- sprintf(logtext, "Memory moves at BB Boundaries: %6d\n\n",count_mem_move_bb );
+ sprintf(logtext, "Memory moves at BB Boundaries: %6d",count_mem_move_bb );
+ log_text(logtext);
+ sprintf(logtext, "Number of interface slots: %6d\n\n",count_interface_size );
+ log_text(logtext);
+ sprintf(logtext, "Number of Argument stack slots in register: %6d",count_argument_reg_ss );
+ log_text(logtext);
+ sprintf(logtext, "Number of Argument stack slots in memory: %6d\n\n",count_argument_mem_ss );
+ log_text(logtext);
+ sprintf(logtext, "Number of Methods kept in registers: %6d\n\n",count_method_in_register );
log_text(logtext);
}
Authors: Christian Thalinger
- $Id: statistics.h 1953 2005-02-17 13:42:23Z christian $
+ $Id: statistics.h 1954 2005-02-17 19:47:23Z christian $
*/
extern int count_ss_register;
extern int count_methods_allocated_by_lsra;
extern int count_mem_move_bb;
+extern int count_interface_size;
+extern int count_argument_mem_ss;
+extern int count_argument_reg_ss;
+extern int count_method_in_register;
extern int count_jit_calls;
extern int count_methods;