26 using namespace coverage;
30 for (
const auto &Filename : Filenames) {
40 class CounterExpressionsMinimizer {
43 std::vector<unsigned> AdjustedExpressionIDs;
48 : Expressions(Expressions) {
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);
70 UsedExpressions.push_back(
E);
122 MappingRegions.begin(), MappingRegions.end(),
124 if (LHS.
FileID != RHS.FileID)
125 return LHS.
FileID < RHS.FileID;
126 if (LHS.
startLoc() != RHS.startLoc())
127 return LHS.
startLoc() < RHS.startLoc();
128 return LHS.
Kind < RHS.Kind;
133 for (
const auto &FileID : VirtualFileMapping)
137 CounterExpressionsMinimizer Minimizer(Expressions, MappingRegions);
138 auto MinExpressions = Minimizer.getExpressions();
140 for (
const auto &
E : MinExpressions) {
148 unsigned PrevLineStart = 0;
149 unsigned CurrentFileID = ~0U;
150 for (
auto I = MappingRegions.begin(),
E = MappingRegions.end();
I !=
E; ++
I) {
151 if (
I->FileID != CurrentFileID) {
153 assert(
I->FileID == (CurrentFileID + 1));
155 unsigned RegionCount = 1;
156 for (
auto J =
I + 1; J !=
E &&
I->FileID == J->FileID; ++J)
161 CurrentFileID =
I->FileID;
164 Counter Count = Minimizer.adjust(
I->Count);
176 unsigned EncodedTagExpandedFileID =
190 assert(
I->LineStart >= PrevLineStart);
196 PrevLineStart =
I->LineStart;
199 assert(CurrentFileID == (VirtualFileMapping.size() - 1));
GCNRegPressure max(const GCNRegPressure &P1, const GCNRegPressure &P2)
void write(raw_ostream &OS)
Write encoded coverage mapping data to the given output stream.
void write(raw_ostream &OS)
Write encoded filenames to the given output stream.
gvn Early GVN Hoisting of Expressions
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory)...
size_t size() const
size - Get the array size.
static unsigned encodeCounter(ArrayRef< CounterExpression > Expressions, Counter C)
Encode the counter.
unsigned getExpressionID() const
CounterKind getKind() const
A CodeRegion associates some code with a counter.
unsigned getCounterID() const
A Counter mapping region associates a source range with a specific counter.
std::pair< unsigned, unsigned > startLoc() const
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)
static const unsigned EncodingCounterTagAndExpansionRegionTagBits
bool isExpression() const
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
static const unsigned EncodingTagBits
This class implements an extremely fast bulk output stream that can only output to a stream...
void encodeULEB128(uint64_t Value, raw_ostream &OS, unsigned Padding=0)
Utility function to encode a ULEB128 value to an output 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...