15 #ifndef LLVM_SUPPORT_GCOV_H
16 #define LLVM_SUPPORT_GCOV_H
50 if (Magic ==
"oncg*404MVLL")
52 else if (Magic ==
"oncg*204MVLL")
54 else if (Magic ==
"adcg*404MVLL")
56 else if (Magic ==
"adcg*204MVLL")
68 Tag[0] !=
'\0' || Tag[1] !=
'\0' ||
69 Tag[2] !=
'\0' || Tag[3] !=
'\1') {
81 Tag[0] !=
'\0' || Tag[1] !=
'\0' ||
82 Tag[2] !=
'\x41' || Tag[3] !=
'\x01') {
94 Tag[0] !=
'\0' || Tag[1] !=
'\0' ||
95 Tag[2] !=
'\x43' || Tag[3] !=
'\x01') {
107 Tag[0] !=
'\0' || Tag[1] !=
'\0' ||
108 Tag[2] !=
'\x45' || Tag[3] !=
'\x01') {
120 Tag[0] !=
'\0' || Tag[1] !=
'\0' ||
121 Tag[2] !=
'\xa1' || Tag[3] !=
'\1') {
133 Tag[0] !=
'\0' || Tag[1] !=
'\0' ||
134 Tag[2] !=
'\0' || Tag[3] !=
'\xa1') {
146 Tag[0] !=
'\0' || Tag[1] !=
'\0' ||
147 Tag[2] !=
'\0' || Tag[3] !=
'\xa3') {
156 errs() <<
"Unexpected end of memory buffer: " << Cursor+4 <<
".\n";
161 Val = *(
const uint32_t *)(Str.
data());
168 Val = ((uint64_t)Hi << 32) |
Lo;
174 if (!
readInt(Len))
return false;
177 errs() <<
"Unexpected end of memory buffer: " << Cursor+Len <<
".\n";
196 GCOVFile() : Functions(), RunCount(0), ProgramCount(0) {}
204 uint32_t ProgramCount;
228 Parent(P), Number(N), Counter(0), Edges(), Lines() {}
248 LineInfo[Filename][Line-1] += Count;
256 uint32_t ProgramCount;
void push_back(const T &Elt)
GCOVBlock(GCOVFunction &P, uint32_t N)
bool readInt(uint32_t &Val)
size_t size() const
size - Get the string size.
void dump()
dump - Dump GCOVBlock content to dbgs() for debugging purposes.
bool read(GCOVBuffer &Buffer)
read - Read GCOV buffer.
void setProgramCount(uint32_t Programs)
bool readString(StringRef &Str)
std::pair< StringRef, StringRef > split(char Separator) const
StringRef getBuffer() const
void collectLineCounts(FileInfo &FI)
const char * data() const
GCOVBlock - Collects block information.
bool readInt64(uint64_t &Val)
void collectLineCounts(FileInfo &FI)
void dump()
dump - Dump GCOVFunction content to dbgs() for debugging purposes.
void advanceCursor(uint32_t n)
static const char *const Magic
~GCOVFunction()
~GCOVFunction - Delete GCOVFunction and its content.
GCOVBuffer(MemoryBuffer *B)
GCOV::GCOVFormat readGCOVFormat()
readGCOVFormat - Read GCOV signature at the beginning of buffer.
void addCount(uint64_t N)
void dump()
dump - Dump GCOVFile content to dbgs() for debugging purposes.
StringRef getFilename() const
void collectLineCounts(FileInfo &FI)
GCOVFunction - Collects function information.
DenseMap< uint32_t, uint64_t > LineCounts
uint64_t getCursor() const
~GCOVBlock()
~GCOVBlock - Delete GCOVBlock and its content.
StringRef slice(size_t Start, size_t End) const
void setRunCount(uint32_t Runs)
~GCOVFile()
~GCOVFile - Delete GCOVFile and its content.
bool read(GCOVBuffer &Buffer, GCOV::GCOVFormat Format)
void addLineCount(StringRef Filename, uint32_t Line, uint64_t Count)
void print(raw_fd_ostream &OS, StringRef gcnoFile, StringRef gcdaFile)
print - Print source files with collected line count information.
bool empty() const
empty - Check if the string is empty.