#include "Analysis.h"
#include "BenchmarkResult.h"
#include "llvm/ADT/STLExtras.h"
#include "llvm/MC/MCAsmInfo.h"
#include "llvm/MC/MCTargetOptions.h"
#include "llvm/Support/FormatVariadic.h"
#include <limits>
#include <vector>
namespace llvm {
namespace exegesis {
static const char kCsvSep = …;
namespace {
enum EscapeTag { … };
template <EscapeTag Tag> void writeEscaped(raw_ostream &OS, const StringRef S);
template <> void writeEscaped<kEscapeCsv>(raw_ostream &OS, const StringRef S) { … }
template <> void writeEscaped<kEscapeHtml>(raw_ostream &OS, const StringRef S) { … }
template <>
void writeEscaped<kEscapeHtmlString>(raw_ostream &OS, const StringRef S) { … }
}
template <EscapeTag Tag>
static void
writeClusterId(raw_ostream &OS,
const BenchmarkClustering::ClusterId &CID) { … }
template <EscapeTag Tag>
static void writeMeasurementValue(raw_ostream &OS, const double Value) { … }
template <typename EscapeTag, EscapeTag Tag>
void Analysis::writeSnippet(raw_ostream &OS, ArrayRef<uint8_t> Bytes,
const char *Separator) const { … }
void Analysis::printInstructionRowCsv(const size_t PointId,
raw_ostream &OS) const { … }
Analysis::Analysis(const LLVMState &State,
const BenchmarkClustering &Clustering,
double AnalysisInconsistencyEpsilon,
bool AnalysisDisplayUnstableOpcodes)
: … { … }
template <>
Error Analysis::run<Analysis::PrintClusters>(raw_ostream &OS) const { … }
Analysis::ResolvedSchedClassAndPoints::ResolvedSchedClassAndPoints(
ResolvedSchedClass &&RSC)
: … { … }
std::vector<Analysis::ResolvedSchedClassAndPoints>
Analysis::makePointsPerSchedClass() const { … }
static void writeParallelSnippetHtml(raw_ostream &OS,
const std::vector<MCInst> &Instructions,
const MCInstrInfo &InstrInfo) { … }
static void writeLatencySnippetHtml(raw_ostream &OS,
const std::vector<MCInst> &Instructions,
const MCInstrInfo &InstrInfo) { … }
void Analysis::printPointHtml(const Benchmark &Point, raw_ostream &OS) const { … }
void Analysis::printSchedClassClustersHtml(
const std::vector<SchedClassCluster> &Clusters,
const ResolvedSchedClass &RSC, raw_ostream &OS) const { … }
void Analysis::SchedClassCluster::addPoint(
size_t PointId, const BenchmarkClustering &Clustering) { … }
bool Analysis::SchedClassCluster::measurementsMatch(
const MCSubtargetInfo &STI, const ResolvedSchedClass &RSC,
const BenchmarkClustering &Clustering,
const double AnalysisInconsistencyEpsilonSquared_) const { … }
void Analysis::printSchedClassDescHtml(const ResolvedSchedClass &RSC,
raw_ostream &OS) const { … }
void Analysis::printClusterRawHtml(const BenchmarkClustering::ClusterId &Id,
StringRef display_name,
raw_ostream &OS) const { … }
static constexpr const char kHtmlHead[] = …;
template <>
Error Analysis::run<Analysis::PrintSchedClassInconsistencies>(
raw_ostream &OS) const { … }
}
}