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
266266 void
267267 initializeProvider (RegAllocEvictionAdvisorAnalysisLegacy::AdvisorMode Mode,
268268 LLVMContext &Ctx);
269- void
270- initializeMLProvider (RegAllocEvictionAdvisorAnalysisLegacy::AdvisorMode Mode,
271- LLVMContext &Ctx);
272269
273270 std::unique_ptr<RegAllocEvictionAdvisorProvider> Provider;
274271};
@@ -282,6 +279,12 @@ RegAllocEvictionAdvisorAnalysisLegacy *createReleaseModeAdvisorAnalysisLegacy();
282279RegAllocEvictionAdvisorAnalysisLegacy *
283280createDevelopmentModeAdvisorAnalysisLegacy ();
284281
282+ RegAllocEvictionAdvisorProvider *
283+ createReleaseModeAdvisorProvider (LLVMContext &Ctx);
284+
285+ RegAllocEvictionAdvisorProvider *
286+ createDevelopmentModeAdvisorProvider (LLVMContext &Ctx);
287+
285288// TODO: move to RegAllocEvictionAdvisor.cpp when we move implementation
286289// out of RegAllocGreedy.cpp
287290class DefaultEvictionAdvisor : public RegAllocEvictionAdvisor {
Original file line number Diff line number Diff line change @@ -1251,22 +1251,17 @@ bool RegAllocScoring::runOnMachineFunction(MachineFunction &MF) {
12511251}
12521252#endif // #ifdef LLVM_HAVE_TFLITE
12531253
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) {
12601261#if defined(LLVM_HAVE_TFLITE)
1261- Provider. reset ( new DevelopmentModeEvictionAdvisorProvider (Ctx) );
1262+ return new DevelopmentModeEvictionAdvisorProvider (Ctx);
12621263#endif
1263- break ;
1264- case RegAllocEvictionAdvisorAnalysisLegacy::AdvisorMode::Release:
1265- Provider.reset (new ReleaseModeEvictionAdvisorProvider (Ctx));
1266- break ;
1267- default :
1268- break ;
1269- }
1264+ return nullptr ;
12701265}
12711266
12721267RegAllocEvictionAdvisorAnalysisLegacy *
Original file line number Diff line number Diff line change @@ -118,11 +118,21 @@ void RegAllocEvictionAdvisorAnalysis::initializeProvider(
118118 RegAllocEvictionAdvisorAnalysisLegacy::AdvisorMode Mode, LLVMContext &Ctx) {
119119 if (Provider)
120120 return ;
121- if (Mode == RegAllocEvictionAdvisorAnalysisLegacy::AdvisorMode::Default)
121+ switch (Mode) {
122+ case RegAllocEvictionAdvisorAnalysisLegacy::AdvisorMode::Default:
122123 Provider.reset (
123124 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+
126136 if (!Provider)
127137 Provider.reset (
128138 new DefaultEvictionAdvisorProvider (/* NotAsRequested=*/ true , Ctx));
You can’t perform that action at this time.
0 commit comments