forked from OSchip/llvm-project
make PIC16 unique its own sections instead of having mcontext do it.
llvm-svn: 78871
This commit is contained in:
parent
b691316838
commit
5ed8c4212a
|
@ -21,8 +21,10 @@ namespace llvm {
|
||||||
class MCSectionPIC16 : public MCSection {
|
class MCSectionPIC16 : public MCSection {
|
||||||
std::string Name;
|
std::string Name;
|
||||||
|
|
||||||
MCSectionPIC16(const StringRef &name, SectionKind K,
|
MCSectionPIC16(const StringRef &name, SectionKind K)
|
||||||
MCContext &Ctx);
|
: MCSection(K), Name(name) {
|
||||||
|
}
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
const std::string &getName() const { return Name; }
|
const std::string &getName() const { return Name; }
|
||||||
|
|
|
@ -18,14 +18,10 @@
|
||||||
#include "llvm/Support/raw_ostream.h"
|
#include "llvm/Support/raw_ostream.h"
|
||||||
using namespace llvm;
|
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,
|
MCSectionPIC16 *MCSectionPIC16::Create(const StringRef &Name,
|
||||||
SectionKind K, MCContext &Ctx) {
|
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::
|
const MCSectionPIC16 *PIC16TargetObjectFile::
|
||||||
getPIC16Section(const char *Name, SectionKind Kind) const {
|
getPIC16Section(const char *Name, SectionKind Kind) const {
|
||||||
if (MCSection *S = getContext().GetSection(Name))
|
MCSectionPIC16 *&Entry = SectionsByName[Name];
|
||||||
return (MCSectionPIC16*)S;
|
if (Entry)
|
||||||
return MCSectionPIC16::Create(Name, Kind, getContext());
|
return Entry;
|
||||||
|
|
||||||
|
return Entry = MCSectionPIC16::Create(Name, Kind, getContext());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -11,6 +11,7 @@
|
||||||
#define LLVM_TARGET_PIC16_TARGETOBJECTFILE_H
|
#define LLVM_TARGET_PIC16_TARGETOBJECTFILE_H
|
||||||
|
|
||||||
#include "llvm/Target/TargetLoweringObjectFile.h"
|
#include "llvm/Target/TargetLoweringObjectFile.h"
|
||||||
|
#include "llvm/ADT/StringMap.h"
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
|
@ -46,6 +47,9 @@ namespace llvm {
|
||||||
};
|
};
|
||||||
|
|
||||||
class PIC16TargetObjectFile : public TargetLoweringObjectFile {
|
class PIC16TargetObjectFile : public TargetLoweringObjectFile {
|
||||||
|
/// SectionsByName - Bindings of names to allocated sections.
|
||||||
|
mutable StringMap<MCSectionPIC16*> SectionsByName;
|
||||||
|
|
||||||
const TargetMachine *TM;
|
const TargetMachine *TM;
|
||||||
|
|
||||||
const MCSectionPIC16 *getPIC16Section(const char *Name,
|
const MCSectionPIC16 *getPIC16Section(const char *Name,
|
||||||
|
|
Loading…
Reference in New Issue