[llvm-commits] [llvm] r129903 - in /llvm/trunk: include/llvm/LinkAllPasses.h include/llvm/Transforms/Instrumentation.h lib/Transforms/Instrumentation/GCOVProfiling.cpp
Nick Lewycky
nicholas at mxc.ca
Wed Apr 20 18:56:25 PDT 2011
Author: nicholas
Date: Wed Apr 20 20:56:25 2011
New Revision: 129903
URL: http://llvm.org/viewvc/llvm-project?rev=129903&view=rev
Log:
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.
Modified:
llvm/trunk/include/llvm/LinkAllPasses.h
llvm/trunk/include/llvm/Transforms/Instrumentation.h
llvm/trunk/lib/Transforms/Instrumentation/GCOVProfiling.cpp
Modified: llvm/trunk/include/llvm/LinkAllPasses.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/LinkAllPasses.h?rev=129903&r1=129902&r2=129903&view=diff
==============================================================================
--- llvm/trunk/include/llvm/LinkAllPasses.h (original)
+++ llvm/trunk/include/llvm/LinkAllPasses.h Wed Apr 20 20:56:25 2011
@@ -70,7 +70,7 @@
(void) llvm::createEdgeProfilerPass();
(void) llvm::createOptimalEdgeProfilerPass();
(void) llvm::createPathProfilerPass();
- (void) llvm::createGCOVProfilerPass();
+ (void) llvm::createGCOVProfilerPass(true, true);
(void) llvm::createFunctionInliningPass();
(void) llvm::createAlwaysInlinerPass();
(void) llvm::createGlobalDCEPass();
Modified: llvm/trunk/include/llvm/Transforms/Instrumentation.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Transforms/Instrumentation.h?rev=129903&r1=129902&r2=129903&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Transforms/Instrumentation.h (original)
+++ llvm/trunk/include/llvm/Transforms/Instrumentation.h Wed Apr 20 20:56:25 2011
@@ -28,7 +28,7 @@
ModulePass *createPathProfilerPass();
// Insert GCOV profiling instrumentation
-ModulePass *createGCOVProfilerPass();
+ModulePass *createGCOVProfilerPass(bool EmitNotes = true, bool EmitData = true);
} // End llvm namespace
Modified: llvm/trunk/lib/Transforms/Instrumentation/GCOVProfiling.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Instrumentation/GCOVProfiling.cpp?rev=129903&r1=129902&r2=129903&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Instrumentation/GCOVProfiling.cpp (original)
+++ llvm/trunk/lib/Transforms/Instrumentation/GCOVProfiling.cpp Wed Apr 20 20:56:25 2011
@@ -43,7 +43,13 @@
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 @@
SmallVector<std::pair<GlobalVariable *,
uint32_t>, 8> &);
+ bool EmitNotes;
+ bool EmitData;
+
Module *Mod;
LLVMContext *Ctx;
};
@@ -79,7 +88,9 @@
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 @@
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) {
More information about the llvm-commits
mailing list