[llvm-commits] [llvm] r53315 - in /llvm/trunk: include/llvm/Target/TargetAsmInfo.h lib/Target/X86/X86TargetAsmInfo.cpp
Anton Korobeynikov
asl at math.spbu.ru
Wed Jul 9 06:26:52 PDT 2008
Author: asl
Date: Wed Jul 9 08:26:52 2008
New Revision: 53315
URL: http://llvm.org/viewvc/llvm-project?rev=53315&view=rev
Log:
Another bunch of hacks for named sections support
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=53315&r1=53314&r2=53315&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Target/TargetAsmInfo.h (original)
+++ llvm/trunk/include/llvm/Target/TargetAsmInfo.h Wed Jul 9 08:26:52 2008
@@ -53,8 +53,9 @@
TLS = 1 << 5, ///< Section contains thread-local data
Debug = 1 << 6, ///< Section contains debug data
Linkonce = 1 << 7, ///< Section is linkonce
- Named = 1 << 8, ///< Section is named
+ TypeFlags = 0xFF,
// Some gap for future flags
+ Named = 1 << 23, ///< Section is named
EntitySize = 0xFF << 24 ///< Entity size for mergeable sections
};
Modified: llvm/trunk/lib/Target/X86/X86TargetAsmInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86TargetAsmInfo.cpp?rev=53315&r1=53314&r2=53315&view=diff
==============================================================================
--- llvm/trunk/lib/Target/X86/X86TargetAsmInfo.cpp (original)
+++ llvm/trunk/lib/Target/X86/X86TargetAsmInfo.cpp Wed Jul 9 08:26:52 2008
@@ -323,8 +323,10 @@
Type = C->getType();
unsigned Size = TD->getABITypeSize(Type);
- if (Size > 16) {
- // Too big for mergeable
+ if (Size > 16 ||
+ !(Flags & SectionFlags::Strings ||
+ (Size == 4 || Size == 8 || Size == 16))) {
+ // Not suitable for mergeable
Size = 0;
Flags &= ~SectionFlags::Mergeable;
}
@@ -516,8 +518,12 @@
Type = C->getType();
unsigned Size = TD->getABITypeSize(Type);
- if (Size > 16) {
- // Too big for mergeable
+ // FIXME: size check here ugly, and will hopefully have gone, when we will
+ // have sane interface for attaching flags to sections.
+ if (Size > 16 ||
+ !(Flags & SectionFlags::Strings ||
+ (Size == 4 || Size == 8 || Size == 16))) {
+ // Not suitable for mergeable
Size = 0;
Flags &= ~SectionFlags::Mergeable;
}
@@ -529,9 +535,11 @@
// Mark section as named, when needed (so, we we will need .section directive
// to switch into it).
- if (Flags & (SectionFlags::Mergeable |
- SectionFlags::TLS |
- SectionFlags::Linkonce))
+ unsigned TypeFlags = Flags & SectionFlags::TypeFlags;
+ if (!TypeFlags /* Read-only section */ ||
+ (TypeFlags & (SectionFlags::Mergeable |
+ SectionFlags::TLS |
+ SectionFlags::Linkonce)))
Flags |= SectionFlags::Named;
return Flags;
@@ -668,9 +676,11 @@
// Mark section as named, when needed (so, we we will need .section directive
// to switch into it).
- if (Flags & (SectionFlags::Mergeable ||
- SectionFlags::TLS ||
- SectionFlags::Linkonce))
+ unsigned TypeFlags = Flags & SectionFlags::TypeFlags;
+ if (!TypeFlags /* Read-only section */ ||
+ (TypeFlags & (SectionFlags::Mergeable |
+ SectionFlags::TLS |
+ SectionFlags::Linkonce)))
Flags |= SectionFlags::Named;
return Flags;
More information about the llvm-commits
mailing list