123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109 |
- #pragma once
- #ifdef __GNUC__
- #pragma GCC diagnostic push
- #pragma GCC diagnostic ignored "-Wunused-parameter"
- #endif
- #ifndef LLVM_TRANSFORMS_UTILS_SAMPLEPROFILELOADERBASEUTIL_H
- #define LLVM_TRANSFORMS_UTILS_SAMPLEPROFILELOADERBASEUTIL_H
- #include "llvm/ADT/DenseMap.h"
- #include "llvm/ProfileData/SampleProf.h"
- #include "llvm/Support/CommandLine.h"
- namespace llvm {
- using namespace sampleprof;
- class ProfileSummaryInfo;
- class Module;
- extern cl::opt<unsigned> SampleProfileMaxPropagateIterations;
- extern cl::opt<unsigned> SampleProfileRecordCoverage;
- extern cl::opt<unsigned> SampleProfileSampleCoverage;
- extern cl::opt<bool> NoWarnSampleUnused;
- namespace sampleprofutil {
- class SampleCoverageTracker {
- public:
- bool markSamplesUsed(const FunctionSamples *FS, uint32_t LineOffset,
- uint32_t Discriminator, uint64_t Samples);
- unsigned computeCoverage(unsigned Used, unsigned Total) const;
- unsigned countUsedRecords(const FunctionSamples *FS,
- ProfileSummaryInfo *PSI) const;
- unsigned countBodyRecords(const FunctionSamples *FS,
- ProfileSummaryInfo *PSI) const;
- uint64_t getTotalUsedSamples() const { return TotalUsedSamples; }
- uint64_t countBodySamples(const FunctionSamples *FS,
- ProfileSummaryInfo *PSI) const;
- void clear() {
- SampleCoverage.clear();
- TotalUsedSamples = 0;
- }
- void setProfAccForSymsInList(bool V) { ProfAccForSymsInList = V; }
- private:
- using BodySampleCoverageMap = std::map<LineLocation, unsigned>;
- using FunctionSamplesCoverageMap =
- DenseMap<const FunctionSamples *, BodySampleCoverageMap>;
-
-
-
-
-
-
-
-
-
- FunctionSamplesCoverageMap SampleCoverage;
-
-
-
-
-
-
-
-
-
-
-
- uint64_t TotalUsedSamples = 0;
-
-
- bool ProfAccForSymsInList = false;
- };
- bool callsiteIsHot(const FunctionSamples *CallsiteFS, ProfileSummaryInfo *PSI,
- bool ProfAccForSymsInList);
- void createFSDiscriminatorVariable(Module *M);
- }
- }
- #endif
- #ifdef __GNUC__
- #pragma GCC diagnostic pop
- #endif
|