forked from OSchip/llvm-project
[Lanai] Code model dictates section selection.
Always use the small section when the small code model is specified. llvm-svn: 324679
This commit is contained in:
parent
b7e13938a9
commit
bd275c7ba7
|
@ -50,8 +50,7 @@ static bool isInSmallSection(uint64_t Size) {
|
|||
// section.
|
||||
bool LanaiTargetObjectFile::isGlobalInSmallSection(
|
||||
const GlobalObject *GO, const TargetMachine &TM) const {
|
||||
if (GO == nullptr)
|
||||
return false;
|
||||
if (GO == nullptr) return TM.getCodeModel() == CodeModel::Small;
|
||||
|
||||
// We first check the case where global is a declaration, because finding
|
||||
// section kind using getKindForGlobal() is only allowed for global
|
||||
|
@ -67,8 +66,7 @@ bool LanaiTargetObjectFile::isGlobalInSmallSection(
|
|||
bool LanaiTargetObjectFile::isGlobalInSmallSection(const GlobalObject *GO,
|
||||
const TargetMachine &TM,
|
||||
SectionKind Kind) const {
|
||||
return (isGlobalInSmallSectionImpl(GO, TM) &&
|
||||
(Kind.isData() || Kind.isBSS() || Kind.isCommon()));
|
||||
return isGlobalInSmallSectionImpl(GO, TM);
|
||||
}
|
||||
|
||||
// Return true if this global address should be placed into small data/bss
|
||||
|
@ -76,10 +74,10 @@ bool LanaiTargetObjectFile::isGlobalInSmallSection(const GlobalObject *GO,
|
|||
// kind.
|
||||
bool LanaiTargetObjectFile::isGlobalInSmallSectionImpl(
|
||||
const GlobalObject *GO, const TargetMachine &TM) const {
|
||||
// Only global variables, not functions.
|
||||
const auto *GVA = dyn_cast<GlobalVariable>(GO);
|
||||
if (!GVA)
|
||||
return false;
|
||||
|
||||
// If not a GlobalVariable, only consider the code model.
|
||||
if (!GVA) return TM.getCodeModel() == CodeModel::Small;
|
||||
|
||||
// Global values placed in sections starting with .ldata do not fit in
|
||||
// 21-bits, so always use large memory access for them. FIXME: This is a
|
||||
|
|
Loading…
Reference in New Issue