26 cl::desc(
"Small data and bss section threshold size (default=8)"),
31 cl::desc(
"MIPS: Use gp_rel for object-local data."),
36 cl::desc(
"MIPS: Use gp_rel for data that is not defined by the " 42 cl::desc(
"MIPS: Try to allocate variables in the following" 43 " sections if possible: .rodata, .sdata, .data ."),
71 bool MipsTargetObjectFile::IsGlobalInSmallSection(
77 return IsGlobalInSmallSectionImpl(GO, TM);
84 bool MipsTargetObjectFile::
87 return IsGlobalInSmallSectionImpl(GO, TM) &&
95 bool MipsTargetObjectFile::
117 if (Section ==
".sdata" || Section ==
".sbss")
157 if (Kind.
isBSS() && IsGlobalInSmallSection(GO, TM, Kind))
158 return SmallBSSSection;
159 if (Kind.
isData() && IsGlobalInSmallSection(GO, TM, Kind))
160 return SmallDataSection;
161 if (Kind.
isReadOnly() && IsGlobalInSmallSection(GO, TM, Kind))
162 return SmallDataSection;
171 return (static_cast<const MipsTargetMachine &>(TM)
173 ->useSmallSection() &&
181 unsigned &
Align)
const {
183 return SmallDataSection;
StringRef getSection() const
Get the custom section of this global if it has one.
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.
bool hasLocalLinkage() const
static const MCSymbolRefExpr * create(const MCSymbol *Symbol, MCContext &Ctx)
This class represents lattice values for constants.
static cl::opt< bool > ExternSData("mextern-sdata", cl::Hidden, cl::desc("MIPS: Use gp_rel for data that is not defined by the " "current object."), cl::init(true))
MCSymbol - Instances of this class represent a symbol name in the MC file, and MCSymbols are created ...
bool isSized(SmallPtrSetImpl< Type *> *Visited=nullptr) const
Return true if it makes sense to take the size of this type.
MCSection * getSectionForConstant(const DataLayout &DL, SectionKind Kind, const Constant *C, unsigned &Align) const override
Return true if this constant should be placed into small data section.
const MCExpr * getDebugThreadLocalSymbol(const MCSymbol *Sym) const override
Describe a TLS variable address within debug info.
bool hasAvailableExternallyLinkage() const
static bool IsInSmallSection(uint64_t Size)
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.
const DataLayout & getDataLayout() const
Get the data layout for the module's target platform.
bool isConstant() const
If the value is a global constant, its value is immutable throughout the runtime execution of the pro...
Base class for the full range of assembler expressions which are needed for parsing.
bool hasCommonLinkage() const
MCSection * SelectSectionForGlobal(const GlobalObject *GO, SectionKind Kind, const TargetMachine &TM) const override
Context object for machine code objects.
bool hasExternalLinkage() const
Type * getType() const
All values are typed, get the type of this value.
bool useSmallSection() const
static const MCBinaryExpr * createAdd(const MCExpr *LHS, const MCExpr *RHS, MCContext &Ctx)
static cl::opt< bool > LocalSData("mlocal-sdata", cl::Hidden, cl::desc("MIPS: Use gp_rel for object-local data."), cl::init(true))
initializer< Ty > init(const Ty &Val)
void Initialize(MCContext &Ctx, const TargetMachine &TM) override
This method must be called before any actual lowering is done.
The instances of the Type class are immutable: once they are created, they are never changed...
This is an important base class in LLVM.
bool IsConstantInSmallSection(const DataLayout &DL, const Constant *CN, const TargetMachine &TM) const
Return true if this constant should be placed into small data section.
void InitializeELF(bool UseInitArray_)
SectionKind - This is a simple POD value that classifies the properties of a section.
MCContext & getContext() const
static cl::opt< bool > EmbeddedData("membedded-data", cl::Hidden, cl::desc("MIPS: Try to allocate variables in the following" " sections if possible: .rodata, .sdata, .data ."), cl::init(false))
unsigned UseInitArray
UseInitArray - Use .init_array instead of .ctors for static constructors.
MCSection * SelectSectionForGlobal(const GlobalObject *GO, SectionKind Kind, const TargetMachine &TM) const override
bool hasSection() const
Check if this global has a custom object file section.
static const MipsMCExpr * create(MipsExprKind Kind, const MCExpr *Expr, MCContext &Ctx)
uint64_t getTypeAllocSize(Type *Ty) const
Returns the offset in bytes between successive objects of the specified type, including alignment pad...
static cl::opt< unsigned > SSThreshold("mips-ssection-threshold", cl::Hidden, cl::desc("Small data and bss section threshold size (default=8)"), cl::init(8))
LLVM_NODISCARD std::enable_if<!is_simple_type< Y >::value, typename cast_retty< X, const Y >::ret_type >::type dyn_cast(const Y &Val)
Type * getValueType() const
bool isDeclaration() const
Return true if the primary definition of this global value is outside of the current translation unit...
MCSectionELF * getELFSection(const Twine &Section, unsigned Type, unsigned Flags)
Module * getParent()
Get the module that this global value is contained inside of...
Primary interface to the complete machine description for the target machine.
StringRef - Represent a constant reference to a string, i.e.
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.
static const MCConstantExpr * create(int64_t Value, MCContext &Ctx)