llvm/llvm/tools/llvm-exegesis/lib/BenchmarkResult.cpp

//===-- BenchmarkResult.cpp -------------------------------------*- C++ -*-===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//

#include "BenchmarkResult.h"
#include "BenchmarkRunner.h"
#include "Error.h"
#include "ValidationEvent.h"
#include "llvm/ADT/STLExtras.h"
#include "llvm/ADT/ScopeExit.h"
#include "llvm/ADT/StringRef.h"
#include "llvm/ADT/bit.h"
#include "llvm/ObjectYAML/YAML.h"
#include "llvm/Support/Errc.h"
#include "llvm/Support/FileOutputBuffer.h"
#include "llvm/Support/FileSystem.h"
#include "llvm/Support/Format.h"
#include "llvm/Support/raw_ostream.h"

static constexpr const char kIntegerPrefix[] =;
static constexpr const char kDoublePrefix[] =;
static constexpr const char kInvalidOperand[] =;

namespace llvm {

namespace {

// A mutable struct holding an LLVMState that can be passed through the
// serialization process to encode/decode registers and instructions.
struct YamlContext {};
} // namespace

// Defining YAML traits for IO.
namespace yaml {

static YamlContext &getTypedContext(void *Ctx) {}

// std::vector<MCInst> will be rendered as a list.
template <> struct SequenceElementTraits<MCInst> {};

template <> struct ScalarTraits<MCInst> {};

// std::vector<exegesis::Measure> will be rendered as a list.
template <> struct SequenceElementTraits<exegesis::BenchmarkMeasure> {};

template <>
struct CustomMappingTraits<std::map<exegesis::ValidationEvent, int64_t>> {};

// exegesis::Measure is rendererd as a flow instead of a list.
// e.g. { "key": "the key", "value": 0123 }
template <> struct MappingTraits<exegesis::BenchmarkMeasure> {};

template <>
struct ScalarEnumerationTraits<exegesis::Benchmark::ModeE> {};

// std::vector<exegesis::RegisterValue> will be rendered as a list.
template <> struct SequenceElementTraits<exegesis::RegisterValue> {};

template <> struct ScalarTraits<exegesis::RegisterValue> {};

template <>
struct MappingContextTraits<exegesis::BenchmarkKey, YamlContext> {};

template <>
struct MappingContextTraits<exegesis::Benchmark, YamlContext> {};

template <> struct MappingTraits<exegesis::Benchmark::TripleAndCpu> {};

} // namespace yaml

namespace exegesis {

Expected<std::set<Benchmark::TripleAndCpu>>
Benchmark::readTriplesAndCpusFromYamls(MemoryBufferRef Buffer) {}

Expected<Benchmark>
Benchmark::readYaml(const LLVMState &State, MemoryBufferRef Buffer) {}

Expected<std::vector<Benchmark>>
Benchmark::readYamls(const LLVMState &State,
                                MemoryBufferRef Buffer) {}

Error Benchmark::writeYamlTo(const LLVMState &State,
                                        raw_ostream &OS) {}

Error Benchmark::readYamlFrom(const LLVMState &State,
                                         StringRef InputContent) {}

void PerInstructionStats::push(const BenchmarkMeasure &BM) {}

bool operator==(const BenchmarkMeasure &A, const BenchmarkMeasure &B) {}

} // namespace exegesis
} // namespace llvm