[llvm-commits] [llvm] r77116 - in /llvm/trunk: include/llvm/Target/TargetAsmInfo.h lib/Target/ELFTargetAsmInfo.cpp test/CodeGen/X86/global-sections.ll

Chris Lattner sabre at nondot.org
Sat Jul 25 20:06:17 PDT 2009


Author: lattner
Date: Sat Jul 25 22:06:11 2009
New Revision: 77116

URL: http://llvm.org/viewvc/llvm-project?rev=77116&view=rev
Log:
put normal data into .data instead of .data.rel on elf systems.

Modified:
    llvm/trunk/include/llvm/Target/TargetAsmInfo.h
    llvm/trunk/lib/Target/ELFTargetAsmInfo.cpp
    llvm/trunk/test/CodeGen/X86/global-sections.ll

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

==============================================================================
--- llvm/trunk/include/llvm/Target/TargetAsmInfo.h (original)
+++ llvm/trunk/include/llvm/Target/TargetAsmInfo.h Sat Jul 25 22:06:11 2009
@@ -55,7 +55,7 @@
       /// Thread local data.
       ThreadData,       ///< Initialized TLS data objects
       ThreadBSS         ///< Uninitialized TLS data objects
-    } K; // This is private.
+    } K : 8; // This is private.
     
     // FIXME: Eliminate.
     Kind getKind() const { return K; }

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

==============================================================================
--- llvm/trunk/lib/Target/ELFTargetAsmInfo.cpp (original)
+++ llvm/trunk/lib/Target/ELFTargetAsmInfo.cpp Sat Jul 25 22:06:11 2009
@@ -49,34 +49,24 @@
 const Section*
 ELFTargetAsmInfo::SelectSectionForGlobal(const GlobalValue *GV,
                                          SectionKind Kind) const {
-  if (isa<Function>(GV))
-    return TextSection;
-  
-  const GlobalVariable *GVar = cast<GlobalVariable>(GV);
   switch (Kind.getKind()) {
-  default: llvm_unreachable("Unsuported section kind for global");
-  case SectionKind::BSS:
-    return getBSSSection_();
-  case SectionKind::Data:
-  case SectionKind::DataRel:
-    return DataRelSection;
-  case SectionKind::DataRelLocal:
-    return DataRelLocalSection;
-  case SectionKind::DataRelRO:
-    return DataRelROSection;
-  case SectionKind::DataRelROLocal:
-    return DataRelROLocalSection;
-  case SectionKind::ROData:
-    return getReadOnlySection();
+  default: llvm_unreachable("Unknown section kind");
+  case SectionKind::Text:           return TextSection;
+  case SectionKind::BSS:            return getBSSSection_();
+  case SectionKind::Data:           return DataSection;
+  case SectionKind::DataRel:        return DataRelSection;
+  case SectionKind::DataRelLocal:   return DataRelLocalSection;
+  case SectionKind::DataRelRO:      return DataRelROSection;
+  case SectionKind::DataRelROLocal: return DataRelROLocalSection;
+  case SectionKind::ROData:         return getReadOnlySection();
   case SectionKind::RODataMergeStr:
-    return MergeableStringSection(GVar);
+    return MergeableStringSection(cast<GlobalVariable>(GV));
   case SectionKind::RODataMergeConst: {
-    const Type *Ty = GVar->getInitializer()->getType();
+    const Type *Ty = cast<GlobalVariable>(GV)->getInitializer()->getType();
     const TargetData *TD = TM.getTargetData();
     return getSectionForMergableConstant(TD->getTypeAllocSize(Ty), 0);
   }
   case SectionKind::ThreadData:
-    // ELF targets usually support TLS stuff
     return TLSDataSection;
   case SectionKind::ThreadBSS:
     return TLSBSSSection;

Modified: llvm/trunk/test/CodeGen/X86/global-sections.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/global-sections.ll?rev=77116&r1=77115&r2=77116&view=diff

==============================================================================
--- llvm/trunk/test/CodeGen/X86/global-sections.ll (original)
+++ llvm/trunk/test/CodeGen/X86/global-sections.ll Sat Jul 25 22:06:11 2009
@@ -39,4 +39,19 @@
 
 ; DARWIN: .const
 ; DARWIN: _G4:
-;	.long	34
+; DARWIN:     .long 34
+
+
+; int G5 = 47;
+ at G5 = global i32 47
+
+; LINUX: .data
+; LINUX: .globl G5
+; LINUX: G5:
+; LINUX:    .long 47
+
+; DARWIN: .data
+; DARWIN: .globl _G5
+; DARWIN: _G5:
+; DARWIN:    .long 47
+





More information about the llvm-commits mailing list