[llvm] Add A Version Of `MachineModuleInfoWrapperPass` That Does Not Own Its Underlying `MachineModuleInfo` (PR #134554)
Matt Arsenault via llvm-commits
llvm-commits at lists.llvm.org
Tue Apr 8 03:00:19 PDT 2025
================
@@ -167,22 +163,51 @@ class MachineModuleInfo {
/// \}
}; // End class MachineModuleInfo
+/// \brief Interface for pass that provide access to \c MachineModuleInfo
+/// being worked on
class MachineModuleInfoWrapperPass : public ImmutablePass {
- MachineModuleInfo MMI;
public:
static char ID; // Pass identification, replacement for typeid
- explicit MachineModuleInfoWrapperPass(const TargetMachine *TM = nullptr);
-
- explicit MachineModuleInfoWrapperPass(const TargetMachine *TM,
- MCContext *ExtContext);
+ MachineModuleInfoWrapperPass();
// Initialization and Finalization
bool doInitialization(Module &) override;
bool doFinalization(Module &) override;
- MachineModuleInfo &getMMI() { return MMI; }
- const MachineModuleInfo &getMMI() const { return MMI; }
+ virtual MachineModuleInfo &getMMI() = 0;
+ virtual const MachineModuleInfo &getMMI() const = 0;
+};
+
+/// \brief a version of \c MachineModuleInfoWrapperPass that manages the
+/// lifetime of its \c MachineModuleInfo
+class OwningMachineModuleInfoWrapperPass : public MachineModuleInfoWrapperPass {
+ MachineModuleInfo MMI;
----------------
arsenm wrote:
One without MachineModuleInfo is for something else; Owning probably isn't the right name (but neither is MachineModuleInfo)
https://github.com/llvm/llvm-project/pull/134554
More information about the llvm-commits
mailing list