summaryrefslogtreecommitdiffstats
path: root/llvm/lib
diff options
context:
space:
mode:
authorAnton Korobeynikov <asl@math.spbu.ru>2008-07-09 13:26:52 +0000
committerAnton Korobeynikov <asl@math.spbu.ru>2008-07-09 13:26:52 +0000
commit3d3d12f431ef925348fdbfb032aa04cca5894df2 (patch)
tree32656b8d0a9fdb7f4abb95bc370aef273afcb047 /llvm/lib
parent4f125b7217e28dacdae950abb38feabc1bfaeb6e (diff)
downloadbcm5719-llvm-3d3d12f431ef925348fdbfb032aa04cca5894df2.tar.gz
bcm5719-llvm-3d3d12f431ef925348fdbfb032aa04cca5894df2.zip
Another bunch of hacks for named sections support
llvm-svn: 53315
Diffstat (limited to 'llvm/lib')
-rw-r--r--llvm/lib/Target/X86/X86TargetAsmInfo.cpp30
1 files changed, 20 insertions, 10 deletions
diff --git a/llvm/lib/Target/X86/X86TargetAsmInfo.cpp b/llvm/lib/Target/X86/X86TargetAsmInfo.cpp
index a53f4a11832..0fdc0eefbae 100644
--- a/llvm/lib/Target/X86/X86TargetAsmInfo.cpp
+++ b/llvm/lib/Target/X86/X86TargetAsmInfo.cpp
@@ -323,8 +323,10 @@ X86DarwinTargetAsmInfo::SectionFlagsForGlobal(const GlobalValue *GV,
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 @@ X86ELFTargetAsmInfo::SectionFlagsForGlobal(const GlobalValue *GV,
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 @@ X86ELFTargetAsmInfo::SectionFlagsForGlobal(const GlobalValue *GV,
// 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 @@ X86COFFTargetAsmInfo::SectionFlagsForGlobal(const GlobalValue *GV,
// 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;
OpenPOWER on IntegriCloud