llvm-project/llvm/lib/ProfileData
Fangrui Song 4d7b194543 [llvm-cov gcov] Refactor counting and reporting
The current organization of FileInfo and its referenced utility functions of
(GCOVFile, GCOVFunction, GCOVBlock) is messy. Some members of FileInfo are just
copied from GCOVFile. FileInfo::print (.gcov output and --intermediate output)
is interleaved with branch statistics and computation of line execution counts.
--intermediate has to do redundant .gcov output to gather branch statistics.

This patch deletes lots of code and introduces a clearer work flow:

```
fn collectFunction
  for each block b
    for each line lineNum
      let line be LineInfo of the file on lineNum
      line.exists = 1
      increment function's lines & linesExec if necessary
      increment line.count
      line.blocks.push_back(&b)

fn collectSourceLine
  compute cycle counts
  count = incoming_counts + cycle_counts
  if line.exists
    ++summary->lines
    if line.count
      ++summary->linesExec

fn collectSource
  for each line
    call collectSourceLine

fn main
  for each function
    call collectFunction
    print function summary
  for each source file
    call collectSource
    print file summary
    annotate the source file with line execution counts
  if -i
    print intermediate file
```

The output order of functions and files now follows the original order in
.gcno files.
2020-09-13 23:00:59 -07:00
..
Coverage [llvm-cov] reset executation count to 0 after wrapped segment 2020-08-04 18:38:44 -07:00
CMakeLists.txt [cmake] Explicitly mark libraries defined in lib/ as "Component Libraries" 2019-11-21 10:48:08 -08:00
GCOV.cpp [llvm-cov gcov] Refactor counting and reporting 2020-09-13 23:00:59 -07:00
InstrProf.cpp [PGO] Extend the value profile buckets for mem op sizes. 2020-08-03 11:04:32 -07:00
InstrProfReader.cpp [PGO] Supporting code for always instrumenting entry block 2020-07-22 15:01:53 -07:00
InstrProfWriter.cpp Supplement instr profile with sample profile. 2020-07-27 20:17:40 -07:00
LLVMBuild.txt
ProfileSummaryBuilder.cpp Supplement instr profile with sample profile. 2020-07-27 20:17:40 -07:00
SampleProf.cpp [SampleFDO] Enhance profile remapping support for searching inline instance 2020-08-26 11:07:35 -07:00
SampleProfReader.cpp [SampleFDO] Enhance profile remapping support for searching inline instance 2020-08-26 11:07:35 -07:00
SampleProfWriter.cpp [SampleFDO] Port MD5 name table support to extbinary format. 2020-03-30 22:07:08 -07:00