26 cl::desc(
"Small data and bss section threshold size (default=0)"),
51 bool LanaiTargetObjectFile::isGlobalInSmallSection(
59 return isGlobalInSmallSectionImpl(GO, TM);
66 bool LanaiTargetObjectFile::isGlobalInSmallSection(
const GlobalObject *GO,
69 return isGlobalInSmallSectionImpl(GO, TM);
75 bool LanaiTargetObjectFile::isGlobalInSmallSectionImpl(
85 if (GVA->getSection().startswith(
".ldata"))
91 if (GVA->hasLocalLinkage())
94 if (((GVA->hasExternalLinkage() && GVA->isDeclaration()) ||
95 GVA->hasCommonLinkage()))
98 Type *Ty = GVA->getValueType();
100 GVA->getParent()->getDataLayout().getTypeAllocSize(Ty));
106 if (Kind.
isBSS() && isGlobalInSmallSection(GO, TM, Kind))
107 return SmallBSSSection;
108 if (Kind.
isData() && isGlobalInSmallSection(GO, TM, Kind))
109 return SmallDataSection;
124 unsigned &
Align)
const {
126 return SmallDataSection;
Instances of this class represent a uniqued identifier for a section in the current translation unit...
A parsed version of the target data layout string in and methods for querying it. ...
constexpr char Align[]
Key for Kernel::Arg::Metadata::mAlign.
This class represents lattice values for constants.
bool hasAvailableExternallyLinkage() const
static cl::opt< unsigned > SSThreshold("lanai-ssection-threshold", cl::Hidden, cl::desc("Small data and bss section threshold size (default=0)"), cl::init(0))
MCSection * getSectionForConstant(const DataLayout &DL, SectionKind Kind, const Constant *C, unsigned &Align) const override
Given a constant with the SectionKind, return a section that it should be placed in.
MCSection * SelectSectionForGlobal(const GlobalObject *GO, SectionKind Kind, const TargetMachine &TM) const override
Context object for machine code objects.
Type * getType() const
All values are typed, get the type of this value.
MCSection * SelectSectionForGlobal(const GlobalObject *GO, SectionKind Kind, const TargetMachine &TM) const override
initializer< Ty > init(const Ty &Val)
The instances of the Type class are immutable: once they are created, they are never changed...
This is an important base class in LLVM.
void InitializeELF(bool UseInitArray_)
bool isConstantInSmallSection(const DataLayout &DL, const Constant *CN) const
Return true if this constant should be placed into small data section.
SectionKind - This is a simple POD value that classifies the properties of a section.
MCContext & getContext() const
unsigned UseInitArray
UseInitArray - Use .init_array instead of .ctors for static constructors.
static bool isInSmallSection(uint64_t Size)
CodeModel::Model getCodeModel() const
Returns the code model.
uint64_t getTypeAllocSize(Type *Ty) const
Returns the offset in bytes between successive objects of the specified type, including alignment pad...
LLVM_NODISCARD std::enable_if<!is_simple_type< Y >::value, typename cast_retty< X, const Y >::ret_type >::type dyn_cast(const Y &Val)
bool isDeclaration() const
Return true if the primary definition of this global value is outside of the current translation unit...
MCSection * getSectionForConstant(const DataLayout &DL, SectionKind Kind, const Constant *C, unsigned &Align) const override
Given a constant with the SectionKind, return a section that it should be placed in.
MCSectionELF * getELFSection(const Twine &Section, unsigned Type, unsigned Flags)
void Initialize(MCContext &Ctx, const TargetMachine &TM) override
This method must be called before any actual lowering is done.
Primary interface to the complete machine description for the target machine.
static SectionKind getKindForGlobal(const GlobalObject *GO, const TargetMachine &TM)
Classify the specified global variable into a set of target independent categories embodied in Sectio...
void Initialize(MCContext &Ctx, const TargetMachine &TM) override
This method must be called before any actual lowering is done.