brintos

brintos / llvm-project-archived public Read only

0
0
Text · 2.3 KiB · 2347449 Raw
62 lines · c
1//===-- SchedClassResolution.h ----------------------------------*- C++ -*-===//2//3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.4// See https://llvm.org/LICENSE.txt for license information.5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception6//7//===----------------------------------------------------------------------===//8///9/// \file10/// Resolution of MCInst sched class into expanded form for further analysis.11///12//===----------------------------------------------------------------------===//13 14#ifndef LLVM_TOOLS_LLVM_EXEGESIS_SCHEDCLASSRESOLUTION_H15#define LLVM_TOOLS_LLVM_EXEGESIS_SCHEDCLASSRESOLUTION_H16 17#include "BenchmarkResult.h"18#include "llvm/MC/MCContext.h"19#include "llvm/MC/MCDisassembler/MCDisassembler.h"20#include "llvm/MC/MCInstPrinter.h"21#include "llvm/MC/MCInstrInfo.h"22#include "llvm/MC/MCObjectFileInfo.h"23#include "llvm/MC/MCSubtargetInfo.h"24#include "llvm/MC/TargetRegistry.h"25#include "llvm/Support/Error.h"26#include "llvm/Support/raw_ostream.h"27 28namespace llvm {29namespace exegesis {30 31// Computes the idealized ProcRes Unit pressure. This is the expected32// distribution if the CPU scheduler can distribute the load as evenly as33// possible.34std::vector<std::pair<uint16_t, float>>35computeIdealizedProcResPressure(const MCSchedModel &SM,36                                SmallVector<MCWriteProcResEntry, 8> WPRS);37 38// An MCSchedClassDesc augmented with some additional data.39struct ResolvedSchedClass {40  ResolvedSchedClass(const MCSubtargetInfo &STI, unsigned ResolvedSchedClassId,41                     bool WasVariant);42 43  static std::pair<unsigned /*SchedClassId*/, bool /*WasVariant*/>44  resolveSchedClassId(const MCSubtargetInfo &SubtargetInfo,45                      const MCInstrInfo &InstrInfo, const MCInst &MCI);46 47  std::vector<BenchmarkMeasure>48  getAsPoint(Benchmark::ModeE Mode, const MCSubtargetInfo &STI,49             ArrayRef<PerInstructionStats> Representative) const;50 51  const unsigned SchedClassId;52  const MCSchedClassDesc *const SCDesc;53  const bool WasVariant; // Whether the original class was variant.54  const SmallVector<MCWriteProcResEntry, 8> NonRedundantWriteProcRes;55  const std::vector<std::pair<uint16_t, float>> IdealizedProcResPressure;56};57 58} // namespace exegesis59} // namespace llvm60 61#endif // LLVM_TOOLS_LLVM_EXEGESIS_SCHEDCLASSRESOLUTION_H62