From c2f819af73c54a8cf923e5a25099ca95dbe76312 Mon Sep 17 00:00:00 2001 From: Philipp Krones Date: Sun, 23 May 2021 14:15:23 -0700 Subject: [MC] Refactor MCObjectFileInfo initialization and allow targets to create MCObjectFileInfo This makes it possible for targets to define their own MCObjectFileInfo. This MCObjectFileInfo is then used to determine things like section alignment. This is a follow up to D101462 and prepares for the RISCV backend defining the text section alignment depending on the enabled extensions. Reviewed By: MaskRay Differential Revision: https://reviews.llvm.org/D101921 --- llvm/lib/CodeGen/MachineModuleInfo.cpp | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) (limited to 'llvm/lib/CodeGen/MachineModuleInfo.cpp') diff --git a/llvm/lib/CodeGen/MachineModuleInfo.cpp b/llvm/lib/CodeGen/MachineModuleInfo.cpp index 2dddb88..50cbb14e 100644 --- a/llvm/lib/CodeGen/MachineModuleInfo.cpp +++ b/llvm/lib/CodeGen/MachineModuleInfo.cpp @@ -218,9 +218,10 @@ void MachineModuleInfo::finalize() { MachineModuleInfo::MachineModuleInfo(MachineModuleInfo &&MMI) : TM(std::move(MMI.TM)), Context(MMI.TM.getTargetTriple(), MMI.TM.getMCAsmInfo(), - MMI.TM.getMCRegisterInfo(), MMI.TM.getObjFileLowering(), - MMI.TM.getMCSubtargetInfo(), nullptr, nullptr, false), + MMI.TM.getMCRegisterInfo(), MMI.TM.getMCSubtargetInfo(), nullptr, + nullptr, false), MachineFunctions(std::move(MMI.MachineFunctions)) { + Context.setObjectFileInfo(MMI.TM.getObjFileLowering()); ObjFileMMI = MMI.ObjFileMMI; CurCallSite = MMI.CurCallSite; UsesMSVCFloatingPoint = MMI.UsesMSVCFloatingPoint; @@ -234,17 +235,19 @@ MachineModuleInfo::MachineModuleInfo(MachineModuleInfo &&MMI) MachineModuleInfo::MachineModuleInfo(const LLVMTargetMachine *TM) : TM(*TM), Context(TM->getTargetTriple(), TM->getMCAsmInfo(), - TM->getMCRegisterInfo(), TM->getObjFileLowering(), - TM->getMCSubtargetInfo(), nullptr, nullptr, false) { + TM->getMCRegisterInfo(), TM->getMCSubtargetInfo(), + nullptr, nullptr, false) { + Context.setObjectFileInfo(TM->getObjFileLowering()); initialize(); } MachineModuleInfo::MachineModuleInfo(const LLVMTargetMachine *TM, MCContext *ExtContext) : TM(*TM), Context(TM->getTargetTriple(), TM->getMCAsmInfo(), - TM->getMCRegisterInfo(), TM->getObjFileLowering(), - TM->getMCSubtargetInfo(), nullptr, nullptr, false), + TM->getMCRegisterInfo(), TM->getMCSubtargetInfo(), + nullptr, nullptr, false), ExternalContext(ExtContext) { + Context.setObjectFileInfo(TM->getObjFileLowering()); initialize(); } -- cgit v1.1