use section flags more correctly.
authorChris Lattner <sabre@nondot.org>
Fri, 24 Jul 2009 04:08:17 +0000 (04:08 +0000)
committerChris Lattner <sabre@nondot.org>
Fri, 24 Jul 2009 04:08:17 +0000 (04:08 +0000)
llvm-svn: 76944

llvm/include/llvm/Target/TargetAsmInfo.h
llvm/lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp
llvm/lib/Target/PowerPC/AsmPrinter/PPCAsmPrinter.cpp
llvm/lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.cpp

index 393be617f42fe6bfaf35bcc03b55fa9aa679cae3..cd0fcf8ad81102fff2d9f6b988a7bcc28a0d3cf9 100644 (file)
@@ -123,6 +123,8 @@ namespace llvm {
 
     const std::string& getName() const { return Name; }
     unsigned getFlags() const { return Flags; }
+    
+    bool hasFlag(unsigned F) const { return (Flags & F) != 0; }
   };
 
   /// TargetAsmInfo - This class is intended to be used as a base class for asm
index e863043de554b0e3e612d6e8db7dce0852d7e552..d69ca325defb0063d435186c3bdf2afb80b306d1 100644 (file)
@@ -1103,9 +1103,8 @@ void ARMAsmPrinter::PrintGlobalVariable(const GlobalVariable* GVar) {
   SwitchToSection(TheSection);
 
   if (C->isNullValue() && !GVar->hasSection() && !GVar->isThreadLocal() &&
-      !(isDarwin && TheSection->getFlags() == SectionKind::RODataMergeStr)) {
-    // FIXME: This seems to be pretty darwin-specific
-
+      // Don't put things that should go in the cstring section into "comm".
+      !TheSection->hasFlag(SectionFlags::Strings)) {
     if (GVar->hasExternalLinkage()) {
       if (const char *Directive = TAI->getZeroFillDirective()) {
         O << "\t.globl\t" << name << "\n";
index 9c0aa74a34e6ffe7d34934fe3f7dd11cb6ab0f5b..1ac3e32e568b36b0783baed1751503876f282057 100644 (file)
@@ -897,7 +897,8 @@ void PPCDarwinAsmPrinter::PrintGlobalVariable(const GlobalVariable *GVar) {
       !GVar->hasSection() &&
       (GVar->hasLocalLinkage() || GVar->hasExternalLinkage() ||
        GVar->isWeakForLinker()) &&
-      TheSection->getFlags() != SectionKind::RODataMergeStr) {
+      // Don't put things that should go in the cstring section into "comm".
+      !TheSection->hasFlag(SectionFlags::Strings)) {
     if (Size == 0) Size = 1;   // .comm Foo, 0 is undefined, avoid it.
 
     if (GVar->hasExternalLinkage()) {
index 334172a90d7bd94bf1936496d29d417b7014475b..6e44b9b87f3a2777f2be39a4ea9d3af934921f44 100644 (file)
@@ -798,9 +798,8 @@ void X86ATTAsmPrinter::PrintGlobalVariable(const GlobalVariable* GVar) {
   SwitchToSection(TheSection);
 
   if (C->isNullValue() && !GVar->hasSection() &&
-      !(Subtarget->isTargetDarwin() &&
-        TAI->SectionKindForGlobal(GVar) == SectionKind::RODataMergeStr)) {
-    // FIXME: This seems to be pretty darwin-specific
+      // Don't put things that should go in the cstring section into "comm".
+      !TheSection->hasFlag(SectionFlags::Strings)) {
     if (GVar->hasExternalLinkage()) {
       if (const char *Directive = TAI->getZeroFillDirective()) {
         O << "\t.globl " << name << '\n';