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:
Anton Korobeynikov 2008-08-07 09:51:54 +00:00
parent 5b794b98ce
commit 4578862dcc
3 changed files with 16 additions and 10 deletions

View File

@ -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 {

View File

@ -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_();
}