llvm.org GIT mirror llvm / 873bc4c
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 Chris Lattner 10 years ago
3 changed file(s) with 14 addition(s) and 10 deletion(s). Raw diff Collapse all Expand all
2020 class MCSectionPIC16 : public MCSection {
2121 std::string Name;
2222
23 MCSectionPIC16(const StringRef &name, SectionKind K,
24 MCContext &Ctx);
23 MCSectionPIC16(const StringRef &name, SectionKind K)
24 : MCSection(K), Name(name) {
25 }
26
2527 public:
2628
2729 const std::string &getName() const { return Name; }
1717 #include "llvm/Support/raw_ostream.h"
1818 using namespace llvm;
1919
20 MCSectionPIC16::MCSectionPIC16(const StringRef &name, SectionKind K,
21 MCContext &Ctx) : MCSection(K), Name(name) {
22 Ctx.SetSection(Name, this);
23 }
2420
2521 MCSectionPIC16 *MCSectionPIC16::Create(const StringRef &Name,
2622 SectionKind K, MCContext &Ctx) {
27 return new (Ctx) MCSectionPIC16(Name, K, Ctx);
23 return new (Ctx) MCSectionPIC16(Name, K);
2824 }
2925
3026
4238
4339 const MCSectionPIC16 *PIC16TargetObjectFile::
4440 getPIC16Section(const char *Name, SectionKind Kind) const {
45 if (MCSection *S = getContext().GetSection(Name))
46 return (MCSectionPIC16*)S;
47 return MCSectionPIC16::Create(Name, Kind, getContext());
41 MCSectionPIC16 *&Entry = SectionsByName[Name];
42 if (Entry)
43 return Entry;
44
45 return Entry = MCSectionPIC16::Create(Name, Kind, getContext());
4846 }
4947
5048
1010 #define LLVM_TARGET_PIC16_TARGETOBJECTFILE_H
1111
1212 #include "llvm/Target/TargetLoweringObjectFile.h"
13 #include "llvm/ADT/StringMap.h"
1314 #include
1415 #include
1516
4546 };
4647
4748 class PIC16TargetObjectFile : public TargetLoweringObjectFile {
49 /// SectionsByName - Bindings of names to allocated sections.
50 mutable StringMap SectionsByName;
51
4852 const TargetMachine *TM;
4953
5054 const MCSectionPIC16 *getPIC16Section(const char *Name,