From 07417085a14349cde788c5cc10663815da40c26f Mon Sep 17 00:00:00 2001 From: Ken Raeburn Date: Thu, 30 Jul 1998 10:38:22 +0000 Subject: Function entry/exit profiling instrumentation: * expr.h (profile_function_entry_libfunc, profile_function_exit_libfunc): Declare new variables. * optabs.c: Define them here. (init_optabs): Initialize them. * tree.h (struct tree_decl): New flag no_instrument_function_entry_exit. (DECL_NO_INSTRUMENT_FUNCTION_ENTRY_EXIT): New accessor macro. * c-decl.c (duplicate_decls): Merge it. * c-common.c (enum attrs): New value A_NO_INSTRUMENT_FUNCTION. (init_attributes): Use it for "no_instrument_function". (decl_attributes): Handle it, for functions that have not yet been compiled. Set decl flag. * flags.h (flag_instrument_function_entry_exit): Declare new variable. * toplev.c (flag_instrument_function_entry_exit): Define it here. (f_options): New option "instrument-functions". * function.h (struct function): New field instrument_entry_exit. * function.c (current_function_instrument_entry_exit): New variable. (push_function_context_to, pop_function_context_from): Save and restore. (expand_function_start): Set current_ variable, maybe emit return label and entry profile call. (expand_function_end): Maybe emit exit profile call. Testsuite: * gcc.c-torture/special/eeprof-1.c: New test, for -finstrument-functions. * gcc.c-torture/special/special.exp: Run it. From-SVN: r21495 --- gcc/toplev.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'gcc/toplev.c') diff --git a/gcc/toplev.c b/gcc/toplev.c index 266a209..9ab6435 100644 --- a/gcc/toplev.c +++ b/gcc/toplev.c @@ -723,6 +723,9 @@ int flag_strict_aliasing = 0; extern int flag_dump_unnumbered; +/* Instrument functions with calls at entry and exit, for profiling. */ +int flag_instrument_function_entry_exit = 0; + /* Table of supported debugging formats. */ static struct @@ -908,7 +911,9 @@ lang_independent_options f_options[] = "Generate code to check every memory access" }, {"prefix-function-name", &flag_prefix_function_name, 1, "Add a prefix to all function names" }, - {"dump-unnumbered", &flag_dump_unnumbered, 1} + {"dump-unnumbered", &flag_dump_unnumbered, 1}, + {"instrument-functions", &flag_instrument_function_entry_exit, 1, + "Instrument function entry/exit with profiling calls"}, }; #define NUM_ELEM(a) (sizeof (a) / sizeof ((a)[0])) -- cgit v1.1