inline a method.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@77198 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Target/ELFTargetAsmInfo.cpp b/lib/Target/ELFTargetAsmInfo.cpp
index 391e348..dbb2ce3 100644
--- a/lib/Target/ELFTargetAsmInfo.cpp
+++ b/lib/Target/ELFTargetAsmInfo.cpp
@@ -58,8 +58,30 @@
ELFTargetAsmInfo::SelectSectionForGlobal(const GlobalValue *GV,
SectionKind Kind) const {
if (Kind.isText()) return TextSection;
- if (Kind.isMergeableCString())
- return MergeableStringSection(cast<GlobalVariable>(GV));
+ if (Kind.isMergeableCString()) {
+ const TargetData *TD = TM.getTargetData();
+ Constant *C = cast<GlobalVariable>(GV)->getInitializer();
+ const Type *Ty = cast<ArrayType>(C->getType())->getElementType();
+
+ unsigned Size = TD->getTypeAllocSize(Ty);
+ if (Size <= 16) {
+ assert(getCStringSection() && "Should have string section prefix");
+
+ // We also need alignment here.
+ // FIXME: this is getting the alignment of the character, not the
+ // alignment of the string!!
+ unsigned Align = TD->getPrefTypeAlignment(Ty);
+ if (Align < Size)
+ Align = Size;
+
+ std::string Name = getCStringSection() + utostr(Size) + '.' +
+ utostr(Align);
+ return getOrCreateSection(Name.c_str(), false,
+ SectionKind::MergeableCString);
+ }
+
+ return getReadOnlySection();
+ }
if (Kind.isMergeableConst()) {
if (Kind.isMergeableConst4())
@@ -145,32 +167,6 @@
}
-
-const Section*
-ELFTargetAsmInfo::MergeableStringSection(const GlobalVariable *GV) const {
- const TargetData *TD = TM.getTargetData();
- Constant *C = cast<GlobalVariable>(GV)->getInitializer();
- const Type *Ty = cast<ArrayType>(C->getType())->getElementType();
-
- unsigned Size = TD->getTypeAllocSize(Ty);
- if (Size <= 16) {
- assert(getCStringSection() && "Should have string section prefix");
-
- // We also need alignment here.
- // FIXME: this is getting the alignment of the character, not the alignment
- // of the string!!
- unsigned Align = TD->getPrefTypeAlignment(Ty);
- if (Align < Size)
- Align = Size;
-
- std::string Name = getCStringSection() + utostr(Size) + '.' + utostr(Align);
- return getOrCreateSection(Name.c_str(), false,
- SectionKind::MergeableCString);
- }
-
- return getReadOnlySection();
-}
-
void ELFTargetAsmInfo::getSectionFlagsAsString(SectionKind Kind,
SmallVectorImpl<char> &Str) const {
Str.push_back(',');