From: Richard Kenner Date: Sat, 15 Apr 2000 16:59:10 +0000 (+0000) Subject: toplev.c: Make *_time variable long to reduce chance of overflow. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=77a02dba353a95a8e4b940f4dc80b927a27b980d;p=gcc.git toplev.c: Make *_time variable long to reduce chance of overflow. * toplev.c: Make *_time variable long to reduce chance of overflow. (TIMEVAR): Likewise for `otime'. (print_time): Arg is now long; compute percentage in FP and round. * toplev.h (print_time): Arg is long. * tree.c: Minor whitespace changes. From-SVN: r33168 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 1a5d65744c3..5f2b8111609 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,6 +1,13 @@ Sat Apr 15 10:59:19 2000 Richard Kenner - * configure.in (alpha*-*-*): Aad config/alpha/t-alpha. + * toplev.c: Make *_time variable long to reduce chance of overflow. + (TIMEVAR): Likewise for `otime'. + (print_time): Arg is now long; compute percentage in FP and round. + * toplev.h (print_time): Arg is long. + + * tree.c: Minor whitespace changes. + + * configure.in (alpha*-*-*): Add config/alpha/t-alpha. * configure: Rebuilt. * libgcc2.c (__fixunstfDI): Renamed from __fixunstfdi. (__fixunsxfDI): Renamed from __fixunsxfdi. diff --git a/gcc/toplev.c b/gcc/toplev.c index 00721b31248..1a2b4f912d9 100644 --- a/gcc/toplev.c +++ b/gcc/toplev.c @@ -1403,36 +1403,36 @@ read_integral_parameter (p, pname, defval) /* Time accumulators, to count the total time spent in various passes. */ -int parse_time; -int varconst_time; -int integration_time; -int jump_time; -int cse_time; -int gcse_time; -int loop_time; -int cse2_time; -int branch_prob_time; -int flow_time; -int combine_time; -int regmove_time; -int sched_time; -int local_alloc_time; -int global_alloc_time; -int flow2_time; -int peephole2_time; -int sched2_time; -int dbr_sched_time; -int reorder_blocks_time; -int rename_registers_time; -int shorten_branch_time; -int stack_reg_time; -int to_ssa_time; -int from_ssa_time; -int final_time; -int symout_time; -int dump_time; -int gc_time; -int all_time; +long parse_time; +long varconst_time; +long integration_time; +long jump_time; +long cse_time; +long gcse_time; +long loop_time; +long cse2_time; +long branch_prob_time; +long flow_time; +long combine_time; +long regmove_time; +long sched_time; +long local_alloc_time; +long global_alloc_time; +long flow2_time; +long peephole2_time; +long sched2_time; +long dbr_sched_time; +long reorder_blocks_time; +long rename_registers_time; +long shorten_branch_time; +long stack_reg_time; +long to_ssa_time; +long from_ssa_time; +long final_time; +long symout_time; +long dump_time; +long gc_time; +long all_time; /* Return time used so far, in microseconds. */ @@ -1503,18 +1503,23 @@ get_run_time () #endif /* __BEOS__ */ } -#define TIMEVAR(VAR, BODY) \ -do { int otime = get_run_time (); BODY; VAR += get_run_time () - otime; } while (0) +#define TIMEVAR(VAR, BODY) \ +do { \ + long otime = get_run_time (); \ + BODY; \ + VAR += get_run_time () - otime; \ +} while (0) void print_time (str, total) const char *str; - int total; + long total; { fprintf (stderr, - "time in %s: %d.%06d (%d%%)\n", + "time in %s: %ld.%06ld (%ld%%)\n", str, total / 1000000, total % 1000000, - all_time == 0 ? 0 : (100 * total) / all_time); + all_time == 0 ? 0 + : (long) (((100.0 * (double) total) / (double) all_time) + .5)); } /* This is the default decl_printable_name function. */ @@ -1528,6 +1533,7 @@ decl_name (decl, verbosity) } /* Mark P for GC. Also mark main_input_filename and input_filename. */ + static void mark_file_stack (p) void *p; diff --git a/gcc/toplev.h b/gcc/toplev.h index 5779ff994e3..e5a06fff093 100644 --- a/gcc/toplev.h +++ b/gcc/toplev.h @@ -30,7 +30,7 @@ extern int read_integral_parameter PARAMS ((const char *, const char *, const int)); extern int count_error PARAMS ((int)); extern void strip_off_ending PARAMS ((char *, int)); -extern void print_time PARAMS ((const char *, int)); +extern void print_time PARAMS ((const char *, long)); extern void debug_start_source_file PARAMS ((char *)); extern void debug_end_source_file PARAMS ((unsigned)); extern void debug_define PARAMS ((unsigned, char *)); diff --git a/gcc/tree.c b/gcc/tree.c index 24eca04e554..72d670cf3ac 100644 --- a/gcc/tree.c +++ b/gcc/tree.c @@ -5170,7 +5170,7 @@ int_fits_type_p (c, type) } /* Given a DECL or TYPE, return the scope in which it was declared, or - NUL_TREE if there is no containing scope. */ + NULL_TREE if there is no containing scope. */ tree get_containing_scope (t) @@ -5193,6 +5193,7 @@ decl_function_context (decl) if (TREE_CODE (decl) == SAVE_EXPR) context = SAVE_EXPR_CONTEXT (decl); + /* C++ virtual functions use DECL_CONTEXT for the class of the vtable where we look up the function at runtime. Such functions always take a first argument of type 'pointer to real context'. @@ -5200,8 +5201,9 @@ decl_function_context (decl) C++ should really be fixed to use DECL_CONTEXT for the real context, and use something else for the "virtual context". */ else if (TREE_CODE (decl) == FUNCTION_DECL && DECL_VINDEX (decl)) - context = TYPE_MAIN_VARIANT - (TREE_TYPE (TREE_VALUE (TYPE_ARG_TYPES (TREE_TYPE (decl))))); + context + = TYPE_MAIN_VARIANT + (TREE_TYPE (TREE_VALUE (TYPE_ARG_TYPES (TREE_TYPE (decl))))); else context = DECL_CONTEXT (decl);