aboutsummaryrefslogtreecommitdiffstats
path: root/lib/Target/PIC16
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2009-08-01 21:11:14 +0000
committerChris Lattner <sabre@nondot.org>2009-08-01 21:11:14 +0000
commit9de4876755e2d4ba1d3ad338cb1c67bf6aabebc4 (patch)
treefade5e6230db537ea51173a1cbeb55d17b554c28 /lib/Target/PIC16
parent62d9d7aed00fb8019faeb95fbfb2779636d23e67 (diff)
downloadexternal_llvm-9de4876755e2d4ba1d3ad338cb1c67bf6aabebc4.zip
external_llvm-9de4876755e2d4ba1d3ad338cb1c67bf6aabebc4.tar.gz
external_llvm-9de4876755e2d4ba1d3ad338cb1c67bf6aabebc4.tar.bz2
Change SectionKind to be a property that is true of a *section*, it
should have no state that is specific to particular globals in the section. In this case, it means the removal of the "isWeak" and "ExplicitSection" bits. MCSection uses the new form of SectionKind. To handle isWeak, I introduced a new SectionInfo class, which is SectionKind + isWeak, and it is used by the part of the code generator that does classification of a specific global. The ExplicitSection disappears. It is moved onto MCSection as a new "IsDirective" bit. Since the Name of a section is either a section or directive, it makes sense to keep this bit in MCSection. Ultimately the creator of MCSection should canonicalize (e.g.) .text to whatever the actual section is. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@77803 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Target/PIC16')
-rw-r--r--lib/Target/PIC16/PIC16AsmPrinter.cpp4
-rw-r--r--lib/Target/PIC16/PIC16TargetObjectFile.cpp35
-rw-r--r--lib/Target/PIC16/PIC16TargetObjectFile.h4
3 files changed, 23 insertions, 20 deletions
diff --git a/lib/Target/PIC16/PIC16AsmPrinter.cpp b/lib/Target/PIC16/PIC16AsmPrinter.cpp
index 604d105..596ec7a 100644
--- a/lib/Target/PIC16/PIC16AsmPrinter.cpp
+++ b/lib/Target/PIC16/PIC16AsmPrinter.cpp
@@ -73,7 +73,7 @@ bool PIC16AsmPrinter::runOnMachineFunction(MachineFunction &MF) {
const MCSection *fCodeSection =
getObjFileLowering().getOrCreateSection(codeSection, false,
- SectionKind::Text);
+ SectionKind::get(SectionKind::Text));
// Start the Code Section.
O << "\n";
SwitchToSection(fCodeSection);
@@ -350,7 +350,7 @@ void PIC16AsmPrinter::EmitFunctionFrame(MachineFunction &MF) {
const MCSection *fPDataSection =
getObjFileLowering().getOrCreateSection(SectionName, false,
- SectionKind::DataRel);
+ SectionKind::get(SectionKind::DataRel));
SwitchToSection(fPDataSection);
// Emit function frame label
diff --git a/lib/Target/PIC16/PIC16TargetObjectFile.cpp b/lib/Target/PIC16/PIC16TargetObjectFile.cpp
index 5a2d4d8..91e98b2 100644
--- a/lib/Target/PIC16/PIC16TargetObjectFile.cpp
+++ b/lib/Target/PIC16/PIC16TargetObjectFile.cpp
@@ -19,24 +19,27 @@ void PIC16TargetObjectFile::Initialize(MCContext &Ctx, const TargetMachine &tm){
TargetLoweringObjectFile::Initialize(Ctx, tm);
TM = &tm;
- BSSSection_ = getOrCreateSection("udata.# UDATA", false, SectionKind::BSS);
+ BSSSection_ = getOrCreateSection("udata.# UDATA", false,
+ SectionKind::get(SectionKind::BSS));
ReadOnlySection = getOrCreateSection("romdata.# ROMDATA", false,
- SectionKind::ReadOnly);
- DataSection = getOrCreateSection("idata.# IDATA", false,SectionKind::DataRel);
+ SectionKind::get(SectionKind::ReadOnly));
+ DataSection = getOrCreateSection("idata.# IDATA", false,
+ SectionKind::get(SectionKind::DataRel));
// Need because otherwise a .text symbol is emitted by DwarfWriter
// in BeginModule, and gpasm cribbs for that .text symbol.
- TextSection = getOrCreateSection("", true, SectionKind::Text);
+ TextSection = getOrCreateSection("", true,
+ SectionKind::get(SectionKind::Text));
ROSections.push_back(new PIC16Section(ReadOnlySection));
// FIXME: I don't know what the classification of these sections really is.
ExternalVarDecls = new PIC16Section(getOrCreateSection("ExternalVarDecls",
false,
- SectionKind::Metadata));
+ SectionKind::get(SectionKind::Metadata)));
ExternalVarDefs = new PIC16Section(getOrCreateSection("ExternalVarDefs",
false,
- SectionKind::Metadata));
+ SectionKind::get(SectionKind::Metadata)));
}
@@ -66,7 +69,7 @@ PIC16TargetObjectFile::getBSSSectionForGlobal(const GlobalVariable *GV) const {
std::string name = PAN::getUdataSectionName(BSSSections.size());
const MCSection *NewSection = getOrCreateSection(name.c_str(), false,
// FIXME.
- SectionKind::Metadata);
+ SectionKind::get(SectionKind::Metadata));
FoundBSS = new PIC16Section(NewSection);
@@ -108,7 +111,7 @@ PIC16TargetObjectFile::getIDATASectionForGlobal(const GlobalVariable *GV) const{
std::string name = PAN::getIdataSectionName(IDATASections.size());
const MCSection *NewSection = getOrCreateSection(name.c_str(), false,
// FIXME.
- SectionKind::Metadata);
+ SectionKind::get(SectionKind::Metadata));
FoundIDATA = new PIC16Section(NewSection);
@@ -144,7 +147,7 @@ PIC16TargetObjectFile::getSectionForAuto(const GlobalVariable *GV) const {
const MCSection *NewSection = getOrCreateSection(name.c_str(),
// FIXME.
false,
- SectionKind::Metadata);
+ SectionKind::get(SectionKind::Metadata));
FoundAutoSec = new PIC16Section(NewSection);
@@ -163,14 +166,14 @@ PIC16TargetObjectFile::getSectionForAuto(const GlobalVariable *GV) const {
// multiple data sections if required.
const MCSection *
PIC16TargetObjectFile::SelectSectionForGlobal(const GlobalValue *GV1,
- SectionKind Kind,
+ SectionInfo Info,
Mangler *Mang,
const TargetMachine &TM) const {
// We select the section based on the initializer here, so it really
// has to be a GlobalVariable.
const GlobalVariable *GV = dyn_cast<GlobalVariable>(GV1);
if (!GV)
- return TargetLoweringObjectFile::SelectSectionForGlobal(GV1, Kind, Mang,TM);
+ return TargetLoweringObjectFile::SelectSectionForGlobal(GV1, Info, Mang,TM);
// Record External Var Decls.
if (GV->isDeclaration()) {
@@ -204,7 +207,7 @@ PIC16TargetObjectFile::SelectSectionForGlobal(const GlobalValue *GV1,
return getROSectionForGlobal(GV);
// Else let the default implementation take care of it.
- return TargetLoweringObjectFile::SelectSectionForGlobal(GV, Kind, Mang,TM);
+ return TargetLoweringObjectFile::SelectSectionForGlobal(GV, Info, Mang,TM);
}
PIC16TargetObjectFile::~PIC16TargetObjectFile() {
@@ -226,7 +229,7 @@ PIC16TargetObjectFile::~PIC16TargetObjectFile() {
const MCSection *
PIC16TargetObjectFile::getSpecialCasedSectionGlobals(const GlobalValue *GV,
Mangler *Mang,
- SectionKind Kind) const {
+ SectionInfo Info) const {
// If GV has a sectin name or section address create that section now.
if (GV->hasSection()) {
if (const GlobalVariable *GVar = cast<GlobalVariable>(GV)) {
@@ -297,7 +300,7 @@ PIC16TargetObjectFile::CreateBSSSectionForGlobal(const GlobalVariable *GV,
PIC16Section *NewBSS = FoundBSS;
if (NewBSS == NULL) {
const MCSection *NewSection = getOrCreateSection(Name.c_str(), false,
- SectionKind::BSS);
+ SectionKind::get(SectionKind::BSS));
NewBSS = new PIC16Section(NewSection);
BSSSections.push_back(NewBSS);
}
@@ -350,7 +353,7 @@ PIC16TargetObjectFile::CreateIDATASectionForGlobal(const GlobalVariable *GV,
if (NewIDATASec == NULL) {
const MCSection *NewSection = getOrCreateSection(Name.c_str(), false,
// FIXME:
- SectionKind::Metadata);
+ SectionKind::get(SectionKind::Metadata));
NewIDATASec = new PIC16Section(NewSection);
IDATASections.push_back(NewIDATASec);
}
@@ -389,7 +392,7 @@ PIC16TargetObjectFile::CreateROSectionForGlobal(const GlobalVariable *GV,
PIC16Section *NewRomSec = FoundROSec;
if (NewRomSec == NULL) {
const MCSection *NewSection = getOrCreateSection(Name.c_str(), false,
- SectionKind::ReadOnly);
+ SectionKind::get(SectionKind::ReadOnly));
NewRomSec = new PIC16Section(NewSection);
ROSections.push_back(NewRomSec);
}
diff --git a/lib/Target/PIC16/PIC16TargetObjectFile.h b/lib/Target/PIC16/PIC16TargetObjectFile.h
index c296954..831f924 100644
--- a/lib/Target/PIC16/PIC16TargetObjectFile.h
+++ b/lib/Target/PIC16/PIC16TargetObjectFile.h
@@ -62,9 +62,9 @@ namespace llvm {
/// section assignment of a global.
virtual const MCSection *
getSpecialCasedSectionGlobals(const GlobalValue *GV, Mangler *Mang,
- SectionKind Kind) const;
+ SectionInfo Info) const;
virtual const MCSection *SelectSectionForGlobal(const GlobalValue *GV,
- SectionKind Kind,
+ SectionInfo Info,
Mangler *Mang,
const TargetMachine&) const;
private: