summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMircea Trofin <mtrofin@google.com>2022-01-12 08:50:57 -0800
committerMircea Trofin <mtrofin@google.com>2022-01-12 08:54:00 -0800
commit3150bce0780c41db1da8dda28d84a5375a2cdd81 (patch)
tree13c63107af8d057efc9bc1e800c494c5f0ee5aec
parent10bc3362a1a8a3df2660bf65db0ec1ccab646e1b (diff)
[NFC][MLGO] Prep a few files before the main ML Regalloc adviser
To avoid trivial changes.
-rw-r--r--llvm/lib/CodeGen/MLRegallocEvictAdvisor.cpp10
-rw-r--r--llvm/lib/CodeGen/RegAllocEvictionAdvisor.h3
2 files changed, 5 insertions, 8 deletions
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 @@ public:
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;
};