llvm.org GIT mirror llvm / a61e52c
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 Nick Lewycky 9 years ago
3 changed file(s) with 18 addition(s) and 6 deletion(s). Raw diff Collapse all Expand all
6969 (void) llvm::createEdgeProfilerPass();
7070 (void) llvm::createOptimalEdgeProfilerPass();
7171 (void) llvm::createPathProfilerPass();
72 (void) llvm::createGCOVProfilerPass();
72 (void) llvm::createGCOVProfilerPass(true, true);
7373 (void) llvm::createFunctionInliningPass();
7474 (void) llvm::createAlwaysInlinerPass();
7575 (void) llvm::createGlobalDCEPass();
2727 ModulePass *createPathProfilerPass();
2828
2929 // Insert GCOV profiling instrumentation
30 ModulePass *createGCOVProfilerPass();
30 ModulePass *createGCOVProfilerPass(bool EmitNotes = true, bool EmitData = true);
3131
3232 } // End llvm namespace
3333
4242 bool runOnModule(Module &M);
4343 public:
4444 static char ID;
45 GCOVProfiler() : ModulePass(ID) {
45 GCOVProfiler()
46 : ModulePass(ID), EmitNotes(true), EmitData(true) {
47 initializeGCOVProfilerPass(*PassRegistry::getPassRegistry());
48 }
49 GCOVProfiler(bool EmitNotes, bool EmitData)
50 : ModulePass(ID), EmitNotes(EmitNotes), EmitData(EmitData) {
51 assert((EmitNotes || EmitData) && "GCOVProfiler asked to do nothing?");
4652 initializeGCOVProfilerPass(*PassRegistry::getPassRegistry());
4753 }
4854 virtual const char *getPassName() const {
6975 SmallVector
7076 uint32_t>, 8> &);
7177
78 bool EmitNotes;
79 bool EmitData;
80
7281 Module *Mod;
7382 LLVMContext *Ctx;
7483 };
7887 INITIALIZE_PASS(GCOVProfiler, "insert-gcov-profiling",
7988 "Insert instrumentation for GCOV profiling", false, false)
8089
81 ModulePass *llvm::createGCOVProfilerPass() { return new GCOVProfiler(); }
90 ModulePass *llvm::createGCOVProfilerPass(bool EmitNotes, bool EmitData) {
91 return new GCOVProfiler(EmitNotes, EmitData);
92 }
8293
8394 static DISubprogram FindSubprogram(DIScope scope) {
8495 while (!scope.isSubprogram()) {
300311 DebugInfoFinder DIF;
301312 DIF.processModule(*Mod);
302313
303 EmitGCNO(DIF);
304 return EmitProfileArcs(DIF);
314 if (EmitNotes) EmitGCNO(DIF);
315 if (EmitData) return EmitProfileArcs(DIF);
316 return false;
305317 }
306318
307319 void GCOVProfiler::EmitGCNO(DebugInfoFinder &DIF) {