14#ifndef LLVM_PROFILEDATA_GCOV_H
15#define LLVM_PROFILEDATA_GCOV_H
82 if (magic ==
"gcno") {
84 }
else if (magic ==
"oncg") {
87 errs() <<
"unexpected magic: " << magic <<
"\n";
97 if (magic ==
"gcda") {
99 }
else if (magic ==
"adcg") {
113 std::reverse(str.begin(), str.end());
114 int ver = str[0] >=
'A'
115 ? (str[0] -
'A') * 100 + (str[1] -
'0') * 10 + str[2] -
'0'
116 : (str[0] -
'0') * 10 + str[2] -
'0';
120 }
else if (ver >= 90) {
124 }
else if (ver >= 80) {
128 }
else if (ver >= 48) {
132 }
else if (ver >= 47) {
136 }
else if (ver >= 34) {
140 errs() <<
"unexpected version: " << str <<
"\n";
155 errs() <<
"unexpected end of memory buffer: " <<
cursor.
tell() <<
"\n";
220 unsigned addNormalizedPathToMap(
StringRef filename);
304 std::vector<std::pair<GCOVBlock *, size_t>> &stack);
This file defines the StringMap class.
bbsections Prepares for basic block by splitting functions into clusters of basic blocks
static GCRegistry::Add< OcamlGC > B("ocaml", "ocaml 3.10-compatible GC")
static GCRegistry::Add< ErlangGC > A("erlang", "erlang-compatible garbage collector")
This file defines the DenseSet and SmallDenseSet classes.
DenseMap< Block *, BlockRelaxAux > Blocks
static GCMetadataPrinterRegistry::Add< ErlangGCPrinter > X("erlang", "erlang-compatible garbage collector")
dot regions Print regions of function to dot file(with no function bodies)"
This file defines the SmallString class.
This file defines the SmallVector class.
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory),...
Implements a dense probed hash-table based set.
GCOVBlock - Collects block information.
iterator_range< EdgeIterator > dsts() const
static uint64_t getCyclesCount(const BlockVector &blocks)
iterator_range< EdgeIterator > srcs() const
SmallVector< uint32_t, 4 > lines
uint64_t getCount() const
static uint64_t getLineCount(const BlockVector &Blocks)
void addDstEdge(GCOVArc *Edge)
uint32_t getLastLine() const
void addSrcEdge(GCOVArc *Edge)
SmallVectorImpl< GCOVArc * >::const_iterator EdgeIterator
void print(raw_ostream &OS) const
collectLineCounts - Collect line counts.
SmallVector< const GCOVBlock *, 1 > BlockVector
static uint64_t augmentOneCycle(GCOVBlock *src, std::vector< std::pair< GCOVBlock *, size_t > > &stack)
SmallVector< GCOVArc *, 2 > pred
void dump() const
dump - Dump GCOVBlock content to dbgs() for debugging purposes.
SmallVector< GCOVArc *, 2 > succ
GCOVBuffer - A wrapper around MemoryBuffer to provide GCOV specific read operations.
bool readInt(uint32_t &Val)
DataExtractor::Cursor cursor
bool readInt64(uint64_t &Val)
GCOVBuffer(MemoryBuffer *B)
bool readGCOVVersion(GCOV::GCOVVersion &version)
readGCOVVersion - Read GCOV version.
bool readString(StringRef &str)
bool readGCNOFormat()
readGCNOFormat - Check GCNO signature is valid at the beginning of buffer.
bool readGCDAFormat()
readGCDAFormat - Check GCDA signature is valid at the beginning of buffer.
GCOVFile - Collects coverage information for one pair of coverage file (.gcno and ....
SmallVector< std::unique_ptr< GCOVFunction >, 16 > functions
void print(raw_ostream &OS) const
GCOV::GCOVVersion version
pointee_iterator< SmallVectorImpl< std::unique_ptr< GCOVFunction > >::const_iterator > iterator
std::vector< std::string > filenames
GCOV::GCOVVersion getVersion() const
void dump() const
dump - Dump GCOVFile content to dbgs() for debugging purposes.
std::map< uint32_t, GCOVFunction * > identToFunction
StringMap< unsigned > filenameToIdx
bool readGCNO(GCOVBuffer &Buffer)
readGCNO - Read GCNO buffer.
bool readGCDA(GCOVBuffer &Buffer)
readGCDA - Read GCDA buffer.
GCOVFunction - Collects function information.
uint64_t getEntryCount() const
getEntryCount - Get the number of times the function was called by retrieving the entry block's count...
SmallVector< std::unique_ptr< GCOVArc >, 0 > treeArcs
StringRef getName(bool demangle) const
GCOVFunction(GCOVFile &file)
void dump() const
dump - Dump GCOVFunction content to dbgs() for debugging purposes.
void propagateCounts(const GCOVBlock &v, GCOVArc *pred)
SmallVector< std::unique_ptr< GCOVBlock >, 0 > blocks
GCOVBlock & getExitBlock() const
StringRef getFilename() const
DenseSet< const GCOVBlock * > visited
SmallString< 0 > demangled
void print(raw_ostream &OS) const
iterator_range< BlockIterator > blocksRange() const
SmallVector< std::unique_ptr< GCOVArc >, 0 > arcs
This interface provides simple read-only access to a block of memory, and provides simple methods for...
StringRef getBuffer() const
SmallString - A SmallString is just a SmallVector with methods and accessors that make it work better...
This class consists of common code factored out of the SmallVector class to reduce code duplication b...
typename SuperClass::const_iterator const_iterator
void push_back(const T &Elt)
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
StringMap - This is an unconventional map that is specialized for handling keys that are "strings",...
StringRef - Represent a constant reference to a string, i.e.
std::pair< StringRef, StringRef > split(char Separator) const
Split into two substrings around the first occurrence of a separator character.
constexpr StringRef substr(size_t Start, size_t N=npos) const
Return a reference to the substring from [Start, Start + N).
StringRef drop_back(size_t N=1) const
Return a StringRef equal to 'this' but with the last N elements dropped.
A range adaptor for a pair of iterators.
This class implements an extremely fast bulk output stream that can only output to a stream.
This provides a very simple, boring adaptor for a begin and end iterator into a range type.
@ C
The default llvm calling convention, compatible with C.
This is an optimization pass for GlobalISel generic memory operations.
iterator_range< T > make_range(T x, T y)
Convenience function for iterating over sub-ranges.
raw_fd_ostream & errs()
This returns a reference to a raw_ostream for standard error.
OutputIt move(R &&Range, OutputIt Out)
Provide wrappers to std::move which take ranges instead of having to pass begin/end explicitly.
void gcovOneInput(const GCOV::Options &options, StringRef filename, StringRef gcno, StringRef gcda, GCOVFile &file)
void consumeError(Error Err)
Consume a Error without doing anything.
std::string demangle(std::string_view MangledName)
Attempt to demangle a string using different demangling schemes.
Implement std::hash so that hash_code can be used in STL containers.
GCOVArc(GCOVBlock &src, GCOVBlock &dst, uint32_t flags)
A struct for passing gcov options between functions.
Options(bool A, bool B, bool C, bool F, bool P, bool U, bool I, bool L, bool M, bool N, bool R, bool T, bool X, std::string SourcePrefix)
An iterator type that allows iterating over the pointees via some other iterator.