Introduce -finstrument-functions-once
commit3b598848f6fdbf7e76eaf2beec1ce94fc3a14b9b
authorEric Botcazou <ebotcazou@adacore.com>
Mon, 13 Jun 2022 11:32:53 +0000 (13 13:32 +0200)
committerEric Botcazou <ebotcazou@adacore.com>
Mon, 13 Jun 2022 11:35:33 +0000 (13 13:35 +0200)
tree0689dfb33dff5dfea9006f428831f3a6b4f5e1e6
parentcb1ecf3819f19a4fc35468010b66b5c1a7b21ee8
Introduce -finstrument-functions-once

The goal is to make it possible to use it in (large) production binaries
to do function-level coverage, so the overhead must be minimum and, in
particular, there is no protection against data races so the "once"
moniker is imprecise.

gcc/
* common.opt (finstrument-functions): Set explicit value.
(-finstrument-functions-once): New option.
* doc/invoke.texi (Program Instrumentation Options): Document it.
* gimplify.cc (build_instrumentation_call): New static function.
(gimplify_function_tree): Call it to emit the instrumentation calls
if -finstrument-functions[-once] is specified.
gcc/testsuite/
* gcc.dg/instrument-4.c: New test.
gcc/common.opt
gcc/doc/invoke.texi
gcc/gimplify.cc
gcc/testsuite/gcc.dg/instrument-4.c [new file with mode: 0644]