25 using namespace coverage;
29 : Filenames(Filenames) {
39 for (
const auto &Filename : Filenames) {
49 class CounterExpressionsMinimizer {
52 std::vector<unsigned> AdjustedExpressionIDs;
58 AdjustedExpressionIDs.resize(Expressions.
size(), 0);
59 for (
const auto &
I : MappingRegions)
61 for (
const auto &
I : MappingRegions)
69 AdjustedExpressionIDs[
ID] = 1;
70 mark(Expressions[ID].LHS);
71 mark(Expressions[ID].RHS);
133 "Source region does not begin before it ends");
148 for (
const auto &FileID : VirtualFileMapping)
152 CounterExpressionsMinimizer Minimizer(
Expressions, MappingRegions);
153 auto MinExpressions = Minimizer.getExpressions();
155 for (
const auto &
E : MinExpressions) {
163 unsigned PrevLineStart = 0;
164 unsigned CurrentFileID = ~0U;
165 for (
auto I = MappingRegions.begin(),
E = MappingRegions.end();
I !=
E; ++
I) {
166 if (
I->FileID != CurrentFileID) {
168 assert(
I->FileID == (CurrentFileID + 1));
170 unsigned RegionCount = 1;
171 for (
auto J =
I + 1; J !=
E &&
I->FileID == J->FileID; ++J)
176 CurrentFileID =
I->FileID;
179 Counter Count = Minimizer.adjust(
I->Count);
192 unsigned EncodedTagExpandedFileID =
206 assert(
I->LineStart >= PrevLineStart);
212 PrevLineStart =
I->LineStart;
215 assert(CurrentFileID == (VirtualFileMapping.size() - 1));
This class represents lattice values for constants.
amdgpu Simplify well known AMD library false FunctionCallee Value const Twine & Name
void push_back(const T &Elt)
void write(raw_ostream &OS)
Write encoded coverage mapping data to the given output stream.
LineColPair endLoc() const
void write(raw_ostream &OS)
Write encoded filenames to the given output stream.
bool all_of(R &&range, UnaryPredicate P)
Provide wrappers to std::all_of which take ranges instead of having to pass begin/end explicitly...
CoverageFilenamesSectionWriter(ArrayRef< StringRef > Filenames)
gvn Early GVN Hoisting of Expressions
A GapRegion is like a CodeRegion, but its count is only set as the line execution count when its the ...
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory)...
static unsigned encodeCounter(ArrayRef< CounterExpression > Expressions, Counter C)
Encode the counter.
* if(!EatIfPresent(lltok::kw_thread_local)) return false
ParseOptionalThreadLocal := /*empty.
size_t size() const
size - Get the array size.
static GCRegistry::Add< CoreCLRGC > E("coreclr", "CoreCLR-compatible GC")
A CodeRegion associates some code with a counter.
A Counter mapping region associates a source range with a specific counter.
LineColPair startLoc() const
std::pair< typename base::iterator, bool > insert(StringRef Key)
Align max(MaybeAlign Lhs, Align Rhs)
unsigned encodeULEB128(uint64_t Value, raw_ostream &OS, unsigned PadTo=0)
Utility function to encode a ULEB128 value to an output stream.
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small...
An ExpansionRegion represents a file expansion region that associates a source range with the expansi...
A SkippedRegion represents a source range with code that was skipped by a preprocessor or similar mea...
static void writeCounter(ArrayRef< CounterExpression > Expressions, Counter C, raw_ostream &OS)
bool isExpression() const
static const unsigned EncodingCounterTagAndExpansionRegionTagBits
unsigned getExpressionID() const
CounterKind getKind() const
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
static const unsigned EncodingTagBits
void stable_sort(R &&Range)
unsigned getCounterID() const
StringSet - A wrapper for StringMap that provides set-like functionality.
This class implements an extremely fast bulk output stream that can only output to a stream...
StringRef - Represent a constant reference to a string, i.e.
static Counter getExpression(unsigned ExpressionId)
Return the counter that corresponds to a specific addition counter expression.
A Counter is an abstract value that describes how to compute the execution count for a region of code...