mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-08-10 02:25:47 +00:00
Provide convenient helpers
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@54451 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -45,6 +45,18 @@ namespace llvm {
|
|||||||
ThreadData, ///< Initialized TLS data objects
|
ThreadData, ///< Initialized TLS data objects
|
||||||
ThreadBSS ///< Uninitialized TLS data objects
|
ThreadBSS ///< Uninitialized TLS data objects
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static inline bool isReadOnly(Kind K) {
|
||||||
|
return (K == SectionKind::ROData ||
|
||||||
|
K == SectionKind::RODataMergeConst ||
|
||||||
|
K == SectionKind::RODataMergeStr ||
|
||||||
|
K == SectionKind::SmallROData);
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline bool isBSS(Kind K) {
|
||||||
|
return (K == SectionKind::BSS ||
|
||||||
|
K == SectionKind::SmallBSS);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace SectionFlags {
|
namespace SectionFlags {
|
||||||
|
@@ -61,7 +61,7 @@ SectionKindForGlobal(const GlobalValue *GV) const {
|
|||||||
if (Subtarget->hasABICall())
|
if (Subtarget->hasABICall())
|
||||||
return K;
|
return K;
|
||||||
|
|
||||||
if (K != SectionKind::Data && K != SectionKind::BSS &&
|
if (K != SectionKind::Data && K != SectionKind::BSS &&
|
||||||
K != SectionKind::RODataMergeConst)
|
K != SectionKind::RODataMergeConst)
|
||||||
return K;
|
return K;
|
||||||
|
|
||||||
@@ -69,7 +69,7 @@ SectionKindForGlobal(const GlobalValue *GV) const {
|
|||||||
const TargetData *TD = ETM->getTargetData();
|
const TargetData *TD = ETM->getTargetData();
|
||||||
unsigned Size = TD->getABITypeSize(GV->getType()->getElementType());
|
unsigned Size = TD->getABITypeSize(GV->getType()->getElementType());
|
||||||
unsigned Threshold = Subtarget->getSSectionThreshold();
|
unsigned Threshold = Subtarget->getSSectionThreshold();
|
||||||
|
|
||||||
if (Size > 0 && Size <= Threshold) {
|
if (Size > 0 && Size <= Threshold) {
|
||||||
if (K == SectionKind::BSS)
|
if (K == SectionKind::BSS)
|
||||||
return SectionKind::SmallBSS;
|
return SectionKind::SmallBSS;
|
||||||
|
@@ -306,15 +306,9 @@ TargetAsmInfo::SelectSectionForGlobal(const GlobalValue *GV) const {
|
|||||||
} else {
|
} else {
|
||||||
if (Kind == SectionKind::Text)
|
if (Kind == SectionKind::Text)
|
||||||
return getTextSection_();
|
return getTextSection_();
|
||||||
else if ((Kind == SectionKind::BSS ||
|
else if (isBSS(Kind) && getBSSSection_())
|
||||||
Kind == SectionKind::SmallBSS) &&
|
|
||||||
getBSSSection_())
|
|
||||||
return getBSSSection_();
|
return getBSSSection_();
|
||||||
else if (getReadOnlySection_() &&
|
else if (getReadOnlySection_() && SectionKind::isReadOnly(Kind))
|
||||||
(Kind == SectionKind::ROData ||
|
|
||||||
Kind == SectionKind::RODataMergeConst ||
|
|
||||||
Kind == SectionKind::RODataMergeStr ||
|
|
||||||
Kind == SectionKind::SmallROData))
|
|
||||||
return getReadOnlySection_();
|
return getReadOnlySection_();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user