diff options
author | Chris Lattner <sabre@nondot.org> | 2009-07-26 05:44:20 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2009-07-26 05:44:20 +0000 |
commit | 1d68bd7f97e4b412c10534d67c7c525ade40e729 (patch) | |
tree | 553b1024d9b818e6b08f828ee00bae759ea89c00 /llvm/lib/Target/DarwinTargetAsmInfo.cpp | |
parent | 9d81cc668ab48f8990dd711a03afca1d102e2bf2 (diff) | |
download | bcm5719-llvm-1d68bd7f97e4b412c10534d67c7c525ade40e729.tar.gz bcm5719-llvm-1d68bd7f97e4b412c10534d67c7c525ade40e729.zip |
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.
llvm-svn: 77129
Diffstat (limited to 'llvm/lib/Target/DarwinTargetAsmInfo.cpp')
-rw-r--r-- | llvm/lib/Target/DarwinTargetAsmInfo.cpp | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/llvm/lib/Target/DarwinTargetAsmInfo.cpp b/llvm/lib/Target/DarwinTargetAsmInfo.cpp index 1356f671e02..7321b187dd2 100644 --- a/llvm/lib/Target/DarwinTargetAsmInfo.cpp +++ b/llvm/lib/Target/DarwinTargetAsmInfo.cpp @@ -127,12 +127,12 @@ bool DarwinTargetAsmInfo::emitUsedDirectiveFor(const GlobalValue* GV, 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 @@ DarwinTargetAsmInfo::SelectSectionForGlobal(const GlobalValue *GV, } // 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; |