LLVM  14.0.0git
M68kTargetObjectFile.cpp
Go to the documentation of this file.
1 //===-- M68kELFTargetObjectFile.cpp - M68k Object Files -----*- C++ -*-===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 ///
9 /// \file
10 /// This file contains definitions for M68k ELF object file lowering.
11 ///
12 //===----------------------------------------------------------------------===//
13 
14 #include "M68kTargetObjectFile.h"
15 
16 #include "M68kSubtarget.h"
17 #include "M68kTargetMachine.h"
18 
19 #include "llvm/BinaryFormat/ELF.h"
20 #include "llvm/IR/DataLayout.h"
21 #include "llvm/IR/DerivedTypes.h"
22 #include "llvm/IR/GlobalVariable.h"
23 #include "llvm/MC/MCContext.h"
24 #include "llvm/MC/MCSectionELF.h"
27 
28 using namespace llvm;
29 
31  "m68k-ssection-threshold", cl::Hidden,
32  cl::desc("Small data and bss section threshold size (default=8)"),
33  cl::init(8));
34 
36  const TargetMachine &TM) {
38  InitializeELF(TM.Options.UseInitArray);
39 
40  this->TM = &static_cast<const M68kTargetMachine &>(TM);
41 
42  // FIXME do we need `.sdata` and `.sbss` explicitly?
43  SmallDataSection = getContext().getELFSection(
45 
46  SmallBSSSection = getContext().getELFSection(".sbss", ELF::SHT_NOBITS,
48 }
llvm
---------------------— PointerInfo ------------------------------------—
Definition: AllocatorList.h:23
llvm::M68kTargetMachine
Definition: M68kTargetMachine.h:29
M68kTargetMachine.h
llvm::MCContext
Context object for machine code objects.
Definition: MCContext.h:72
MCSectionELF.h
llvm::cl::Hidden
@ Hidden
Definition: CommandLine.h:143
llvm::TargetLoweringObjectFileELF::InitializeELF
void InitializeELF(bool UseInitArray_)
Definition: TargetLoweringObjectFileImpl.cpp:1120
llvm::MCObjectFileInfo::getContext
MCContext & getContext() const
Definition: MCObjectFileInfo.h:235
M68kTargetObjectFile.h
llvm::ELF::SHT_PROGBITS
@ SHT_PROGBITS
Definition: ELF.h:910
CommandLine.h
ELF.h
TargetMachine.h
MCContext.h
llvm::MCContext::getELFSection
MCSectionELF * getELFSection(const Twine &Section, unsigned Type, unsigned Flags)
Definition: MCContext.h:540
llvm::cl::opt
Definition: CommandLine.h:1434
llvm::ELF::SHF_WRITE
@ SHF_WRITE
Definition: ELF.h:985
llvm::cl::init
initializer< Ty > init(const Ty &Val)
Definition: CommandLine.h:443
llvm::TargetMachine
Primary interface to the complete machine description for the target machine.
Definition: TargetMachine.h:79
llvm::ELF::SHF_ALLOC
@ SHF_ALLOC
Definition: ELF.h:988
DataLayout.h
SSThreshold
static cl::opt< unsigned > SSThreshold("m68k-ssection-threshold", cl::Hidden, cl::desc("Small data and bss section threshold size (default=8)"), cl::init(8))
GlobalVariable.h
llvm::TargetLoweringObjectFileELF::Initialize
void Initialize(MCContext &Ctx, const TargetMachine &TM) override
This method must be called before any actual lowering is done.
Definition: TargetLoweringObjectFileImpl.cpp:116
M68kSubtarget.h
DerivedTypes.h
TM
const char LLVMTargetMachineRef TM
Definition: PassBuilderBindings.cpp:47
llvm::M68kELFTargetObjectFile::Initialize
void Initialize(MCContext &Ctx, const TargetMachine &TM) override
This method must be called before any actual lowering is done.
Definition: M68kTargetObjectFile.cpp:35
llvm::cl::desc
Definition: CommandLine.h:414
llvm::ELF::SHT_NOBITS
@ SHT_NOBITS
Definition: ELF.h:917