LLVM 22.0.0git
llvm::coverage::CounterExpressionBuilder Class Reference

A Counter expression builder is used to construct the counter expressions. More...

#include "llvm/ProfileData/Coverage/CoverageMapping.h"

Public Types

using SubstMap = std::map<Counter, Counter>
 K to V map.

Public Member Functions

ArrayRef< CounterExpressiongetExpressions () const
LLVM_ABI Counter add (Counter LHS, Counter RHS, bool Simplify=true)
 Return a counter that represents the expression that adds LHS and RHS.
LLVM_ABI Counter subtract (Counter LHS, Counter RHS, bool Simplify=true)
 Return a counter that represents the expression that subtracts RHS from LHS.
LLVM_ABI Counter subst (Counter C, const SubstMap &Map)

Detailed Description

A Counter expression builder is used to construct the counter expressions.

It avoids unnecessary duplication and simplifies algebraic expressions.

Definition at line 176 of file CoverageMapping.h.

Member Typedef Documentation

◆ SubstMap

K to V map.

K will be Counter in most cases. V may be Counter or Expression.

Definition at line 222 of file CoverageMapping.h.

Member Function Documentation

◆ add()

Counter CounterExpressionBuilder::add ( Counter LHS,
Counter RHS,
bool Simplify = true )

Return a counter that represents the expression that adds LHS and RHS.

Definition at line 127 of file CoverageMapping.cpp.

References llvm::coverage::CounterExpression::Add, and simplify.

Referenced by subst().

◆ getExpressions()

ArrayRef< CounterExpression > llvm::coverage::CounterExpressionBuilder::getExpressions ( ) const
inline

Definition at line 211 of file CoverageMapping.h.

◆ subst()

Counter CounterExpressionBuilder::subst ( Counter C,
const SubstMap & Map )
Returns
A counter equivalent to \C, with each term in its expression replaced with term from Map.

Definition at line 138 of file CoverageMapping.cpp.

References llvm::coverage::CounterExpression::Add, add(), llvm::CallingConv::C, I, subst(), llvm::coverage::CounterExpression::Subtract, and subtract().

Referenced by subst().

◆ subtract()

Counter CounterExpressionBuilder::subtract ( Counter LHS,
Counter RHS,
bool Simplify = true )

Return a counter that represents the expression that subtracts RHS from LHS.

Definition at line 132 of file CoverageMapping.cpp.

References simplify, and llvm::coverage::CounterExpression::Subtract.

Referenced by subst().


The documentation for this class was generated from the following files: