Krzysztof Parzyszek | 5de5910 | 2016-04-21 18:56:45 +0000 | [diff] [blame] | 1 | //===-- HexagonTargetObjectFile.h -----------------------------------------===// |
Tony Linthicum | 1213a7a | 2011-12-12 21:14:40 +0000 | [diff] [blame] | 2 | // |
Chandler Carruth | 2946cd7 | 2019-01-19 08:50:56 +0000 | [diff] [blame] | 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 |
Tony Linthicum | 1213a7a | 2011-12-12 21:14:40 +0000 | [diff] [blame] | 6 | // |
| 7 | //===----------------------------------------------------------------------===// |
| 8 | |
Benjamin Kramer | a7c40ef | 2014-08-13 16:26:38 +0000 | [diff] [blame] | 9 | #ifndef LLVM_LIB_TARGET_HEXAGON_HEXAGONTARGETOBJECTFILE_H |
| 10 | #define LLVM_LIB_TARGET_HEXAGON_HEXAGONTARGETOBJECTFILE_H |
Tony Linthicum | 1213a7a | 2011-12-12 21:14:40 +0000 | [diff] [blame] | 11 | |
| 12 | #include "llvm/CodeGen/TargetLoweringObjectFileImpl.h" |
| 13 | #include "llvm/MC/MCSectionELF.h" |
| 14 | |
| 15 | namespace llvm { |
| 16 | |
| 17 | class HexagonTargetObjectFile : public TargetLoweringObjectFileELF { |
Tony Linthicum | 1213a7a | 2011-12-12 21:14:40 +0000 | [diff] [blame] | 18 | public: |
Craig Topper | 7315602 | 2014-03-02 09:09:27 +0000 | [diff] [blame] | 19 | void Initialize(MCContext &Ctx, const TargetMachine &TM) override; |
Tony Linthicum | 1213a7a | 2011-12-12 21:14:40 +0000 | [diff] [blame] | 20 | |
Peter Collingbourne | 6733564 | 2016-10-24 19:23:39 +0000 | [diff] [blame] | 21 | MCSection *SelectSectionForGlobal(const GlobalObject *GO, SectionKind Kind, |
Eric Christopher | 4367c7f | 2016-09-16 07:33:15 +0000 | [diff] [blame] | 22 | const TargetMachine &TM) const override; |
Krzysztof Parzyszek | 5de5910 | 2016-04-21 18:56:45 +0000 | [diff] [blame] | 23 | |
Peter Collingbourne | 6733564 | 2016-10-24 19:23:39 +0000 | [diff] [blame] | 24 | MCSection *getExplicitSectionGlobal(const GlobalObject *GO, |
| 25 | SectionKind Kind, |
Eric Christopher | 4367c7f | 2016-09-16 07:33:15 +0000 | [diff] [blame] | 26 | const TargetMachine &TM) const override; |
Krzysztof Parzyszek | 5de5910 | 2016-04-21 18:56:45 +0000 | [diff] [blame] | 27 | |
Peter Collingbourne | 6733564 | 2016-10-24 19:23:39 +0000 | [diff] [blame] | 28 | bool isGlobalInSmallSection(const GlobalObject *GO, |
| 29 | const TargetMachine &TM) const; |
Krzysztof Parzyszek | 5de5910 | 2016-04-21 18:56:45 +0000 | [diff] [blame] | 30 | |
Krzysztof Parzyszek | 977a1fe | 2018-10-31 15:54:31 +0000 | [diff] [blame] | 31 | bool isSmallDataEnabled(const TargetMachine &TM) const; |
Krzysztof Parzyszek | 5de5910 | 2016-04-21 18:56:45 +0000 | [diff] [blame] | 32 | |
| 33 | unsigned getSmallDataSize() const; |
| 34 | |
Sumanth Gundapaneni | 8c5d595 | 2017-06-30 20:21:48 +0000 | [diff] [blame] | 35 | bool shouldPutJumpTableInFunctionSection(bool UsesLabelDifference, |
| 36 | const Function &F) const override; |
| 37 | |
Sumanth Gundapaneni | d5aa0f3 | 2017-07-18 15:31:37 +0000 | [diff] [blame] | 38 | const Function *getLutUsedFunction(const GlobalObject *GO) const; |
| 39 | |
Krzysztof Parzyszek | 5de5910 | 2016-04-21 18:56:45 +0000 | [diff] [blame] | 40 | private: |
| 41 | MCSectionELF *SmallDataSection; |
| 42 | MCSectionELF *SmallBSSSection; |
| 43 | |
| 44 | unsigned getSmallestAddressableSize(const Type *Ty, const GlobalValue *GV, |
| 45 | const TargetMachine &TM) const; |
| 46 | |
Peter Collingbourne | 6733564 | 2016-10-24 19:23:39 +0000 | [diff] [blame] | 47 | MCSection *selectSmallSectionForGlobal(const GlobalObject *GO, |
Eric Christopher | 4367c7f | 2016-09-16 07:33:15 +0000 | [diff] [blame] | 48 | SectionKind Kind, |
| 49 | const TargetMachine &TM) const; |
Sumanth Gundapaneni | d5aa0f3 | 2017-07-18 15:31:37 +0000 | [diff] [blame] | 50 | |
| 51 | MCSection *selectSectionForLookupTable(const GlobalObject *GO, |
| 52 | const TargetMachine &TM, |
| 53 | const Function *Fn) const; |
Tony Linthicum | 1213a7a | 2011-12-12 21:14:40 +0000 | [diff] [blame] | 54 | }; |
| 55 | |
| 56 | } // namespace llvm |
| 57 | |
| 58 | #endif |