1 //===-- HexagonTargetObjectFile.h -----------------------------------------===//
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_HEXAGON_HEXAGONTARGETOBJECTFILE_H
10 #define LLVM_LIB_TARGET_HEXAGON_HEXAGONTARGETOBJECTFILE_H
11 
12 #include "llvm/CodeGen/TargetLoweringObjectFileImpl.h"
13 #include "llvm/MC/MCSectionELF.h"
14 
15 namespace llvm {
16 
17   class HexagonTargetObjectFile : public TargetLoweringObjectFileELF {
18   public:
19     void Initialize(MCContext &Ctx, const TargetMachine &TM) override;
20 
21     MCSection *SelectSectionForGlobal(const GlobalObject *GO, SectionKind Kind,
22                                       const TargetMachine &TM) const override;
23 
24     MCSection *getExplicitSectionGlobal(const GlobalObject *GO,
25                                         SectionKind Kind,
26                                         const TargetMachine &TM) const override;
27 
28     bool isGlobalInSmallSection(const GlobalObject *GO,
29                                 const TargetMachine &TM) const;
30 
31     bool isSmallDataEnabled(const TargetMachine &TM) const;
32 
33     unsigned getSmallDataSize() const;
34 
35     bool shouldPutJumpTableInFunctionSection(bool UsesLabelDifference,
36                                              const Function &F) const override;
37 
38     const Function *getLutUsedFunction(const GlobalObject *GO) const;
39 
40   private:
41     MCSectionELF *SmallDataSection;
42     MCSectionELF *SmallBSSSection;
43 
44     unsigned getSmallestAddressableSize(const Type *Ty, const GlobalValue *GV,
45         const TargetMachine &TM) const;
46 
47     MCSection *selectSmallSectionForGlobal(const GlobalObject *GO,
48                                            SectionKind Kind,
49                                            const TargetMachine &TM) const;
50 
51     MCSection *selectSectionForLookupTable(const GlobalObject *GO,
52                                            const TargetMachine &TM,
53                                            const Function *Fn) const;
54   };
55 
56 } // namespace llvm
57 
58 #endif
59