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

Anton Korobeynikov asl at math.spbu.ru
Wed Jul 9 06:22:17 PDT 2008


Author: asl
Date: Wed Jul  9 08:22:17 2008
New Revision: 53303

URL: http://llvm.org/viewvc/llvm-project?rev=53303&view=rev
Log:
Print entity size for mergeable sections

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

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

==============================================================================
--- llvm/trunk/include/llvm/Target/TargetAsmInfo.h (original)
+++ llvm/trunk/include/llvm/Target/TargetAsmInfo.h Wed Jul  9 08:22:17 2008
@@ -45,15 +45,25 @@
   namespace SectionFlags {
     enum Flags {
       None       = 0,
-      Code       = 1 << 0, ///< Section contains code
-      Writeable  = 1 << 1, ///< Section is writeable
-      BSS        = 1 << 2, ///< Section contains only zeroes
-      Mergeable  = 1 << 3, ///< Section contains mergeable data
-      Strings    = 1 << 4, ///< Section contains null-terminated strings
-      TLS        = 1 << 5, ///< Section contains thread-local data
-      Debug      = 1 << 6, ///< Section contains debug data
-      Linkonce   = 1 << 7  ///< Section is linkonce
+      Code       = 1 << 0,    ///< Section contains code
+      Writeable  = 1 << 1,    ///< Section is writeable
+      BSS        = 1 << 2,    ///< Section contains only zeroes
+      Mergeable  = 1 << 3,    ///< Section contains mergeable data
+      Strings    = 1 << 4,    ///< Section contains null-terminated strings
+      TLS        = 1 << 5,    ///< Section contains thread-local data
+      Debug      = 1 << 6,    ///< Section contains debug data
+      Linkonce   = 1 << 7,    ///< Section is linkonce
+      // Some gap for future flags
+      EntitySize = 0xFF << 24 ///< Entity size for mergeable sections
     };
+
+    static inline unsigned getEntitySize(unsigned flags) {
+      return (flags >> 24) & 0xFF;
+    }
+
+    static inline unsigned setEntitySize(unsigned flags, unsigned size) {
+      return ((flags & ~EntitySize) | ((size & 0xFF) << 24));
+    }
   }
 
   class TargetMachine;

Modified: llvm/trunk/lib/Target/X86/X86TargetAsmInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86TargetAsmInfo.cpp?rev=53303&r1=53302&r2=53303&view=diff

==============================================================================
--- llvm/trunk/lib/Target/X86/X86TargetAsmInfo.cpp (original)
+++ llvm/trunk/lib/Target/X86/X86TargetAsmInfo.cpp Wed Jul  9 08:22:17 2008
@@ -337,7 +337,8 @@
   else
     Flags += ", at progbits";
 
-  // FIXME: entity size for mergeable sections
+  if (unsigned entitySize = SectionFlags::getEntitySize(flags))
+    Flags += "," + utostr(entitySize);
 
   return Flags;
 }





More information about the llvm-commits mailing list