aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/llvm/Target/TargetAsmInfo.h12
-rw-r--r--lib/Target/Mips/MipsTargetAsmInfo.cpp4
-rw-r--r--lib/Target/TargetAsmInfo.cpp10
3 files changed, 16 insertions, 10 deletions
diff --git a/include/llvm/Target/TargetAsmInfo.h b/include/llvm/Target/TargetAsmInfo.h
index e20a6c8995..04e91cb381 100644
--- a/include/llvm/Target/TargetAsmInfo.h
+++ b/include/llvm/Target/TargetAsmInfo.h
@@ -45,6 +45,18 @@ namespace llvm {
ThreadData, ///< Initialized 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 {
diff --git a/lib/Target/Mips/MipsTargetAsmInfo.cpp b/lib/Target/Mips/MipsTargetAsmInfo.cpp
index 10b1d843f9..04edd0d4b5 100644
--- a/lib/Target/Mips/MipsTargetAsmInfo.cpp
+++ b/lib/Target/Mips/MipsTargetAsmInfo.cpp
@@ -61,7 +61,7 @@ SectionKindForGlobal(const GlobalValue *GV) const {
if (Subtarget->hasABICall())
return K;
- if (K != SectionKind::Data && K != SectionKind::BSS &&
+ if (K != SectionKind::Data && K != SectionKind::BSS &&
K != SectionKind::RODataMergeConst)
return K;
@@ -69,7 +69,7 @@ SectionKindForGlobal(const GlobalValue *GV) const {
const TargetData *TD = ETM->getTargetData();
unsigned Size = TD->getABITypeSize(GV->getType()->getElementType());
unsigned Threshold = Subtarget->getSSectionThreshold();
-
+
if (Size > 0 && Size <= Threshold) {
if (K == SectionKind::BSS)
return SectionKind::SmallBSS;
diff --git a/lib/Target/TargetAsmInfo.cpp b/lib/Target/TargetAsmInfo.cpp
index eb74836aec..9bc0b4055e 100644
--- a/lib/Target/TargetAsmInfo.cpp
+++ b/lib/Target/TargetAsmInfo.cpp
@@ -306,15 +306,9 @@ TargetAsmInfo::SelectSectionForGlobal(const GlobalValue *GV) const {
} else {
if (Kind == SectionKind::Text)
return getTextSection_();
- else if ((Kind == SectionKind::BSS ||
- Kind == SectionKind::SmallBSS) &&
- getBSSSection_())
+ else if (isBSS(Kind) && getBSSSection_())
return getBSSSection_();
- else if (getReadOnlySection_() &&
- (Kind == SectionKind::ROData ||
- Kind == SectionKind::RODataMergeConst ||
- Kind == SectionKind::RODataMergeStr ||
- Kind == SectionKind::SmallROData))
+ else if (getReadOnlySection_() && SectionKind::isReadOnly(Kind))
return getReadOnlySection_();
}