[llvm-commits] [llvm] r77135 - in /llvm/trunk: include/llvm/Target/TargetAsmInfo.h lib/Target/TargetAsmInfo.cpp

Chris Lattner sabre at nondot.org
Sat Jul 25 23:35:24 PDT 2009


Author: lattner
Date: Sun Jul 26 01:34:33 2009
New Revision: 77135

URL: http://llvm.org/viewvc/llvm-project?rev=77135&view=rev
Log:
remove a bunch of helper functions, just use SectionKind::get instead.

Modified:
    llvm/trunk/include/llvm/Target/TargetAsmInfo.h
    llvm/trunk/lib/Target/TargetAsmInfo.cpp

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

==============================================================================
--- llvm/trunk/include/llvm/Target/TargetAsmInfo.h (original)
+++ llvm/trunk/include/llvm/Target/TargetAsmInfo.h Sun Jul 26 01:34:33 2009
@@ -181,23 +181,6 @@
       SectionKind Res = { K };
       return Res;
     }
-    static SectionKind getText()             { return get(Text); }
-    static SectionKind getReadOnly()         { return get(ReadOnly); }
-    static SectionKind getMergableCString()  { return get(MergableCString); }
-    static SectionKind getMergableConst()    { return get(MergableConst); }
-    static SectionKind getMergableConst4()   { return get(MergableConst4); }
-    static SectionKind getMergableConst8()   { return get(MergableConst8); }
-    static SectionKind getMergableConst16()  { return get(MergableConst16); }
-    static SectionKind getThreadBSS()        { return get(ThreadBSS); }
-    static SectionKind getThreadData()       { return get(ThreadData); }
-    static SectionKind getBSS()              { return get(BSS); }
-    static SectionKind getDataRel()          { return get(DataRel); }
-    static SectionKind getDataRelLocal()     { return get(DataRelLocal); }
-    static SectionKind getDataNoRel()        { return get(DataNoRel); }
-    static SectionKind getReadOnlyWithRel()  { return get(ReadOnlyWithRel); }
-    static SectionKind getReadOnlyWithRelLocal() {
-      return get(ReadOnlyWithRelLocal);
-    }
   };
 
   namespace SectionFlags {

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

==============================================================================
--- llvm/trunk/lib/Target/TargetAsmInfo.cpp (original)
+++ llvm/trunk/lib/Target/TargetAsmInfo.cpp Sun Jul 26 01:34:33 2009
@@ -224,18 +224,20 @@
   // Early exit - functions should be always in text sections.
   const GlobalVariable *GVar = dyn_cast<GlobalVariable>(GV);
   if (GVar == 0)
-    return SectionKind::getText();
+    return SectionKind::get(SectionKind::Text);
 
-  bool isThreadLocal = GVar->isThreadLocal();
+  
+  // Handle thread-local data first.
+  if (GVar->isThreadLocal()) {
+    if (isSuitableForBSS(GVar))
+      return SectionKind::get(SectionKind::ThreadBSS);
+    return SectionKind::get(SectionKind::ThreadData);;
+  }
 
   // Variable can be easily put to BSS section.
   if (isSuitableForBSS(GVar))
-    return isThreadLocal ? SectionKind::getThreadBSS() : SectionKind::getBSS();
+    return SectionKind::get(SectionKind::BSS);
 
-  // If this is thread-local, put it in the general "thread_data" section.
-  if (isThreadLocal)
-    return SectionKind::getThreadData();
-  
   Constant *C = GVar->getInitializer();
   
   // If the global is marked constant, we can put it into a mergable section,
@@ -250,16 +252,16 @@
       // If initializer is a null-terminated string, put it in a "cstring"
       // section if the target has it.
       if (isConstantString(C))
-        return SectionKind::getMergableCString();
+        return SectionKind::get(SectionKind::MergableCString);
       
       // Otherwise, just drop it into a mergable constant section.  If we have
       // a section for this size, use it, otherwise use the arbitrary sized
       // mergable section.
       switch (TM.getTargetData()->getTypeAllocSize(C->getType())) {
-      case 4:  return SectionKind::getMergableConst4();
-      case 8:  return SectionKind::getMergableConst8();
-      case 16: return SectionKind::getMergableConst16();
-      default: return SectionKind::getMergableConst();
+      case 4:  return SectionKind::get(SectionKind::MergableConst4);
+      case 8:  return SectionKind::get(SectionKind::MergableConst8);
+      case 16: return SectionKind::get(SectionKind::MergableConst16);
+      default: return SectionKind::get(SectionKind::MergableConst);
       }
       
     case Constant::LocalRelocation:
@@ -267,22 +269,22 @@
       // the relocation entries will actually be constants by the time the app
       // starts up.
       if (ReloModel == Reloc::Static)
-        return SectionKind::getReadOnly();
+        return SectionKind::get(SectionKind::ReadOnly);
               
       // Otherwise, the dynamic linker needs to fix it up, put it in the
       // writable data.rel.local section.
-      return SectionKind::getReadOnlyWithRelLocal();
+      return SectionKind::get(SectionKind::ReadOnlyWithRelLocal);
               
     case Constant::GlobalRelocations:
       // In static relocation model, the linker will resolve all addresses, so
       // the relocation entries will actually be constants by the time the app
       // starts up.
       if (ReloModel == Reloc::Static)
-        return SectionKind::getReadOnly();
+        return SectionKind::get(SectionKind::ReadOnly);
       
       // Otherwise, the dynamic linker needs to fix it up, put it in the
       // writable data.rel section.
-      return SectionKind::getReadOnlyWithRel();
+      return SectionKind::get(SectionKind::ReadOnlyWithRel);
     }
   }
 
@@ -292,13 +294,16 @@
   // globals together onto fewer pages, improving the locality of the dynamic
   // linker.
   if (ReloModel == Reloc::Static)
-    return SectionKind::getDataNoRel();
+    return SectionKind::get(SectionKind::DataNoRel);
 
   switch (C->getRelocationInfo()) {
   default: llvm_unreachable("unknown relocation info kind");
-  case Constant::NoRelocation:      return SectionKind::getDataNoRel();
-  case Constant::LocalRelocation:   return SectionKind::getDataRelLocal();
-  case Constant::GlobalRelocations: return SectionKind::getDataRel();
+  case Constant::NoRelocation:
+    return SectionKind::get(SectionKind::DataNoRel);
+  case Constant::LocalRelocation:
+    return SectionKind::get(SectionKind::DataRelLocal);
+  case Constant::GlobalRelocations:
+    return SectionKind::get(SectionKind::DataRel);
   }
 }
 





More information about the llvm-commits mailing list