14 #ifndef LLVM_PROFILEDATA_GCOV_H 15 #define LLVM_PROFILEDATA_GCOV_H 47 Options(
bool A,
bool B,
bool C,
bool F,
bool P,
bool U,
bool L,
bool N,
bool X)
75 errs() <<
"Unexpected file type: " << File <<
".\n";
86 errs() <<
"Unexpected file type: " << File <<
".\n";
95 StringRef VersionStr = Buffer->getBuffer().
slice(Cursor, Cursor + 4);
96 if (VersionStr ==
"*204") {
101 if (VersionStr ==
"*404") {
106 if (VersionStr ==
"*704") {
111 errs() <<
"Unexpected version: " << VersionStr <<
".\n";
118 StringRef Tag = Buffer->getBuffer().slice(Cursor, Cursor + 4);
119 if (Tag.
empty() || Tag[0] !=
'\0' || Tag[1] !=
'\0' || Tag[2] !=
'\0' ||
130 StringRef Tag = Buffer->getBuffer().slice(Cursor, Cursor + 4);
131 if (Tag.
empty() || Tag[0] !=
'\0' || Tag[1] !=
'\0' || Tag[2] !=
'\x41' ||
142 StringRef Tag = Buffer->getBuffer().slice(Cursor, Cursor + 4);
143 if (Tag.
empty() || Tag[0] !=
'\0' || Tag[1] !=
'\0' || Tag[2] !=
'\x43' ||
154 StringRef Tag = Buffer->getBuffer().slice(Cursor, Cursor + 4);
155 if (Tag.
empty() || Tag[0] !=
'\0' || Tag[1] !=
'\0' || Tag[2] !=
'\x45' ||
166 StringRef Tag = Buffer->getBuffer().slice(Cursor, Cursor + 4);
167 if (Tag.
empty() || Tag[0] !=
'\0' || Tag[1] !=
'\0' || Tag[2] !=
'\xa1' ||
178 StringRef Tag = Buffer->getBuffer().slice(Cursor, Cursor + 4);
179 if (Tag.
empty() || Tag[0] !=
'\0' || Tag[1] !=
'\0' || Tag[2] !=
'\0' ||
190 StringRef Tag = Buffer->getBuffer().slice(Cursor, Cursor + 4);
191 if (Tag.
empty() || Tag[0] !=
'\0' || Tag[1] !=
'\0' || Tag[2] !=
'\0' ||
200 if (Buffer->getBuffer().size() < Cursor + 4) {
201 errs() <<
"Unexpected end of memory buffer: " << Cursor + 4 <<
".\n";
212 if (!readInt(Lo) || !readInt(Hi))
214 Val = ((uint64_t)Hi << 32) |
Lo;
226 if (Buffer->getBuffer().size() < Cursor + Len) {
227 errs() <<
"Unexpected end of memory buffer: " << Cursor + Len <<
".\n";
230 Str = Buffer->getBuffer().
slice(Cursor, Cursor + Len).
split(
'\0').first;
254 void collectLineCounts(
FileInfo &FI);
257 bool GCNOInitialized =
false;
272 uint64_t CyclesCount = 0;
288 uint64_t getEntryCount()
const;
289 uint64_t getExitCount()
const;
294 return make_range(block_begin(), block_end());
299 void collectLineCounts(
FileInfo &FI);
333 void addCount(
size_t DstEdgeNo, uint64_t
N);
338 SrcEdges.push_back(Edge);
344 if (DstEdges.size() && DstEdges.back()->Dst.Number > Edge->
Dst.Number)
345 DstEdgesAreSorted =
false;
346 DstEdges.push_back(Edge);
367 void collectLineCounts(
FileInfo &FI);
369 static uint64_t getCycleCount(
const Edges &Path);
376 static void getCyclesCount(
const BlockVector &Blocks, uint64_t &Count);
377 static uint64_t getLineCount(
const BlockVector &Blocks);
382 uint64_t Counter = 0;
383 bool DstEdgesAreSorted =
true;
426 if (Line > LineInfo[Filename].LastLine)
427 LineInfo[Filename].LastLine = Line;
428 LineInfo[Filename].Blocks[Line - 1].push_back(Block);
433 if (Line > LineInfo[Filename].LastLine)
434 LineInfo[Filename].LastLine = Line;
435 LineInfo[Filename].Functions[Line - 1].push_back(Function);
445 std::unique_ptr<raw_ostream> openCoveragePath(
StringRef CoveragePath);
452 uint64_t Count)
const;
472 #endif // LLVM_SUPPORT_GCOV_H EdgeIterator dst_begin() const
static GCMetadataPrinterRegistry::Add< ErlangGCPrinter > X("erlang", "erlang-compatible garbage collector")
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)
amdgpu Simplify well known AMD library false FunctionCallee Value const Twine & Name
bool readLineTag()
readLineTag - If cursor points to a line tag then increment the cursor and return true otherwise retu...
void setProgramCount(uint32_t Programs)
Options(bool A, bool B, bool C, bool F, bool P, bool U, bool L, bool N, bool X)
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
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...
LLVM_NODISCARD StringRef slice(size_t Start, size_t End) const
Return a reference to the substring from [Start, End).
LLVM_NODISCARD bool empty() const
empty - Check if the string is empty.
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
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
Instrumentation for Order File
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
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. ...
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 ...
LLVM_NODISCARD const char * data() const
data - Get a pointer to the start of the string (which may not be null terminated).
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)