From 47cf918e20a0d5a38fea51885db060a1cdcaa4fc Mon Sep 17 00:00:00 2001 From: Matthias Braun Date: Tue, 10 May 2016 01:32:40 +0000 Subject: LLVMTargetMachine: Add functions to create MIModuleInfo/MIFunction; NFC Add convenience function to create MachineModuleInfo and MachineFunctionAnalysis passes and add them to a pass manager. Despite factoring out some shared code in LiveIntervalTest/LLVMTargetMachine this will be used by my upcoming llc change. llvm-svn: 269002 --- llvm/unittests/MI/LiveIntervalTest.cpp | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) (limited to 'llvm/unittests/MI') diff --git a/llvm/unittests/MI/LiveIntervalTest.cpp b/llvm/unittests/MI/LiveIntervalTest.cpp index afd3b51793b..b74908411da 100644 --- a/llvm/unittests/MI/LiveIntervalTest.cpp +++ b/llvm/unittests/MI/LiveIntervalTest.cpp @@ -3,8 +3,6 @@ #include "llvm/CodeGen/LiveIntervalAnalysis.h" #include "llvm/CodeGen/MIRParser/MIRParser.h" #include "llvm/CodeGen/MachineFunction.h" -#include "llvm/CodeGen/MachineFunctionAnalysis.h" -#include "llvm/CodeGen/MachineModuleInfo.h" #include "llvm/CodeGen/MachineRegisterInfo.h" #include "llvm/CodeGen/Passes.h" #include "llvm/Support/MemoryBuffer.h" @@ -69,12 +67,9 @@ std::unique_ptr parseMIR(LLVMContext &Context, if (!F) return nullptr; - MachineModuleInfo *MMI = new MachineModuleInfo( - *TM.getMCAsmInfo(), *TM.getMCRegisterInfo(), nullptr); - PM.add(MMI); - - MachineFunctionAnalysis *MFA = new MachineFunctionAnalysis(TM, MIR.get()); - PM.add(MFA); + const LLVMTargetMachine &LLVMTM = static_cast(TM); + LLVMTM.addMachineModuleInfo(PM); + LLVMTM.addMachineFunctionAnalysis(PM, MIR.get()); return M; } -- cgit v1.2.3