xref: /freebsd/contrib/llvm-project/llvm/lib/Target/Mips/MipsTargetObjectFile.h (revision 0b57cec536236d46e3dba9bd041533462f33dbb7)
1*0b57cec5SDimitry Andric //===-- llvm/Target/MipsTargetObjectFile.h - Mips Object Info ---*- C++ -*-===//
2*0b57cec5SDimitry Andric //
3*0b57cec5SDimitry Andric // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4*0b57cec5SDimitry Andric // See https://llvm.org/LICENSE.txt for license information.
5*0b57cec5SDimitry Andric // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6*0b57cec5SDimitry Andric //
7*0b57cec5SDimitry Andric //===----------------------------------------------------------------------===//
8*0b57cec5SDimitry Andric 
9*0b57cec5SDimitry Andric #ifndef LLVM_LIB_TARGET_MIPS_MIPSTARGETOBJECTFILE_H
10*0b57cec5SDimitry Andric #define LLVM_LIB_TARGET_MIPS_MIPSTARGETOBJECTFILE_H
11*0b57cec5SDimitry Andric 
12*0b57cec5SDimitry Andric #include "llvm/CodeGen/TargetLoweringObjectFileImpl.h"
13*0b57cec5SDimitry Andric 
14*0b57cec5SDimitry Andric namespace llvm {
15*0b57cec5SDimitry Andric class MipsTargetMachine;
16*0b57cec5SDimitry Andric   class MipsTargetObjectFile : public TargetLoweringObjectFileELF {
17*0b57cec5SDimitry Andric     MCSection *SmallDataSection;
18*0b57cec5SDimitry Andric     MCSection *SmallBSSSection;
19*0b57cec5SDimitry Andric     const MipsTargetMachine *TM;
20*0b57cec5SDimitry Andric 
21*0b57cec5SDimitry Andric     bool IsGlobalInSmallSection(const GlobalObject *GO, const TargetMachine &TM,
22*0b57cec5SDimitry Andric                                 SectionKind Kind) const;
23*0b57cec5SDimitry Andric     bool IsGlobalInSmallSectionImpl(const GlobalObject *GO,
24*0b57cec5SDimitry Andric                                     const TargetMachine &TM) const;
25*0b57cec5SDimitry Andric   public:
26*0b57cec5SDimitry Andric 
27*0b57cec5SDimitry Andric     void Initialize(MCContext &Ctx, const TargetMachine &TM) override;
28*0b57cec5SDimitry Andric 
29*0b57cec5SDimitry Andric     /// Return true if this global address should be placed into small data/bss
30*0b57cec5SDimitry Andric     /// section.
31*0b57cec5SDimitry Andric     bool IsGlobalInSmallSection(const GlobalObject *GO,
32*0b57cec5SDimitry Andric                                 const TargetMachine &TM) const;
33*0b57cec5SDimitry Andric 
34*0b57cec5SDimitry Andric     MCSection *SelectSectionForGlobal(const GlobalObject *GO, SectionKind Kind,
35*0b57cec5SDimitry Andric                                       const TargetMachine &TM) const override;
36*0b57cec5SDimitry Andric 
37*0b57cec5SDimitry Andric     /// Return true if this constant should be placed into small data section.
38*0b57cec5SDimitry Andric     bool IsConstantInSmallSection(const DataLayout &DL, const Constant *CN,
39*0b57cec5SDimitry Andric                                   const TargetMachine &TM) const;
40*0b57cec5SDimitry Andric 
41*0b57cec5SDimitry Andric     MCSection *getSectionForConstant(const DataLayout &DL, SectionKind Kind,
42*0b57cec5SDimitry Andric                                      const Constant *C,
43*0b57cec5SDimitry Andric                                      unsigned &Align) const override;
44*0b57cec5SDimitry Andric     /// Describe a TLS variable address within debug info.
45*0b57cec5SDimitry Andric     const MCExpr *getDebugThreadLocalSymbol(const MCSymbol *Sym) const override;
46*0b57cec5SDimitry Andric   };
47*0b57cec5SDimitry Andric } // end namespace llvm
48*0b57cec5SDimitry Andric 
49*0b57cec5SDimitry Andric #endif
50