Go to the documentation of this file.
25 cl::desc(
"Small data and bss section threshold size (default=0)"),
49 bool LanaiTargetObjectFile::isGlobalInSmallSection(
57 return isGlobalInSmallSectionImpl(GO,
TM);
64 bool LanaiTargetObjectFile::isGlobalInSmallSection(
const GlobalObject *GO,
67 return isGlobalInSmallSectionImpl(GO,
TM);
73 bool LanaiTargetObjectFile::isGlobalInSmallSectionImpl(
75 const auto *GVA = dyn_cast<GlobalVariable>(GO);
83 if (GVA->getSection().startswith(
".ldata"))
89 if (GVA->hasLocalLinkage())
92 if (((GVA->hasExternalLinkage() && GVA->isDeclaration()) ||
93 GVA->hasCommonLinkage()))
96 Type *Ty = GVA->getValueType();
98 GVA->getParent()->getDataLayout().getTypeAllocSize(Ty));
104 if (
Kind.isBSS() && isGlobalInSmallSection(GO,
TM,
Kind))
105 return SmallBSSSection;
106 if (
Kind.isData() && isGlobalInSmallSection(GO,
TM,
Kind))
107 return SmallDataSection;
121 Align &Alignment)
const {
123 return SmallDataSection;
This is an optimization pass for GlobalISel generic memory operations.
A parsed version of the target data layout string in and methods for querying it.
MCSection * SelectSectionForGlobal(const GlobalObject *GO, SectionKind Kind, const TargetMachine &TM) const override
Context object for machine code objects.
The instances of the Type class are immutable: once they are created, they are never changed.
MCContext & getContext() const
bool isDeclaration() const
Return true if the primary definition of this global value is outside of the current translation unit...
(vector float) vec_cmpeq(*A, *B) C
MCSection * getSectionForConstant(const DataLayout &DL, SectionKind Kind, const Constant *C, Align &Alignment) 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)
static bool isInSmallSection(uint64_t Size)
This struct is a compact representation of a valid (non-zero power of two) alignment.
static SectionKind getKindForGlobal(const GlobalObject *GO, const TargetMachine &TM)
Classify the specified global variable into a set of target independent categories embodied in Sectio...
MCSection * SelectSectionForGlobal(const GlobalObject *GO, SectionKind Kind, const TargetMachine &TM) const override
bool hasAvailableExternallyLinkage() const
This is an important base class in LLVM.
initializer< Ty > init(const Ty &Val)
Primary interface to the complete machine description for the target machine.
MCSection * getSectionForConstant(const DataLayout &DL, SectionKind Kind, const Constant *C, Align &Alignment) const override
Given a constant with the SectionKind, return a section that it should be placed in.
void Initialize(MCContext &Ctx, const TargetMachine &TM) override
This method must be called before any actual lowering is done.
Type * getType() const
All values are typed, get the type of this value.
MachineBasicBlock MachineBasicBlock::iterator DebugLoc DL
bool isConstantInSmallSection(const DataLayout &DL, const Constant *CN) const
Return true if this constant should be placed into small data section.
Instances of this class represent a uniqued identifier for a section in the current translation unit.
SectionKind - This is a simple POD value that classifies the properties of a section.
void Initialize(MCContext &Ctx, const TargetMachine &TM) override
This method must be called before any actual lowering is done.
CodeModel::Model getCodeModel() const
Returns the code model.
const char LLVMTargetMachineRef TM
static cl::opt< unsigned > SSThreshold("lanai-ssection-threshold", cl::Hidden, cl::desc("Small data and bss section threshold size (default=0)"), cl::init(0))