forked from securesystemslab/LLVM-MCA-Daemon
-
Notifications
You must be signed in to change notification settings - Fork 2
/
MCAWorker.h
99 lines (83 loc) · 2.25 KB
/
MCAWorker.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
#ifndef MCAD_MCAWORKER_H
#define MCAD_MCAWORKER_H
#include "llvm/ADT/Optional.h"
#include "llvm/MCA/SourceMgr.h"
#include "llvm/Support/Error.h"
#include "llvm/Support/Timer.h"
#include <functional>
#include <utility>
#include <list>
#include <unordered_map>
#include <set>
#include "BrokerFacade.h"
#include "Brokers/Broker.h"
namespace llvm {
class Target;
class ToolOutputFile;
class MCAsmInfo;
class MCContext;
class MCSubtargetInfo;
class MCInst;
class MCInstPrinter;
class MCInstrInfo;
namespace mca {
class Context;
class InstrBuilder;
class Pipeline;
class PipelineOptions;
class PipelinePrinter;
class InstrDesc;
class Instruction;
} // end namespace mca
namespace mcad {
class MCAWorker {
friend class BrokerFacade;
const Target &TheTarget;
const MCSubtargetInfo &STI;
mca::InstrBuilder &MCAIB;
MCContext &Ctx;
const MCAsmInfo &MAI;
const MCInstrInfo &MCII;
MCInstPrinter &MIP;
mca::Context &TheMCA;
const mca::PipelineOptions &MCAPO;
ToolOutputFile &MCAOF;
std::unique_ptr<mca::Pipeline> MCAPipeline;
std::unique_ptr<mca::PipelinePrinter> MCAPipelinePrinter;
size_t NumTraceMIs;
// MCAWorker is the owner of this callback. Note that
// SummaryView will only take reference of it.
std::function<size_t(void)> GetTraceMISize;
mca::IncrementalSourceMgr SrcMgr;
std::unordered_map<const mca::InstrDesc*,
std::set<mca::Instruction*>> RecycledInsts;
std::function<mca::Instruction*(const mca::InstrDesc&)>
GetRecycledInst;
std::function<void(mca::Instruction*)> AddRecycledInst;
TimerGroup Timers;
std::unique_ptr<Broker> TheBroker;
std::unique_ptr<mca::Pipeline> createPipeline();
void resetPipeline();
Error runPipeline();
void printMCA(StringRef RegionDescription = "");
public:
MCAWorker() = delete;
MCAWorker(const Target &T,
const MCSubtargetInfo &STI,
mca::Context &MCA,
const mca::PipelineOptions &PO,
mca::InstrBuilder &IB,
ToolOutputFile &OF,
MCContext &Ctx,
const MCAsmInfo &MAI,
const MCInstrInfo &II,
MCInstPrinter &IP);
BrokerFacade getBrokerFacade() {
return BrokerFacade(*this);
}
Error run();
~MCAWorker();
};
} // end namespace mcad
} // end namespace llvm
#endif