/// Negative value here means user hasn't specified any.
int Address;
- /// FIXME: Keep overlay information here. uncomment the decl below.
/// Overlay information - Sections with same color can be overlaid on
/// one another.
- /// std::string Color;
+ int Color;
/// Conatined data objects.
std::vector<const GlobalVariable *>Items;
/// Total size of all data objects contained here.
unsigned Size;
- MCSectionPIC16(const StringRef &name, SectionKind K, int addr)
- : MCSection(K), Name(name), Address(addr) {
+ MCSectionPIC16(const StringRef &name, SectionKind K, int addr, int color)
+ : MCSection(K), Name(name), Address(addr), Color(color) {
}
public:
/// Return the Address of the section.
int getAddress() const { return Address; }
+ /// Return the Color of the section.
+ int getColor() const { return Color; }
+
/// PIC16 Terminology for section kinds is as below.
/// UDATA - BSS
/// IDATA - initialized data (equiv to Metadata)
/// This would be the only way to create a section.
static MCSectionPIC16 *Create(const StringRef &Name, SectionKind K,
- int Address, MCContext &Ctx);
+ int Address, int Color, MCContext &Ctx);
/// Override this as PIC16 has its own way of printing switching
/// to a section.
MCSectionPIC16 *MCSectionPIC16::Create(const StringRef &Name, SectionKind K,
- int Address, MCContext &Ctx) {
- return new (Ctx) MCSectionPIC16(Name, K, Address);
+ int Address, int Color, MCContext &Ctx) {
+ return new (Ctx) MCSectionPIC16(Name, K, Address, Color);
}
}
const MCSectionPIC16 *PIC16TargetObjectFile::
-getPIC16Section(const char *Name, SectionKind Kind, int Address) const {
+getPIC16Section(const char *Name, SectionKind Kind,
+ int Address, int Color) const {
MCSectionPIC16 *&Entry = SectionsByName[Name];
if (Entry)
return Entry;
- return Entry = MCSectionPIC16::Create(Name, Kind, Address, getContext());
+ return Entry = MCSectionPIC16::Create(Name, Kind, Address, Color,
+ getContext());
}
TargetLoweringObjectFile::Initialize(Ctx, tm);
TM = &tm;
- BSSSection = getPIC16Section("udata.# UDATA", SectionKind::getBSS());
+ BSSSection = getPIC16Section("udata.# UDATA", MCSectionPIC16::UDATA_Kind());
ReadOnlySection = getPIC16Section("romdata.# ROMDATA",
- SectionKind::getReadOnly());
- DataSection = getPIC16Section("idata.# IDATA", SectionKind::getDataRel());
+ MCSectionPIC16::ROMDATA_Kind());
+ DataSection = getPIC16Section("idata.# IDATA", MCSectionPIC16::IDATA_Kind());
// Need because otherwise a .text symbol is emitted by DwarfWriter
// in BeginModule, and gpasm cribbs for that .text symbol.
ROSections.push_back(new PIC16Section((MCSectionPIC16*)ReadOnlySection));
// FIXME: I don't know what the classification of these sections really is.
+ // These aren't really objects belonging to any section. Just emit them
+ // in AsmPrinter and remove this code from here.
ExternalVarDecls = new PIC16Section(getPIC16Section("ExternalVarDecls",
SectionKind::getMetadata()));
ExternalVarDefs = new PIC16Section(getPIC16Section("ExternalVarDefs",
if (!FoundBSS) {
std::string name = PAN::getUdataSectionName(BSSSections.size());
const MCSectionPIC16 *NewSection
- = getPIC16Section(name.c_str(), /*FIXME*/ SectionKind::getMetadata());
+ = getPIC16Section(name.c_str(), MCSectionPIC16::UDATA_Kind());
FoundBSS = new PIC16Section(NewSection);
if (!FoundIDATA) {
std::string name = PAN::getIdataSectionName(IDATASections.size());
const MCSectionPIC16 *NewSection =
- getPIC16Section(name.c_str(), /*FIXME*/ SectionKind::getMetadata());
+ getPIC16Section(name.c_str(), MCSectionPIC16::IDATA_Kind());
FoundIDATA = new PIC16Section(NewSection);
// No Auto section was found. Crate a new one.
if (!FoundAutoSec) {
const MCSectionPIC16 *NewSection =
- getPIC16Section(name.c_str(), /*FIXME*/ SectionKind::getMetadata());
+ getPIC16Section(name.c_str(), MCSectionPIC16::UDATA_OVR_Kind());
FoundAutoSec = new PIC16Section(NewSection);
PIC16Section *NewBSS = FoundBSS;
if (NewBSS == NULL) {
const MCSectionPIC16 *NewSection =
- getPIC16Section(Name.c_str(), SectionKind::getBSS());
+ getPIC16Section(Name.c_str(), MCSectionPIC16::UDATA_Kind());
NewBSS = new PIC16Section(NewSection);
BSSSections.push_back(NewBSS);
}
PIC16Section *NewIDATASec = FoundIDATASec;
if (NewIDATASec == NULL) {
const MCSectionPIC16 *NewSection =
- getPIC16Section(Name.c_str(), /* FIXME */SectionKind::getMetadata());
+ getPIC16Section(Name.c_str(), MCSectionPIC16::IDATA_Kind());
NewIDATASec = new PIC16Section(NewSection);
IDATASections.push_back(NewIDATASec);
}
PIC16Section *NewRomSec = FoundROSec;
if (NewRomSec == NULL) {
const MCSectionPIC16 *NewSection =
- getPIC16Section(Name.c_str(), SectionKind::getReadOnly());
+ getPIC16Section(Name.c_str(), MCSectionPIC16::ROMDATA_Kind());
NewRomSec = new PIC16Section(NewSection);
ROSections.push_back(NewRomSec);
}