14#ifndef LLVM_PROFILEDATA_GCOV_H
15#define LLVM_PROFILEDATA_GCOV_H
83 if (magic ==
"gcno") {
85 }
else if (magic ==
"oncg") {
88 errs() <<
"unexpected magic: " << magic <<
"\n";
98 if (magic ==
"gcda") {
100 }
else if (magic ==
"adcg") {
110 std::string str(
de.getBytes(
cursor, 4));
113 if (
de.isLittleEndian())
114 std::reverse(str.begin(), str.end());
115 int ver = str[0] >=
'A'
116 ? (str[0] -
'A') * 100 + (str[1] -
'0') * 10 + str[2] -
'0'
117 : (str[0] -
'0') * 10 + str[2] -
'0';
121 }
else if (ver >= 90) {
125 }
else if (ver >= 80) {
129 }
else if (ver >= 48) {
133 }
else if (ver >= 47) {
137 }
else if (ver >= 34) {
141 errs() <<
"unexpected version: " << str <<
"\n";
150 return de.getBytes(
cursor, len * 4).split(
'\0').first;
154 if (
cursor.tell() + 4 >
de.size()) {
156 errs() <<
"unexpected end of memory buffer: " <<
cursor.tell() <<
"\n";
176 str =
de.getBytes(
cursor, len).drop_back();
178 str =
de.getBytes(
cursor, len * 4).split(
'\0').first;
221 unsigned addNormalizedPathToMap(
StringRef filename);
318 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< ErlangGC > A("erlang", "erlang-compatible garbage collector")
static GCRegistry::Add< OcamlGC > B("ocaml", "ocaml 3.10-compatible GC")
This file defines the DenseSet and SmallDenseSet classes.
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.
static TableGen::Emitter::OptClass< SkeletonEmitter > X("gen-skeleton-class", "Generate example skeleton 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 LLVM_ABI uint64_t getCyclesCount(const BlockVector &blocks)
iterator_range< EdgeIterator > srcs() const
uint64_t getCount() const
SmallVector< BlockVector, 4 > BlockVectorLists
void addDstEdge(GCOVArc *Edge)
uint32_t getLastLine() const
SmallVector< GCOVBlockLocation > locations
void addSrcEdge(GCOVArc *Edge)
SmallVectorImpl< GCOVArc * >::const_iterator EdgeIterator
SmallVector< GCOVArc *, 4 > Edges
LLVM_ABI void print(raw_ostream &OS) const
collectLineCounts - Collect line counts.
static LLVM_ABI uint64_t getLineCount(const BlockVector &Blocks)
SmallVector< const GCOVBlock *, 1 > BlockVector
static LLVM_ABI uint64_t augmentOneCycle(GCOVBlock *src, std::vector< std::pair< GCOVBlock *, size_t > > &stack)
SmallVector< GCOVArc *, 2 > pred
LLVM_ABI void dump() const
dump - Dump GCOVBlock content to dbgs() for debugging purposes.
void addFile(unsigned fileIdx)
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
LLVM_ABI void print(raw_ostream &OS) const
GCOV::GCOVVersion version
std::vector< std::string > filenames
GCOV::GCOVVersion getVersion() const
LLVM_ABI void dump() const
dump - Dump GCOVFile content to dbgs() for debugging purposes.
std::map< uint32_t, GCOVFunction * > identToFunction
StringMap< unsigned > filenameToIdx
LLVM_ABI bool readGCNO(GCOVBuffer &Buffer)
readGCNO - Read GCNO buffer.
pointee_iterator< SmallVectorImpl< std::unique_ptr< GCOVFunction > >::const_iterator > iterator
LLVM_ABI bool readGCDA(GCOVBuffer &Buffer)
readGCDA - Read GCDA buffer.
GCOVFunction - Collects function information.
LLVM_ABI 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
LLVM_ABI StringRef getName(bool demangle) const
GCOVFunction(GCOVFile &file)
LLVM_ABI void dump() const
dump - Dump GCOVFunction content to dbgs() for debugging purposes.
LLVM_ABI void propagateCounts(const GCOVBlock &v, GCOVArc *pred)
SmallVector< std::unique_ptr< GCOVBlock >, 0 > blocks
LLVM_ABI GCOVBlock & getExitBlock() const
LLVM_ABI StringRef getFilename() const
pointee_iterator< SmallVectorImpl< std::unique_ptr< GCOVBlock > >::const_iterator > BlockIterator
DenseSet< const GCOVBlock * > visited
SmallString< 0 > demangled
LLVM_ABI 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...
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
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.
constexpr StringRef substr(size_t Start, size_t N=npos) const
Return a reference to the substring from [Start, Start + N).
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.
LLVM_ABI 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.
LLVM_ABI void gcovOneInput(const GCOV::Options &options, StringRef filename, StringRef gcno, StringRef gcda, GCOVFile &file)
void consumeError(Error Err)
Consume a Error without doing anything.
DEMANGLE_ABI 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.
LLVM_ABI bool onTree() const
GCOVArc(GCOVBlock &src, GCOVBlock &dst, uint32_t flags)
GCOVBlockLocation(unsigned idx)
SmallVector< uint32_t, 4 > lines
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.