diff options
author | Yuchen Wu <yuchenericwu@hotmail.com> | 2013-11-05 01:11:58 +0000 |
---|---|---|
committer | Yuchen Wu <yuchenericwu@hotmail.com> | 2013-11-05 01:11:58 +0000 |
commit | 30672d90861ba7b94fdab3ba171b836552d4ed43 (patch) | |
tree | 14580267338a57ca5a9d7a5b440a7f1c1a7cbfda /llvm/lib/IR/GCOV.cpp | |
parent | 2bad63c3415d2658f8e302597472fbcf6a3dc803 (diff) | |
download | bcm5719-llvm-30672d90861ba7b94fdab3ba171b836552d4ed43.tar.gz bcm5719-llvm-30672d90861ba7b94fdab3ba171b836552d4ed43.zip |
Support for reading run counts in llvm-cov.
This patch enables llvm-cov to correctly output the run count stored in
the GCDA file. GCOVProfiling currently does not generate this
information, so the GCDA run data had to be hacked on from a GCDA file
generated by gcc. This is corrected by a subsequent patch.
With the run and program data included, both llvm-cov and gcov produced
the same output.
llvm-svn: 194033
Diffstat (limited to 'llvm/lib/IR/GCOV.cpp')
-rw-r--r-- | llvm/lib/IR/GCOV.cpp | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/llvm/lib/IR/GCOV.cpp b/llvm/lib/IR/GCOV.cpp index 794ead9e71f..a33da2a5525 100644 --- a/llvm/lib/IR/GCOV.cpp +++ b/llvm/lib/IR/GCOV.cpp @@ -59,8 +59,18 @@ bool GCOVFile::read(GCOVBuffer &Buffer) { (void)ReadGCDA; assert(ReadGCDA && ".gcda data does not match .gcno data"); } - while (Buffer.readProgramTag()) + if (Buffer.readObjectTag()) { + uint32_t Length = Buffer.readInt(); + Buffer.readInt(); // checksum + Buffer.readInt(); // num + RunCount = Buffer.readInt(); + Buffer.advanceCursor(Length-3); + } + while (Buffer.readProgramTag()) { + uint32_t Length = Buffer.readInt(); + Buffer.advanceCursor(Length); ++ProgramCount; + } } return true; @@ -79,6 +89,7 @@ void GCOVFile::collectLineCounts(FileInfo &FI) { for (SmallVectorImpl<GCOVFunction *>::iterator I = Functions.begin(), E = Functions.end(); I != E; ++I) (*I)->collectLineCounts(FI); + FI.setRunCount(RunCount); FI.setProgramCount(ProgramCount); } @@ -258,6 +269,7 @@ void FileInfo::print(raw_fd_ostream &OS, StringRef gcnoFile, OS << " -: 0:Source:" << Filename << "\n"; OS << " -: 0:Graph:" << gcnoFile << "\n"; OS << " -: 0:Data:" << gcdaFile << "\n"; + OS << " -: 0:Runs:" << RunCount << "\n"; OS << " -: 0:Programs:" << ProgramCount << "\n"; LineCounts &L = LineInfo[Filename]; OwningPtr<MemoryBuffer> Buff; |