summaryrefslogtreecommitdiff
path: root/unittests
diff options
context:
space:
mode:
authorMatthias Braun <matze@braunis.de>2016-05-10 01:32:40 +0000
committerMatthias Braun <matze@braunis.de>2016-05-10 01:32:40 +0000
commitbf765dfe2148742344f84b1032793a4ff2d174c9 (patch)
tree4dbffb5ee0e1faec7e02fce3d5ec5b070e32ac7c /unittests
parentc2cb1b7b04b3d966e92cd3b52ce2f9c929c4bdf6 (diff)
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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@269002 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'unittests')
-rw-r--r--unittests/MI/LiveIntervalTest.cpp11
1 files changed, 3 insertions, 8 deletions
diff --git a/unittests/MI/LiveIntervalTest.cpp b/unittests/MI/LiveIntervalTest.cpp
index afd3b51793b..b74908411da 100644
--- a/unittests/MI/LiveIntervalTest.cpp
+++ b/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<Module> 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<const LLVMTargetMachine&>(TM);
+ LLVMTM.addMachineModuleInfo(PM);
+ LLVMTM.addMachineFunctionAnalysis(PM, MIR.get());
return M;
}