diff options
author | Hans Wennborg <hans@hanshq.net> | 2017-11-14 21:09:45 +0000 |
---|---|---|
committer | Hans Wennborg <hans@hanshq.net> | 2017-11-14 21:09:45 +0000 |
commit | e1ecd61b9813453ceb442f71a75ee3c1b28189f0 (patch) | |
tree | 1d5586b860a8ab6bf75f9a4a68127c7d5667d6dd /llvm/lib/CodeGen/TargetPassConfig.cpp | |
parent | 817d7f36e9bf0dbd82ddfb2b76e8b23fe9a18d4e (diff) | |
download | bcm5719-llvm-e1ecd61b9813453ceb442f71a75ee3c1b28189f0.tar.gz bcm5719-llvm-e1ecd61b9813453ceb442f71a75ee3c1b28189f0.zip |
Rename CountingFunctionInserter and use for both mcount and cygprofile calls, before and after inlining
Clang implements the -finstrument-functions flag inherited from GCC, which
inserts calls to __cyg_profile_func_{enter,exit} on function entry and exit.
This is useful for getting a trace of how the functions in a program are
executed. Normally, the calls remain even if a function is inlined into another
function, but it is useful to be able to turn this off for users who are
interested in a lower-level trace, i.e. one that reflects what functions are
called post-inlining. (We use this to generate link order files for Chromium.)
LLVM already has a pass for inserting similar instrumentation calls to
mcount(), which it does after inlining. This patch renames and extends that
pass to handle calls both to mcount and the cygprofile functions, before and/or
after inlining as controlled by function attributes.
Differential Revision: https://reviews.llvm.org/D39287
llvm-svn: 318195
Diffstat (limited to 'llvm/lib/CodeGen/TargetPassConfig.cpp')
-rw-r--r-- | llvm/lib/CodeGen/TargetPassConfig.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/llvm/lib/CodeGen/TargetPassConfig.cpp b/llvm/lib/CodeGen/TargetPassConfig.cpp index 59e88ba3bda..3f2a31a69cf 100644 --- a/llvm/lib/CodeGen/TargetPassConfig.cpp +++ b/llvm/lib/CodeGen/TargetPassConfig.cpp @@ -625,8 +625,8 @@ void TargetPassConfig::addIRPasses() { if (getOptLevel() != CodeGenOpt::None && !DisablePartialLibcallInlining) addPass(createPartiallyInlineLibCallsPass()); - // Insert calls to mcount-like functions. - addPass(createCountingFunctionInserterPass()); + // Instrument function entry and exit, e.g. with calls to mcount(). + addPass(createPostInlineEntryExitInstrumenterPass()); // Add scalarization of target's unsupported masked memory intrinsics pass. // the unsupported intrinsic will be replaced with a chain of basic blocks, |