1 //===-- SchedClassResolution.h ----------------------------------*- C++ -*-===//
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-exception
7 //===----------------------------------------------------------------------===//
10 /// Resolution of MCInst sched class into expanded form for further analysis.
12 //===----------------------------------------------------------------------===//
14 #ifndef LLVM_TOOLS_LLVM_EXEGESIS_SCHEDCLASSRESOLUTION_H
15 #define LLVM_TOOLS_LLVM_EXEGESIS_SCHEDCLASSRESOLUTION_H
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"
31 // Computes the idealized ProcRes Unit pressure. This is the expected
32 // distribution if the CPU scheduler can distribute the load as evenly as
34 std::vector
<std::pair
<uint16_t, float>>
35 computeIdealizedProcResPressure(const MCSchedModel
&SM
,
36 SmallVector
<MCWriteProcResEntry
, 8> WPRS
);
38 // An MCSchedClassDesc augmented with some additional data.
39 struct ResolvedSchedClass
{
40 ResolvedSchedClass(const MCSubtargetInfo
&STI
, unsigned ResolvedSchedClassId
,
43 static std::pair
<unsigned /*SchedClassId*/, bool /*WasVariant*/>
44 resolveSchedClassId(const MCSubtargetInfo
&SubtargetInfo
,
45 const MCInstrInfo
&InstrInfo
, const MCInst
&MCI
);
47 std::vector
<BenchmarkMeasure
>
48 getAsPoint(Benchmark::ModeE Mode
, const MCSubtargetInfo
&STI
,
49 ArrayRef
<PerInstructionStats
> Representative
) const;
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
;
58 } // namespace exegesis
61 #endif // LLVM_TOOLS_LLVM_EXEGESIS_SCHEDCLASSRESOLUTION_H