summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Target/PIC16/PIC16TargetAsmInfo.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/lib/Target/PIC16/PIC16TargetAsmInfo.cpp')
-rw-r--r--llvm/lib/Target/PIC16/PIC16TargetAsmInfo.cpp54
1 files changed, 31 insertions, 23 deletions
diff --git a/llvm/lib/Target/PIC16/PIC16TargetAsmInfo.cpp b/llvm/lib/Target/PIC16/PIC16TargetAsmInfo.cpp
index c855632d9f5..5a4387ae253 100644
--- a/llvm/lib/Target/PIC16/PIC16TargetAsmInfo.cpp
+++ b/llvm/lib/Target/PIC16/PIC16TargetAsmInfo.cpp
@@ -37,21 +37,24 @@ PIC16TargetAsmInfo(const PIC16TargetMachine &TM)
ZeroDirective = NULL;
AsciiDirective = " dt ";
AscizDirective = NULL;
- BSSSection_ = getNamedSection("udata.# UDATA", SectionKind::BSS);
- ReadOnlySection = getNamedSection("romdata.# ROMDATA", SectionKind::ReadOnly);
- DataSection = getNamedSection("idata.# IDATA", SectionKind::DataRel);
+ BSSSection_ = getOrCreateSection("udata.# UDATA", false, SectionKind::BSS);
+ ReadOnlySection = getOrCreateSection("romdata.# ROMDATA", false,
+ SectionKind::ReadOnly);
+ DataSection = getOrCreateSection("idata.# IDATA", false,SectionKind::DataRel);
SwitchToSectionDirective = "";
// Need because otherwise a .text symbol is emitted by DwarfWriter
// in BeginModule, and gpasm cribbs for that .text symbol.
- TextSection = getUnnamedSection("", SectionKind::Text);
+ TextSection = getOrCreateSection("", true, SectionKind::Text);
PIC16Section *ROSection = new PIC16Section(getReadOnlySection());
ROSections.push_back(ROSection);
// FIXME: I don't know what the classification of these sections really is.
- ExternalVarDecls = new PIC16Section(getNamedSection("ExternalVarDecls",
- SectionKind::Metadata));
- ExternalVarDefs = new PIC16Section(getNamedSection("ExternalVarDefs",
- SectionKind::Metadata));
+ ExternalVarDecls = new PIC16Section(getOrCreateSection("ExternalVarDecls",
+ false,
+ SectionKind::Metadata));
+ ExternalVarDefs = new PIC16Section(getOrCreateSection("ExternalVarDefs",
+ false,
+ SectionKind::Metadata));
// Set it to false because we weed to generate c file name and not bc file
// name.
HasSingleParameterDotFile = false;
@@ -98,9 +101,9 @@ PIC16TargetAsmInfo::getBSSSectionForGlobal(const GlobalVariable *GV) const {
// No BSS section spacious enough was found. Crate a new one.
if (!FoundBSS) {
std::string name = PAN::getUdataSectionName(BSSSections.size());
- const Section *NewSection = getNamedSection(name.c_str(),
- // FIXME.
- SectionKind::Metadata);
+ const Section *NewSection = getOrCreateSection(name.c_str(), false,
+ // FIXME.
+ SectionKind::Metadata);
FoundBSS = new PIC16Section(NewSection);
@@ -140,9 +143,10 @@ PIC16TargetAsmInfo::getIDATASectionForGlobal(const GlobalVariable *GV) const {
// No IDATA section spacious enough was found. Crate a new one.
if (!FoundIDATA) {
std::string name = PAN::getIdataSectionName(IDATASections.size());
- const Section *NewSection = getNamedSection(name.c_str(),
- // FIXME.
- SectionKind::Metadata);
+ const Section *NewSection = getOrCreateSection(name.c_str(),
+ false,
+ // FIXME.
+ SectionKind::Metadata);
FoundIDATA = new PIC16Section(NewSection);
@@ -175,9 +179,10 @@ PIC16TargetAsmInfo::getSectionForAuto(const GlobalVariable *GV) const {
// No Auto section was found. Crate a new one.
if (!FoundAutoSec) {
- const Section *NewSection = getNamedSection(name.c_str(),
- // FIXME.
- SectionKind::Metadata);
+ const Section *NewSection = getOrCreateSection(name.c_str(),
+ // FIXME.
+ false,
+ SectionKind::Metadata);
FoundAutoSec = new PIC16Section(NewSection);
@@ -325,7 +330,8 @@ PIC16TargetAsmInfo::CreateBSSSectionForGlobal(const GlobalVariable *GV,
PIC16Section *NewBSS = FoundBSS;
if (NewBSS == NULL) {
- const Section *NewSection = getNamedSection(Name.c_str(), SectionKind::BSS);
+ const Section *NewSection = getOrCreateSection(Name.c_str(),
+ false, SectionKind::BSS);
NewBSS = new PIC16Section(NewSection);
BSSSections.push_back(NewBSS);
}
@@ -376,9 +382,10 @@ PIC16TargetAsmInfo::CreateIDATASectionForGlobal(const GlobalVariable *GV,
PIC16Section *NewIDATASec = FoundIDATASec;
if (NewIDATASec == NULL) {
- const Section *NewSection = getNamedSection(Name.c_str(),
- // FIXME:
- SectionKind::Metadata);
+ const Section *NewSection = getOrCreateSection(Name.c_str(),
+ false,
+ // FIXME:
+ SectionKind::Metadata);
NewIDATASec = new PIC16Section(NewSection);
IDATASections.push_back(NewIDATASec);
}
@@ -416,8 +423,9 @@ PIC16TargetAsmInfo::CreateROSectionForGlobal(const GlobalVariable *GV,
PIC16Section *NewRomSec = FoundROSec;
if (NewRomSec == NULL) {
- const Section *NewSection = getNamedSection(Name.c_str(),
- SectionKind::ReadOnly);
+ const Section *NewSection = getOrCreateSection(Name.c_str(),
+ false,
+ SectionKind::ReadOnly);
NewRomSec = new PIC16Section(NewSection);
ROSections.push_back(NewRomSec);
}
OpenPOWER on IntegriCloud