LLVM: include/llvm/CodeGen/RegAllocEvictionAdvisor.h Source File (original) (raw)
1
2
3
4
5
6
7
8
9#ifndef LLVM_CODEGEN_REGALLOCEVICTIONADVISOR_H
10#define LLVM_CODEGEN_REGALLOCEVICTIONADVISOR_H
11
19#include "llvm/Config/llvm-config.h"
24
25namespace llvm {
35
37
38
39
40
41
42
43
44
45
46
47
48
49
50
52
54
55
57
58
60
61
62
63
65
66
68
69
70
72};
73
74
75
76
77
79 unsigned BrokenHints = 0;
81
83
85
87
89
92 std::tie(O.BrokenHints, O.MaxWeight);
93 }
94
96};
97
98
99
100class RAGreedy;
102public:
106
107
108
109
113
114
115
116 virtual bool
119
120
121
123
124protected:
126
128
129
130
133 unsigned CostPerUseLimit) const;
134
135
136
137
139
149
150
151
153};
154
155
156
157
158
159
161public:
165
167
170
171 virtual std::unique_ptr
174
176
177protected:
179
180private:
182};
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
200public:
202
206
207
209
213
214protected:
215
216
221
222private:
225};
226
227
228
229
230
231
232
233
234
235
236
241
242public:
244
246
248 MachineFunctionAnalysisManager::Invalidator &Inv) {
249
250
251 return false;
252 }
253 };
254
256
257private:
258 void
261
262 std::unique_ptr Provider;
263};
264
265
266
268
270
271RegAllocEvictionAdvisorAnalysisLegacy *
273
276
279
280
281
283public:
286
287private:
297 bool) const;
298};
299}
300
301#endif
This file provides Any, a non-template class modeled in the spirit of std::any.
static GCRegistry::Add< ErlangGC > A("erlang", "erlang-compatible garbage collector")
static GCRegistry::Add< OcamlGC > B("ocaml", "ocaml 3.10-compatible GC")
#define LLVM_ATTRIBUTE_RETURNS_NONNULL
This header defines various interfaces for pass management in LLVM.
print mir2vec MIR2Vec Vocabulary Printer Pass
ModuleAnalysisManager MAM
static cl::opt< RegAllocEvictionAdvisorAnalysisLegacy::AdvisorMode > Mode("regalloc-enable-advisor", cl::Hidden, cl::init(RegAllocEvictionAdvisorAnalysisLegacy::AdvisorMode::Default), cl::desc("Enable regalloc advisor mode"), cl::values(clEnumValN(RegAllocEvictionAdvisorAnalysisLegacy::AdvisorMode::Default, "default", "Default"), clEnumValN(RegAllocEvictionAdvisorAnalysisLegacy::AdvisorMode::Release, "release", "precompiled"), clEnumValN(RegAllocEvictionAdvisorAnalysisLegacy::AdvisorMode::Development, "development", "for training")))
SI optimize exec mask operations pre RA
This file defines the SmallSet class.
Represent the analysis usage information of a pass.
void setPreservesAll()
Set by analyses that do not transform their input at all.
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory),...
DefaultEvictionAdvisor(const MachineFunction &MF, const RAGreedy &RA)
Definition RegAllocEvictionAdvisor.h:284
This is an important class for using LLVM in a threaded context.
LiveInterval - This class represents the liveness of a register, or stack slot.
Wrapper class representing physical registers. Should be passed by value.
MachineBlockFrequencyInfo pass uses BlockFrequencyInfoImpl implementation to estimate machine basic b...
MachineRegisterInfo - Keep track of information for virtual and physical registers,...
virtual StringRef getPassName() const
getPassName - Return a nice clean name for a pass.
A set of analyses that are preserved following a run of a transformation pass.
std::unique_ptr< RegAllocEvictionAdvisorProvider > Provider
Definition RegAllocEvictionAdvisor.h:220
RegAllocEvictionAdvisorProvider & getProvider()
Get an advisor for the given context (i.e. machine function, etc)
Definition RegAllocEvictionAdvisor.h:208
static char ID
Definition RegAllocEvictionAdvisor.h:205
virtual void logRewardIfNeeded(const MachineFunction &MF, function_ref< float()> GetReward)
Definition RegAllocEvictionAdvisor.h:211
RegAllocEvictionAdvisorAnalysisLegacy(AdvisorMode Mode)
Definition RegAllocEvictionAdvisor.h:203
AdvisorMode getAdvisorMode() const
Definition RegAllocEvictionAdvisor.h:210
void getAnalysisUsage(AnalysisUsage &AU) const override
getAnalysisUsage - This function should be overriden by passes that need analysis information to do t...
Definition RegAllocEvictionAdvisor.h:217
AdvisorMode
Definition RegAllocEvictionAdvisor.h:201
@ Development
Definition RegAllocEvictionAdvisor.h:201
@ Default
Definition RegAllocEvictionAdvisor.h:201
@ Release
Definition RegAllocEvictionAdvisor.h:201
A MachineFunction analysis for fetching the Eviction Advisor.
Definition RegAllocEvictionAdvisor.h:238
Result run(MachineFunction &MF, MachineFunctionAnalysisManager &MAM)
Common provider for legacy and new pass managers.
Definition RegAllocEvictionAdvisor.h:160
virtual std::unique_ptr< RegAllocEvictionAdvisor > getAdvisor(const MachineFunction &MF, const RAGreedy &RA, MachineBlockFrequencyInfo *MBFI, MachineLoopInfo *Loops)=0
virtual void logRewardIfNeeded(const MachineFunction &MF, llvm::function_ref< float()> GetReward)
Definition RegAllocEvictionAdvisor.h:168
AdvisorMode
Definition RegAllocEvictionAdvisor.h:162
@ Development
Definition RegAllocEvictionAdvisor.h:162
@ Default
Definition RegAllocEvictionAdvisor.h:162
@ Release
Definition RegAllocEvictionAdvisor.h:162
AdvisorMode getAdvisorMode() const
Definition RegAllocEvictionAdvisor.h:175
LLVMContext & Ctx
Definition RegAllocEvictionAdvisor.h:178
RegAllocEvictionAdvisorProvider(AdvisorMode Mode, LLVMContext &Ctx)
Definition RegAllocEvictionAdvisor.h:163
virtual ~RegAllocEvictionAdvisorProvider()=default
const TargetRegisterInfo *const TRI
Definition RegAllocEvictionAdvisor.h:146
virtual bool canEvictHintInterference(const LiveInterval &VirtReg, MCRegister PhysReg, const SmallVirtRegSet &FixedRegisters) const =0
Find out if we can evict the live ranges occupying the given PhysReg, which is a hint (preferred regi...
RegAllocEvictionAdvisor(RegAllocEvictionAdvisor &&)=delete
std::optional< unsigned > getOrderLimit(const LiveInterval &VirtReg, const AllocationOrder &Order, unsigned CostPerUseLimit) const
virtual MCRegister tryFindEvictionCandidate(const LiveInterval &VirtReg, const AllocationOrder &Order, uint8_t CostPerUseLimit, const SmallVirtRegSet &FixedRegisters) const =0
Find a physical register that can be freed by evicting the FixedRegisters, or return NoRegister.
const ArrayRef< uint8_t > RegCosts
Definition RegAllocEvictionAdvisor.h:148
MachineRegisterInfo *const MRI
Definition RegAllocEvictionAdvisor.h:145
const RegisterClassInfo & RegClassInfo
Definition RegAllocEvictionAdvisor.h:147
VirtRegMap *const VRM
Definition RegAllocEvictionAdvisor.h:144
const MachineFunction & MF
Definition RegAllocEvictionAdvisor.h:140
bool isUnusedCalleeSavedReg(MCRegister PhysReg) const
Returns true if the given PhysReg is a callee saved register and has not been used for allocation yet...
const RAGreedy & RA
Definition RegAllocEvictionAdvisor.h:141
RegAllocEvictionAdvisor(const RegAllocEvictionAdvisor &)=delete
bool canReassign(const LiveInterval &VirtReg, MCRegister FromReg) const
const bool EnableLocalReassign
Run or not the local reassignment heuristic.
Definition RegAllocEvictionAdvisor.h:152
virtual ~RegAllocEvictionAdvisor()=default
bool canAllocatePhysReg(unsigned CostPerUseLimit, MCRegister PhysReg) const
LiveIntervals *const LIS
Definition RegAllocEvictionAdvisor.h:143
LiveRegMatrix *const Matrix
Definition RegAllocEvictionAdvisor.h:142
SmallSet - This maintains a set of unique values, optimizing for the case when the set is small (less...
StringRef - Represent a constant reference to a string, i.e.
TargetRegisterInfo base class - We assume that the target defines a static array of TargetRegisterDes...
An efficient, type-erasing, non-owning reference to a callable.
This is an optimization pass for GlobalISel generic memory operations.
SmallSet< Register, 16 > SmallVirtRegSet
Definition RegAllocEvictionAdvisor.h:36
RegAllocEvictionAdvisorAnalysisLegacy * createReleaseModeAdvisorAnalysisLegacy()
RegAllocEvictionAdvisorProvider * createDevelopmentModeAdvisorProvider(LLVMContext &Ctx)
AnalysisManager< MachineFunction > MachineFunctionAnalysisManager
Pass * callDefaultCtor< RegAllocEvictionAdvisorAnalysisLegacy >()
Specialization for the API used by the analysis infrastructure to create an instance of the eviction ...
LiveRangeStage
Definition RegAllocEvictionAdvisor.h:51
@ RS_Split2
Attempt more aggressive live range splitting that is guaranteed to make progress.
Definition RegAllocEvictionAdvisor.h:64
@ RS_Spill
Live range will be spilled. No more splitting will be attempted.
Definition RegAllocEvictionAdvisor.h:67
@ RS_Split
Attempt live range splitting if assignment is impossible.
Definition RegAllocEvictionAdvisor.h:59
@ RS_New
Newly created live range that has never been queued.
Definition RegAllocEvictionAdvisor.h:53
@ RS_Done
There is nothing more we can do to this live range.
Definition RegAllocEvictionAdvisor.h:71
@ RS_Assign
Only attempt assignment and eviction. Then requeue as RS_Split.
Definition RegAllocEvictionAdvisor.h:56
LLVM_ATTRIBUTE_RETURNS_NONNULL RegAllocEvictionAdvisorProvider * createReleaseModeAdvisorProvider(LLVMContext &Ctx)
RegAllocEvictionAdvisorAnalysisLegacy * createDevelopmentModeAdvisorAnalysisLegacy()
A CRTP mix-in that provides informational APIs needed for analysis passes.
A special type used by analysis passes to provide an address that identifies that particular analysis...
Cost of evicting interference - used by default advisor, and the eviction chain heuristic in RegAlloc...
Definition RegAllocEvictionAdvisor.h:78
bool operator>=(const EvictionCost &O) const
Definition RegAllocEvictionAdvisor.h:95
bool isMax() const
Definition RegAllocEvictionAdvisor.h:84
unsigned BrokenHints
Total number of broken hints.
Definition RegAllocEvictionAdvisor.h:79
bool operator<(const EvictionCost &O) const
Definition RegAllocEvictionAdvisor.h:90
float MaxWeight
Maximum spill weight evicted.
Definition RegAllocEvictionAdvisor.h:80
void setMax()
Definition RegAllocEvictionAdvisor.h:86
void setBrokenHints(unsigned NHints)
Definition RegAllocEvictionAdvisor.h:88
RegAllocEvictionAdvisorProvider * Provider
Definition RegAllocEvictionAdvisor.h:245
bool invalidate(MachineFunction &MF, const PreservedAnalyses &PA, MachineFunctionAnalysisManager::Invalidator &Inv)
Definition RegAllocEvictionAdvisor.h:247