@@ -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-
5140MachineModuleInfo::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
153142MachineModuleInfoWrapperPass::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