This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
timevar tweeks
- To: gcc-patches at gcc dot gnu dot org, rth at cygnus dot com
- Subject: timevar tweeks
- From: Jan Hubicka <jh at suse dot cz>
- Date: Thu, 18 Oct 2001 18:02:25 +0200
Hi,
this patch adds some new time variables, so the life analyzis time is measured.
The global life analyzis, for some purpose, appears to be considerably slower now
than it used to be in 3.0.x and it is often called 3 times instead of 2 times
because of optimize_for_mode_switching pass (used even without compilation), so
we need to handle the problem somewhat. For instance following is -O1 compilation
of loop.c:
garbage collection : 0.15 ( 2%) usr 0.00 ( 0%) sys 0.15 ( 2%) wall
cfg construction : 0.07 ( 1%) usr 0.00 ( 0%) sys 0.07 ( 1%) wall
cfg cleanup : 0.07 ( 1%) usr 0.00 ( 0%) sys 0.07 ( 1%) wall
life analyzis : 0.96 (15%) usr 0.06 (38%) sys 1.02 (16%) wall
life info update : 0.06 ( 1%) usr 0.03 (19%) sys 0.09 ( 1%) wall
parser : 0.60 (10%) usr 0.05 (31%) sys 0.65 (10%) wall
expand : 0.56 ( 9%) usr 0.00 ( 0%) sys 0.57 ( 9%) wall
jump : 0.10 ( 2%) usr 0.00 ( 0%) sys 0.10 ( 2%) wall
CSE : 0.53 ( 8%) usr 0.00 ( 0%) sys 0.53 ( 8%) wall
loop analysis : 0.11 ( 2%) usr 0.00 ( 0%) sys 0.11 ( 2%) wall
flow analysis : 0.09 ( 1%) usr 0.00 ( 0%) sys 0.09 ( 1%) wall
combiner : 0.59 ( 9%) usr 0.00 ( 0%) sys 0.59 ( 9%) wall
if-conversion : 0.04 ( 1%) usr 0.00 ( 0%) sys 0.04 ( 1%) wall
mode switching : 0.08 ( 1%) usr 0.00 ( 0%) sys 0.08 ( 1%) wall
local alloc : 0.41 ( 7%) usr 0.00 ( 0%) sys 0.41 ( 6%) wall
global alloc : 0.85 (14%) usr 0.01 ( 6%) sys 0.86 (13%) wall
reload CSE regs : 0.41 ( 7%) usr 0.00 ( 0%) sys 0.41 ( 6%) wall
flow 2 : 0.06 ( 1%) usr 0.00 ( 0%) sys 0.06 ( 1%) wall
if-conversion 2 : 0.01 ( 0%) usr 0.00 ( 0%) sys 0.01 ( 0%) wall
shorten branches : 0.06 ( 1%) usr 0.00 ( 0%) sys 0.06 ( 1%) wall
final : 0.18 ( 3%) usr 0.00 ( 0%) sys 0.18 ( 3%) wall
rest of compilation : 0.25 ( 4%) usr 0.00 ( 0%) sys 0.25 ( 4%) wall
TOTAL : 6.27 0.16 6.43
I've also added code to c-decl.c to measure RTL expansion time (that appears
to be bit too large too).
Honza
Thu Oct 18 18:56:31 CEST 2001 Jan Hubicka <jh@suse.cz>
* timevar.def (TV_LIFE, TV_LIFE_UPDATE, TV_MODE_SWITCH): new.
* flow.c (update_life_info): Measure time.
* c-decl.c: Include timevar.h
(c_expand_body): Measure time.
* toplev.c (rest_of_compilation): Measure time of mode switching
separately.
* Makefile.in (c-decl.o, cfgcleanup.o): Add dependancy.
*** timevar.def.old Thu Oct 18 18:24:10 2001
--- timevar.def Thu Oct 18 18:28:16 2001
*************** DEFTIMEVAR (TV_DUMP , "
*** 43,48 ****
--- 43,51 ----
DEFTIMEVAR (TV_CFG , "cfg construction")
/* Time spent by cleaning up CFG. */
DEFTIMEVAR (TV_CLEANUP_CFG , "cfg cleanup")
+ /* Time spent by life analyzis. */
+ DEFTIMEVAR (TV_LIFE , "life analyzis")
+ DEFTIMEVAR (TV_LIFE_UPDATE , "life info update")
/* Timing in various stages of the compiler. */
DEFTIMEVAR (TV_CPP , "preprocessing")
DEFTIMEVAR (TV_LEX , "lexical analysis")
*************** DEFTIMEVAR (TV_FLOW , "
*** 60,65 ****
--- 63,69 ----
DEFTIMEVAR (TV_COMBINE , "combiner")
DEFTIMEVAR (TV_IFCVT , "if-conversion")
DEFTIMEVAR (TV_REGMOVE , "regmove")
+ DEFTIMEVAR (TV_MODE_SWITCH , "mode switching")
DEFTIMEVAR (TV_SCHED , "scheduling")
DEFTIMEVAR (TV_LOCAL_ALLOC , "local alloc")
DEFTIMEVAR (TV_GLOBAL_ALLOC , "global alloc")
*** flow.c.oldtv Thu Oct 18 18:27:30 2001
--- flow.c Thu Oct 18 18:42:29 2001
*************** update_life_info (blocks, extent, prop_f
*** 629,634 ****
--- 629,637 ----
tmp = INITIALIZE_REG_SET (tmp_head);
+ timevar_push ((extent == UPDATE_LIFE_LOCAL || blocks)
+ ? TV_LIFE_UPDATE : TV_LIFE);
+
/* Changes to the CFG are only allowed when
doing a global update for the entire CFG. */
if ((prop_flags & PROP_ALLOW_CFG_CHANGES)
*************** update_life_info (blocks, extent, prop_f
*** 732,737 ****
--- 735,742 ----
}
});
}
+ timevar_pop ((extent == UPDATE_LIFE_LOCAL || blocks)
+ ? TV_LIFE_UPDATE : TV_LIFE);
}
/* Free the variables allocated by find_basic_blocks.
*** c-decl.c.oldt Thu Oct 18 18:41:24 2001
--- c-decl.c Thu Oct 18 18:42:54 2001
*************** Software Foundation, 59 Temple Place - S
*** 44,49 ****
--- 44,50 ----
#include "cpplib.h"
#include "target.h"
#include "debug.h"
+ #include "timevar.h"
/* In grokdeclarator, distinguish syntactic contexts of declarators. */
enum decl_context
*************** c_expand_body (fndecl, nested_p)
*** 6751,6756 ****
--- 6752,6759 ----
if (flag_syntax_only)
return;
+ timevar_push (TV_EXPAND);
+
if (flag_inline_trees)
{
/* First, cache whether the current function is inlinable. Some
*************** c_expand_body (fndecl, nested_p)
*** 6901,6906 ****
--- 6904,6910 ----
if (nested_p)
/* Return to the enclosing function. */
pop_function_context ();
+ timevar_pop (TV_EXPAND);
}
/* Check the declarations given in a for-loop for satisfying the C99
*** toplev.c.olda Wed Oct 17 18:14:27 2001
--- toplev.c Thu Oct 18 18:25:28 2001
*************** rest_of_compilation (decl)
*** 3387,3393 ****
register_life_up_to_date = 0;
#ifdef OPTIMIZE_MODE_SWITCHING
! timevar_push (TV_GCSE);
no_new_pseudos = 0;
if (optimize_mode_switching (NULL))
--- 3376,3382 ----
register_life_up_to_date = 0;
#ifdef OPTIMIZE_MODE_SWITCHING
! timevar_push (TV_MODE_SWITCH);
no_new_pseudos = 0;
if (optimize_mode_switching (NULL))
*************** rest_of_compilation (decl)
*** 3399,3405 ****
}
no_new_pseudos = 1;
! timevar_pop (TV_GCSE);
#endif
timevar_push (TV_SCHED);
--- 3388,3394 ----
}
no_new_pseudos = 1;
! timevar_pop (TV_MODE_SWITCH);
#endif
timevar_push (TV_SCHED);
*** Makefile.in.old Thu Oct 18 18:55:34 2001
--- Makefile.in Thu Oct 18 18:55:36 2001
*************** $(srcdir)/c-parse.y: c-parse.in
*** 1168,1174 ****
c-decl.o : c-decl.c $(CONFIG_H) $(SYSTEM_H) $(TREE_H) $(RTL_H) $(C_TREE_H) \
$(GGC_H) $(TARGET_H) c-lex.h flags.h function.h output.h $(EXPR_H) \
! debug.h toplev.h intl.h $(TM_P_H) tree-inline.h
c-typeck.o : c-typeck.c $(CONFIG_H) $(SYSTEM_H) $(TREE_H) $(C_TREE_H) \
$(TARGET_H) flags.h intl.h output.h $(EXPR_H) $(RTL_H) toplev.h $(TM_P_H)
c-lang.o : c-lang.c $(CONFIG_H) $(SYSTEM_H) $(TREE_H) $(C_TREE_H) \
--- 1168,1174 ----
c-decl.o : c-decl.c $(CONFIG_H) $(SYSTEM_H) $(TREE_H) $(RTL_H) $(C_TREE_H) \
$(GGC_H) $(TARGET_H) c-lex.h flags.h function.h output.h $(EXPR_H) \
! debug.h toplev.h intl.h $(TM_P_H) tree-inline.h $(TIMEVAR_H)
c-typeck.o : c-typeck.c $(CONFIG_H) $(SYSTEM_H) $(TREE_H) $(C_TREE_H) \
$(TARGET_H) flags.h intl.h output.h $(EXPR_H) $(RTL_H) toplev.h $(TM_P_H)
c-lang.o : c-lang.c $(CONFIG_H) $(SYSTEM_H) $(TREE_H) $(C_TREE_H) \
*************** cfganal.o : cfganal.c $(CONFIG_H) $(SYST
*** 1512,1518 ****
cfgbuild.o : cfgbuild.c $(CONFIG_H) $(SYSTEM_H) $(RTL_H) flags.h insn-config.h \
$(BASIC_BLOCK_H) $(REGS_H) hard-reg-set.h output.h toplev.h $(RECOG_H) \
function.h except.h $(GGC_H)
! cfgcleanup.o : cfgcleanup.c $(CONFIG_H) $(SYSTEM_H) $(RTL_H) \
$(BASIC_BLOCK_H) hard-reg-set.h output.h flags.h $(RECOG_H) toplev.h $(GGC_H)
cfgloop.o : cfgloop.c $(CONFIG_H) $(SYSTEM_H) $(RTL_H) \
$(BASIC_BLOCK_H) hard-reg-set.h
--- 1512,1518 ----
cfgbuild.o : cfgbuild.c $(CONFIG_H) $(SYSTEM_H) $(RTL_H) flags.h insn-config.h \
$(BASIC_BLOCK_H) $(REGS_H) hard-reg-set.h output.h toplev.h $(RECOG_H) \
function.h except.h $(GGC_H)
! cfgcleanup.o : cfgcleanup.c $(CONFIG_H) $(SYSTEM_H) $(RTL_H) $(TIMEVAR_H)\
$(BASIC_BLOCK_H) hard-reg-set.h output.h flags.h $(RECOG_H) toplev.h $(GGC_H)
cfgloop.o : cfgloop.c $(CONFIG_H) $(SYSTEM_H) $(RTL_H) \
$(BASIC_BLOCK_H) hard-reg-set.h