summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Target/Sparc
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2009-07-26 07:33:58 +0000
committerChris Lattner <sabre@nondot.org>2009-07-26 07:33:58 +0000
commit1db210322aee38cd93a5489996e251072461f1ff (patch)
treef20488bc741c9d5b0fa0a560b7c15d114d5f9c68 /llvm/lib/Target/Sparc
parentd2e0220cb411126637d0f9ff3262a33201d37385 (diff)
downloadbcm5719-llvm-1db210322aee38cd93a5489996e251072461f1ff.tar.gz
bcm5719-llvm-1db210322aee38cd93a5489996e251072461f1ff.zip
remove a densemap from TargetAsmInfo that was uniquing the targetflags strings,
just use a smallstring instead. llvm-svn: 77144
Diffstat (limited to 'llvm/lib/Target/Sparc')
-rw-r--r--llvm/lib/Target/Sparc/SparcTargetAsmInfo.cpp31
-rw-r--r--llvm/lib/Target/Sparc/SparcTargetAsmInfo.h4
2 files changed, 20 insertions, 15 deletions
diff --git a/llvm/lib/Target/Sparc/SparcTargetAsmInfo.cpp b/llvm/lib/Target/Sparc/SparcTargetAsmInfo.cpp
index 0087c262fbd..7b9f449436e 100644
--- a/llvm/lib/Target/Sparc/SparcTargetAsmInfo.cpp
+++ b/llvm/lib/Target/Sparc/SparcTargetAsmInfo.cpp
@@ -12,7 +12,7 @@
//===----------------------------------------------------------------------===//
#include "SparcTargetAsmInfo.h"
-
+#include "llvm/ADT/SmallVector.h"
using namespace llvm;
SparcELFTargetAsmInfo::SparcELFTargetAsmInfo(const TargetMachine &TM):
@@ -32,19 +32,22 @@ SparcELFTargetAsmInfo::SparcELFTargetAsmInfo(const TargetMachine &TM):
/* Override */ true);
}
-std::string SparcELFTargetAsmInfo::printSectionFlags(unsigned flags) const {
- if (flags & SectionFlags::Mergeable)
- return ELFTargetAsmInfo::printSectionFlags(flags);
- std::string Flags;
- if (!(flags & SectionFlags::Debug))
- Flags += ",#alloc";
- if (flags & SectionFlags::Code)
- Flags += ",#execinstr";
- if (flags & SectionFlags::Writable)
- Flags += ",#write";
- if (flags & SectionFlags::TLS)
- Flags += ",#tls";
+void SparcELFTargetAsmInfo::getSectionFlags(unsigned Flags,
+ SmallVectorImpl<char> &Str) const {
+ if (Flags & SectionFlags::Mergeable)
+ return ELFTargetAsmInfo::getSectionFlags(Flags, Str);
+
+ // FIXME: Inefficient.
+ std::string Res;
+ if (!(Flags & SectionFlags::Debug))
+ Res += ",#alloc";
+ if (Flags & SectionFlags::Code)
+ Res += ",#execinstr";
+ if (Flags & SectionFlags::Writable)
+ Res += ",#write";
+ if (Flags & SectionFlags::TLS)
+ Res += ",#tls";
- return Flags;
+ Str.append(Res.begin(), Res.end());
}
diff --git a/llvm/lib/Target/Sparc/SparcTargetAsmInfo.h b/llvm/lib/Target/Sparc/SparcTargetAsmInfo.h
index 1af5d80b550..77cf4e9f4d6 100644
--- a/llvm/lib/Target/Sparc/SparcTargetAsmInfo.h
+++ b/llvm/lib/Target/Sparc/SparcTargetAsmInfo.h
@@ -25,7 +25,9 @@ namespace llvm {
struct SparcELFTargetAsmInfo : public ELFTargetAsmInfo {
explicit SparcELFTargetAsmInfo(const TargetMachine &TM);
- std::string printSectionFlags(unsigned flags) const;
+ virtual void getSectionFlags(unsigned Flags,
+ SmallVectorImpl<char> &Str) const;
+
};
} // namespace llvm
OpenPOWER on IntegriCloud