diff options
author | Nick Lewycky <nicholas@mxc.ca> | 2011-04-21 01:56:25 +0000 |
---|---|---|
committer | Nick Lewycky <nicholas@mxc.ca> | 2011-04-21 01:56:25 +0000 |
commit | a61e52c9b7cf874b46cef687c1c4627a35952542 (patch) | |
tree | 6068d1dec1aaa8c6475140576226c55ece5e18dd /lib | |
parent | 333ed454d0c20d0f4999f7c9a404688b254a0cb0 (diff) |
Add independent controls for whether GCOV profiling should emit .gcno files or
instrument the program to emit .gcda.
TODO: we should emit slightly different .gcda files when .gcno emission is off.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@129903 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r-- | lib/Transforms/Instrumentation/GCOVProfiling.cpp | 20 |
1 files changed, 16 insertions, 4 deletions
diff --git a/lib/Transforms/Instrumentation/GCOVProfiling.cpp b/lib/Transforms/Instrumentation/GCOVProfiling.cpp index 4e63a43f83..a3ad5fe2e2 100644 --- a/lib/Transforms/Instrumentation/GCOVProfiling.cpp +++ b/lib/Transforms/Instrumentation/GCOVProfiling.cpp @@ -43,7 +43,13 @@ namespace { bool runOnModule(Module &M); public: static char ID; - GCOVProfiler() : ModulePass(ID) { + GCOVProfiler() + : ModulePass(ID), EmitNotes(true), EmitData(true) { + initializeGCOVProfilerPass(*PassRegistry::getPassRegistry()); + } + GCOVProfiler(bool EmitNotes, bool EmitData) + : ModulePass(ID), EmitNotes(EmitNotes), EmitData(EmitData) { + assert((EmitNotes || EmitData) && "GCOVProfiler asked to do nothing?"); initializeGCOVProfilerPass(*PassRegistry::getPassRegistry()); } virtual const char *getPassName() const { @@ -70,6 +76,9 @@ namespace { SmallVector<std::pair<GlobalVariable *, uint32_t>, 8> &); + bool EmitNotes; + bool EmitData; + Module *Mod; LLVMContext *Ctx; }; @@ -79,7 +88,9 @@ char GCOVProfiler::ID = 0; INITIALIZE_PASS(GCOVProfiler, "insert-gcov-profiling", "Insert instrumentation for GCOV profiling", false, false) -ModulePass *llvm::createGCOVProfilerPass() { return new GCOVProfiler(); } +ModulePass *llvm::createGCOVProfilerPass(bool EmitNotes, bool EmitData) { + return new GCOVProfiler(EmitNotes, EmitData); +} static DISubprogram FindSubprogram(DIScope scope) { while (!scope.isSubprogram()) { @@ -301,8 +312,9 @@ bool GCOVProfiler::runOnModule(Module &M) { DebugInfoFinder DIF; DIF.processModule(*Mod); - EmitGCNO(DIF); - return EmitProfileArcs(DIF); + if (EmitNotes) EmitGCNO(DIF); + if (EmitData) return EmitProfileArcs(DIF); + return false; } void GCOVProfiler::EmitGCNO(DebugInfoFinder &DIF) { |