1//===-- llvm/Target/MipsTargetObjectFile.h - Mips Object Info ---*- 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#ifndef LLVM_LIB_TARGET_MIPS_MIPSTARGETOBJECTFILE_H
10#define LLVM_LIB_TARGET_MIPS_MIPSTARGETOBJECTFILE_H
11
12#include "llvm/CodeGen/TargetLoweringObjectFileImpl.h"
13
14namespace llvm {
15class MipsTargetObjectFile : public TargetLoweringObjectFileELF {
16 MCSection *SmallDataSection;
17 MCSection *SmallBSSSection;
18 const bool UseSmallSection;
19
20 bool IsGlobalInSmallSection(const GlobalObject *GO, SectionKind Kind) const;
21 bool IsGlobalInSmallSectionImpl(const GlobalObject *GO) const;
22
23public:
24 explicit MipsTargetObjectFile(bool UseSmallSection)
25 : UseSmallSection(UseSmallSection) {}
26
27 void Initialize(MCContext &Ctx, const TargetMachine &TM) override;
28
29 /// Return true if this global address should be placed into small data/bss
30 /// section.
31 bool IsGlobalInSmallSection(const GlobalObject *GO) const;
32
33 MCSection *SelectSectionForGlobal(const GlobalObject *GO, SectionKind Kind,
34 const TargetMachine &TM) const override;
35
36 /// Return true if this constant should be placed into small data section.
37 bool IsConstantInSmallSection(const DataLayout &DL, const Constant *CN,
38 const Function *F) const;
39
40 MCSection *getSectionForConstant(const DataLayout &DL, SectionKind Kind,
41 const Constant *C, Align &Alignment,
42 const Function *F) const override;
43 /// Describe a TLS variable address within debug info.
44 const MCExpr *getDebugThreadLocalSymbol(const MCSymbol *Sym) const override;
45};
46} // end namespace llvm
47
48#endif
49