[llvm-commits] [llvm] r56582 - in /llvm/trunk: include/llvm/Target/TargetAsmInfo.h lib/Target/ARM/ARMTargetAsmInfo.cpp lib/Target/DarwinTargetAsmInfo.cpp lib/Target/ELFTargetAsmInfo.cpp lib/Target/Mips/MipsTargetAsmInfo.cpp lib/Target/PowerPC/PPCTargetAsmInfo.cpp lib/Target/TargetAsmInfo.cpp lib/Target/X86/X86TargetAsmInfo.cpp

Anton Korobeynikov asl at math.spbu.ru
Wed Sep 24 15:20:28 PDT 2008


Author: asl
Date: Wed Sep 24 17:20:27 2008
New Revision: 56582

URL: http://llvm.org/viewvc/llvm-project?rev=56582&view=rev
Log:
Get rid of ReadOnlySection duplicate

Modified:
    llvm/trunk/include/llvm/Target/TargetAsmInfo.h
    llvm/trunk/lib/Target/ARM/ARMTargetAsmInfo.cpp
    llvm/trunk/lib/Target/DarwinTargetAsmInfo.cpp
    llvm/trunk/lib/Target/ELFTargetAsmInfo.cpp
    llvm/trunk/lib/Target/Mips/MipsTargetAsmInfo.cpp
    llvm/trunk/lib/Target/PowerPC/PPCTargetAsmInfo.cpp
    llvm/trunk/lib/Target/TargetAsmInfo.cpp
    llvm/trunk/lib/Target/X86/X86TargetAsmInfo.cpp

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

==============================================================================
--- llvm/trunk/include/llvm/Target/TargetAsmInfo.h (original)
+++ llvm/trunk/include/llvm/Target/TargetAsmInfo.h Wed Sep 24 17:20:27 2008
@@ -146,8 +146,7 @@
     /// ReadOnlySection - This is the directive that is emitted to switch to a
     /// read-only section for constant data (e.g. data declared const,
     /// jump tables).
-    const char *ReadOnlySection;          // Defaults to NULL
-    const Section *ReadOnlySection_;
+    const Section *ReadOnlySection;       // Defaults to NULL
 
     /// SmallDataSection - This is the directive that is emitted to switch to a
     /// small data section.
@@ -597,12 +596,9 @@
     const Section *getBSSSection_() const {
       return BSSSection_;
     }
-    const char *getReadOnlySection() const {
+    const Section *getReadOnlySection() const {
       return ReadOnlySection;
     }
-    const Section *getReadOnlySection_() const {
-      return ReadOnlySection_;
-    }
     const Section *getSmallDataSection() const {
       return SmallDataSection;
     }

Modified: llvm/trunk/lib/Target/ARM/ARMTargetAsmInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMTargetAsmInfo.cpp?rev=56582&r1=56581&r2=56582&view=diff

==============================================================================
--- llvm/trunk/lib/Target/ARM/ARMTargetAsmInfo.cpp (original)
+++ llvm/trunk/lib/Target/ARM/ARMTargetAsmInfo.cpp Wed Sep 24 17:20:27 2008
@@ -72,7 +72,6 @@
   ProtectedDirective = NULL;
   JumpTableDataSection = ".const";
   CStringSection = "\t.cstring";
-  ReadOnlySection = "\t.const\n";
   HasDotTypeDotSizeDirective = false;
   NeedsIndirectEncoding = true;
   if (TM.getRelocationModel() == Reloc::Static) {
@@ -112,7 +111,6 @@
   HasLEB128 = true;
   AbsoluteDebugSectionOffsets = true;
   CStringSection = ".rodata.str";
-  ReadOnlySection = "\t.section\t.rodata\n";
   PrivateGlobalPrefix = ".L";
   WeakRefDirective = "\t.weak\t";
   SetDirective = "\t.set\t";

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

==============================================================================
--- llvm/trunk/lib/Target/DarwinTargetAsmInfo.cpp (original)
+++ llvm/trunk/lib/Target/DarwinTargetAsmInfo.cpp Wed Sep 24 17:20:27 2008
@@ -38,12 +38,12 @@
   // there, if needed.
   SixteenByteConstantSection = 0;
 
-  ReadOnlySection_ = getUnnamedSection("\t.const\n", SectionFlags::None);
+  ReadOnlySection = getUnnamedSection("\t.const\n", SectionFlags::None);
 
   TextCoalSection =
     getNamedSection("\t__TEXT,__textcoal_nt,coalesced,pure_instructions",
                     SectionFlags::Code);
-  ConstDataCoalSection = getBamedSection("\t__DATA,__const_coal,coalesced",
+  ConstDataCoalSection = getNamedSection("\t__DATA,__const_coal,coalesced",
                                          SectionFlags::None);
   ConstDataSection = getUnnamedSection(".const_data", SectionFlags::None);
   DataCoalSection = getNamedSection("\t__DATA,__datacoal_nt,coalesced",
@@ -92,7 +92,7 @@
       return (isWeak ? DataCoalSection : DataSection);
    case SectionKind::ROData:
     return (isWeak ? ConstDataCoalSection :
-            (isNonStatic ? ConstDataSection : getReadOnlySection_()));
+            (isNonStatic ? ConstDataSection : getReadOnlySection()));
    case SectionKind::RODataMergeStr:
     return (isWeak ?
             ConstDataCoalSection :
@@ -122,7 +122,7 @@
       return getCStringSection_();
   }
 
-  return getReadOnlySection_();
+  return getReadOnlySection();
 }
 
 const Section*
@@ -144,7 +144,7 @@
   else if (Size == 16 && SixteenByteConstantSection)
     return SixteenByteConstantSection;
 
-  return getReadOnlySection_();
+  return getReadOnlySection();
 }
 
 const Section*
@@ -152,7 +152,7 @@
   const Section* S = MergeableConstSection(Ty);
 
   // Handle weird special case, when compiling PIC stuff.
-  if (S == getReadOnlySection_() &&
+  if (S == getReadOnlySection() &&
       DTM->getRelocationModel() != Reloc::Static)
     return ConstDataSection;
 

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

==============================================================================
--- llvm/trunk/lib/Target/ELFTargetAsmInfo.cpp (original)
+++ llvm/trunk/lib/Target/ELFTargetAsmInfo.cpp Wed Sep 24 17:20:27 2008
@@ -29,7 +29,7 @@
 
   BSSSection_  = getUnnamedSection("\t.bss",
                                    SectionFlags::Writeable | SectionFlags::BSS);
-  ReadOnlySection_ = getNamedSection("\t.rodata", SectionFlags::None);
+  ReadOnlySection = getNamedSection("\t.rodata", SectionFlags::None);
   TLSDataSection = getNamedSection("\t.tdata",
                                    SectionFlags::Writeable | SectionFlags::TLS);
   TLSBSSSection = getNamedSection("\t.tbss",
@@ -70,7 +70,7 @@
         return getBSSSection_();
        case SectionKind::ROData:
        case SectionKind::SmallROData:
-        return getReadOnlySection_();
+        return getReadOnlySection();
        case SectionKind::RODataMergeStr:
         return MergeableStringSection(GVar);
        case SectionKind::RODataMergeConst:
@@ -116,7 +116,7 @@
                                                        Size));
   }
 
-  return getReadOnlySection_();
+  return getReadOnlySection();
 }
 
 const Section*
@@ -143,7 +143,7 @@
     return getNamedSection(Name.c_str(), Flags);
   }
 
-  return getReadOnlySection_();
+  return getReadOnlySection();
 }
 
 std::string ELFTargetAsmInfo::printSectionFlags(unsigned flags) const {

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

==============================================================================
--- llvm/trunk/lib/Target/Mips/MipsTargetAsmInfo.cpp (original)
+++ llvm/trunk/lib/Target/Mips/MipsTargetAsmInfo.cpp Wed Sep 24 17:20:27 2008
@@ -30,7 +30,6 @@
   PrivateGlobalPrefix         = "$";
   JumpTableDataSection        = "\t.rdata";
   CommentString               = "#";
-  ReadOnlySection             = "\t.rdata";
   ZeroDirective               = "\t.space\t";
   BSSSection                  = "\t.section\t.bss";
   CStringSection              = ".rodata.str";
@@ -38,9 +37,10 @@
   if (!Subtarget->hasABICall()) {
     JumpTableDirective = "\t.word\t";
     SmallDataSection = getNamedSection("\t.sdata", SectionFlags::Writeable);
-    SmallBSSSection = getNamedSection("\t.sbss", SectionFlags::Writeable | 
+    SmallBSSSection = getNamedSection("\t.sbss",
+                                      SectionFlags::Writeable |
                                       SectionFlags::BSS);
-  } else 
+  } else
     JumpTableDirective = "\t.gpword\t";
 
 }

Modified: llvm/trunk/lib/Target/PowerPC/PPCTargetAsmInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/PowerPC/PPCTargetAsmInfo.cpp?rev=56582&r1=56581&r2=56582&view=diff

==============================================================================
--- llvm/trunk/lib/Target/PowerPC/PPCTargetAsmInfo.cpp (original)
+++ llvm/trunk/lib/Target/PowerPC/PPCTargetAsmInfo.cpp Wed Sep 24 17:20:27 2008
@@ -43,7 +43,6 @@
   ConstantPoolSection = "\t.const\t";
   JumpTableDataSection = ".const";
   CStringSection = "\t.cstring";
-  ReadOnlySection = "\t.const\n";
   if (TM.getRelocationModel() == Reloc::Static) {
     StaticCtorsSection = ".constructor";
     StaticDtorsSection = ".destructor";
@@ -137,7 +136,6 @@
   DwarfRangesSection =  "\t.section\t.debug_ranges,\"\", at progbits";
   DwarfMacInfoSection = "\t.section\t.debug_macinfo,\"\", at progbits";
 
-  ReadOnlySection = "\t.section\t.rodata";
   PCSymbol = ".";
 
   // Set up DWARF directives

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

==============================================================================
--- llvm/trunk/lib/Target/TargetAsmInfo.cpp (original)
+++ llvm/trunk/lib/Target/TargetAsmInfo.cpp Wed Sep 24 17:20:27 2008
@@ -31,7 +31,6 @@
   BSSSection("\t.bss"),
   BSSSection_(0),
   ReadOnlySection(0),
-  ReadOnlySection_(0),
   SmallDataSection(0),
   SmallBSSSection(0),
   SmallRODataSection(0),
@@ -293,8 +292,8 @@
       return getTextSection();
     else if (isBSS(Kind) && getBSSSection_())
       return getBSSSection_();
-    else if (getReadOnlySection_() && SectionKind::isReadOnly(Kind))
-      return getReadOnlySection_();
+    else if (getReadOnlySection() && SectionKind::isReadOnly(Kind))
+      return getReadOnlySection();
   }
 
   return getDataSection();

Modified: llvm/trunk/lib/Target/X86/X86TargetAsmInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86TargetAsmInfo.cpp?rev=56582&r1=56581&r2=56582&view=diff

==============================================================================
--- llvm/trunk/lib/Target/X86/X86TargetAsmInfo.cpp (original)
+++ llvm/trunk/lib/Target/X86/X86TargetAsmInfo.cpp Wed Sep 24 17:20:27 2008
@@ -150,8 +150,6 @@
     SixteenByteConstantSection = getUnnamedSection("\t.literal16\n",
                                                    SectionFlags::Mergeable);
   }
-  ReadOnlySection = "\t.const\n";
-
   LCOMMDirective = "\t.lcomm\t";
   SwitchToSectionDirective = "\t.section ";
   StringConstantPrefix = "\1LC";
@@ -229,7 +227,6 @@
 X86ELFTargetAsmInfo::X86ELFTargetAsmInfo(const X86TargetMachine &TM):
   X86TargetAsmInfo(TM), ELFTargetAsmInfo(TM) {
 
-  ReadOnlySection = ".rodata";
   CStringSection = ".rodata.str";
   PrivateGlobalPrefix = ".L";
   WeakRefDirective = "\t.weak\t";





More information about the llvm-commits mailing list