diff options
-rw-r--r-- | bootstrap.conf | 1 | ||||
-rw-r--r-- | configure.ac | 2 | ||||
m--------- | gnulib | 0 | ||||
-rw-r--r-- | lib/.gitignore | 2 | ||||
-rw-r--r-- | lib/timevar.c | 451 | ||||
-rw-r--r-- | lib/timevar.def | 40 | ||||
-rw-r--r-- | lib/timevar.h | 123 | ||||
-rw-r--r-- | m4/.gitignore | 1 | ||||
-rw-r--r-- | m4/timevar.m4 | 60 | ||||
-rw-r--r-- | src/ielr.c | 28 | ||||
-rw-r--r-- | src/main.c | 52 | ||||
-rw-r--r-- | src/output.c | 4 |
12 files changed, 67 insertions, 697 deletions
diff --git a/bootstrap.conf b/bootstrap.conf index 7c436a59..448ad91c 100644 --- a/bootstrap.conf +++ b/bootstrap.conf @@ -35,6 +35,7 @@ gnulib_modules=' readme-release realloc-posix spawn-pipe stdbool stpcpy strdup-posix strerror strverscmp + timevar unistd unistd-safer unlink unlocked-io update-copyright unsetenv verify warnings diff --git a/configure.ac b/configure.ac index 28639408..f081f822 100644 --- a/configure.ac +++ b/configure.ac @@ -219,7 +219,7 @@ gl_INIT # Checks for library functions. AC_CHECK_FUNCS_ONCE([setlocale]) AM_WITH_DMALLOC -BISON_PREREQ_TIMEVAR +gl_TIMEVAR # Gettext. # We use gnulib, which is only guaranteed to work properly with the diff --git a/gnulib b/gnulib -Subproject 0782fa4dc036a709d5501a8712c5331489c28be +Subproject fb63c8672e829296e1aa5d67fc8320f6dcb5099 diff --git a/lib/.gitignore b/lib/.gitignore index 39d86665..8a463ad8 100644 --- a/lib/.gitignore +++ b/lib/.gitignore @@ -273,3 +273,5 @@ /xstrndup.h /stat-time.c /stat-time.h +/timevar.c +/timevar.h diff --git a/lib/timevar.c b/lib/timevar.c deleted file mode 100644 index 0cf32641..00000000 --- a/lib/timevar.c +++ /dev/null @@ -1,451 +0,0 @@ -/* Timing variables for measuring compiler performance. - - Copyright (C) 2000, 2002, 2004, 2006, 2009-2015, 2018 Free Software - Foundation, Inc. - - Contributed by Alex Samuel <samuel@codesourcery.com> - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ - -#include <config.h> - -/* This source file was taken from the GCC source code. */ - -#include "../src/system.h" -#if HAVE_SYS_TIME_H -# include <sys/time.h> -#endif - -#ifdef HAVE_SYS_TIMES_H -# include <sys/times.h> -#endif -#ifdef HAVE_SYS_RESOURCE_H -# include <sys/resource.h> -#endif - -#ifndef HAVE_CLOCK_T -typedef int clock_t; -#endif - -#ifndef HAVE_STRUCT_TMS -struct tms -{ - clock_t tms_utime; - clock_t tms_stime; - clock_t tms_cutime; - clock_t tms_cstime; -}; -#endif - -/* Calculation of scale factor to convert ticks to microseconds. - We mustn't use CLOCKS_PER_SEC except with clock(). */ -#if HAVE_SYSCONF && defined _SC_CLK_TCK -# define TICKS_PER_SECOND sysconf (_SC_CLK_TCK) /* POSIX 1003.1-1996 */ -#elif defined CLK_TCK -# define TICKS_PER_SECOND CLK_TCK /* POSIX 1003.1-1988; obsolescent */ -#elif defined HZ -# define TICKS_PER_SECOND HZ /* traditional UNIX */ -#else -# define TICKS_PER_SECOND 100 /* often the correct value */ -#endif - -/* Prefer times to getrusage to clock (each gives successively less - information). */ -#if defined HAVE_TIMES -# define USE_TIMES -# define HAVE_USER_TIME -# define HAVE_SYS_TIME -# define HAVE_WALL_TIME -#elif defined HAVE_GETRUSAGE -# define USE_GETRUSAGE -# define HAVE_USER_TIME -# define HAVE_SYS_TIME -#elif defined HAVE_CLOCK -# define USE_CLOCK -# define HAVE_USER_TIME -#endif - -#if defined USE_TIMES && !defined HAVE_DECL_TIMES -clock_t times (struct tms *); -#elif defined USE_GETRUSAGE && !defined HAVE_DECL_GETRUSAGE -int getrusage (int, struct rusage *); -#elif defined USE_CLOCK && !defined HAVE_DECL_CLOCK -clock_t clock (void); -#endif - -/* libc is very likely to have snuck a call to sysconf() into one of - the underlying constants, and that can be very slow, so we have to - precompute them. Whose wonderful idea was it to make all those - _constants_ variable at run time, anyway? */ -#ifdef USE_TIMES -static float ticks_to_msec; -# define TICKS_TO_MSEC (1.0 / TICKS_PER_SECOND) -#elif defined USE_CLOCK -static float clocks_to_msec; -# define CLOCKS_TO_MSEC (1.0 / CLOCKS_PER_SEC) -#endif - -#include "timevar.h" - -/* See timevar.h for an explanation of timing variables. */ - -int timevar_enabled = 0; - -/* A timing variable. */ - -struct timevar_def -{ - /* Elapsed time for this variable. */ - struct timevar_time_def elapsed; - - /* If this variable is timed independently of the timing stack, - using timevar_start, this contains the start time. */ - struct timevar_time_def start_time; - - /* The name of this timing variable. */ - const char *name; - - /* Non-zero if this timing variable is running as a standalone - timer. */ - unsigned standalone : 1; - - /* Non-zero if this timing variable was ever started or pushed onto - the timing stack. */ - unsigned used : 1; -}; - -/* An element on the timing stack. Elapsed time is attributed to the - topmost timing variable on the stack. */ - -struct timevar_stack_def -{ - /* The timing variable at this stack level. */ - struct timevar_def *timevar; - - /* The next lower timing variable context in the stack. */ - struct timevar_stack_def *next; -}; - -/* Declared timing variables. Constructed from the contents of - timevar.def. */ -static struct timevar_def timevars[TIMEVAR_LAST]; - -/* The top of the timing stack. */ -static struct timevar_stack_def *stack; - -/* A list of unused (i.e. allocated and subsequently popped) - timevar_stack_def instances. */ -static struct timevar_stack_def *unused_stack_instances; - -/* The time at which the topmost element on the timing stack was - pushed. Time elapsed since then is attributed to the topmost - element. */ -static struct timevar_time_def start_time; - -/* Fill the current times into TIME. The definition of this function - also defines any or all of the HAVE_USER_TIME, HAVE_SYS_TIME, and - HAVE_WALL_TIME macros. */ - -static void -set_to_current_time (struct timevar_time_def *now) -{ - now->user = 0; - now->sys = 0; - now->wall = 0; - - if (!timevar_enabled) - return; - - { -#ifdef USE_TIMES - struct tms tms; - now->wall = times (&tms) * ticks_to_msec; - now->user = (tms.tms_utime + tms.tms_cutime) * ticks_to_msec; - now->sys = (tms.tms_stime + tms.tms_cstime) * ticks_to_msec; -#elif defined USE_GETRUSAGE - struct rusage rusage; - getrusage (RUSAGE_CHILDREN, &rusage); - now->user = rusage.ru_utime.tv_sec + rusage.ru_utime.tv_usec * 1e-6; - now->sys = rusage.ru_stime.tv_sec + rusage.ru_stime.tv_usec * 1e-6; -#elif defined USE_CLOCK - now->user = clock () * clocks_to_msec; -#endif - } -} - -/* Return the current time. */ - -static struct timevar_time_def -get_current_time (void) -{ - struct timevar_time_def now; - set_to_current_time (&now); - return now; -} - -/* Add the difference between STOP and START to TIMER. */ - -static void -timevar_accumulate (struct timevar_time_def *timer, - const struct timevar_time_def *start, - const struct timevar_time_def *stop) -{ - timer->user += stop->user - start->user; - timer->sys += stop->sys - start->sys; - timer->wall += stop->wall - start->wall; -} - -void -timevar_init () -{ - if (!timevar_enabled) - return; - - /* Zero all elapsed times. */ - memset ((void *) timevars, 0, sizeof (timevars)); - - /* Initialize the names of timing variables. */ -#define DEFTIMEVAR(identifier__, name__) \ - timevars[identifier__].name = name__; -#include "timevar.def" -#undef DEFTIMEVAR - -#if defined USE_TIMES - ticks_to_msec = TICKS_TO_MSEC; -#elif defined USE_CLOCK - clocks_to_msec = CLOCKS_TO_MSEC; -#endif -} - -void -timevar_push (timevar_id_t timevar) -{ - if (!timevar_enabled) - return; - - struct timevar_def *tv = &timevars[timevar]; - - /* Mark this timing variable as used. */ - tv->used = 1; - - /* Can't push a standalone timer. */ - if (tv->standalone) - abort (); - - /* What time is it? */ - struct timevar_time_def const now = get_current_time (); - - /* If the stack isn't empty, attribute the current elapsed time to - the old topmost element. */ - if (stack) - timevar_accumulate (&stack->timevar->elapsed, &start_time, &now); - - /* Reset the start time; from now on, time is attributed to - TIMEVAR. */ - start_time = now; - - /* See if we have a previously-allocated stack instance. If so, - take it off the list. If not, malloc a new one. */ - struct timevar_stack_def *context = NULL; - if (unused_stack_instances != NULL) - { - context = unused_stack_instances; - unused_stack_instances = unused_stack_instances->next; - } - else - context = (struct timevar_stack_def *) - xmalloc (sizeof (struct timevar_stack_def)); - - /* Fill it in and put it on the stack. */ - context->timevar = tv; - context->next = stack; - stack = context; -} - -void -timevar_pop (timevar_id_t timevar) -{ - if (!timevar_enabled) - return; - - if (&timevars[timevar] != stack->timevar) - abort (); - - /* What time is it? */ - struct timevar_time_def const now = get_current_time (); - - /* Attribute the elapsed time to the element we're popping. */ - struct timevar_stack_def *popped = stack; - timevar_accumulate (&popped->timevar->elapsed, &start_time, &now); - - /* Reset the start time; from now on, time is attributed to the - element just exposed on the stack. */ - start_time = now; - - /* Take the item off the stack. */ - stack = stack->next; - - /* Don't delete the stack element; instead, add it to the list of - unused elements for later use. */ - popped->next = unused_stack_instances; - unused_stack_instances = popped; -} - -void -timevar_start (timevar_id_t timevar) -{ - if (!timevar_enabled) - return; - - struct timevar_def *tv = &timevars[timevar]; - - /* Mark this timing variable as used. */ - tv->used = 1; - - /* Don't allow the same timing variable to be started more than - once. */ - if (tv->standalone) - abort (); - tv->standalone = 1; - - set_to_current_time (&tv->start_time); -} - -void -timevar_stop (timevar_id_t timevar) -{ - if (!timevar_enabled) - return; - - struct timevar_def *tv = &timevars[timevar]; - - /* TIMEVAR must have been started via timevar_start. */ - if (!tv->standalone) - abort (); - - struct timevar_time_def const now = get_current_time (); - timevar_accumulate (&tv->elapsed, &tv->start_time, &now); -} - -void -timevar_get (timevar_id_t timevar, - struct timevar_time_def *elapsed) -{ - struct timevar_def *tv = &timevars[timevar]; - *elapsed = tv->elapsed; - - /* Is TIMEVAR currently running as a standalone timer? */ - if (tv->standalone) - { - struct timevar_time_def const now = get_current_time (); - timevar_accumulate (elapsed, &tv->start_time, &now); - } - /* Or is TIMEVAR at the top of the timer stack? */ - else if (stack->timevar == tv) - { - struct timevar_time_def const now = get_current_time (); - timevar_accumulate (elapsed, &start_time, &now); - } -} - -void -timevar_print (FILE *fp) -{ - /* Only print stuff if we have some sort of time information. */ -#if defined HAVE_USER_TIME || defined HAVE_SYS_TIME || defined HAVE_WALL_TIME - if (!timevar_enabled) - return; - - /* Update timing information in case we're calling this from GDB. */ - - if (fp == 0) - fp = stderr; - - /* What time is it? */ - struct timevar_time_def const now = get_current_time (); - - /* If the stack isn't empty, attribute the current elapsed time to - the old topmost element. */ - if (stack) - timevar_accumulate (&stack->timevar->elapsed, &start_time, &now); - - /* Reset the start time; from now on, time is attributed to - TIMEVAR. */ - start_time = now; - - struct timevar_time_def const* total = &timevars[TV_TOTAL].elapsed; - - fputs (_("\nExecution times (seconds)\n"), fp); - for (unsigned /* timevar_id_t */ id = 0; id < (unsigned) TIMEVAR_LAST; ++id) - { - struct timevar_def *tv = &timevars[(timevar_id_t) id]; - const float tiny = 5e-3; - - /* Don't print the total execution time here; that goes at the - end. */ - if ((timevar_id_t) id == TV_TOTAL) - continue; - - /* Don't print timing variables that were never used. */ - if (!tv->used) - continue; - - /* Don't print timing variables if we're going to get a row of - zeroes. */ - if (tv->elapsed.user < tiny - && tv->elapsed.sys < tiny - && tv->elapsed.wall < tiny) - continue; - - /* The timing variable name. */ - fprintf (fp, " %-22s:", tv->name); - -# ifdef HAVE_USER_TIME - /* Print user-mode time for this process. */ - fprintf (fp, "%7.2f (%2.0f%%) usr", - tv->elapsed.user, - (total->user == 0 ? 0 : tv->elapsed.user / total->user) * 100); -# endif - -# ifdef HAVE_SYS_TIME - /* Print system-mode time for this process. */ - fprintf (fp, "%7.2f (%2.0f%%) sys", - tv->elapsed.sys, - (total->sys == 0 ? 0 : tv->elapsed.sys / total->sys) * 100); -# endif - -# ifdef HAVE_WALL_TIME - /* Print wall clock time elapsed. */ - fprintf (fp, "%7.2f (%2.0f%%) wall", - tv->elapsed.wall, - (total->wall == 0 ? 0 : tv->elapsed.wall / total->wall) * 100); -# endif - - putc ('\n', fp); - } - - /* Print total time. */ - fputs (_(" TOTAL :"), fp); -#ifdef HAVE_USER_TIME - fprintf (fp, "%7.2f ", total->user); -#endif -#ifdef HAVE_SYS_TIME - fprintf (fp, "%7.2f ", total->sys); -#endif -#ifdef HAVE_WALL_TIME - fprintf (fp, "%7.2f\n", total->wall); -#endif - -#endif /* defined HAVE_USER_TIME || defined HAVE_SYS_TIME || defined HAVE_WALL_TIME */ -} diff --git a/lib/timevar.def b/lib/timevar.def index 01eaba70..37fc6f8e 100644 --- a/lib/timevar.def +++ b/lib/timevar.def @@ -32,31 +32,31 @@ variable, and NAME is a character string describing its purpose. */ /* The total execution time. */ -DEFTIMEVAR (TV_TOTAL , "total time") +DEFTIMEVAR (tv_total , "total time") /* Time spent in the reader. */ -DEFTIMEVAR (TV_READER , "reader") -DEFTIMEVAR (TV_SCANNING , "scanner") -DEFTIMEVAR (TV_PARSING , "parser") +DEFTIMEVAR (tv_reader , "reader") +DEFTIMEVAR (tv_scanning , "scanner") +DEFTIMEVAR (tv_parsing , "parser") /* Time spent handling the grammar. */ -DEFTIMEVAR (TV_REDUCE , "reducing the grammar") -DEFTIMEVAR (TV_SETS , "computing the sets") -DEFTIMEVAR (TV_LR0 , "LR(0)") -DEFTIMEVAR (TV_LALR , "LALR(1)") -DEFTIMEVAR (TV_IELR_PHASE1 , "IELR(1) Phase 1") -DEFTIMEVAR (TV_IELR_PHASE2 , "IELR(1) Phase 2") -DEFTIMEVAR (TV_IELR_PHASE3 , "IELR(1) Phase 3") -DEFTIMEVAR (TV_IELR_PHASE4 , "IELR(1) Phase 4") -DEFTIMEVAR (TV_CONFLICTS , "conflicts") +DEFTIMEVAR (tv_reduce , "reducing the grammar") +DEFTIMEVAR (tv_sets , "computing the sets") +DEFTIMEVAR (tv_lr0 , "LR(0)") +DEFTIMEVAR (tv_lalr , "LALR(1)") +DEFTIMEVAR (tv_ielr_phase1 , "IELR(1) Phase 1") +DEFTIMEVAR (tv_ielr_phase2 , "IELR(1) Phase 2") +DEFTIMEVAR (tv_ielr_phase3 , "IELR(1) Phase 3") +DEFTIMEVAR (tv_ielr_phase4 , "IELR(1) Phase 4") +DEFTIMEVAR (tv_conflicts , "conflicts") /* Time spent outputing results. */ -DEFTIMEVAR (TV_REPORT , "outputing report") -DEFTIMEVAR (TV_GRAPH , "outputing graph") -DEFTIMEVAR (TV_XML , "outputing xml") -DEFTIMEVAR (TV_ACTIONS , "parser action tables") -DEFTIMEVAR (TV_PARSER , "outputing parser") -DEFTIMEVAR (TV_M4 , "running m4") +DEFTIMEVAR (tv_report , "outputing report") +DEFTIMEVAR (tv_graph , "outputing graph") +DEFTIMEVAR (tv_xml , "outputing xml") +DEFTIMEVAR (tv_actions , "parser action tables") +DEFTIMEVAR (tv_parser , "outputing parser") +DEFTIMEVAR (tv_m4 , "running m4") /* Time spent by freeing the memory :). */ -DEFTIMEVAR (TV_FREE , "freeing") +DEFTIMEVAR (tv_free , "freeing") diff --git a/lib/timevar.h b/lib/timevar.h deleted file mode 100644 index a3c4e864..00000000 --- a/lib/timevar.h +++ /dev/null @@ -1,123 +0,0 @@ -/* Timing variables for measuring compiler performance. - - Copyright (C) 2000, 2002, 2004, 2009-2015, 2018 Free Software - Foundation, Inc. - - Contributed by Alex Samuel <samuel@codesourcery.com> - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ - -#ifndef _TIMEVAR_H -#define _TIMEVAR_H - -/* Timing variables are used to measure elapsed time in various - portions of the compiler. Each measures elapsed user, system, and - wall-clock time, as appropriate to and supported by the host - system. - - Timing variables are defined using the DEFTIMEVAR macro in - timevar.def. Each has an enumeral identifier, used when referring - to the timing variable in code, and a character string name. - - Timing variables can be used in two ways: - - - On the timing stack, using timevar_push and timevar_pop. - Timing variables may be pushed onto the stack; elapsed time is - attributed to the topmost timing variable on the stack. When - another variable is pushed on, the previous topmost variable is - 'paused' until the pushed variable is popped back off. - - - As a standalone timer, using timevar_start and timevar_stop. - All time elapsed between the two calls is attributed to the - variable. -*/ - -/* This structure stores the various varieties of time that can be - measured. Times are stored in seconds. The time may be an - absolute time or a time difference; in the former case, the time - base is undefined, except that the difference between two times - produces a valid time difference. */ - -struct timevar_time_def -{ - /* User time in this process. */ - float user; - - /* System time (if applicable for this host platform) in this - process. */ - float sys; - - /* Wall clock time. */ - float wall; -}; - -/* An enumeration of timing variable identifiers. Constructed from - the contents of timevar.def. */ - -#define DEFTIMEVAR(identifier__, name__) \ - identifier__, -typedef enum -{ -#include "timevar.def" - TIMEVAR_LAST -} -timevar_id_t; -#undef DEFTIMEVAR - -/* Initialize timing variables. */ - -void timevar_init (void); - -/* Push TIMEVAR onto the timing stack. No further elapsed time is - attributed to the previous topmost timing variable on the stack; - subsequent elapsed time is attributed to TIMEVAR, until it is - popped or another element is pushed on top. - - TIMEVAR cannot be running as a standalone timer. */ - -void timevar_push (timevar_id_t); - -/* Pop the topmost timing variable element off the timing stack. The - popped variable must be TIMEVAR. Elapsed time since the that - element was pushed on, or since it was last exposed on top of the - stack when the element above it was popped off, is credited to that - timing variable. */ - -void timevar_pop (timevar_id_t); - -/* Start timing TIMEVAR independently of the timing stack. Elapsed - time until timevar_stop is called for the same timing variable is - attributed to TIMEVAR. */ - -void timevar_start (timevar_id_t); - -/* Stop timing TIMEVAR. Time elapsed since timevar_start was called - is attributed to it. */ - -void timevar_stop (timevar_id_t); -/* Fill the elapsed time for TIMEVAR into ELAPSED. Returns - update-to-date information even if TIMEVAR is currently running. */ - -void timevar_get (timevar_id_t, struct timevar_time_def *); - -/* Summarize timing variables to FP. The timing variable TV_TOTAL has - a special meaning -- it's considered to be the total elapsed time, - for normalizing the others, and is displayed last. */ - -void timevar_print (FILE *); - -/* Set to to nonzero to enable timing variables. */ -extern int timevar_enabled; - -#endif /* ! _TIMEVAR_H */ diff --git a/m4/.gitignore b/m4/.gitignore index 66cf8bbf..f97cf00f 100644 --- a/m4/.gitignore +++ b/m4/.gitignore @@ -179,3 +179,4 @@ /xstrndup.m4 /host-cpu-c-abi.m4 /stat-time.m4 +/timevar.m4 diff --git a/m4/timevar.m4 b/m4/timevar.m4 deleted file mode 100644 index ad061413..00000000 --- a/m4/timevar.m4 +++ /dev/null @@ -1,60 +0,0 @@ -# -*- Autoconf -*- -# Checks required to run `timevar', a time tracker. -# -# Copyright (C) 2002-2003, 2009-2015, 2018 Free Software Foundation, -# Inc. -# -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program. If not, see <http://www.gnu.org/licenses/>. - -# serial 2 - -AC_DEFUN([BISON_PREREQ_TIMEVAR], -[AC_CHECK_HEADERS([sys/time.h sys/times.h]) - AC_CHECK_HEADERS([sys/resource.h],,, - [$ac_includes_default -#if HAVE_SYS_TIME_H -# include <sys/time.h> -#endif -#ifdef HAVE_SYS_TIMES_H -# include <sys/times.h> -#endif -]) -AC_CHECK_FUNCS([times]) - -AC_CHECK_DECLS([getrusage, times, clock, sysconf], [], [], -[$ac_includes_default -#if HAVE_SYS_TIME_H -# include <sys/time.h> -#endif -#if HAVE_SYS_TIMES_H -# include <sys/times.h> -#endif -#if HAVE_SYS_RESOURCE_H -# include <sys/resource.h> -#endif -]) - -AC_CHECK_TYPES([clock_t, struct tms], [], [], -[$ac_includes_default -#if HAVE_SYS_TIME_H -# include <sys/time.h> -#endif -#if HAVE_SYS_TIMES_H -# include <sys/times.h> -#endif -#if HAVE_SYS_RESOURCE_H -# include <sys/resource.h> -#endif -]) -]) @@ -929,7 +929,7 @@ ielr_compute_state (bitsetv follow_kernel_items, bitsetv always_follows, * compatibility or, if <tt>annotation_lists = NULL</tt>, the canonical * LR(1) state compatibility test was used. * - If <tt>annotation_lists = NULL</tt>, reduction lookahead sets were - * computed in all states. TV_IELR_PHASE4 was pushed while they were + * computed in all states. tv_ielr_phase4 was pushed while they were * computed from item lookahead sets. */ static void @@ -1004,7 +1004,7 @@ ielr_split_states (bitsetv follow_kernel_items, bitsetv always_follows, lookahead sets. */ if (!annotation_lists) { - timevar_push (TV_IELR_PHASE4); + timevar_push (tv_ielr_phase4); initialize_LA (); for (state_list *node = first_state; node; node = node->next) if (!node->state->consistent) @@ -1037,7 +1037,7 @@ ielr_split_states (bitsetv follow_kernel_items, bitsetv always_follows, } } } - timevar_pop (TV_IELR_PHASE4); + timevar_pop (tv_ielr_phase4); } /* Free state list. */ @@ -1080,7 +1080,7 @@ ielr (void) } /* Phase 0: LALR(1). */ - timevar_push (TV_LALR); + timevar_push (tv_lalr); if (lr_type == LR_TYPE__CANONICAL_LR) set_goto_map (); else @@ -1088,10 +1088,10 @@ ielr (void) if (lr_type == LR_TYPE__LALR) { bitsetv_free (goto_follows); - timevar_pop (TV_LALR); + timevar_pop (tv_lalr); return; } - timevar_pop (TV_LALR); + timevar_pop (tv_lalr); { bitsetv follow_kernel_items; @@ -1104,14 +1104,14 @@ ielr (void) { /* Phase 1: Compute Auxiliary Tables. */ state ***predecessors; - timevar_push (TV_IELR_PHASE1); + timevar_push (tv_ielr_phase1); ielr_compute_auxiliary_tables ( &follow_kernel_items, &always_follows, lr_type == LR_TYPE__CANONICAL_LR ? NULL : &predecessors); - timevar_pop (TV_IELR_PHASE1); + timevar_pop (tv_ielr_phase1); /* Phase 2: Compute Annotations. */ - timevar_push (TV_IELR_PHASE2); + timevar_push (tv_ielr_phase2); if (lr_type != LR_TYPE__CANONICAL_LR) { obstack_init (&annotations_obstack); @@ -1125,11 +1125,11 @@ ielr (void) bitsetv_free (goto_follows); lalr_free (); } - timevar_pop (TV_IELR_PHASE2); + timevar_pop (tv_ielr_phase2); } /* Phase 3: Split States. */ - timevar_push (TV_IELR_PHASE3); + timevar_push (tv_ielr_phase3); { state_number nstates_lr0 = nstates; ielr_split_states (follow_kernel_items, always_follows, @@ -1144,11 +1144,11 @@ ielr (void) free (annotation_lists); bitsetv_free (follow_kernel_items); bitsetv_free (always_follows); - timevar_pop (TV_IELR_PHASE3); + timevar_pop (tv_ielr_phase3); } /* Phase 4: Compute Reduction Lookaheads. */ - timevar_push (TV_IELR_PHASE4); + timevar_push (tv_ielr_phase4); free (goto_map); free (from_state); free (to_state); @@ -1163,5 +1163,5 @@ ielr (void) lalr (); bitsetv_free (goto_follows); } - timevar_pop (TV_IELR_PHASE4); + timevar_pop (tv_ielr_phase4); } @@ -82,7 +82,7 @@ main (int argc, char *argv[]) timevar_enabled = trace_flag & trace_time; timevar_init (); - timevar_start (TV_TOTAL); + timevar_start (tv_total); if (trace_flag & trace_bitsets) bitset_stats_enable (); @@ -91,29 +91,29 @@ main (int argc, char *argv[]) and FATTRS. In file reader.c. The other parts are recorded in the grammar; see gram.h. */ - timevar_push (TV_READER); + timevar_push (tv_reader); reader (); - timevar_pop (TV_READER); + timevar_pop (tv_reader); if (complaint_status == status_complaint) goto finish; /* Find useless nonterminals and productions and reduce the grammar. */ - timevar_push (TV_REDUCE); + timevar_push (tv_reduce); reduce_grammar (); - timevar_pop (TV_REDUCE); + timevar_pop (tv_reduce); /* Record other info about the grammar. In files derives and nullable. */ - timevar_push (TV_SETS); + timevar_push (tv_sets); derives_compute (); nullable_compute (); - timevar_pop (TV_SETS); + timevar_pop (tv_sets); /* Compute LR(0) parser states. See state.h for more info. */ - timevar_push (TV_LR0); + timevar_push (tv_lr0); generate_states (); - timevar_pop (TV_LR0); + timevar_pop (tv_lr0); /* Add lookahead sets to parser states. Except when LALR(1) is requested, split states to eliminate LR(1)-relative @@ -124,7 +124,7 @@ main (int argc, char *argv[]) lookahead is not enough to disambiguate the parsing. In file conflicts. Also resolve s/r conflicts based on precedence declarations. */ - timevar_push (TV_CONFLICTS); + timevar_push (tv_conflicts); conflicts_solve (); if (!muscle_percent_define_flag_if ("lr.keep-unreachable-state")) { @@ -136,12 +136,12 @@ main (int argc, char *argv[]) free (old_to_new); } conflicts_print (); - timevar_pop (TV_CONFLICTS); + timevar_pop (tv_conflicts); /* Compute the parser tables. */ - timevar_push (TV_ACTIONS); + timevar_push (tv_actions); tables_generate (); - timevar_pop (TV_ACTIONS); + timevar_pop (tv_actions); grammar_rules_useless_report (_("rule useless in parser due to conflicts")); @@ -153,25 +153,25 @@ main (int argc, char *argv[]) /* Output the detailed report on the grammar. */ if (report_flag) { - timevar_push (TV_REPORT); + timevar_push (tv_report); print_results (); - timevar_pop (TV_REPORT); + timevar_pop (tv_report); } /* Output the graph. */ if (graph_flag) { - timevar_push (TV_GRAPH); + timevar_push (tv_graph); print_graph (); - timevar_pop (TV_GRAPH); + timevar_pop (tv_graph); } /* Output xml. */ if (xml_flag) { - timevar_push (TV_XML); + timevar_push (tv_xml); print_xml (); - timevar_pop (TV_XML); + timevar_pop (tv_xml); } /* Stop if there were errors, to avoid trashing previous output @@ -180,16 +180,16 @@ main (int argc, char *argv[]) goto finish; /* Lookahead tokens are no longer needed. */ - timevar_push (TV_FREE); + timevar_push (tv_free); lalr_free (); - timevar_pop (TV_FREE); + timevar_pop (tv_free); /* Output the tables and the parser to ftable. In file output. */ - timevar_push (TV_PARSER); + timevar_push (tv_parser); output (); - timevar_pop (TV_PARSER); + timevar_pop (tv_parser); - timevar_push (TV_FREE); + timevar_push (tv_free); nullable_free (); derives_free (); tables_free (); @@ -207,7 +207,7 @@ main (int argc, char *argv[]) code_scanner_free (); skel_scanner_free (); quotearg_free (); - timevar_pop (TV_FREE); + timevar_pop (tv_free); if (trace_flag & trace_bitsets) bitset_stats_dump (stderr); @@ -215,7 +215,7 @@ main (int argc, char *argv[]) finish: /* Stop timing and print the times. */ - timevar_stop (TV_TOTAL); + timevar_stop (tv_total); timevar_print (stderr); cleanup_caret (); diff --git a/src/output.c b/src/output.c index 22c73f1c..57d4334e 100644 --- a/src/output.c +++ b/src/output.c @@ -603,7 +603,7 @@ output_skeleton (void) } /* Read and process m4's output. */ - timevar_push (TV_M4); + timevar_push (tv_m4); { FILE *in = xfdopen (filter_fd[0], "r"); scan_skel (in); @@ -614,7 +614,7 @@ output_skeleton (void) xfclose (in); } wait_subprocess (pid, "m4", false, false, true, true, NULL); - timevar_pop (TV_M4); + timevar_pop (tv_m4); } static void |