Skip to content

Commit ed5c332

Browse files
committed
- Removed move constructor for MMI.
- Made MMIWP not own the MMI storage.
1 parent 19e0233 commit ed5c332

File tree

2 files changed

+7
-28
lines changed

2 files changed

+7
-28
lines changed

llvm/include/llvm/CodeGen/MachineModuleInfo.h

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -106,15 +106,11 @@ class MachineModuleInfo {
106106
const Function *LastRequest = nullptr; ///< Used for shortcut/cache.
107107
MachineFunction *LastResult = nullptr; ///< Used for shortcut/cache.
108108

109-
MachineModuleInfo &operator=(MachineModuleInfo &&MMII) = delete;
110-
111109
public:
112110
explicit MachineModuleInfo(const TargetMachine *TM = nullptr);
113111

114112
explicit MachineModuleInfo(const TargetMachine *TM, MCContext *ExtContext);
115113

116-
MachineModuleInfo(MachineModuleInfo &&MMII);
117-
118114
~MachineModuleInfo();
119115

120116
void initialize();
@@ -168,14 +164,11 @@ class MachineModuleInfo {
168164
}; // End class MachineModuleInfo
169165

170166
class MachineModuleInfoWrapperPass : public ImmutablePass {
171-
MachineModuleInfo MMI;
167+
MachineModuleInfo &MMI;
172168

173169
public:
174170
static char ID; // Pass identification, replacement for typeid
175-
explicit MachineModuleInfoWrapperPass(const TargetMachine *TM = nullptr);
176-
177-
explicit MachineModuleInfoWrapperPass(const TargetMachine *TM,
178-
MCContext *ExtContext);
171+
explicit MachineModuleInfoWrapperPass(MachineModuleInfo *MMI = nullptr);
179172

180173
// Initialization and Finalization
181174
bool doInitialization(Module &) override;

llvm/lib/CodeGen/MachineModuleInfo.cpp

Lines changed: 5 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -37,17 +37,6 @@ void MachineModuleInfo::finalize() {
3737
ObjFileMMI = nullptr;
3838
}
3939

40-
MachineModuleInfo::MachineModuleInfo(MachineModuleInfo &&MMI)
41-
: TM(std::move(MMI.TM)),
42-
Context(TM.getTargetTriple(), TM.getMCAsmInfo(), TM.getMCRegisterInfo(),
43-
TM.getMCSubtargetInfo(), nullptr, &TM.Options.MCOptions, false),
44-
MachineFunctions(std::move(MMI.MachineFunctions)) {
45-
Context.setObjectFileInfo(TM.getObjFileLowering());
46-
ObjFileMMI = MMI.ObjFileMMI;
47-
ExternalContext = MMI.ExternalContext;
48-
TheModule = MMI.TheModule;
49-
}
50-
5140
MachineModuleInfo::MachineModuleInfo(const TargetMachine *TM)
5241
: TM(*TM), Context(TM->getTargetTriple(), TM->getMCAsmInfo(),
5342
TM->getMCRegisterInfo(), TM->getMCSubtargetInfo(),
@@ -151,14 +140,11 @@ FunctionPass *llvm::createFreeMachineFunctionPass() {
151140
}
152141

153142
MachineModuleInfoWrapperPass::MachineModuleInfoWrapperPass(
154-
const TargetMachine *TM)
155-
: ImmutablePass(ID), MMI(TM) {
156-
initializeMachineModuleInfoWrapperPassPass(*PassRegistry::getPassRegistry());
157-
}
158-
159-
MachineModuleInfoWrapperPass::MachineModuleInfoWrapperPass(
160-
const TargetMachine *TM, MCContext *ExtContext)
161-
: ImmutablePass(ID), MMI(TM, ExtContext) {
143+
MachineModuleInfo *MMI)
144+
: ImmutablePass(ID), MMI([&] -> MachineModuleInfo & {
145+
assert(MMI != nullptr, "MMI is nullptr");
146+
return *MMI;
147+
}()) {
162148
initializeMachineModuleInfoWrapperPassPass(*PassRegistry::getPassRegistry());
163149
}
164150

0 commit comments

Comments
 (0)