introduce specialized mergable const sectionkinds for elements of size 4/8/16 to
simplify targets.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@77132 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Target/DarwinTargetAsmInfo.cpp b/lib/Target/DarwinTargetAsmInfo.cpp
index 7321b18..1804adf 100644
--- a/lib/Target/DarwinTargetAsmInfo.cpp
+++ b/lib/Target/DarwinTargetAsmInfo.cpp
@@ -148,9 +148,13 @@
return MergeableStringSection(cast<GlobalVariable>(GV));
if (Kind.isMergableConst()) {
- const Type *Ty = cast<GlobalVariable>(GV)->getInitializer()->getType();
- const TargetData *TD = TM.getTargetData();
- return getSectionForMergableConstant(TD->getTypeAllocSize(Ty), 0);
+ if (Kind.isMergableConst4())
+ return FourByteConstantSection;
+ if (Kind.isMergableConst8())
+ return EightByteConstantSection;
+ if (Kind.isMergableConst16() && SixteenByteConstantSection)
+ return SixteenByteConstantSection;
+ return ReadOnlySection; // .const
}
// FIXME: ROData -> const in -static mode that is relocatable but they happen