File tree Expand file tree Collapse file tree 3 files changed +28
-20
lines changed Expand file tree Collapse file tree 3 files changed +28
-20
lines changed Original file line number Diff line number Diff line change @@ -266,9 +266,6 @@ class RegAllocEvictionAdvisorAnalysis
266
266
void
267
267
initializeProvider (RegAllocEvictionAdvisorAnalysisLegacy::AdvisorMode Mode,
268
268
LLVMContext &Ctx);
269
- void
270
- initializeMLProvider (RegAllocEvictionAdvisorAnalysisLegacy::AdvisorMode Mode,
271
- LLVMContext &Ctx);
272
269
273
270
std::unique_ptr<RegAllocEvictionAdvisorProvider> Provider;
274
271
};
@@ -282,6 +279,12 @@ RegAllocEvictionAdvisorAnalysisLegacy *createReleaseModeAdvisorAnalysisLegacy();
282
279
RegAllocEvictionAdvisorAnalysisLegacy *
283
280
createDevelopmentModeAdvisorAnalysisLegacy ();
284
281
282
+ RegAllocEvictionAdvisorProvider *
283
+ createReleaseModeAdvisorProvider (LLVMContext &Ctx);
284
+
285
+ RegAllocEvictionAdvisorProvider *
286
+ createDevelopmentModeAdvisorProvider (LLVMContext &Ctx);
287
+
285
288
// TODO: move to RegAllocEvictionAdvisor.cpp when we move implementation
286
289
// out of RegAllocGreedy.cpp
287
290
class DefaultEvictionAdvisor : public RegAllocEvictionAdvisor {
Original file line number Diff line number Diff line change @@ -1218,22 +1218,17 @@ bool RegAllocScoring::runOnMachineFunction(MachineFunction &MF) {
1218
1218
}
1219
1219
#endif // #ifdef LLVM_HAVE_TFLITE
1220
1220
1221
- void RegAllocEvictionAdvisorAnalysis::initializeMLProvider (
1222
- RegAllocEvictionAdvisorAnalysisLegacy::AdvisorMode Mode, LLVMContext &Ctx) {
1223
- if (Provider)
1224
- return ;
1225
- switch (Mode) {
1226
- case RegAllocEvictionAdvisorAnalysisLegacy::AdvisorMode::Development:
1221
+ RegAllocEvictionAdvisorProvider *
1222
+ llvm::createReleaseModeAdvisorProvider (LLVMContext &Ctx) {
1223
+ return new ReleaseModeEvictionAdvisorProvider (Ctx);
1224
+ }
1225
+
1226
+ RegAllocEvictionAdvisorProvider *
1227
+ llvm::createDevelopmentModeAdvisorProvider (LLVMContext &Ctx) {
1227
1228
#if defined(LLVM_HAVE_TFLITE)
1228
- Provider. reset ( new DevelopmentModeEvictionAdvisorProvider (Ctx) );
1229
+ return new DevelopmentModeEvictionAdvisorProvider (Ctx);
1229
1230
#endif
1230
- break ;
1231
- case RegAllocEvictionAdvisorAnalysisLegacy::AdvisorMode::Release:
1232
- Provider.reset (new ReleaseModeEvictionAdvisorProvider (Ctx));
1233
- break ;
1234
- default :
1235
- break ;
1236
- }
1231
+ return nullptr ;
1237
1232
}
1238
1233
1239
1234
RegAllocEvictionAdvisorAnalysisLegacy *
Original file line number Diff line number Diff line change @@ -118,11 +118,21 @@ void RegAllocEvictionAdvisorAnalysis::initializeProvider(
118
118
RegAllocEvictionAdvisorAnalysisLegacy::AdvisorMode Mode, LLVMContext &Ctx) {
119
119
if (Provider)
120
120
return ;
121
- if (Mode == RegAllocEvictionAdvisorAnalysisLegacy::AdvisorMode::Default)
121
+ switch (Mode) {
122
+ case RegAllocEvictionAdvisorAnalysisLegacy::AdvisorMode::Default:
122
123
Provider.reset (
123
124
new DefaultEvictionAdvisorProvider (/* NotAsRequested=*/ false , Ctx));
124
- else
125
- initializeMLProvider (Mode, Ctx);
125
+ break ;
126
+ case RegAllocEvictionAdvisorAnalysisLegacy::AdvisorMode::Development:
127
+ #if defined(LLVM_HAVE_TFLITE)
128
+ Provider.reset (createDevelopmentModeAdvisorProvider (Ctx));
129
+ #endif
130
+ break ;
131
+ case RegAllocEvictionAdvisorAnalysisLegacy::AdvisorMode::Release:
132
+ Provider.reset (createReleaseModeAdvisorProvider (Ctx));
133
+ break ;
134
+ }
135
+
126
136
if (!Provider)
127
137
Provider.reset (
128
138
new DefaultEvictionAdvisorProvider (/* NotAsRequested=*/ true , Ctx));
You can’t perform that action at this time.
0 commit comments