LLVM: lib/Support/CodeGenCoverage.cpp Source File (original) (raw)
1
2
3
4
5
6
7
8
9
10
11
13
21
22using namespace llvm;
23
25
31
37
42
45
47
48 const char *LexedBackendName = CurPtr;
49 while (*CurPtr++ != 0)
50 ;
52 return false;
53
54 bool IsForThisBackend = BackendName == LexedBackendName;
56 if (std::distance(CurPtr, Buffer.getBufferEnd()) < 8)
57 return false;
58
61 CurPtr += 8;
62
63
64 if (RuleID == ~0ull)
65 break;
66
67
68
69 if (IsForThisBackend)
71 }
72 }
73
74 return true;
75}
76
82
83
84
85
87
88 std::string CoverageFilename = (CoveragePrefix + Pid).str();
89
90 std::error_code EC;
92 std::unique_ptr CoverageFile =
93 std::make_unique(CoverageFilename, EC, OpenFlags);
94 if (EC)
95 return false;
96
99 CoverageFile->os() << BackendName;
100 CoverageFile->os().write((const char *)&Zero, sizeof(unsigned char));
102 CoverageFile->os().write((const char *)&I, sizeof(uint64_t));
103 CoverageFile->os().write((const char *)&InvZero, sizeof(uint64_t));
104
105 CoverageFile->keep();
106 }
107
108 return true;
109}
110
static const std::string CoveragePrefix
Provides a library for accessing information about this process and other processes on the operating ...
bool isCovered(uint64_t RuleID) const
Definition CodeGenCoverage.cpp:32
void setCovered(uint64_t RuleID)
Definition CodeGenCoverage.cpp:26
void reset()
Definition CodeGenCoverage.cpp:111
iterator_range< const_covered_iterator > covered() const
Definition CodeGenCoverage.cpp:39
bool parse(MemoryBuffer &Buffer, StringRef BackendName)
Definition CodeGenCoverage.cpp:43
bool emit(StringRef FilePrefix, StringRef BackendName) const
Definition CodeGenCoverage.cpp:77
This interface provides simple read-only access to a block of memory, and provides simple methods for...
const char * getBufferEnd() const
const char * getBufferStart() const
StringRef - Represent a constant reference to a string, i.e.
A range adaptor for a pair of iterators.
static LLVM_ABI Pid getProcessId()
Get the process's identifier.
SmartMutex - A mutex with a compile time constant parameter that indicates whether this mutex should ...
uint64_t read64(const void *P, endianness E)
@ OF_Append
The file should be opened in append mode.
std::lock_guard< SmartMutex< mt_only > > SmartScopedLock
This is an optimization pass for GlobalISel generic memory operations.
const char * to_string(ThinOrFullLTOPhase Phase)