26 using namespace coverage;
30 for (
const auto &Filename : Filenames) {
40 class CounterExpressionsMinimizer {
43 std::vector<unsigned> AdjustedExpressionIDs;
49 AdjustedExpressionIDs.resize(Expressions.
size(), 0);
50 for (
const auto &
I : MappingRegions)
52 for (
const auto &
I : MappingRegions)
60 AdjustedExpressionIDs[
ID] = 1;
61 mark(Expressions[ID].LHS);
62 mark(Expressions[ID].RHS);
124 "Source region does not begin before it ends");
129 MappingRegions.begin(), MappingRegions.end(),
131 if (LHS.
FileID != RHS.FileID)
132 return LHS.
FileID < RHS.FileID;
133 if (LHS.
startLoc() != RHS.startLoc())
134 return LHS.
startLoc() < RHS.startLoc();
135 return LHS.
Kind < RHS.Kind;
140 for (
const auto &FileID : VirtualFileMapping)
144 CounterExpressionsMinimizer Minimizer(
Expressions, MappingRegions);
145 auto MinExpressions = Minimizer.getExpressions();
147 for (
const auto &
E : MinExpressions) {
155 unsigned PrevLineStart = 0;
156 unsigned CurrentFileID = ~0U;
157 for (
auto I = MappingRegions.begin(),
E = MappingRegions.end();
I !=
E; ++
I) {
158 if (
I->FileID != CurrentFileID) {
160 assert(
I->FileID == (CurrentFileID + 1));
162 unsigned RegionCount = 1;
163 for (
auto J =
I + 1; J !=
E &&
I->FileID == J->FileID; ++J)
168 CurrentFileID =
I->FileID;
171 Counter Count = Minimizer.adjust(
I->Count);
184 unsigned EncodedTagExpandedFileID =
198 assert(
I->LineStart >= PrevLineStart);
204 PrevLineStart =
I->LineStart;
207 assert(CurrentFileID == (VirtualFileMapping.size() - 1));
GCNRegPressure max(const GCNRegPressure &P1, const GCNRegPressure &P2)
This class represents lattice values for constants.
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...
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.
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
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
unsigned getCounterID() const
This class implements an extremely fast bulk output stream that can only output to a stream...
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...