LLVM: lib/CodeGen/PostRAHazardRecognizer.cpp Source File (original) (raw)
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
37using namespace llvm;
38
39#define DEBUG_TYPE "post-RA-hazard-rec"
40
41STATISTIC(NumNoops, "Number of noops inserted");
42
43namespace {
44struct PostRAHazardRecognizer {
46};
47
49
50public:
51 static char ID;
52 PostRAHazardRecognizerLegacy() : MachineFunctionPass(ID) {}
53
54 void getAnalysisUsage(AnalysisUsage &AU) const override {
57 }
58
59 bool runOnMachineFunction(MachineFunction &Fn) override {
60 return PostRAHazardRecognizer().run(Fn);
61 }
62};
63char PostRAHazardRecognizerLegacy::ID = 0;
64
65}
66
68
70 "Post RA hazard recognizer", false, false)
71
75 if (!PostRAHazardRecognizer().run(MF))
77
80 return PA;
81}
82
85 std::unique_ptr HazardRec(
87
88
89 if (!HazardRec)
90 return false;
91
92
94 for (auto &MBB : Fn) {
95
96
97 for (MachineInstr &MI : MBB) {
98
99 unsigned NumPreNoops = HazardRec->PreEmitNoops(&MI);
100 HazardRec->EmitNoops(NumPreNoops);
102 NumNoops += NumPreNoops;
103 if (NumPreNoops)
105
106 HazardRec->EmitInstruction(&MI);
107 if (HazardRec->atIssueLimit()) {
108 HazardRec->AdvanceCycle();
109 }
110 }
111 }
113}
const HexagonInstrInfo * TII
#define INITIALIZE_PASS(passName, arg, name, cfg, analysis)
This file defines the 'Statistic' class, which is designed to be an easy way to expose various metric...
#define STATISTIC(VARNAME, DESC)
LLVM_ABI void setPreservesCFG()
This function should be called by the pass, iff they do not:
Represents analyses that only rely on functions' control flow.
ScheduleHazardRecognizer * CreateTargetPostRAHazardRecognizer(const InstrItineraryData *II, const ScheduleDAG *DAG) const override
Allocate and return a hazard recognizer to use for this target when scheduling the machine instructio...
MachineInstrBundleIterator< MachineInstr > iterator
MachineFunctionPass - This class adapts the FunctionPass interface to allow convenient creation of pa...
void getAnalysisUsage(AnalysisUsage &AU) const override
getAnalysisUsage - Subclasses that override getAnalysisUsage must call this.
const TargetSubtargetInfo & getSubtarget() const
getSubtarget - Return the subtarget for which this machine code is being compiled.
A set of analyses that are preserved following a run of a transformation pass.
static PreservedAnalyses all()
Construct a special preserved set that preserves all passes.
virtual const TargetInstrInfo * getInstrInfo() const
This is an optimization pass for GlobalISel generic memory operations.
LLVM_ABI char & PostRAHazardRecognizerID
PostRAHazardRecognizer - This pass runs the post-ra hazard recognizer.
Definition PostRAHazardRecognizer.cpp:67
AnalysisManager< MachineFunction > MachineFunctionAnalysisManager
LLVM_ABI PreservedAnalyses getMachineFunctionPassPreservedAnalyses()
Returns the minimum set of Analyses that all machine function passes must preserve.