[llvm] 3150bce - [NFC][MLGO] Prep a few files before the main ML Regalloc adviser
Mircea Trofin via llvm-commits
llvm-commits at lists.llvm.org
Wed Jan 12 08:54:06 PST 2022
Author: Mircea Trofin
Date: 2022-01-12T08:54:00-08:00
New Revision: 3150bce0780c41db1da8dda28d84a5375a2cdd81
URL: https://github.com/llvm/llvm-project/commit/3150bce0780c41db1da8dda28d84a5375a2cdd81
DIFF: https://github.com/llvm/llvm-project/commit/3150bce0780c41db1da8dda28d84a5375a2cdd81.diff
LOG: [NFC][MLGO] Prep a few files before the main ML Regalloc adviser
To avoid trivial changes.
Added:
Modified:
llvm/lib/CodeGen/MLRegallocEvictAdvisor.cpp
llvm/lib/CodeGen/RegAllocEvictionAdvisor.h
Removed:
################################################################################
diff --git a/llvm/lib/CodeGen/MLRegallocEvictAdvisor.cpp b/llvm/lib/CodeGen/MLRegallocEvictAdvisor.cpp
index 3ffd75f32b6a..3310d0c2acc5 100644
--- a/llvm/lib/CodeGen/MLRegallocEvictAdvisor.cpp
+++ b/llvm/lib/CodeGen/MLRegallocEvictAdvisor.cpp
@@ -10,10 +10,6 @@
//
//===----------------------------------------------------------------------===//
-#include "llvm/Config/config.h"
-
-#if defined(LLVM_HAVE_TF_AOT) || defined(LLVM_HAVE_TF_API)
-
#include "RegAllocEvictionAdvisor.h"
#include "llvm/Analysis/MLModelRunner.h"
#include "llvm/Analysis/ModelUnderTrainingRunner.h"
@@ -25,6 +21,7 @@
#include "llvm/CodeGen/MachineLoopInfo.h"
#include "llvm/CodeGen/RegisterClassInfo.h"
#include "llvm/CodeGen/VirtRegMap.h"
+#include "llvm/Config/config.h"
#include "llvm/InitializePasses.h"
#include "llvm/Pass.h"
#include "llvm/PassRegistry.h"
@@ -38,6 +35,7 @@ using namespace llvm;
#define DEBUG_TYPE "ml-regalloc"
+#if defined(LLVM_HAVE_TF_AOT) || defined(LLVM_HAVE_TF_API)
namespace {
// This is the maximum number of interfererring ranges. That's the number of
// distinct AllocationOrder values, which comes from MCRegisterClass::RegsSize.
@@ -164,9 +162,7 @@ static const std::vector<TensorSpec> InputFeatures{
#undef _DECL_FEATURES
static const TensorSpec Output =
TensorSpec::createSpec<int64_t>(DecisionName, {1});
-const char *const RewardName = "reward";
-static const TensorSpec Reward =
- TensorSpec::createSpec<int64_t>(RewardName, {1});
+static const TensorSpec Reward = TensorSpec::createSpec<int64_t>("reward", {1});
#endif //#ifdef LLVM_HAVE_TF_API
} // namespace
diff --git a/llvm/lib/CodeGen/RegAllocEvictionAdvisor.h b/llvm/lib/CodeGen/RegAllocEvictionAdvisor.h
index a2fe3014d34f..8ad45c02285c 100644
--- a/llvm/lib/CodeGen/RegAllocEvictionAdvisor.h
+++ b/llvm/lib/CodeGen/RegAllocEvictionAdvisor.h
@@ -176,13 +176,14 @@ class RegAllocEvictionAdvisorAnalysis : public ImmutablePass {
getAdvisor(const MachineFunction &MF, const RAGreedy &RA) = 0;
AdvisorMode getAdvisorMode() const { return Mode; }
-private:
+protected:
// This analysis preserves everything, and subclasses may have additional
// requirements.
void getAnalysisUsage(AnalysisUsage &AU) const override {
AU.setPreservesAll();
}
+private:
StringRef getPassName() const override;
const AdvisorMode Mode;
};
More information about the llvm-commits
mailing list