[llvm] [CodeGen][NewPM] Port RegisterUsageInfo to NPM (PR #113873)

Akshat Oke via llvm-commits llvm-commits at lists.llvm.org
Tue Oct 29 13:58:31 PDT 2024


================
@@ -66,6 +63,52 @@ class PhysicalRegisterUsageInfo : public ImmutablePass {
   const LLVMTargetMachine *TM = nullptr;
 };
 
+class PhysicalRegisterUsageInfoWrapperLegacy : public ImmutablePass {
+  std::unique_ptr<PhysicalRegisterUsageInfo> PRUI;
+
+public:
+  static char ID;
+  PhysicalRegisterUsageInfoWrapperLegacy() : ImmutablePass(ID) {
+    initializePhysicalRegisterUsageInfoWrapperLegacyPass(
+        *PassRegistry::getPassRegistry());
+  }
+
+  PhysicalRegisterUsageInfo &getPRUI() { return *PRUI; }
+  const PhysicalRegisterUsageInfo &getPRUI() const { return *PRUI; }
+
+  bool doInitialization(Module &M) override {
+    PRUI.reset(new PhysicalRegisterUsageInfo());
+    return PRUI->doInitialization(M);
+  }
+
+  bool doFinalization(Module &M) override { return PRUI->doFinalization(M); }
+
+  void print(raw_ostream &OS, const Module *M = nullptr) const override {
+    PRUI->print(OS, M);
+  }
+};
+
+class PhysicalRegisterUsageInfoAnalysis
----------------
optimisan wrote:

Right

https://github.com/llvm/llvm-project/pull/113873


More information about the llvm-commits mailing list