15 #ifndef LLVM_PROFILEDATA_GCOV_H 16 #define LLVM_PROFILEDATA_GCOV_H 46 Options(
bool A,
bool B,
bool C,
bool F,
bool P,
bool U,
bool L,
bool N)
72 errs() <<
"Unexpected file type: " << File <<
".\n";
83 errs() <<
"Unexpected file type: " << File <<
".\n";
92 StringRef VersionStr = Buffer->getBuffer().
slice(Cursor, Cursor + 4);
93 if (VersionStr ==
"*204") {
98 if (VersionStr ==
"*404") {
103 if (VersionStr ==
"*704") {
108 errs() <<
"Unexpected version: " << VersionStr <<
".\n";
115 StringRef Tag = Buffer->getBuffer().slice(Cursor, Cursor + 4);
116 if (Tag.
empty() || Tag[0] !=
'\0' || Tag[1] !=
'\0' || Tag[2] !=
'\0' ||
127 StringRef Tag = Buffer->getBuffer().slice(Cursor, Cursor + 4);
128 if (Tag.
empty() || Tag[0] !=
'\0' || Tag[1] !=
'\0' || Tag[2] !=
'\x41' ||
139 StringRef Tag = Buffer->getBuffer().slice(Cursor, Cursor + 4);
140 if (Tag.
empty() || Tag[0] !=
'\0' || Tag[1] !=
'\0' || Tag[2] !=
'\x43' ||
151 StringRef Tag = Buffer->getBuffer().slice(Cursor, Cursor + 4);
152 if (Tag.
empty() || Tag[0] !=
'\0' || Tag[1] !=
'\0' || Tag[2] !=
'\x45' ||
163 StringRef Tag = Buffer->getBuffer().slice(Cursor, Cursor + 4);
164 if (Tag.
empty() || Tag[0] !=
'\0' || Tag[1] !=
'\0' || Tag[2] !=
'\xa1' ||
175 StringRef Tag = Buffer->getBuffer().slice(Cursor, Cursor + 4);
176 if (Tag.
empty() || Tag[0] !=
'\0' || Tag[1] !=
'\0' || Tag[2] !=
'\0' ||
187 StringRef Tag = Buffer->getBuffer().slice(Cursor, Cursor + 4);
188 if (Tag.
empty() || Tag[0] !=
'\0' || Tag[1] !=
'\0' || Tag[2] !=
'\0' ||
197 if (Buffer->getBuffer().size() < Cursor + 4) {
198 errs() <<
"Unexpected end of memory buffer: " << Cursor + 4 <<
".\n";
209 if (!readInt(Lo) || !readInt(Hi))
211 Val = ((uint64_t)Hi << 32) |
Lo;
223 if (Buffer->getBuffer().size() < Cursor + Len) {
224 errs() <<
"Unexpected end of memory buffer: " << Cursor + Len <<
".\n";
227 Str = Buffer->getBuffer().
slice(Cursor, Cursor + Len).
split(
'\0').first;
251 void collectLineCounts(
FileInfo &FI);
254 bool GCNOInitialized =
false;
275 std::unique_ptr<GCOVBlock>>::const_iterator>;
284 uint64_t getEntryCount()
const;
285 uint64_t getExitCount()
const;
290 return make_range(block_begin(), block_end());
295 void collectLineCounts(
FileInfo &FI);
317 struct SortDstEdgesFunctor {
319 return E1->
Dst.Number < E2->
Dst.Number;
332 void addCount(
size_t DstEdgeNo, uint64_t
N);
337 SrcEdges.push_back(Edge);
343 if (DstEdges.size() && DstEdges.back()->Dst.Number > Edge->
Dst.Number)
344 DstEdgesAreSorted =
false;
345 DstEdges.push_back(Edge);
366 void collectLineCounts(
FileInfo &FI);
371 uint64_t Counter = 0;
372 bool DstEdgesAreSorted =
true;
415 if (Line > LineInfo[Filename].LastLine)
416 LineInfo[Filename].LastLine = Line;
417 LineInfo[Filename].Blocks[Line - 1].push_back(Block);
422 if (Line > LineInfo[Filename].LastLine)
423 LineInfo[Filename].LastLine = Line;
424 LineInfo[Filename].Functions[Line - 1].push_back(Function);
434 std::unique_ptr<raw_ostream> openCoveragePath(
StringRef CoveragePath);
441 uint64_t Count)
const;
461 #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.
Compute iterated dominance frontiers using a linear time algorithm.
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
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)