LLVM  11.0.0git
CoverageMappingWriter.cpp File Reference
#include "llvm/ProfileData/InstrProf.h"
#include "llvm/ProfileData/Coverage/CoverageMappingWriter.h"
#include "llvm/ADT/ArrayRef.h"
#include "llvm/ADT/SmallVector.h"
#include "llvm/Support/Compression.h"
#include "llvm/Support/LEB128.h"
#include "llvm/Support/raw_ostream.h"
#include <algorithm>
#include <cassert>
#include <limits>
#include <vector>
Include dependency graph for CoverageMappingWriter.cpp:

Go to the source code of this file.


static unsigned encodeCounter (ArrayRef< CounterExpression > Expressions, Counter C)
 Encode the counter. More...
static void writeCounter (ArrayRef< CounterExpression > Expressions, Counter C, raw_ostream &OS)

Function Documentation

◆ encodeCounter()

static unsigned encodeCounter ( ArrayRef< CounterExpression Expressions,
Counter  C 

Encode the counter.

The encoding uses the following format: Low 2 bits - Tag: Counter::Zero(0) - A Counter with kind Counter::Zero Counter::CounterValueReference(1) - A counter with kind Counter::CounterValueReference Counter::Expression(2) + CounterExpression::Subtract(0) - A counter with kind Counter::Expression and an expression with kind CounterExpression::Subtract Counter::Expression(2) + CounterExpression::Add(1) - A counter with kind Counter::Expression and an expression with kind CounterExpression::Add Remaining bits - Counter/Expression ID.

Definition at line 135 of file CoverageMappingWriter.cpp.

References assert(), llvm::coverage::Counter::EncodingTagBits, llvm::coverage::Counter::getCounterID(), llvm::coverage::Counter::getExpressionID(), llvm::coverage::Counter::getKind(), llvm::coverage::Counter::isExpression(), and llvm::max().

Referenced by writeCounter().

◆ writeCounter()

static void writeCounter ( ArrayRef< CounterExpression Expressions,
Counter  C,
raw_ostream OS