Get rid of duplicate char*/Section* DataSection
authorAnton Korobeynikov <asl@math.spbu.ru>
Wed, 24 Sep 2008 22:16:16 +0000 (22:16 +0000)
committerAnton Korobeynikov <asl@math.spbu.ru>
Wed, 24 Sep 2008 22:16:16 +0000 (22:16 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@56575 91177308-0d34-0410-b5e6-96231b3b80d8

include/llvm/Target/TargetAsmInfo.h
lib/CodeGen/AsmPrinter/DwarfWriter.cpp
lib/CodeGen/AsmPrinter/OcamlGCPrinter.cpp
lib/Target/ARM/ARMTargetAsmInfo.cpp
lib/Target/DarwinTargetAsmInfo.cpp
lib/Target/ELFTargetAsmInfo.cpp
lib/Target/TargetAsmInfo.cpp
lib/Target/X86/AsmPrinter/X86IntelAsmPrinter.cpp
lib/Target/X86/X86TargetAsmInfo.cpp

index 6e019fd73b7ef4c47a2ba66387abbe9cbde0c357..99ae1832f8c1249becf8fed9f8343fe5d4664c5e 100644 (file)
@@ -131,12 +131,11 @@ namespace llvm {
 
     /// TextSection - Section directive for standard text.
     ///
-    const Section *TextSection;              // Defaults to ".text".
+    const Section *TextSection;           // Defaults to ".text".
 
     /// DataSection - Section directive for standard data.
     ///
-    const char *DataSection;              // Defaults to ".data".
-    const Section *DataSection_;
+    const Section *DataSection;           // Defaults to ".data".
 
     /// BSSSection - Section directive for uninitialized data.  Null if this
     /// target doesn't support a BSS section.
@@ -601,12 +600,9 @@ namespace llvm {
     const Section *getTextSection() const {
       return TextSection;
     }
-    const char *getDataSection() const {
+    const Section *getDataSection() const {
       return DataSection;
     }
-    const Section *getDataSection_() const {
-      return DataSection_;
-    }
     const char *getBSSSection() const {
       return BSSSection;
     }
index 5d2581f5f3baeadbc8e90ee0c8acdf3f6635474d..d45ab13e86393098049948ca7c4c0fb52ac69a2e 100644 (file)
@@ -2064,7 +2064,7 @@ private:
 
     Asm->SwitchToSection(TAI->getTextSection());
     EmitLabel("text_begin", 0);
-    Asm->SwitchToDataSection(TAI->getDataSection());
+    Asm->SwitchToSection(TAI->getDataSection());
     EmitLabel("data_begin", 0);
   }
 
@@ -2750,7 +2750,7 @@ public:
     // Standard sections final addresses.
     Asm->SwitchToSection(TAI->getTextSection());
     EmitLabel("text_end", 0);
-    Asm->SwitchToDataSection(TAI->getDataSection());
+    Asm->SwitchToSection(TAI->getDataSection());
     EmitLabel("data_end", 0);
 
     // End text sections.
index 7f069f699a2f4ee5a7e03c918f399cc18e9dbeab..4e42df579d5853423e9804dcf67d8c160c8d9a31 100644 (file)
@@ -65,7 +65,7 @@ void OcamlGCMetadataPrinter::beginAssembly(raw_ostream &OS, AsmPrinter &AP,
   AP.SwitchToSection(TAI.getTextSection());
   EmitCamlGlobal(getModule(), OS, AP, TAI, "code_begin");
   
-  AP.SwitchToDataSection(TAI.getDataSection());
+  AP.SwitchToSection(TAI.getDataSection());
   EmitCamlGlobal(getModule(), OS, AP, TAI, "data_begin");
 }
 
@@ -100,13 +100,13 @@ void OcamlGCMetadataPrinter::finishAssembly(raw_ostream &OS, AsmPrinter &AP,
   AP.SwitchToSection(TAI.getTextSection());
   EmitCamlGlobal(getModule(), OS, AP, TAI, "code_end");
   
-  AP.SwitchToDataSection(TAI.getDataSection());
+  AP.SwitchToSection(TAI.getDataSection());
   EmitCamlGlobal(getModule(), OS, AP, TAI, "data_end");
   
   OS << AddressDirective << 0; // FIXME: Why does ocaml emit this??
   AP.EOL();
   
-  AP.SwitchToDataSection(TAI.getDataSection());
+  AP.SwitchToSection(TAI.getDataSection());
   EmitCamlGlobal(getModule(), OS, AP, TAI, "frametable");
   
   for (iterator I = begin(), IE = end(); I != IE; ++I) {
index a1a00a2cdaed1dd56ae57f6002f9ff0f852e8bdc..d41f350240063da20af319c1f9b598dc27aa9694 100644 (file)
@@ -48,7 +48,6 @@ ARMTargetAsmInfo::ARMTargetAsmInfo(const ARMTargetMachine &TM) {
   AlignmentIsInBytes = false;
   Data64bitsDirective = 0;
   CommentString = "@";
-  DataSection = "\t.data";
   ConstantPoolSection = "\t.text\n";
   COMMDirectiveTakesAlignment = false;
   InlineAsmStart = "@ InlineAsm Start";
index a5b72e3edd3abddd6620dd8da5bb842e46764f58..6a53b6b25a5f70cae1d53a56a3e35023403f1d78 100644 (file)
@@ -90,7 +90,7 @@ DarwinTargetAsmInfo::SelectSectionForGlobal(const GlobalValue *GV) const {
     if (cast<GlobalVariable>(GV)->isConstant())
       return (isWeak ? ConstDataCoalSection : ConstDataSection);
     else
-      return (isWeak ? DataCoalSection : getDataSection_());
+      return (isWeak ? DataCoalSection : getDataSection());
    case SectionKind::ROData:
     return (isWeak ? ConstDataCoalSection :
             (isNonStatic ? ConstDataSection : getReadOnlySection_()));
index 4529d0158d9cafbb18bc55242a99dfb6ae5b48a9..df4e43d0aae34d381e52d1d1c4821c3c89d5366a 100644 (file)
@@ -27,7 +27,6 @@ using namespace llvm;
 ELFTargetAsmInfo::ELFTargetAsmInfo(const TargetMachine &TM) {
   ETM = &TM;
 
-  DataSection_ = getUnnamedSection("\t.data", SectionFlags::Writeable);
   BSSSection_  = getUnnamedSection("\t.bss",
                                    SectionFlags::Writeable | SectionFlags::BSS);
   ReadOnlySection_ = getNamedSection("\t.rodata", SectionFlags::None);
@@ -64,7 +63,7 @@ ELFTargetAsmInfo::SelectSectionForGlobal(const GlobalValue *GV) const {
       switch (Kind) {
        case SectionKind::Data:
        case SectionKind::SmallData:
-        return getDataSection_();
+        return getDataSection();
        case SectionKind::BSS:
        case SectionKind::SmallBSS:
         // ELF targets usually have BSS sections
index df540393d5c56aeb3a0be1617b52a3737c373a3a..e963d7116ae8dfabc84b6eb212dee6178bcb8d9a 100644 (file)
@@ -27,8 +27,7 @@ using namespace llvm;
 
 TargetAsmInfo::TargetAsmInfo() :
   TextSection(0),
-  DataSection("\t.data"),
-  DataSection_(0),
+  DataSection(0),
   BSSSection("\t.bss"),
   BSSSection_(0),
   ReadOnlySection(0),
@@ -126,7 +125,7 @@ TargetAsmInfo::TargetAsmInfo() :
   DwarfExceptionSection(".gcc_except_table"),
   AsmTransCBE(0) {
   TextSection = getUnnamedSection("\t.text", SectionFlags::Code);
-  DataSection_ = getUnnamedSection(DataSection);
+  DataSection = getUnnamedSection("\t.data", SectionFlags::Writeable);
 }
 
 TargetAsmInfo::~TargetAsmInfo() {
@@ -306,14 +305,14 @@ TargetAsmInfo::SelectSectionForGlobal(const GlobalValue *GV) const {
       return getReadOnlySection_();
   }
 
-  return getDataSection_();
+  return getDataSection();
 }
 
 // Lame default implementation. Calculate the section name for machine const.
 const Section*
 TargetAsmInfo::SelectSectionForMachineConst(const Type *Ty) const {
   // FIXME: Support data.rel stuff someday
-  return getDataSection_();
+  return getDataSection();
 }
 
 std::string
index ec0bfeb7d63d9c3eb44817829df9c6f0ac7396bb..262e0f70ad546b49113ff422ddd782b13f676665 100644 (file)
@@ -481,7 +481,7 @@ bool X86IntelAsmPrinter::doFinalization(Module &M) {
       O << "\tpublic " << name << "\n";
       // FALL THROUGH
     case GlobalValue::InternalLinkage:
-      SwitchToDataSection(TAI->getDataSection(), I);
+      SwitchToSection(TAI->getDataSection());
       break;
     default:
       assert(0 && "Unknown linkage type!");
index 9f9e2ed7d6842006395224de8b87bc67383221a1..b31da8f900a4c862fa175bae01913eea38fea298 100644 (file)
@@ -434,7 +434,8 @@ X86WinTargetAsmInfo::X86WinTargetAsmInfo(const X86TargetMachine &TM):
   HasDotTypeDotSizeDirective = false;
 
   TextSection = getUnnamedSection("_text", SectionFlags::Code);
-  DataSection = "_data";
+  DataSection = getUnnamedSection("_data", SectionFlags::Writeable);
+
   JumpTableDataSection = NULL;
   SwitchToSectionDirective = "";
   TextSectionStartSuffix = "\tsegment 'CODE'";