summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Target/PIC16/PIC16TargetObjectFile.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2009-08-13 00:26:52 +0000
committerChris Lattner <sabre@nondot.org>2009-08-13 00:26:52 +0000
commit5ed8c4212ac37c98139ccc19d86333c6ae9a150f (patch)
treee0b7db232304aec030bdfb54984183458784c30a /llvm/lib/Target/PIC16/PIC16TargetObjectFile.cpp
parentb691316838646a0b6ea9743fe23683e650740290 (diff)
downloadbcm5719-llvm-5ed8c4212ac37c98139ccc19d86333c6ae9a150f.tar.gz
bcm5719-llvm-5ed8c4212ac37c98139ccc19d86333c6ae9a150f.zip
make PIC16 unique its own sections instead of having mcontext do it.
llvm-svn: 78871
Diffstat (limited to 'llvm/lib/Target/PIC16/PIC16TargetObjectFile.cpp')
-rw-r--r--llvm/lib/Target/PIC16/PIC16TargetObjectFile.cpp14
1 files changed, 6 insertions, 8 deletions
diff --git a/llvm/lib/Target/PIC16/PIC16TargetObjectFile.cpp b/llvm/lib/Target/PIC16/PIC16TargetObjectFile.cpp
index ed1caf225e2..aa865bfb509 100644
--- a/llvm/lib/Target/PIC16/PIC16TargetObjectFile.cpp
+++ b/llvm/lib/Target/PIC16/PIC16TargetObjectFile.cpp
@@ -18,14 +18,10 @@
#include "llvm/Support/raw_ostream.h"
using namespace llvm;
-MCSectionPIC16::MCSectionPIC16(const StringRef &name, SectionKind K,
- MCContext &Ctx) : MCSection(K), Name(name) {
- Ctx.SetSection(Name, this);
-}
MCSectionPIC16 *MCSectionPIC16::Create(const StringRef &Name,
SectionKind K, MCContext &Ctx) {
- return new (Ctx) MCSectionPIC16(Name, K, Ctx);
+ return new (Ctx) MCSectionPIC16(Name, K);
}
@@ -43,9 +39,11 @@ PIC16TargetObjectFile::PIC16TargetObjectFile()
const MCSectionPIC16 *PIC16TargetObjectFile::
getPIC16Section(const char *Name, SectionKind Kind) const {
- if (MCSection *S = getContext().GetSection(Name))
- return (MCSectionPIC16*)S;
- return MCSectionPIC16::Create(Name, Kind, getContext());
+ MCSectionPIC16 *&Entry = SectionsByName[Name];
+ if (Entry)
+ return Entry;
+
+ return Entry = MCSectionPIC16::Create(Name, Kind, getContext());
}
OpenPOWER on IntegriCloud