15 #ifndef LLVM_PROFILEDATA_GCOV_H 16 #define LLVM_PROFILEDATA_GCOV_H 48 Options(
bool A,
bool B,
bool C,
bool F,
bool P,
bool U,
bool L,
bool N)
74 errs() <<
"Unexpected file type: " << File <<
".\n";
85 errs() <<
"Unexpected file type: " << File <<
".\n";
94 StringRef VersionStr = Buffer->getBuffer().
slice(Cursor, Cursor + 4);
95 if (VersionStr ==
"*204") {
100 if (VersionStr ==
"*404") {
105 if (VersionStr ==
"*704") {
110 errs() <<
"Unexpected version: " << VersionStr <<
".\n";
117 StringRef Tag = Buffer->getBuffer().slice(Cursor, Cursor + 4);
118 if (Tag.
empty() || Tag[0] !=
'\0' || Tag[1] !=
'\0' || Tag[2] !=
'\0' ||
129 StringRef Tag = Buffer->getBuffer().slice(Cursor, Cursor + 4);
130 if (Tag.
empty() || Tag[0] !=
'\0' || Tag[1] !=
'\0' || Tag[2] !=
'\x41' ||
141 StringRef Tag = Buffer->getBuffer().slice(Cursor, Cursor + 4);
142 if (Tag.
empty() || Tag[0] !=
'\0' || Tag[1] !=
'\0' || Tag[2] !=
'\x43' ||
153 StringRef Tag = Buffer->getBuffer().slice(Cursor, Cursor + 4);
154 if (Tag.
empty() || Tag[0] !=
'\0' || Tag[1] !=
'\0' || Tag[2] !=
'\x45' ||
165 StringRef Tag = Buffer->getBuffer().slice(Cursor, Cursor + 4);
166 if (Tag.
empty() || Tag[0] !=
'\0' || Tag[1] !=
'\0' || Tag[2] !=
'\xa1' ||
177 StringRef Tag = Buffer->getBuffer().slice(Cursor, Cursor + 4);
178 if (Tag.
empty() || Tag[0] !=
'\0' || Tag[1] !=
'\0' || Tag[2] !=
'\0' ||
189 StringRef Tag = Buffer->getBuffer().slice(Cursor, Cursor + 4);
190 if (Tag.
empty() || Tag[0] !=
'\0' || Tag[1] !=
'\0' || Tag[2] !=
'\0' ||
199 if (Buffer->getBuffer().size() < Cursor + 4) {
200 errs() <<
"Unexpected end of memory buffer: " << Cursor + 4 <<
".\n";
211 if (!readInt(Lo) || !readInt(Hi))
213 Val = ((uint64_t)Hi << 32) |
Lo;
225 if (Buffer->getBuffer().size() < Cursor + Len) {
226 errs() <<
"Unexpected end of memory buffer: " << Cursor + Len <<
".\n";
229 Str = Buffer->getBuffer().
slice(Cursor, Cursor + Len).
split(
'\0').first;
253 void collectLineCounts(
FileInfo &FI);
256 bool GCNOInitialized =
false;
271 uint64_t CyclesCount = 0;
287 uint64_t getEntryCount()
const;
288 uint64_t getExitCount()
const;
293 return make_range(block_begin(), block_end());
298 void collectLineCounts(
FileInfo &FI);
320 struct SortDstEdgesFunctor {
322 return E1->
Dst.Number < E2->
Dst.Number;
338 void addCount(
size_t DstEdgeNo, uint64_t
N);
343 SrcEdges.push_back(Edge);
349 if (DstEdges.size() && DstEdges.back()->Dst.Number > Edge->
Dst.Number)
350 DstEdgesAreSorted =
false;
351 DstEdges.push_back(Edge);
372 void collectLineCounts(
FileInfo &FI);
374 static uint64_t getCycleCount(
const Edges &Path);
381 static void getCyclesCount(
const BlockVector &Blocks, uint64_t &Count);
382 static uint64_t getLineCount(
const BlockVector &Blocks);
387 uint64_t Counter = 0;
388 bool DstEdgesAreSorted =
true;
431 if (Line > LineInfo[Filename].LastLine)
432 LineInfo[Filename].LastLine = Line;
433 LineInfo[Filename].Blocks[Line - 1].push_back(Block);
438 if (Line > LineInfo[Filename].LastLine)
439 LineInfo[Filename].LastLine = Line;
440 LineInfo[Filename].Functions[Line - 1].push_back(Function);
450 std::unique_ptr<raw_ostream> openCoveragePath(
StringRef CoveragePath);
457 uint64_t Count)
const;
477 #endif // LLVM_SUPPORT_GCOV_H EdgeIterator dst_begin() const
GCOVBlock(GCOVFunction &P, uint32_t N)
raw_ostream & errs()
This returns a reference to a raw_ostream for standard error.
bool readInt(uint32_t &Val)
typename SuperClass::const_iterator const_iterator
EdgeIterator src_end() const
bool readGCDAFormat()
readGCDAFormat - Check GCDA signature is valid at the beginning of buffer.
GCOVEdge - Collects edge information.
This class represents lattice values for constants.
void addFunctionLine(StringRef Filename, uint32_t Line, const GCOVFunction *Function)
bool readLineTag()
readLineTag - If cursor points to a line tag then increment the cursor and return true otherwise retu...
void setProgramCount(uint32_t Programs)
This provides a very simple, boring adaptor for a begin and end iterator into a range type...
bool readString(StringRef &Str)
BlockIterator block_begin() const
iterator_range< EdgeIterator > srcs() const
uint32_t getChecksum() const
A struct for passing gcov options between functions.
uint64_t getCursor() const
void addBlockLine(StringRef Filename, uint32_t Line, const GCOVBlock *Block)
GCOVBuffer - A wrapper around MemoryBuffer to provide GCOV specific read operations.
uint32_t getLastLine() const
LLVM_NODISCARD LLVM_ATTRIBUTE_ALWAYS_INLINE const char * data() const
data - Get a pointer to the start of the string (which may not be null terminated).
FuncCoverageMap FuncCoverages
EdgeIterator src_begin() const
amdgpu Simplify well known AMD library false Value Value const Twine & Name
uint64_t getCount() const
This class consists of common code factored out of the SmallVector class to reduce code duplication b...
bool readArcTag()
readArcTag - If cursor points to an gcda arc tag then increment the cursor and return true otherwise ...
StringRef getName() const
void addDstEdge(GCOVEdge *Edge)
StringMap< LineData > LineInfo
LLVM_NODISCARD LLVM_ATTRIBUTE_ALWAYS_INLINE bool empty() const
empty - Check if the string is empty.
GCOVBlock - Collects block information.
GCOVFunction(GCOVFile &P)
SmallVectorImpl< GCOVEdge * >::const_iterator EdgeIterator
bool readInt64(uint64_t &Val)
const GCOV::Options & Options
BlockIterator block_end() const
static GCRegistry::Add< OcamlGC > B("ocaml", "ocaml 3.10-compatible GC")
void dump(const SparseBitVector< ElementSize > &LHS, raw_ostream &out)
void addSrcEdge(GCOVEdge *Edge)
iterator_range< EdgeIterator > dsts() const
bool readBlockTag()
readBlockTag - If cursor points to a block tag then increment the cursor and return true otherwise re...
size_t getNumSrcEdges() const
bool readGCNOFormat()
readGCNOFormat - Check GCNO signature is valid at the beginning of buffer.
static void print(raw_ostream &Out, object::Archive::Kind Kind, T Val)
void advanceCursor(uint32_t n)
const GCOVFunction & getParent() const
Options(bool A, bool B, bool C, bool F, bool P, bool U, bool L, bool N)
bool readEdgeTag()
readEdgeTag - If cursor points to an edge tag then increment the cursor and return true otherwise ret...
StringRef getFilename() const
iterator_range< T > make_range(T x, T y)
Convenience function for iterating over sub-ranges.
GCOVBuffer(MemoryBuffer *B)
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small...
iterator_range< BlockIterator > blocks() const
GCOVEdge(GCOVBlock &S, GCOVBlock &D)
LLVM_NODISCARD std::pair< StringRef, StringRef > split(char Separator) const
Split into two substrings around the first occurrence of a separator character.
An iterator type that allows iterating over the pointees via some other iterator. ...
LLVM_NODISCARD LLVM_ATTRIBUTE_ALWAYS_INLINE StringRef slice(size_t Start, size_t End) const
Return a reference to the substring from [Start, End).
static GCRegistry::Add< StatepointGC > D("statepoint-example", "an example strategy for statepoint")
This interface provides simple read-only access to a block of memory, and provides simple methods for...
A range adaptor for a pair of iterators.
StringMap - This is an unconventional map that is specialized for handling keys that are "strings"...
size_t getNumBlocks() const
FileInfo(const GCOV::Options &Options)
size_t getNumDstEdges() const
GCOVFunction - Collects function information.
FileCoverageList FileCoverages
bool readObjectTag()
readObjectTag - If cursor points to an object summary tag then increment the cursor and return true o...
GCOVFile - Collects coverage information for one pair of coverage file (.gcno and ...
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
EdgeIterator dst_end() const
This class implements an extremely fast bulk output stream that can only output to a stream...
bool readProgramTag()
readProgramTag - If cursor points to a program summary tag then increment the cursor and return true ...
StringRef - Represent a constant reference to a string, i.e.
bool readFunctionTag()
readFunctionTag - If cursor points to a function tag then increment the cursor and return true otherw...
void setRunCount(uint32_t Runs)
bool readGCOVVersion(GCOV::GCOVVersion &Version)
readGCOVVersion - Read GCOV version.
GCOVCoverage(StringRef Name)