Rearrange all the SectionKinds and structure them into a hierarchical
group instead of a bunch of random unrelated ideas. Provide predicates
to categorize a SectionKind into a group, and use them instead of
getKind() throughout the code.
This also renames a ton of SectionKinds to be more consistent and
evocative, and adds a huge number of comments on the enums so that
I will hopefully be able to remember how this stuff works long from
now.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@77129 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Target/DarwinTargetAsmInfo.cpp b/lib/Target/DarwinTargetAsmInfo.cpp
index 1356f67..7321b18 100644
--- a/lib/Target/DarwinTargetAsmInfo.cpp
+++ b/lib/Target/DarwinTargetAsmInfo.cpp
@@ -127,12 +127,12 @@
const Section*
DarwinTargetAsmInfo::SelectSectionForGlobal(const GlobalValue *GV,
SectionKind Kind) const {
- assert(!Kind.isTLS() && "Darwin doesn't support TLS");
+ assert(!Kind.isThreadLocal() && "Darwin doesn't support TLS");
// FIXME: Use sectionflags:linkonce instead of isWeakForLinker() here.
bool isWeak = GV->isWeakForLinker();
- if (Kind.isCode())
+ if (Kind.isText())
return isWeak ? TextCoalSection : TextSection;
// If this is weak/linkonce, put this in a coalescable section, either in text
@@ -144,24 +144,24 @@
}
// FIXME: Alignment check should be handled by section classifier.
- if (Kind.isMergableString())
+ if (Kind.isMergableCString())
return MergeableStringSection(cast<GlobalVariable>(GV));
- if (Kind.isMergableConstant()) {
+ if (Kind.isMergableConst()) {
const Type *Ty = cast<GlobalVariable>(GV)->getInitializer()->getType();
const TargetData *TD = TM.getTargetData();
return getSectionForMergableConstant(TD->getTypeAllocSize(Ty), 0);
}
-
- // If this is marked const, put it into a const section. But if the dynamic
- // linker needs to write to it, put it in the data segment.
- if (Kind.isReadOnlyWithDynamicInit())
- return ConstDataSection;
// FIXME: ROData -> const in -static mode that is relocatable but they happen
// by the static linker. Why not mergable?
if (Kind.isReadOnly())
return getReadOnlySection();
+
+ // If this is marked const, put it into a const section. But if the dynamic
+ // linker needs to write to it, put it in the data segment.
+ if (Kind.isReadOnlyWithRel())
+ return ConstDataSection;
// Otherwise, just drop the variable in the normal data section.
return DataSection;