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 @@ -1251,22 +1251,17 @@ bool RegAllocScoring::runOnMachineFunction(MachineFunction &MF) {
1251
1251
}
1252
1252
#endif // #ifdef LLVM_HAVE_TFLITE
1253
1253
1254
- void RegAllocEvictionAdvisorAnalysis::initializeMLProvider (
1255
- RegAllocEvictionAdvisorAnalysisLegacy::AdvisorMode Mode, LLVMContext &Ctx) {
1256
- if (Provider)
1257
- return ;
1258
- switch (Mode) {
1259
- case RegAllocEvictionAdvisorAnalysisLegacy::AdvisorMode::Development:
1254
+ RegAllocEvictionAdvisorProvider *
1255
+ llvm::createReleaseModeAdvisorProvider (LLVMContext &Ctx) {
1256
+ return new ReleaseModeEvictionAdvisorProvider (Ctx);
1257
+ }
1258
+
1259
+ RegAllocEvictionAdvisorProvider *
1260
+ llvm::createDevelopmentModeAdvisorProvider (LLVMContext &Ctx) {
1260
1261
#if defined(LLVM_HAVE_TFLITE)
1261
- Provider. reset ( new DevelopmentModeEvictionAdvisorProvider (Ctx) );
1262
+ return new DevelopmentModeEvictionAdvisorProvider (Ctx);
1262
1263
#endif
1263
- break ;
1264
- case RegAllocEvictionAdvisorAnalysisLegacy::AdvisorMode::Release:
1265
- Provider.reset (new ReleaseModeEvictionAdvisorProvider (Ctx));
1266
- break ;
1267
- default :
1268
- break ;
1269
- }
1264
+ return nullptr ;
1270
1265
}
1271
1266
1272
1267
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