diff options
author | Chris Lattner <sabre@nondot.org> | 2009-08-13 00:26:52 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2009-08-13 00:26:52 +0000 |
commit | 7f5ea440715153c429583505fb7dd08a247444c3 (patch) | |
tree | e8422ed8c319b661a1abdd7edc8c800c4f73a068 /lib/Target/PIC16/PIC16TargetObjectFile.cpp | |
parent | f7c76a2ebf6cd56882838c25232474bc2120a3ac (diff) | |
download | external_llvm-7f5ea440715153c429583505fb7dd08a247444c3.zip external_llvm-7f5ea440715153c429583505fb7dd08a247444c3.tar.gz external_llvm-7f5ea440715153c429583505fb7dd08a247444c3.tar.bz2 |
make PIC16 unique its own sections instead of having mcontext do it.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@78871 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Target/PIC16/PIC16TargetObjectFile.cpp')
-rw-r--r-- | lib/Target/PIC16/PIC16TargetObjectFile.cpp | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/lib/Target/PIC16/PIC16TargetObjectFile.cpp b/lib/Target/PIC16/PIC16TargetObjectFile.cpp index ed1caf2..aa865bf 100644 --- a/lib/Target/PIC16/PIC16TargetObjectFile.cpp +++ b/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()); } |