summaryrefslogtreecommitdiffstats
path: root/llvm/lib/IR/GCOV.cpp
diff options
context:
space:
mode:
authorYuchen Wu <yuchenericwu@hotmail.com>2013-12-03 00:38:21 +0000
committerYuchen Wu <yuchenericwu@hotmail.com>2013-12-03 00:38:21 +0000
commit8f1c881abcc2c92d73a6b5f75021dd6e29f7efb5 (patch)
treed2edd2b80a8f58e99e1217debf713c0e8a279852 /llvm/lib/IR/GCOV.cpp
parentd28f5a54d9c6362ab6f8560ee95083d0e2064d4c (diff)
downloadbcm5719-llvm-8f1c881abcc2c92d73a6b5f75021dd6e29f7efb5.tar.gz
bcm5719-llvm-8f1c881abcc2c92d73a6b5f75021dd6e29f7efb5.zip
llvm-cov: Store blocks rather than counts per line.
Each line stores all the blocks that execute on that line, instead of only storing the line counts previously accumulated. This provides more information for each line, and will be useful for options in enabling block and branch information. llvm-svn: 196177
Diffstat (limited to 'llvm/lib/IR/GCOV.cpp')
-rw-r--r--llvm/lib/IR/GCOV.cpp20
1 files changed, 13 insertions, 7 deletions
diff --git a/llvm/lib/IR/GCOV.cpp b/llvm/lib/IR/GCOV.cpp
index ebf10927fc9..bcc62b11d5f 100644
--- a/llvm/lib/IR/GCOV.cpp
+++ b/llvm/lib/IR/GCOV.cpp
@@ -282,7 +282,7 @@ void GCOVBlock::addCount(size_t DstEdgeNo, uint64_t N) {
void GCOVBlock::collectLineCounts(FileInfo &FI) {
for (SmallVectorImpl<uint32_t>::iterator I = Lines.begin(),
E = Lines.end(); I != E; ++I)
- FI.addLineCount(Parent.getFilename(), *I, Counter);
+ FI.addBlockLine(Parent.getFilename(), *I, this);
}
/// dump - Dump GCOVBlock content to dbgs() for debugging purposes.
@@ -319,7 +319,7 @@ void GCOVBlock::dump() const {
/// print - Print source files with collected line count information.
void FileInfo::print(raw_fd_ostream &OS, StringRef gcnoFile,
StringRef gcdaFile) const {
- for (StringMap<LineCounts>::const_iterator I = LineInfo.begin(),
+ for (StringMap<LineData>::const_iterator I = LineInfo.begin(),
E = LineInfo.end(); I != E; ++I) {
StringRef Filename = I->first();
OwningPtr<MemoryBuffer> Buff;
@@ -335,15 +335,21 @@ void FileInfo::print(raw_fd_ostream &OS, StringRef gcnoFile,
OS << " -: 0:Runs:" << RunCount << "\n";
OS << " -: 0:Programs:" << ProgramCount << "\n";
- const LineCounts &L = I->second;
+ const LineData &L = I->second;
uint32_t i = 0;
while (!AllLines.empty()) {
- LineCounts::const_iterator CountIt = L.find(i);
- if (CountIt != L.end()) {
- if (CountIt->second == 0)
+ LineData::const_iterator BlocksIt = L.find(i);
+ if (BlocksIt != L.end()) {
+ const BlockVector &Blocks = BlocksIt->second;
+ uint64_t LineCount = 0;
+ for (BlockVector::const_iterator I = Blocks.begin(), E = Blocks.end();
+ I != E; ++I) {
+ LineCount += (*I)->getCount();
+ }
+ if (LineCount == 0)
OS << " #####:";
else
- OS << format("%9" PRIu64 ":", CountIt->second);
+ OS << format("%9" PRIu64 ":", LineCount);
} else {
OS << " -:";
}
OpenPOWER on IntegriCloud