36 return Size > 0 &&
Size <= CLOpts.ssection_threshold;
41bool LanaiTargetObjectFile::isGlobalInSmallSection(
49 return isGlobalInSmallSectionImpl(GO,
TM);
56bool LanaiTargetObjectFile::isGlobalInSmallSection(
const GlobalObject *GO,
59 return isGlobalInSmallSectionImpl(GO,
TM);
65bool LanaiTargetObjectFile::isGlobalInSmallSectionImpl(
75 if (GVA->getSection().starts_with(
".ldata"))
81 if (GVA->hasLocalLinkage())
84 if (((GVA->hasExternalLinkage() && GVA->isDeclaration()) ||
85 GVA->hasCommonLinkage()))
88 Type *Ty = GVA->getValueType();
91 GVA->getDataLayout().getTypeAllocSize(Ty));
97 if (Kind.isBSS() && isGlobalInSmallSection(GO,
TM, Kind))
98 return SmallBSSSection;
99 if (Kind.isData() && isGlobalInSmallSection(GO,
TM, Kind))
100 return SmallDataSection;
118 return SmallDataSection;
MachineBasicBlock MachineBasicBlock::iterator DebugLoc DL
static GCRegistry::Add< ShadowStackGC > C("shadow-stack", "Very portable GC for uncooperative code generators")
static bool isInSmallSection(const LanaiOptions &CLOpts, uint64_t Size)
This is an important base class in LLVM.
A parsed version of the target data layout string in and methods for querying it.
LLVM_ABI bool isDeclaration() const
Return true if the primary definition of this global value is outside of the current translation unit...
bool hasAvailableExternallyLinkage() const
MCSection * getSectionForConstant(const DataLayout &DL, SectionKind Kind, const Constant *C, Align &Alignment, const Function *F) const override
Given a constant with the SectionKind, return a section that it should be placed in.
void initialize(MCContext &Ctx, const TargetMachine &TM, const Module &M) override
This method must be called before any actual lowering is done.
MCSection * SelectSectionForGlobal(const GlobalObject *GO, SectionKind Kind, const TargetMachine &TM) const override
bool isConstantInSmallSection(const DataLayout &DL, const Constant *CN) const
Return true if this constant should be placed into small data section.
Context object for machine code objects.
MCSectionELF * getELFSection(const Twine &Section, unsigned Type, unsigned Flags)
MCContext & getContext() const
Instances of this class represent a uniqued identifier for a section in the current translation unit.
A Module instance is used to store all the information related to an LLVM module.
SectionKind - This is a simple POD value that classifies the properties of a section.
MCSection * getSectionForConstant(const DataLayout &DL, SectionKind Kind, const Constant *C, Align &Alignment, const Function *F) 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
void initialize(MCContext &Ctx, const TargetMachine &TM, const Module &M) override
This method must be called before any actual lowering is done.
static SectionKind getKindForGlobal(const GlobalObject *GO, const TargetMachine &TM)
Classify the specified global variable into a set of target independent categories embodied in Sectio...
Primary interface to the complete machine description for the target machine.
CodeModel::Model getCodeModel() const
Returns the code model.
The instances of the Type class are immutable: once they are created, they are never changed.
Type * getType() const
All values are typed, get the type of this value.
This is an optimization pass for GlobalISel generic memory operations.
decltype(auto) dyn_cast(const From &Val)
dyn_cast<X> - Return the argument parameter cast to the specified type.
This struct is a compact representation of a valid (non-zero power of two) alignment.