[llvm] [CodeGen][NewPM] Port RegAllocEvictionAdvisor analysis to NPM (PR #117309)
Matt Arsenault via llvm-commits
llvm-commits at lists.llvm.org
Mon Dec 2 16:29:35 PST 2024
================
@@ -535,7 +535,28 @@ class DevelopmentModeEvictionAdvisorAnalysis final
Log = std::make_unique<Logger>(std::move(OS), LFS, Reward,
/*IncludeReward*/ true);
- return false;
+ return;
+ }
+
+ // support for isa<> and dyn_cast.
+ static bool classof(const RegAllocEvictionAdvisorProvider *R) {
+ return R->getAdvisorMode() == AdvisorMode::Development;
+ }
+
+ void logRewardIfNeeded(const MachineFunction &MF,
+ llvm::function_ref<float()> GetReward) override {
+ if (!Log || !Log->hasAnyObservationForContext(MF.getName()))
+ return;
+ // The function pass manager would run all the function passes for a
+ // function, so we assume the last context belongs to this function. If
+ // this invariant ever changes, we can implement at that time switching
+ // contexts. At this point, it'd be an error
+ if (Log->currentContext() != MF.getName()) {
----------------
arsenm wrote:
Relying on function names isn't great, there are anonymous functions...
https://github.com/llvm/llvm-project/pull/117309
More information about the llvm-commits
mailing list