Undo most of r54519.
authorEvan Cheng <evan.cheng@apple.com>
Fri, 8 Aug 2008 17:56:50 +0000 (17:56 +0000)
committerEvan Cheng <evan.cheng@apple.com>
Fri, 8 Aug 2008 17:56:50 +0000 (17:56 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@54534 91177308-0d34-0410-b5e6-96231b3b80d8

include/llvm/Target/DarwinTargetAsmInfo.h
include/llvm/Target/ELFTargetAsmInfo.h
include/llvm/Target/TargetAsmInfo.h
lib/Target/ARM/ARMAsmPrinter.cpp
lib/Target/DarwinTargetAsmInfo.cpp
lib/Target/ELFTargetAsmInfo.cpp
lib/Target/Mips/MipsTargetAsmInfo.cpp
lib/Target/Mips/MipsTargetAsmInfo.h
lib/Target/TargetAsmInfo.cpp

index 3403f066159233e5a766dbf1b6cdcea56a79866b..0ed9b387037c3407ad9d83af160964362843d285 100644 (file)
@@ -30,8 +30,7 @@ namespace llvm {
     const Section* DataCoalSection;
 
     explicit DarwinTargetAsmInfo(const TargetMachine &TM);
-    virtual const Section* SelectSectionForGlobal(const GlobalValue *GV,
-                                                 bool NoCoalesce = false) const;
+    virtual const Section* SelectSectionForGlobal(const GlobalValue *GV) const;
     virtual std::string UniqueSectionForGlobal(const GlobalValue* GV,
                                                SectionKind::Kind kind) const;
     const Section* MergeableConstSection(const GlobalVariable *GV) const;
index b8261ef1da5cdd9e402cac8d64359aa0aa1163c1..fe339f8e591c7b1f22758df90cf17d0a75da52a1 100644 (file)
@@ -26,8 +26,7 @@ namespace llvm {
   struct ELFTargetAsmInfo: public virtual TargetAsmInfo {
     explicit ELFTargetAsmInfo(const TargetMachine &TM);
 
-    virtual const Section* SelectSectionForGlobal(const GlobalValue *GV,
-                                                 bool NoCoalesce = false) const;
+    virtual const Section* SelectSectionForGlobal(const GlobalValue *GV) const;
     virtual std::string PrintSectionFlags(unsigned flags) const;
     const Section* MergeableConstSection(const GlobalVariable *GV) const;
     inline const Section* MergeableConstSection(const Type *Ty) const;
index 2fd1492c99237c7a5ee21a73ddf29396d0457381..04e91cb38120948bd805bddc0246e0c5b22d7402 100644 (file)
@@ -544,10 +544,8 @@ namespace llvm {
                           const char* name = NULL) const;
 
     /// SectionForGlobal - This hooks returns proper section name for given
-    /// global with all necessary flags and marks. If NoCoalesce is true,
-    /// do not use coalesced section.
-    virtual std::string SectionForGlobal(const GlobalValue *GV,
-                                         bool NoCoalesce = false) const;
+    /// global with all necessary flags and marks.
+    virtual std::string SectionForGlobal(const GlobalValue *GV) const;
 
     // Helper methods for SectionForGlobal
     virtual std::string UniqueSectionForGlobal(const GlobalValue* GV,
@@ -555,8 +553,7 @@ namespace llvm {
 
     virtual std::string PrintSectionFlags(unsigned flags) const { return ""; }
 
-    virtual const Section* SelectSectionForGlobal(const GlobalValue *GV,
-                                                 bool NoCoalesce = false) const;
+    virtual const Section* SelectSectionForGlobal(const GlobalValue *GV) const;
 
     virtual const Section* SelectSectionForMachineConst(const Type *Ty) const;
 
index 420ccd0bcc982070e44114b6d468091af4cddac0..8af79de902eb65ef11546fcc89534aec8e81478d 100644 (file)
@@ -863,8 +863,7 @@ void ARMAsmPrinter::printModuleLevelGV(const GlobalVariable* GVar) {
     return;
   }
 
-  bool NoCoalesc = PCRelGVs.count(GVar);
-  std::string SectionName = TAI->SectionForGlobal(GVar, NoCoalesc);
+  std::string SectionName = TAI->SectionForGlobal(GVar);
   std::string name = Mang->getValueName(GVar);
   Constant *C = GVar->getInitializer();
   const Type *Type = C->getType();
@@ -901,7 +900,7 @@ void ARMAsmPrinter::printModuleLevelGV(const GlobalVariable* GVar) {
       if (Size == 0) Size = 1;   // .comm Foo, 0 is undefined, avoid it.
 
       if (TAI->getLCOMMDirective() != NULL) {
-        if (NoCoalesc || GVar->hasInternalLinkage()) {
+        if (PCRelGVs.count(GVar) || GVar->hasInternalLinkage()) {
           O << TAI->getLCOMMDirective() << name << "," << Size;
           if (Subtarget->isTargetDarwin())
             O << "," << Align;
index 978f5cf36ac15c5672534d50bc7315168456ba0e..749cb7179437c8e9c0329f9c881a10fd8254834e 100644 (file)
@@ -51,15 +51,14 @@ DarwinTargetAsmInfo::DarwinTargetAsmInfo(const TargetMachine &TM) {
 }
 
 const Section*
-DarwinTargetAsmInfo::SelectSectionForGlobal(const GlobalValue *GV,
-                                            bool NoCoalesce) const {
+DarwinTargetAsmInfo::SelectSectionForGlobal(const GlobalValue *GV) const {
   SectionKind::Kind Kind = SectionKindForGlobal(GV);
-  bool CanCoalesce = !NoCoalesce && GV->isWeakForLinker();
+  bool isWeak = GV->isWeakForLinker();
   bool isNonStatic = (DTM->getRelocationModel() != Reloc::Static);
 
   switch (Kind) {
    case SectionKind::Text:
-    if (CanCoalesce)
+    if (isWeak)
       return TextCoalSection;
     else
       return getTextSection_();
@@ -68,18 +67,18 @@ DarwinTargetAsmInfo::SelectSectionForGlobal(const GlobalValue *GV,
    case SectionKind::BSS:
    case SectionKind::ThreadBSS:
     if (cast<GlobalVariable>(GV)->isConstant())
-      return (CanCoalesce ? ConstDataCoalSection : ConstDataSection);
+      return (isWeak ? ConstDataCoalSection : ConstDataSection);
     else
-      return (CanCoalesce ? DataCoalSection : getDataSection_());
+      return (isWeak ? DataCoalSection : getDataSection_());
    case SectionKind::ROData:
-    return (CanCoalesce ? ConstDataCoalSection :
+    return (isWeak ? ConstDataCoalSection :
             (isNonStatic ? ConstDataSection : getReadOnlySection_()));
    case SectionKind::RODataMergeStr:
-    return (CanCoalesce ?
+    return (isWeak ?
             ConstDataCoalSection :
             MergeableStringSection(cast<GlobalVariable>(GV)));
    case SectionKind::RODataMergeConst:
-    return (CanCoalesce ?
+    return (isWeak ?
             ConstDataCoalSection:
             MergeableConstSection(cast<GlobalVariable>(GV)));
    default:
index 523527c7b6d70438861513a326cef9b7fb7ad970..82ac847e845fcb9e9d4f54ee35b202b77eb37878 100644 (file)
@@ -40,8 +40,7 @@ ELFTargetAsmInfo::ELFTargetAsmInfo(const TargetMachine &TM) {
 }
 
 const Section*
-ELFTargetAsmInfo::SelectSectionForGlobal(const GlobalValue *GV,
-                                         bool NoCoalesce) const {
+ELFTargetAsmInfo::SelectSectionForGlobal(const GlobalValue *GV) const {
   SectionKind::Kind Kind = SectionKindForGlobal(GV);
 
   if (const Function *F = dyn_cast<Function>(GV)) {
index eff69abc6db28c066254edbf051109537ee20d30..04edd0d4b537c8031f08910dbae4ab9e922f2a71 100644 (file)
@@ -82,7 +82,7 @@ SectionKindForGlobal(const GlobalValue *GV) const {
 }
 
 const Section* MipsTargetAsmInfo::
-SelectSectionForGlobal(const GlobalValue *GV, bool NoCoalesce) const {
+SelectSectionForGlobal(const GlobalValue *GV) const {
   SectionKind::Kind K = SectionKindForGlobal(GV);
   const GlobalVariable *GVA = dyn_cast<GlobalVariable>(GV);
 
index 806cda8be368ea338e444338887b6a026aa04e83..2b5a739e7219ea9c271ed536a75a7b0058bfe577 100644 (file)
@@ -40,8 +40,7 @@ namespace llvm {
     SectionFlagsForGlobal(const GlobalValue *GV = NULL,
                           const char* name = NULL) const;
 
-    virtual const Section* SelectSectionForGlobal(const GlobalValue *GV,
-                                                  bool NoCoalesce) const;
+    virtual const Section* SelectSectionForGlobal(const GlobalValue *GV) const;
 
     private:
       const MipsSubtarget *Subtarget;
index cf43112634928ed78646e9075936da7d1c781351..9bc0b4055e3370bdddb54e18c58a8c19a3884139 100644 (file)
@@ -272,7 +272,7 @@ TargetAsmInfo::SectionFlagsForGlobal(const GlobalValue *GV,
 }
 
 std::string
-TargetAsmInfo::SectionForGlobal(const GlobalValue *GV, bool NoCoalesce) const {
+TargetAsmInfo::SectionForGlobal(const GlobalValue *GV) const {
   const Section* S;
   // Select section name
   if (GV->hasSection()) {
@@ -282,7 +282,7 @@ TargetAsmInfo::SectionForGlobal(const GlobalValue *GV, bool NoCoalesce) const {
     S = getNamedSection(GV->getSection().c_str(), Flags);
   } else {
     // Use default section depending on the 'type' of global
-    S = SelectSectionForGlobal(GV, NoCoalesce);
+    S = SelectSectionForGlobal(GV);
   }
 
   if (!S->isNamed())
@@ -295,8 +295,8 @@ TargetAsmInfo::SectionForGlobal(const GlobalValue *GV, bool NoCoalesce) const {
 }
 
 // Lame default implementation. Calculate the section name for global.
-const Section* TargetAsmInfo::SelectSectionForGlobal(const GlobalValue *GV,
-                                                     bool NoCoalesce) const {
+const Section*
+TargetAsmInfo::SelectSectionForGlobal(const GlobalValue *GV) const {
   SectionKind::Kind Kind = SectionKindForGlobal(GV);
 
   if (GV->isWeakForLinker()) {