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 | e85959cb2cb6f82959b3cf1a9ef59c6d793a2556 (patch) | |
tree | e8aacd6a728630b9dda10307428452f0cd49419b /lib/IR | |
parent | 23c8d2bf861ac0984da0b214fa08090abcba1869 (diff) | |
download | llvm-e85959cb2cb6f82959b3cf1a9ef59c6d793a2556.tar.gz llvm-e85959cb2cb6f82959b3cf1a9ef59c6d793a2556.tar.bz2 llvm-e85959cb2cb6f82959b3cf1a9ef59c6d793a2556.tar.xz |
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.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@194033 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/IR')
-rw-r--r-- | lib/IR/GCOV.cpp | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/lib/IR/GCOV.cpp b/lib/IR/GCOV.cpp index 794ead9e71..a33da2a552 100644 --- a/lib/IR/GCOV.cpp +++ b/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; |