diff options
author | Chris Lattner <sabre@nondot.org> | 2009-07-26 06:26:55 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2009-07-26 06:26:55 +0000 |
commit | fc60ba101e122dd74ee0a2aeafd80a620c6bbb47 (patch) | |
tree | 2ae0bbd9bc6de6fa917533c7992c7b7d69054f8f /lib/Target | |
parent | 5295484c40e908e2c95466508ead47c6eba6e8f0 (diff) | |
download | external_llvm-fc60ba101e122dd74ee0a2aeafd80a620c6bbb47.zip external_llvm-fc60ba101e122dd74ee0a2aeafd80a620c6bbb47.tar.gz external_llvm-fc60ba101e122dd74ee0a2aeafd80a620c6bbb47.tar.bz2 |
simplify getSectionForMergableConstant to take a SectionKind.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@77134 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Target')
-rw-r--r-- | lib/Target/DarwinTargetAsmInfo.cpp | 19 | ||||
-rw-r--r-- | lib/Target/ELFTargetAsmInfo.cpp | 17 | ||||
-rw-r--r-- | lib/Target/TargetAsmInfo.cpp | 5 |
3 files changed, 10 insertions, 31 deletions
diff --git a/lib/Target/DarwinTargetAsmInfo.cpp b/lib/Target/DarwinTargetAsmInfo.cpp index 1804adf..778aa22 100644 --- a/lib/Target/DarwinTargetAsmInfo.cpp +++ b/lib/Target/DarwinTargetAsmInfo.cpp @@ -188,25 +188,18 @@ DarwinTargetAsmInfo::MergeableStringSection(const GlobalVariable *GV) const { } const Section * -DarwinTargetAsmInfo::getSectionForMergableConstant(uint64_t Size, - unsigned ReloInfo) const { +DarwinTargetAsmInfo::getSectionForMergableConstant(SectionKind Kind) const { // If this constant requires a relocation, we have to put it in the data // segment, not in the text segment. - if (ReloInfo != 0) + if (Kind.isDataRel()) return ConstDataSection; - switch (Size) { - default: break; - case 4: + if (Kind.isMergableConst4()) return FourByteConstantSection; - case 8: + if (Kind.isMergableConst8()) return EightByteConstantSection; - case 16: - if (SixteenByteConstantSection) - return SixteenByteConstantSection; - break; - } - + if (Kind.isMergableConst16() && SixteenByteConstantSection) + return SixteenByteConstantSection; return ReadOnlySection; // .const } diff --git a/lib/Target/ELFTargetAsmInfo.cpp b/lib/Target/ELFTargetAsmInfo.cpp index 82c993b..5d8d720 100644 --- a/lib/Target/ELFTargetAsmInfo.cpp +++ b/lib/Target/ELFTargetAsmInfo.cpp @@ -92,21 +92,8 @@ ELFTargetAsmInfo::SelectSectionForGlobal(const GlobalValue *GV, /// specified size and relocation information, return a section that it /// should be placed in. const Section * -ELFTargetAsmInfo::getSectionForMergableConstant(uint64_t Size, - unsigned ReloInfo) const { - // If this constant pool entry has relocations, stick it into a relocatable - // section. - if (ReloInfo == 2) - return DataRelROSection; - if (ReloInfo == 1) - return DataRelROLocalSection; - - switch (Size) { - default: return ReadOnlySection; // .rodata - case 4: return MergableConst4Section; - case 8: return MergableConst8Section; - case 16: return MergableConst16Section; - } +ELFTargetAsmInfo::getSectionForMergableConstant(SectionKind Kind) const { + return SelectSectionForGlobal(0, Kind); } /// getFlagsForNamedSection - If this target wants to be able to infer diff --git a/lib/Target/TargetAsmInfo.cpp b/lib/Target/TargetAsmInfo.cpp index c68f04b..7abfcf9 100644 --- a/lib/Target/TargetAsmInfo.cpp +++ b/lib/Target/TargetAsmInfo.cpp @@ -372,9 +372,8 @@ TargetAsmInfo::SelectSectionForGlobal(const GlobalValue *GV, /// specified size and relocation information, return a section that it /// should be placed in. const Section * -TargetAsmInfo::getSectionForMergableConstant(uint64_t Size, - unsigned ReloInfo) const { - if (ReloInfo == 0) +TargetAsmInfo::getSectionForMergableConstant(SectionKind Kind) const { + if (Kind.isReadOnly()) if (const Section *S = getReadOnlySection()) return S; |