56 std::vector<Metadata *> Entries;
59 for (
auto &Entry : DetailedSummary) {
81 bool AddPartialProfileRatioField) {
82 const char *KindStr[3] = {
"InstrProf",
"CSInstrProf",
"SampleProfile"};
96 if (AddPartialProfileRatioField)
99 Components.
push_back(getDetailedSummaryMD(Context));
111 if (!KeyMD || !ValMD)
141 if (!KeyMD || !ValMD)
153 if (!KeyMD || KeyMD->
getString() !=
"DetailedSummary")
158 for (
auto &&MDOp : EntriesMD->
operands()) {
169 if (!Op0 || !Op1 || !Op2)
180template <
typename ValueType>
188 return Idx < Tuple->getNumOperands();
196 if (!Tuple || Tuple->getNumOperands() < 8 || Tuple->getNumOperands() > 10)
200 auto &FormatMD = Tuple->getOperand(
I++);
214 uint64_t NumCounts, TotalCount, NumFunctions, MaxFunctionCount, MaxCount,
238 double PartialProfileRatio = 0;
239 if (!
getOptionalVal(Tuple,
I,
"PartialProfileRatio", PartialProfileRatio))
245 return new ProfileSummary(SummaryKind, std::move(Summary), TotalCount,
246 MaxCount, MaxInternalCount, MaxFunctionCount,
247 NumCounts, NumFunctions, IsPartialProfile,
248 PartialProfileRatio);
252 OS <<
"Total functions: " << NumFunctions <<
"\n";
253 OS <<
"Maximum function count: " << MaxFunctionCount <<
"\n";
254 OS <<
"Maximum internal block count: " << MaxInternalCount <<
"\n";
255 OS <<
"Total number of blocks: " << NumCounts <<
"\n";
256 OS <<
"Total count: " << TotalCount <<
"\n";
260 OS <<
"Detailed summary:\n";
261 for (
const auto &Entry : DetailedSummary) {
262 OS << Entry.NumCounts <<
" blocks "
264 NumCounts ? (100.f * Entry.NumCounts / NumCounts) : 0)
265 <<
" with count >= " << Entry.MinCount <<
" account for "
267 <<
"% of the total counts.\n";
This file contains the declarations for the subclasses of Constant, which represent the different fla...
const AbstractManglingParser< Derived, Alloc >::OperatorInfo AbstractManglingParser< Derived, Alloc >::Ops[]
static ConstantAsMetadata * getValMD(MDTuple *MD, const char *Key)
static Metadata * getKeyFPValMD(LLVMContext &Context, const char *Key, double Val)
static bool isKeyValuePair(MDTuple *MD, const char *Key, const char *Val)
static bool getOptionalVal(MDTuple *Tuple, unsigned &Idx, const char *Key, ValueType &Value)
static bool getSummaryFromMD(MDTuple *MD, SummaryEntryVector &Summary)
static Metadata * getKeyValMD(LLVMContext &Context, const char *Key, uint64_t Val)
static bool getVal(MDTuple *MD, const char *Key, uint64_t &Val)
This is an important class for using LLVM in a threaded context.
const MDOperand & getOperand(unsigned I) const
ArrayRef< MDOperand > operands() const
unsigned getNumOperands() const
Return number of MDNode operands.
LLVM_ABI StringRef getString() const
static LLVM_ABI MDString * get(LLVMContext &Context, StringRef Str)
static MDTuple * get(LLVMContext &Context, ArrayRef< Metadata * > MDs)
uint64_t getTotalCount() const
uint64_t getMaxCount() const
LLVM_ABI Metadata * getMD(LLVMContext &Context, bool AddPartialField=true, bool AddPartialProfileRatioField=true)
Return summary information as metadata.
uint32_t getNumCounts() const
ProfileSummary(Kind K, const SummaryEntryVector &DetailedSummary, uint64_t TotalCount, uint64_t MaxCount, uint64_t MaxInternalCount, uint64_t MaxFunctionCount, uint32_t NumCounts, uint32_t NumFunctions, bool Partial=false, double PartialProfileRatio=0)
LLVM_ABI void printDetailedSummary(raw_ostream &OS) const
uint64_t getMaxInternalCount() const
bool isPartialProfile() const
static LLVM_ABI ProfileSummary * getFromMD(Metadata *MD)
Construct profile summary from metdata.
uint64_t getMaxFunctionCount() const
LLVM_ABI void printSummary(raw_ostream &OS) const
double getPartialProfileRatio() const
uint32_t getNumFunctions() const
void push_back(const T &Elt)
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
The instances of the Type class are immutable: once they are created, they are never changed.
static LLVM_ABI IntegerType * getInt64Ty(LLVMContext &C)
static LLVM_ABI IntegerType * getInt32Ty(LLVMContext &C)
static LLVM_ABI Type * getDoubleTy(LLVMContext &C)
LLVM Value Representation.
This class implements an extremely fast bulk output stream that can only output to a stream.
This is an optimization pass for GlobalISel generic memory operations.
decltype(auto) dyn_cast(const From &Val)
dyn_cast<X> - Return the argument parameter cast to the specified type.
FunctionAddr VTableAddr uintptr_t uintptr_t Int32Ty
auto dyn_cast_or_null(const Y &Val)
format_object< Ts... > format(const char *Fmt, const Ts &... Vals)
These are helper functions used to produce formatted output.
LLVM_ATTRIBUTE_VISIBILITY_DEFAULT AnalysisKey InnerAnalysisManagerProxy< AnalysisManagerT, IRUnitT, ExtraArgTs... >::Key
decltype(auto) cast(const From &Val)
cast<X> - Return the argument parameter cast to the specified type.
PointerUnion< const Value *, const PseudoSourceValue * > ValueType
std::vector< ProfileSummaryEntry > SummaryEntryVector