[llvm-commits] [llvm] r76710 - in /llvm/trunk: include/llvm/Target/DarwinTargetAsmInfo.h include/llvm/Target/ELFTargetAsmInfo.h lib/Target/DarwinTargetAsmInfo.cpp lib/Target/ELFTargetAsmInfo.cpp

Chris Lattner sabre at nondot.org
Tue Jul 21 17:47:12 PDT 2009


Author: lattner
Date: Tue Jul 21 19:47:11 2009
New Revision: 76710

URL: http://llvm.org/viewvc/llvm-project?rev=76710&view=rev
Log:
inline the two MergeableConstSection implementations into their
only caller.


Modified:
    llvm/trunk/include/llvm/Target/DarwinTargetAsmInfo.h
    llvm/trunk/include/llvm/Target/ELFTargetAsmInfo.h
    llvm/trunk/lib/Target/DarwinTargetAsmInfo.cpp
    llvm/trunk/lib/Target/ELFTargetAsmInfo.cpp

Modified: llvm/trunk/include/llvm/Target/DarwinTargetAsmInfo.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Target/DarwinTargetAsmInfo.h?rev=76710&r1=76709&r2=76710&view=diff

==============================================================================
--- llvm/trunk/include/llvm/Target/DarwinTargetAsmInfo.h (original)
+++ llvm/trunk/include/llvm/Target/DarwinTargetAsmInfo.h Tue Jul 21 19:47:11 2009
@@ -45,7 +45,6 @@
     getSectionForMergableConstant(uint64_t Size, unsigned ReloInfo) const;
     
   private:
-    const Section* MergeableConstSection(const Type *Ty) const;
     const Section* MergeableStringSection(const GlobalVariable *GV) const;
   };
 }

Modified: llvm/trunk/include/llvm/Target/ELFTargetAsmInfo.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Target/ELFTargetAsmInfo.h?rev=76710&r1=76709&r2=76710&view=diff

==============================================================================
--- llvm/trunk/include/llvm/Target/ELFTargetAsmInfo.h (original)
+++ llvm/trunk/include/llvm/Target/ELFTargetAsmInfo.h Tue Jul 21 19:47:11 2009
@@ -42,7 +42,6 @@
     const Section* DataRelROLocalSection;
     
   private:
-    const Section* MergeableConstSection(const Type *Ty) const;
     const Section* MergeableStringSection(const GlobalVariable *GV) const;
   };
 }

Modified: llvm/trunk/lib/Target/DarwinTargetAsmInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/DarwinTargetAsmInfo.cpp?rev=76710&r1=76709&r2=76710&view=diff

==============================================================================
--- llvm/trunk/lib/Target/DarwinTargetAsmInfo.cpp (original)
+++ llvm/trunk/lib/Target/DarwinTargetAsmInfo.cpp Tue Jul 21 19:47:11 2009
@@ -131,31 +131,33 @@
   bool isNonStatic = TM.getRelocationModel() != Reloc::Static;
 
   switch (Kind) {
-   case SectionKind::Text:
+  case SectionKind::Text:
     if (isWeak)
       return TextCoalSection;
     else
       return TextSection;
-   case SectionKind::Data:
-   case SectionKind::ThreadData:
-   case SectionKind::BSS:
-   case SectionKind::ThreadBSS:
+  case SectionKind::Data:
+  case SectionKind::ThreadData:
+  case SectionKind::BSS:
+  case SectionKind::ThreadBSS:
     if (cast<GlobalVariable>(GV)->isConstant())
       return (isWeak ? ConstDataCoalSection : ConstDataSection);
     else
       return (isWeak ? DataCoalSection : DataSection);
-   case SectionKind::ROData:
+  case SectionKind::ROData:
     return (isWeak ? ConstDataCoalSection :
             (isNonStatic ? ConstDataSection : getReadOnlySection()));
-   case SectionKind::RODataMergeStr:
+  case SectionKind::RODataMergeStr:
     return (isWeak ?
             ConstTextCoalSection :
             MergeableStringSection(cast<GlobalVariable>(GV)));
-   case SectionKind::RODataMergeConst:
+  case SectionKind::RODataMergeConst: {
     if (isWeak) return ConstDataCoalSection;
-    return MergeableConstSection(cast<GlobalVariable>(GV)
-                                 ->getInitializer()->getType());
-   default:
+    const Type *Ty = cast<GlobalVariable>(GV)->getInitializer()->getType();
+    const TargetData *TD = TM.getTargetData();
+    return getSectionForMergableConstant(TD->getTypeAllocSize(Ty), 0);
+  }
+  default:
     llvm_unreachable("Unsuported section kind for global");
   }
 
@@ -179,12 +181,6 @@
   return getReadOnlySection();
 }
 
-const Section*
-DarwinTargetAsmInfo::MergeableConstSection(const Type *Ty) const {
-  const TargetData *TD = TM.getTargetData();
-  return getSectionForMergableConstant(TD->getTypeAllocSize(Ty), 0);
-}
-
 const Section *
 DarwinTargetAsmInfo::getSectionForMergableConstant(uint64_t Size,
                                                    unsigned ReloInfo) const {

Modified: llvm/trunk/lib/Target/ELFTargetAsmInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ELFTargetAsmInfo.cpp?rev=76710&r1=76709&r2=76710&view=diff

==============================================================================
--- llvm/trunk/lib/Target/ELFTargetAsmInfo.cpp (original)
+++ llvm/trunk/lib/Target/ELFTargetAsmInfo.cpp Tue Jul 21 19:47:11 2009
@@ -121,8 +121,11 @@
         return getReadOnlySection();
       case SectionKind::RODataMergeStr:
         return MergeableStringSection(GVar);
-      case SectionKind::RODataMergeConst:
-        return MergeableConstSection(GVar->getInitializer()->getType());
+      case SectionKind::RODataMergeConst: {
+        const Type *Ty = GVar->getInitializer()->getType();
+        const TargetData *TD = TM.getTargetData();
+        return getSectionForMergableConstant(TD->getTypeAllocSize(Ty), 0);
+      }
       case SectionKind::ThreadData:
         // ELF targets usually support TLS stuff
         return TLSDataSection;
@@ -166,12 +169,6 @@
 
 
 const Section*
-ELFTargetAsmInfo::MergeableConstSection(const Type *Ty) const {
-  const TargetData *TD = TM.getTargetData();
-  return getSectionForMergableConstant(TD->getTypeAllocSize(Ty), 0);
-}
-
-const Section*
 ELFTargetAsmInfo::MergeableStringSection(const GlobalVariable *GV) const {
   const TargetData *TD = TM.getTargetData();
   Constant *C = cast<GlobalVariable>(GV)->getInitializer();





More information about the llvm-commits mailing list