[llvm] A MMIWP Constructor Initialized with the move constructor of MMI (PR #98770)

Matin Raayai via llvm-commits llvm-commits at lists.llvm.org
Fri Jul 26 09:05:26 PDT 2024


https://github.com/matinraayai updated https://github.com/llvm/llvm-project/pull/98770

>From 5ed07a26ccf7f208af12d5acf73e64f3c92d4315 Mon Sep 17 00:00:00 2001
From: matinraayai <30674652+matinraayai at users.noreply.github.com>
Date: Sat, 13 Jul 2024 14:33:08 -0400
Subject: [PATCH 1/3] Added forwarding the MMI move constructor for MMIWP.

---
 llvm/include/llvm/CodeGen/MachineModuleInfo.h | 2 ++
 llvm/lib/CodeGen/MachineModuleInfo.cpp        | 5 +++++
 2 files changed, 7 insertions(+)

diff --git a/llvm/include/llvm/CodeGen/MachineModuleInfo.h b/llvm/include/llvm/CodeGen/MachineModuleInfo.h
index 92ea3c902ce95..6c8c94117625c 100644
--- a/llvm/include/llvm/CodeGen/MachineModuleInfo.h
+++ b/llvm/include/llvm/CodeGen/MachineModuleInfo.h
@@ -208,6 +208,8 @@ class MachineModuleInfoWrapperPass : public ImmutablePass {
   explicit MachineModuleInfoWrapperPass(const LLVMTargetMachine *TM,
                                         MCContext *ExtContext);
 
+  explicit MachineModuleInfoWrapperPass(MachineModuleInfo &&MMI);
+
   // Initialization and Finalization
   bool doInitialization(Module &) override;
   bool doFinalization(Module &) override;
diff --git a/llvm/lib/CodeGen/MachineModuleInfo.cpp b/llvm/lib/CodeGen/MachineModuleInfo.cpp
index b950f4fdbcf79..83364fc380fad 100644
--- a/llvm/lib/CodeGen/MachineModuleInfo.cpp
+++ b/llvm/lib/CodeGen/MachineModuleInfo.cpp
@@ -180,6 +180,11 @@ MachineModuleInfoWrapperPass::MachineModuleInfoWrapperPass(
   initializeMachineModuleInfoWrapperPassPass(*PassRegistry::getPassRegistry());
 }
 
+MachineModuleInfoWrapperPass::MachineModuleInfoWrapperPass(
+    MachineModuleInfo &&MMI): ImmutablePass(ID), MMI(std::move(MMI)) {
+  initializeMachineModuleInfoWrapperPassPass(*PassRegistry::getPassRegistry());
+}
+
 // Handle the Pass registration stuff necessary to use DataLayout's.
 INITIALIZE_PASS(MachineModuleInfoWrapperPass, "machinemoduleinfo",
                 "Machine Module Information", false, false)

>From 6b38275acb200289abdf9b6043fb79d61daa1064 Mon Sep 17 00:00:00 2001
From: matinraayai <30674652+matinraayai at users.noreply.github.com>
Date: Sat, 13 Jul 2024 16:27:26 -0400
Subject: [PATCH 2/3] Clang format.

---
 llvm/lib/CodeGen/MachineModuleInfo.cpp | 11 +++++------
 1 file changed, 5 insertions(+), 6 deletions(-)

diff --git a/llvm/lib/CodeGen/MachineModuleInfo.cpp b/llvm/lib/CodeGen/MachineModuleInfo.cpp
index 83364fc380fad..6f4e6763b9de1 100644
--- a/llvm/lib/CodeGen/MachineModuleInfo.cpp
+++ b/llvm/lib/CodeGen/MachineModuleInfo.cpp
@@ -155,9 +155,7 @@ class FreeMachineFunction : public FunctionPass {
     return true;
   }
 
-  StringRef getPassName() const override {
-    return "Free MachineFunction";
-  }
+  StringRef getPassName() const override { return "Free MachineFunction"; }
 };
 
 } // end anonymous namespace
@@ -181,7 +179,8 @@ MachineModuleInfoWrapperPass::MachineModuleInfoWrapperPass(
 }
 
 MachineModuleInfoWrapperPass::MachineModuleInfoWrapperPass(
-    MachineModuleInfo &&MMI): ImmutablePass(ID), MMI(std::move(MMI)) {
+    MachineModuleInfo &&MMI)
+    : ImmutablePass(ID), MMI(std::move(MMI)) {
   initializeMachineModuleInfoWrapperPassPass(*PassRegistry::getPassRegistry());
 }
 
@@ -229,8 +228,8 @@ bool MachineModuleInfoWrapperPass::doInitialization(Module &M) {
         Ctx.diagnose(
             DiagnosticInfoSrcMgr(SMD, M.getName(), IsInlineAsm, LocCookie));
       });
-  MMI.DbgInfoAvailable = !DisableDebugInfoPrinting &&
-                         !M.debug_compile_units().empty();
+  MMI.DbgInfoAvailable =
+      !DisableDebugInfoPrinting && !M.debug_compile_units().empty();
   return false;
 }
 

>From 74f84458318a0bd01e590c493407aaa3ae3c3f65 Mon Sep 17 00:00:00 2001
From: matinraayai <30674652+matinraayai at users.noreply.github.com>
Date: Mon, 15 Jul 2024 11:48:10 -0400
Subject: [PATCH 3/3] reverted clang format.

---
 llvm/lib/CodeGen/MachineModuleInfo.cpp | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/llvm/lib/CodeGen/MachineModuleInfo.cpp b/llvm/lib/CodeGen/MachineModuleInfo.cpp
index 6f4e6763b9de1..33bea187754f3 100644
--- a/llvm/lib/CodeGen/MachineModuleInfo.cpp
+++ b/llvm/lib/CodeGen/MachineModuleInfo.cpp
@@ -155,7 +155,9 @@ class FreeMachineFunction : public FunctionPass {
     return true;
   }
 
-  StringRef getPassName() const override { return "Free MachineFunction"; }
+  StringRef getPassName() const override {
+    return "Free MachineFunction";
+  }
 };
 
 } // end anonymous namespace
@@ -228,8 +230,8 @@ bool MachineModuleInfoWrapperPass::doInitialization(Module &M) {
         Ctx.diagnose(
             DiagnosticInfoSrcMgr(SMD, M.getName(), IsInlineAsm, LocCookie));
       });
-  MMI.DbgInfoAvailable =
-      !DisableDebugInfoPrinting && !M.debug_compile_units().empty();
+  MMI.DbgInfoAvailable = !DisableDebugInfoPrinting &&
+                         !M.debug_compile_units().empty();
   return false;
 }
 



More information about the llvm-commits mailing list