mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-02-12 03:32:10 +00:00
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
This commit is contained in:
parent
333ed454d0
commit
a61e52c9b7
@ -70,7 +70,7 @@ namespace {
|
|||||||
(void) llvm::createEdgeProfilerPass();
|
(void) llvm::createEdgeProfilerPass();
|
||||||
(void) llvm::createOptimalEdgeProfilerPass();
|
(void) llvm::createOptimalEdgeProfilerPass();
|
||||||
(void) llvm::createPathProfilerPass();
|
(void) llvm::createPathProfilerPass();
|
||||||
(void) llvm::createGCOVProfilerPass();
|
(void) llvm::createGCOVProfilerPass(true, true);
|
||||||
(void) llvm::createFunctionInliningPass();
|
(void) llvm::createFunctionInliningPass();
|
||||||
(void) llvm::createAlwaysInlinerPass();
|
(void) llvm::createAlwaysInlinerPass();
|
||||||
(void) llvm::createGlobalDCEPass();
|
(void) llvm::createGlobalDCEPass();
|
||||||
|
@ -28,7 +28,7 @@ ModulePass *createOptimalEdgeProfilerPass();
|
|||||||
ModulePass *createPathProfilerPass();
|
ModulePass *createPathProfilerPass();
|
||||||
|
|
||||||
// Insert GCOV profiling instrumentation
|
// Insert GCOV profiling instrumentation
|
||||||
ModulePass *createGCOVProfilerPass();
|
ModulePass *createGCOVProfilerPass(bool EmitNotes = true, bool EmitData = true);
|
||||||
|
|
||||||
} // End llvm namespace
|
} // End llvm namespace
|
||||||
|
|
||||||
|
@ -43,7 +43,13 @@ namespace {
|
|||||||
bool runOnModule(Module &M);
|
bool runOnModule(Module &M);
|
||||||
public:
|
public:
|
||||||
static char ID;
|
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());
|
initializeGCOVProfilerPass(*PassRegistry::getPassRegistry());
|
||||||
}
|
}
|
||||||
virtual const char *getPassName() const {
|
virtual const char *getPassName() const {
|
||||||
@ -70,6 +76,9 @@ namespace {
|
|||||||
SmallVector<std::pair<GlobalVariable *,
|
SmallVector<std::pair<GlobalVariable *,
|
||||||
uint32_t>, 8> &);
|
uint32_t>, 8> &);
|
||||||
|
|
||||||
|
bool EmitNotes;
|
||||||
|
bool EmitData;
|
||||||
|
|
||||||
Module *Mod;
|
Module *Mod;
|
||||||
LLVMContext *Ctx;
|
LLVMContext *Ctx;
|
||||||
};
|
};
|
||||||
@ -79,7 +88,9 @@ char GCOVProfiler::ID = 0;
|
|||||||
INITIALIZE_PASS(GCOVProfiler, "insert-gcov-profiling",
|
INITIALIZE_PASS(GCOVProfiler, "insert-gcov-profiling",
|
||||||
"Insert instrumentation for GCOV profiling", false, false)
|
"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) {
|
static DISubprogram FindSubprogram(DIScope scope) {
|
||||||
while (!scope.isSubprogram()) {
|
while (!scope.isSubprogram()) {
|
||||||
@ -301,8 +312,9 @@ bool GCOVProfiler::runOnModule(Module &M) {
|
|||||||
DebugInfoFinder DIF;
|
DebugInfoFinder DIF;
|
||||||
DIF.processModule(*Mod);
|
DIF.processModule(*Mod);
|
||||||
|
|
||||||
EmitGCNO(DIF);
|
if (EmitNotes) EmitGCNO(DIF);
|
||||||
return EmitProfileArcs(DIF);
|
if (EmitData) return EmitProfileArcs(DIF);
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void GCOVProfiler::EmitGCNO(DebugInfoFinder &DIF) {
|
void GCOVProfiler::EmitGCNO(DebugInfoFinder &DIF) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user