diff options
author | Chris Lattner <sabre@nondot.org> | 2009-07-26 06:34:33 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2009-07-26 06:34:33 +0000 |
commit | 3081d4aa14c8bbe562d60920f3aa3c9a407377fb (patch) | |
tree | 629a85786b40d09df6eaccf3f98357904908b7c6 /lib/Target | |
parent | fc60ba101e122dd74ee0a2aeafd80a620c6bbb47 (diff) | |
download | external_llvm-3081d4aa14c8bbe562d60920f3aa3c9a407377fb.zip external_llvm-3081d4aa14c8bbe562d60920f3aa3c9a407377fb.tar.gz external_llvm-3081d4aa14c8bbe562d60920f3aa3c9a407377fb.tar.bz2 |
remove a bunch of helper functions, just use SectionKind::get instead.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@77135 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Target')
-rw-r--r-- | lib/Target/TargetAsmInfo.cpp | 45 |
1 files changed, 25 insertions, 20 deletions
diff --git a/lib/Target/TargetAsmInfo.cpp b/lib/Target/TargetAsmInfo.cpp index 7abfcf9..c847102 100644 --- a/lib/Target/TargetAsmInfo.cpp +++ b/lib/Target/TargetAsmInfo.cpp @@ -224,18 +224,20 @@ static SectionKind SectionKindForGlobal(const GlobalValue *GV, // Early exit - functions should be always in text sections. const GlobalVariable *GVar = dyn_cast<GlobalVariable>(GV); if (GVar == 0) - return SectionKind::getText(); + return SectionKind::get(SectionKind::Text); - bool isThreadLocal = GVar->isThreadLocal(); + + // Handle thread-local data first. + if (GVar->isThreadLocal()) { + if (isSuitableForBSS(GVar)) + return SectionKind::get(SectionKind::ThreadBSS); + return SectionKind::get(SectionKind::ThreadData);; + } // Variable can be easily put to BSS section. if (isSuitableForBSS(GVar)) - return isThreadLocal ? SectionKind::getThreadBSS() : SectionKind::getBSS(); + return SectionKind::get(SectionKind::BSS); - // If this is thread-local, put it in the general "thread_data" section. - if (isThreadLocal) - return SectionKind::getThreadData(); - Constant *C = GVar->getInitializer(); // If the global is marked constant, we can put it into a mergable section, @@ -250,16 +252,16 @@ static SectionKind SectionKindForGlobal(const GlobalValue *GV, // If initializer is a null-terminated string, put it in a "cstring" // section if the target has it. if (isConstantString(C)) - return SectionKind::getMergableCString(); + return SectionKind::get(SectionKind::MergableCString); // Otherwise, just drop it into a mergable constant section. If we have // a section for this size, use it, otherwise use the arbitrary sized // mergable section. switch (TM.getTargetData()->getTypeAllocSize(C->getType())) { - case 4: return SectionKind::getMergableConst4(); - case 8: return SectionKind::getMergableConst8(); - case 16: return SectionKind::getMergableConst16(); - default: return SectionKind::getMergableConst(); + case 4: return SectionKind::get(SectionKind::MergableConst4); + case 8: return SectionKind::get(SectionKind::MergableConst8); + case 16: return SectionKind::get(SectionKind::MergableConst16); + default: return SectionKind::get(SectionKind::MergableConst); } case Constant::LocalRelocation: @@ -267,22 +269,22 @@ static SectionKind SectionKindForGlobal(const GlobalValue *GV, // the relocation entries will actually be constants by the time the app // starts up. if (ReloModel == Reloc::Static) - return SectionKind::getReadOnly(); + return SectionKind::get(SectionKind::ReadOnly); // Otherwise, the dynamic linker needs to fix it up, put it in the // writable data.rel.local section. - return SectionKind::getReadOnlyWithRelLocal(); + return SectionKind::get(SectionKind::ReadOnlyWithRelLocal); case Constant::GlobalRelocations: // In static relocation model, the linker will resolve all addresses, so // the relocation entries will actually be constants by the time the app // starts up. if (ReloModel == Reloc::Static) - return SectionKind::getReadOnly(); + return SectionKind::get(SectionKind::ReadOnly); // Otherwise, the dynamic linker needs to fix it up, put it in the // writable data.rel section. - return SectionKind::getReadOnlyWithRel(); + return SectionKind::get(SectionKind::ReadOnlyWithRel); } } @@ -292,13 +294,16 @@ static SectionKind SectionKindForGlobal(const GlobalValue *GV, // globals together onto fewer pages, improving the locality of the dynamic // linker. if (ReloModel == Reloc::Static) - return SectionKind::getDataNoRel(); + return SectionKind::get(SectionKind::DataNoRel); switch (C->getRelocationInfo()) { default: llvm_unreachable("unknown relocation info kind"); - case Constant::NoRelocation: return SectionKind::getDataNoRel(); - case Constant::LocalRelocation: return SectionKind::getDataRelLocal(); - case Constant::GlobalRelocations: return SectionKind::getDataRel(); + case Constant::NoRelocation: + return SectionKind::get(SectionKind::DataNoRel); + case Constant::LocalRelocation: + return SectionKind::get(SectionKind::DataRelLocal); + case Constant::GlobalRelocations: + return SectionKind::get(SectionKind::DataRel); } } |