summaryrefslogtreecommitdiffstats
path: root/llvm/lib/MC/MCSection.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2009-08-08 23:39:42 +0000
committerChris Lattner <sabre@nondot.org>2009-08-08 23:39:42 +0000
commit591105c540fbdbbe41539ac0aa7c6eed393478ff (patch)
tree3caca0506ccb45794ba71c210ffdda9c95d3aa77 /llvm/lib/MC/MCSection.cpp
parent24f38969d5a2148576a5405d831c16bab51dcc77 (diff)
downloadbcm5719-llvm-591105c540fbdbbe41539ac0aa7c6eed393478ff.tar.gz
bcm5719-llvm-591105c540fbdbbe41539ac0aa7c6eed393478ff.zip
sink the 'name' and 'isdirective' state out of MCSection into its derived classes.
This totally optimizes PIC16 sections by not having an 'isdirective' bit anymore!! ;-) llvm-svn: 78517
Diffstat (limited to 'llvm/lib/MC/MCSection.cpp')
-rw-r--r--llvm/lib/MC/MCSection.cpp27
1 files changed, 20 insertions, 7 deletions
diff --git a/llvm/lib/MC/MCSection.cpp b/llvm/lib/MC/MCSection.cpp
index a1f56648597..80a80e7d8d0 100644
--- a/llvm/lib/MC/MCSection.cpp
+++ b/llvm/lib/MC/MCSection.cpp
@@ -20,13 +20,6 @@ using namespace llvm;
MCSection::~MCSection() {
}
-MCSection::MCSection(const StringRef &N, bool isDirective, SectionKind K,
- MCContext &Ctx)
- : Name(N), IsDirective(isDirective), Kind(K) {
- MCSection *&Entry = Ctx.Sections[Name];
- assert(Entry == 0 && "Multiple sections with the same name created");
- Entry = this;
-}
//===----------------------------------------------------------------------===//
// MCSectionELF
@@ -37,6 +30,13 @@ Create(const StringRef &Name, bool IsDirective, SectionKind K, MCContext &Ctx) {
return new (Ctx) MCSectionELF(Name, IsDirective, K, Ctx);
}
+MCSectionELF::MCSectionELF(const StringRef &name, bool isDirective,
+ SectionKind K, MCContext &Ctx)
+ : MCSection(K), Name(name), IsDirective(isDirective) {
+ Ctx.SetSection(Name, this);
+}
+
+
void MCSectionELF::PrintSwitchToSection(const TargetAsmInfo &TAI,
raw_ostream &OS) const {
if (isDirective()) {
@@ -118,6 +118,12 @@ Create(const StringRef &Name, bool IsDirective, SectionKind K, MCContext &Ctx) {
return new (Ctx) MCSectionMachO(Name, IsDirective, K, Ctx);
}
+MCSectionMachO::MCSectionMachO(const StringRef &name, bool isDirective,
+ SectionKind K, MCContext &Ctx)
+ : MCSection(K), Name(name), IsDirective(isDirective) {
+ Ctx.SetSection(Name, this);
+}
+
void MCSectionMachO::PrintSwitchToSection(const TargetAsmInfo &TAI,
raw_ostream &OS) const {
if (!isDirective())
@@ -135,6 +141,13 @@ Create(const StringRef &Name, bool IsDirective, SectionKind K, MCContext &Ctx) {
return new (Ctx) MCSectionCOFF(Name, IsDirective, K, Ctx);
}
+MCSectionCOFF::MCSectionCOFF(const StringRef &name, bool isDirective,
+ SectionKind K, MCContext &Ctx)
+ : MCSection(K), Name(name), IsDirective(isDirective) {
+ Ctx.SetSection(Name, this);
+}
+
+
void MCSectionCOFF::PrintSwitchToSection(const TargetAsmInfo &TAI,
raw_ostream &OS) const {
OpenPOWER on IntegriCloud