[llvm-commits] [llvm] r76935 - in /llvm/trunk: include/llvm/Target/TargetAsmInfo.h lib/Target/ELFTargetAsmInfo.cpp lib/Target/Mips/MipsTargetAsmInfo.cpp lib/Target/Mips/MipsTargetAsmInfo.h lib/Target/TargetAsmInfo.cpp test/CodeGen/Mips/2008-07-15-SmallSection.ll

Chris Lattner sabre at nondot.org
Thu Jul 23 20:11:52 PDT 2009


Author: lattner
Date: Thu Jul 23 22:11:51 2009
New Revision: 76935

URL: http://llvm.org/viewvc/llvm-project?rev=76935&view=rev
Log:
Remove SectionKind::Small*.  This was only used on mips, and is apparently
a sad mistake that is regretted. :)

Removed:
    llvm/trunk/test/CodeGen/Mips/2008-07-15-SmallSection.ll
Modified:
    llvm/trunk/include/llvm/Target/TargetAsmInfo.h
    llvm/trunk/lib/Target/ELFTargetAsmInfo.cpp
    llvm/trunk/lib/Target/Mips/MipsTargetAsmInfo.cpp
    llvm/trunk/lib/Target/Mips/MipsTargetAsmInfo.h
    llvm/trunk/lib/Target/TargetAsmInfo.cpp

Modified: llvm/trunk/include/llvm/Target/TargetAsmInfo.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Target/TargetAsmInfo.h?rev=76935&r1=76934&r2=76935&view=diff

==============================================================================
--- llvm/trunk/include/llvm/Target/TargetAsmInfo.h (original)
+++ llvm/trunk/include/llvm/Target/TargetAsmInfo.h Thu Jul 23 22:11:51 2009
@@ -50,12 +50,6 @@
       RODataMergeStr,   ///< Readonly data section: nul-terminated strings.
       RODataMergeConst, ///< Readonly data section: fixed-length constants.
       
-      /// Small sections - These sections contains "short" data, and should be
-      /// placed "near" the GP.
-      SmallData,        ///< Small data section
-      SmallBSS,         ///< Small bss section
-      SmallROData,      ///< Small readonly section
-      
       /// Thread local data.
       ThreadData,       ///< Initialized TLS data objects
       ThreadBSS         ///< Uninitialized TLS data objects
@@ -64,13 +58,11 @@
     static inline bool isReadOnly(Kind K) {
       return (K == SectionKind::ROData ||
               K == SectionKind::RODataMergeConst ||
-              K == SectionKind::RODataMergeStr ||
-              K == SectionKind::SmallROData);
+              K == SectionKind::RODataMergeStr);
     }
 
     static inline bool isBSS(Kind K) {
-      return (K == SectionKind::BSS ||
-              K == SectionKind::SmallBSS);
+      return K == SectionKind::BSS;
     }
   }
 

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

==============================================================================
--- llvm/trunk/lib/Target/ELFTargetAsmInfo.cpp (original)
+++ llvm/trunk/lib/Target/ELFTargetAsmInfo.cpp Thu Jul 23 22:11:51 2009
@@ -102,8 +102,6 @@
     } else {
       switch (Kind) {
       case SectionKind::Data:
-      case SectionKind::SmallData:
-        return DataSection;
       case SectionKind::DataRel:
         return DataRelSection;
       case SectionKind::DataRelLocal:
@@ -113,11 +111,8 @@
       case SectionKind::DataRelROLocal:
         return DataRelROLocalSection;
       case SectionKind::BSS:
-      case SectionKind::SmallBSS:
-        // ELF targets usually have BSS sections
         return getBSSSection_();
       case SectionKind::ROData:
-      case SectionKind::SmallROData:
         return getReadOnlySection();
       case SectionKind::RODataMergeStr:
         return MergeableStringSection(GVar);

Modified: llvm/trunk/lib/Target/Mips/MipsTargetAsmInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Mips/MipsTargetAsmInfo.cpp?rev=76935&r1=76934&r2=76935&view=diff

==============================================================================
--- llvm/trunk/lib/Target/Mips/MipsTargetAsmInfo.cpp (original)
+++ llvm/trunk/lib/Target/Mips/MipsTargetAsmInfo.cpp Thu Jul 23 22:11:51 2009
@@ -20,8 +20,6 @@
 MipsTargetAsmInfo::MipsTargetAsmInfo(const MipsTargetMachine &TM):
   ELFTargetAsmInfo(TM) {
 
-  Subtarget = &TM.getSubtarget<MipsSubtarget>();
-
   AlignmentIsInBytes          = false;
   COMMDirectiveTakesAlignment = true;
   Data16bitsDirective         = "\t.half\t";
@@ -34,57 +32,13 @@
   BSSSection                  = "\t.section\t.bss";
   CStringSection              = ".rodata.str";
 
-  if (!Subtarget->hasABICall()) {
+  if (!TM.getSubtarget<MipsSubtarget>().hasABICall()) {
     JumpTableDirective = "\t.word\t";
     SmallDataSection = getNamedSection("\t.sdata", SectionFlags::Writeable);
     SmallBSSSection = getNamedSection("\t.sbss",
                                       SectionFlags::Writeable |
                                       SectionFlags::BSS);
-  } else
+  } else {
     JumpTableDirective = "\t.gpword\t";
-
-}
-
-SectionKind::Kind MipsTargetAsmInfo::
-SectionKindForGlobal(const GlobalValue *GV) const {
-  SectionKind::Kind K = ELFTargetAsmInfo::SectionKindForGlobal(GV);
-
-  if (Subtarget->hasABICall())
-    return K;
-
-  if (K != SectionKind::Data && K != SectionKind::BSS &&
-      K != SectionKind::RODataMergeConst)
-    return K;
-
-  if (isa<GlobalVariable>(GV)) {
-    const TargetData *TD = TM.getTargetData();
-    unsigned Size = TD->getTypeAllocSize(GV->getType()->getElementType());
-    unsigned Threshold = Subtarget->getSSectionThreshold();
-
-    if (Size > 0 && Size <= Threshold) {
-      if (K == SectionKind::BSS)
-        return SectionKind::SmallBSS;
-      else
-        return SectionKind::SmallData;
-    }
   }
-
-  return K;
-}
-
-const Section* MipsTargetAsmInfo::
-SelectSectionForGlobal(const GlobalValue *GV) const {
-  SectionKind::Kind K = SectionKindForGlobal(GV);
-  const GlobalVariable *GVA = dyn_cast<GlobalVariable>(GV);
-
-  if (GVA && (!GVA->isWeakForLinker()))
-    switch (K) {
-      case SectionKind::SmallData:
-        return getSmallDataSection();
-      case SectionKind::SmallBSS:
-        return getSmallBSSSection();
-      default: break;
-    }
-
-  return ELFTargetAsmInfo::SelectSectionForGlobal(GV);
 }

Modified: llvm/trunk/lib/Target/Mips/MipsTargetAsmInfo.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Mips/MipsTargetAsmInfo.h?rev=76935&r1=76934&r2=76935&view=diff

==============================================================================
--- llvm/trunk/lib/Target/Mips/MipsTargetAsmInfo.h (original)
+++ llvm/trunk/lib/Target/Mips/MipsTargetAsmInfo.h Thu Jul 23 22:11:51 2009
@@ -29,13 +29,6 @@
   struct MipsTargetAsmInfo : public ELFTargetAsmInfo {
     explicit MipsTargetAsmInfo(const MipsTargetMachine &TM);
 
-    /// SectionKindForGlobal - This hook allows the target to select proper
-    /// section kind used for global emission.
-    virtual SectionKind::Kind
-    SectionKindForGlobal(const GlobalValue *GV) const;
-
-    virtual const Section* SelectSectionForGlobal(const GlobalValue *GV) const;
-
     private:
       const MipsSubtarget *Subtarget;
   };

Modified: llvm/trunk/lib/Target/TargetAsmInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/TargetAsmInfo.cpp?rev=76935&r1=76934&r2=76935&view=diff

==============================================================================
--- llvm/trunk/lib/Target/TargetAsmInfo.cpp (original)
+++ llvm/trunk/lib/Target/TargetAsmInfo.cpp Thu Jul 23 22:11:51 2009
@@ -257,12 +257,6 @@
     case SectionKind::RODataMergeConst:
       // No additional flags here
       break;
-    case SectionKind::SmallData:
-    case SectionKind::SmallBSS:
-      Flags |= SectionFlags::Writeable;
-      break;
-    case SectionKind::SmallROData:
-      break;
     default:
       llvm_unreachable("Unexpected section kind!");
     }
@@ -359,18 +353,12 @@
     return ".gnu.linkonce.d.rel.ro" + GV->getNameStr();
   case SectionKind::DataRelROLocal:
     return ".gnu.linkonce.d.rel.ro.local" + GV->getNameStr();
-  case SectionKind::SmallData:
-    return ".gnu.linkonce.s." + GV->getNameStr();
   case SectionKind::BSS:
     return ".gnu.linkonce.b." + GV->getNameStr();
-  case SectionKind::SmallBSS:
-    return ".gnu.linkonce.sb." + GV->getNameStr();
   case SectionKind::ROData:
   case SectionKind::RODataMergeConst:
   case SectionKind::RODataMergeStr:
     return ".gnu.linkonce.r." + GV->getNameStr();
-  case SectionKind::SmallROData:
-    return ".gnu.linkonce.s2." + GV->getNameStr();
   case SectionKind::ThreadData:
     return ".gnu.linkonce.td." + GV->getNameStr();
   case SectionKind::ThreadBSS:

Removed: llvm/trunk/test/CodeGen/Mips/2008-07-15-SmallSection.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/Mips/2008-07-15-SmallSection.ll?rev=76934&view=auto

==============================================================================
--- llvm/trunk/test/CodeGen/Mips/2008-07-15-SmallSection.ll (original)
+++ llvm/trunk/test/CodeGen/Mips/2008-07-15-SmallSection.ll (removed)
@@ -1,32 +0,0 @@
-; RUN: llvm-as < %s | llc -mips-ssection-threshold=8 -march=mips -f -o %t0
-; RUN: llvm-as < %s | llc -mips-ssection-threshold=0 -march=mips -f -o %t1
-; RUN: grep {sdata} %t0 | count 1
-; RUN: grep {sbss} %t0 | count 1
-; RUN: grep {gp_rel} %t0 | count 2
-; RUN: not grep {sdata} %t1 
-; RUN: not grep {sbss} %t1 
-; RUN: not grep {gp_rel} %t1
-; RUN: grep {\%hi} %t1 | count 2
-; RUN: grep {\%lo} %t1 | count 2
-
-target datalayout = "e-p:32:32:32-i1:8:8-i8:8:32-i16:16:32-i32:32:32-i64:32:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64"
-target triple = "mipsallegrexel-psp-elf"
-
-  %struct.anon = type { i32, i32 }
- at s0 = global [8 x i8] c"AAAAAAA\00", align 4
- at foo = global %struct.anon { i32 2, i32 3 }
- at bar = global %struct.anon zeroinitializer 
-
-define i8* @A0() nounwind {
-entry:
-	ret i8* getelementptr ([8 x i8]* @s0, i32 0, i32 0)
-}
-
-define i32 @A1() nounwind {
-entry:
-  load i32* getelementptr (%struct.anon* @foo, i32 0, i32 0), align 8 
-  load i32* getelementptr (%struct.anon* @foo, i32 0, i32 1), align 4 
-  add i32 %1, %0
-  ret i32 %2
-}
-





More information about the llvm-commits mailing list