blob: 99ec1956da4b96111cb1596187b69981b866d1cf [file] [log] [blame]
Jacques Pienaarfcef3e42016-03-28 13:09:54 +00001//===-- LanaiTargetObjectFile.h - Lanai Object Info -----------------------===//
2//
3// The LLVM Compiler Infrastructure
4//
5// This file is distributed under the University of Illinois Open Source
6// License. See LICENSE.TXT for details.
7//
8//===----------------------------------------------------------------------===//
9
10#ifndef LLVM_LIB_TARGET_LANAI_LANAITARGETOBJECTFILE_H
11#define LLVM_LIB_TARGET_LANAI_LANAITARGETOBJECTFILE_H
12
13#include "llvm/CodeGen/TargetLoweringObjectFileImpl.h"
14
15namespace llvm {
16class LanaiTargetMachine;
17class LanaiTargetObjectFile : public TargetLoweringObjectFileELF {
18 MCSection *SmallDataSection;
19 MCSection *SmallBSSSection;
20
Peter Collingbourne67335642016-10-24 19:23:39 +000021 bool isGlobalInSmallSection(const GlobalObject *GO, const TargetMachine &TM,
22 SectionKind Kind) const;
23 bool isGlobalInSmallSectionImpl(const GlobalObject *GO,
24 const TargetMachine &TM) const;
25
Jacques Pienaarfcef3e42016-03-28 13:09:54 +000026public:
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.
Peter Collingbourne67335642016-10-24 19:23:39 +000031 bool isGlobalInSmallSection(const GlobalObject *GO,
Jacques Pienaarfcef3e42016-03-28 13:09:54 +000032 const TargetMachine &TM) const;
Jacques Pienaarfcef3e42016-03-28 13:09:54 +000033
Peter Collingbourne67335642016-10-24 19:23:39 +000034 MCSection *SelectSectionForGlobal(const GlobalObject *GO, SectionKind Kind,
Jacques Pienaarfcef3e42016-03-28 13:09:54 +000035 const TargetMachine &TM) const override;
36
37 /// Return true if this constant should be placed into small data section.
38 bool isConstantInSmallSection(const DataLayout &DL, const Constant *CN) const;
39
40 MCSection *getSectionForConstant(const DataLayout &DL, SectionKind Kind,
41 const Constant *C,
42 unsigned &Align) const override;
43};
44} // end namespace llvm
45
46#endif // LLVM_LIB_TARGET_LANAI_LANAITARGETOBJECTFILE_H