xref: /freebsd/contrib/llvm-project/llvm/lib/Target/Hexagon/HexagonTargetObjectFile.h (revision e25152834cdf3b353892835a4f3b157e066a8ed4)
10b57cec5SDimitry Andric //===-- HexagonTargetObjectFile.h -----------------------------------------===//
20b57cec5SDimitry Andric //
30b57cec5SDimitry Andric // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
40b57cec5SDimitry Andric // See https://llvm.org/LICENSE.txt for license information.
50b57cec5SDimitry Andric // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
60b57cec5SDimitry Andric //
70b57cec5SDimitry Andric //===----------------------------------------------------------------------===//
80b57cec5SDimitry Andric 
90b57cec5SDimitry Andric #ifndef LLVM_LIB_TARGET_HEXAGON_HEXAGONTARGETOBJECTFILE_H
100b57cec5SDimitry Andric #define LLVM_LIB_TARGET_HEXAGON_HEXAGONTARGETOBJECTFILE_H
110b57cec5SDimitry Andric 
120b57cec5SDimitry Andric #include "llvm/CodeGen/TargetLoweringObjectFileImpl.h"
130b57cec5SDimitry Andric #include "llvm/MC/MCSectionELF.h"
140b57cec5SDimitry Andric 
150b57cec5SDimitry Andric namespace llvm {
16*5ffd83dbSDimitry Andric   class Type;
170b57cec5SDimitry Andric 
180b57cec5SDimitry Andric   class HexagonTargetObjectFile : public TargetLoweringObjectFileELF {
190b57cec5SDimitry Andric   public:
200b57cec5SDimitry Andric     void Initialize(MCContext &Ctx, const TargetMachine &TM) override;
210b57cec5SDimitry Andric 
220b57cec5SDimitry Andric     MCSection *SelectSectionForGlobal(const GlobalObject *GO, SectionKind Kind,
230b57cec5SDimitry Andric                                       const TargetMachine &TM) const override;
240b57cec5SDimitry Andric 
250b57cec5SDimitry Andric     MCSection *getExplicitSectionGlobal(const GlobalObject *GO,
260b57cec5SDimitry Andric                                         SectionKind Kind,
270b57cec5SDimitry Andric                                         const TargetMachine &TM) const override;
280b57cec5SDimitry Andric 
290b57cec5SDimitry Andric     bool isGlobalInSmallSection(const GlobalObject *GO,
300b57cec5SDimitry Andric                                 const TargetMachine &TM) const;
310b57cec5SDimitry Andric 
320b57cec5SDimitry Andric     bool isSmallDataEnabled(const TargetMachine &TM) const;
330b57cec5SDimitry Andric 
340b57cec5SDimitry Andric     unsigned getSmallDataSize() const;
350b57cec5SDimitry Andric 
360b57cec5SDimitry Andric     bool shouldPutJumpTableInFunctionSection(bool UsesLabelDifference,
370b57cec5SDimitry Andric                                              const Function &F) const override;
380b57cec5SDimitry Andric 
390b57cec5SDimitry Andric     const Function *getLutUsedFunction(const GlobalObject *GO) const;
400b57cec5SDimitry Andric 
410b57cec5SDimitry Andric   private:
420b57cec5SDimitry Andric     MCSectionELF *SmallDataSection;
430b57cec5SDimitry Andric     MCSectionELF *SmallBSSSection;
440b57cec5SDimitry Andric 
450b57cec5SDimitry Andric     unsigned getSmallestAddressableSize(const Type *Ty, const GlobalValue *GV,
460b57cec5SDimitry Andric         const TargetMachine &TM) const;
470b57cec5SDimitry Andric 
480b57cec5SDimitry Andric     MCSection *selectSmallSectionForGlobal(const GlobalObject *GO,
490b57cec5SDimitry Andric                                            SectionKind Kind,
500b57cec5SDimitry Andric                                            const TargetMachine &TM) const;
510b57cec5SDimitry Andric 
520b57cec5SDimitry Andric     MCSection *selectSectionForLookupTable(const GlobalObject *GO,
530b57cec5SDimitry Andric                                            const TargetMachine &TM,
540b57cec5SDimitry Andric                                            const Function *Fn) const;
550b57cec5SDimitry Andric   };
560b57cec5SDimitry Andric 
570b57cec5SDimitry Andric } // namespace llvm
580b57cec5SDimitry Andric 
590b57cec5SDimitry Andric #endif
60