aboutsummaryrefslogtreecommitdiff
path: root/llvm/unittests/CodeGen/MachineInstrTest.cpp
diff options
context:
space:
mode:
authorPhilipp Krones <philipp.krones@embecosm.com>2021-05-05 10:03:02 -0700
committerFangrui Song <i@maskray.me>2021-05-05 10:03:02 -0700
commit632ebc4ab4374e53fce1ec870465c587e0a33668 (patch)
treef3bbf72dacf56163a62c0f6e18c52f2fd102d8ff /llvm/unittests/CodeGen/MachineInstrTest.cpp
parent80e8025083982f4eca8ca8200eafecf4a5c3ae6e (diff)
downloadllvm-632ebc4ab4374e53fce1ec870465c587e0a33668.zip
llvm-632ebc4ab4374e53fce1ec870465c587e0a33668.tar.gz
llvm-632ebc4ab4374e53fce1ec870465c587e0a33668.tar.bz2
[MC] Untangle MCContext and MCObjectFileInfo
This untangles the MCContext and the MCObjectFileInfo. There is a circular dependency between MCContext and MCObjectFileInfo. Currently this dependency also exists during construction: You can't contruct a MOFI without a MCContext without constructing the MCContext with a dummy version of that MOFI first. This removes this dependency during construction. In a perfect world, MCObjectFileInfo wouldn't depend on MCContext at all, but only be stored in the MCContext, like other MC information. This is future work. This also shifts/adds more information to the MCContext making it more available to the different targets. Namely: - TargetTriple - ObjectFileType - SubtargetInfo Reviewed By: MaskRay Differential Revision: https://reviews.llvm.org/D101462
Diffstat (limited to 'llvm/unittests/CodeGen/MachineInstrTest.cpp')
-rw-r--r--llvm/unittests/CodeGen/MachineInstrTest.cpp9
1 files changed, 6 insertions, 3 deletions
diff --git a/llvm/unittests/CodeGen/MachineInstrTest.cpp b/llvm/unittests/CodeGen/MachineInstrTest.cpp
index 7c9faec..1616311 100644
--- a/llvm/unittests/CodeGen/MachineInstrTest.cpp
+++ b/llvm/unittests/CodeGen/MachineInstrTest.cpp
@@ -6,8 +6,9 @@
//
//===----------------------------------------------------------------------===//
-#include "llvm/CodeGen/MachineBasicBlock.h"
#include "llvm/CodeGen/MachineInstr.h"
+#include "llvm/ADT/Triple.h"
+#include "llvm/CodeGen/MachineBasicBlock.h"
#include "llvm/CodeGen/MachineFunction.h"
#include "llvm/CodeGen/MachineMemOperand.h"
#include "llvm/CodeGen/MachineModuleInfo.h"
@@ -33,8 +34,10 @@ namespace {
#include "MFCommon.inc"
std::unique_ptr<MCContext> createMCContext(MCAsmInfo *AsmInfo) {
- return std::make_unique<MCContext>(
- AsmInfo, nullptr, nullptr, nullptr, nullptr, false);
+ Triple TheTriple(/*ArchStr=*/"", /*VendorStr=*/"", /*OSStr=*/"",
+ /*EnvironmentStr=*/"elf");
+ return std::make_unique<MCContext>(TheTriple, AsmInfo, nullptr, nullptr,
+ nullptr, nullptr, nullptr, false);
}
// This test makes sure that MachineInstr::isIdenticalTo handles Defs correctly