diff options
author | Philipp Krones <philipp.krones@embecosm.com> | 2021-05-05 10:03:02 -0700 |
---|---|---|
committer | Fangrui Song <i@maskray.me> | 2021-05-05 10:03:02 -0700 |
commit | 632ebc4ab4374e53fce1ec870465c587e0a33668 (patch) | |
tree | f3bbf72dacf56163a62c0f6e18c52f2fd102d8ff /llvm/lib/CodeGen/MachineModuleInfo.cpp | |
parent | 80e8025083982f4eca8ca8200eafecf4a5c3ae6e (diff) | |
download | llvm-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/lib/CodeGen/MachineModuleInfo.cpp')
-rw-r--r-- | llvm/lib/CodeGen/MachineModuleInfo.cpp | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/llvm/lib/CodeGen/MachineModuleInfo.cpp b/llvm/lib/CodeGen/MachineModuleInfo.cpp index 776b7f5..2dddb88 100644 --- a/llvm/lib/CodeGen/MachineModuleInfo.cpp +++ b/llvm/lib/CodeGen/MachineModuleInfo.cpp @@ -217,8 +217,9 @@ void MachineModuleInfo::finalize() { MachineModuleInfo::MachineModuleInfo(MachineModuleInfo &&MMI) : TM(std::move(MMI.TM)), - Context(MMI.TM.getMCAsmInfo(), MMI.TM.getMCRegisterInfo(), - MMI.TM.getObjFileLowering(), nullptr, nullptr, false), + Context(MMI.TM.getTargetTriple(), MMI.TM.getMCAsmInfo(), + MMI.TM.getMCRegisterInfo(), MMI.TM.getObjFileLowering(), + MMI.TM.getMCSubtargetInfo(), nullptr, nullptr, false), MachineFunctions(std::move(MMI.MachineFunctions)) { ObjFileMMI = MMI.ObjFileMMI; CurCallSite = MMI.CurCallSite; @@ -232,15 +233,17 @@ MachineModuleInfo::MachineModuleInfo(MachineModuleInfo &&MMI) } MachineModuleInfo::MachineModuleInfo(const LLVMTargetMachine *TM) - : TM(*TM), Context(TM->getMCAsmInfo(), TM->getMCRegisterInfo(), - TM->getObjFileLowering(), nullptr, nullptr, false) { + : TM(*TM), Context(TM->getTargetTriple(), TM->getMCAsmInfo(), + TM->getMCRegisterInfo(), TM->getObjFileLowering(), + TM->getMCSubtargetInfo(), nullptr, nullptr, false) { initialize(); } MachineModuleInfo::MachineModuleInfo(const LLVMTargetMachine *TM, MCContext *ExtContext) - : TM(*TM), Context(TM->getMCAsmInfo(), TM->getMCRegisterInfo(), - TM->getObjFileLowering(), nullptr, nullptr, false), + : TM(*TM), Context(TM->getTargetTriple(), TM->getMCAsmInfo(), + TM->getMCRegisterInfo(), TM->getObjFileLowering(), + TM->getMCSubtargetInfo(), nullptr, nullptr, false), ExternalContext(ExtContext) { initialize(); } |