diff options
author | Chris Lattner <sabre@nondot.org> | 2009-08-08 23:39:42 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2009-08-08 23:39:42 +0000 |
commit | 93b6db3de934a3cfca5586df25184fef4a54c500 (patch) | |
tree | 3c32466a689b69726787f2b72bcdaf6a3879df50 /include/llvm/MC/MCSection.h | |
parent | 8e9ece75db5045ec057efbbdba6550fa0d85e695 (diff) | |
download | llvm-93b6db3de934a3cfca5586df25184fef4a54c500.tar.gz llvm-93b6db3de934a3cfca5586df25184fef4a54c500.tar.bz2 llvm-93b6db3de934a3cfca5586df25184fef4a54c500.tar.xz |
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!! ;-)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@78517 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/llvm/MC/MCSection.h')
-rw-r--r-- | include/llvm/MC/MCSection.h | 58 |
1 files changed, 41 insertions, 17 deletions
diff --git a/include/llvm/MC/MCSection.h b/include/llvm/MC/MCSection.h index 4e5969ab3e..4d505028db 100644 --- a/include/llvm/MC/MCSection.h +++ b/include/llvm/MC/MCSection.h @@ -27,27 +27,14 @@ namespace llvm { /// section in the current translation unit. The MCContext class uniques and /// creates these. class MCSection { - std::string Name; - - /// IsDirective - This is true if the section name is a directive, not - /// something that should be printed with ".section". - /// - /// FIXME: This is a hack. Switch to a semantic view of the section instead - /// of a syntactic one. - bool IsDirective; - MCSection(const MCSection&); // DO NOT IMPLEMENT void operator=(const MCSection&); // DO NOT IMPLEMENT protected: - MCSection(const StringRef &Name, bool IsDirective, SectionKind K, - MCContext &Ctx); + MCSection(SectionKind K) : Kind(K) {} SectionKind Kind; public: virtual ~MCSection(); - const std::string &getName() const { return Name; } - bool isDirective() const { return IsDirective; } - SectionKind getKind() const { return Kind; } virtual void PrintSwitchToSection(const TargetAsmInfo &TAI, @@ -56,36 +43,73 @@ namespace llvm { class MCSectionELF : public MCSection { + std::string Name; + + /// IsDirective - This is true if the section name is a directive, not + /// something that should be printed with ".section". + /// + /// FIXME: This is a hack. Switch to a semantic view of the section instead + /// of a syntactic one. + bool IsDirective; + MCSectionELF(const StringRef &Name, bool IsDirective, SectionKind K, - MCContext &Ctx) : MCSection(Name, IsDirective, K, Ctx) {} + MCContext &Ctx); public: static MCSectionELF *Create(const StringRef &Name, bool IsDirective, SectionKind K, MCContext &Ctx); + const std::string &getName() const { return Name; } + bool isDirective() const { return IsDirective; } + + virtual void PrintSwitchToSection(const TargetAsmInfo &TAI, raw_ostream &OS) const; }; class MCSectionMachO : public MCSection { + std::string Name; + + /// IsDirective - This is true if the section name is a directive, not + /// something that should be printed with ".section". + /// + /// FIXME: This is a hack. Switch to a semantic view of the section instead + /// of a syntactic one. + bool IsDirective; + MCSectionMachO(const StringRef &Name, bool IsDirective, SectionKind K, - MCContext &Ctx) : MCSection(Name, IsDirective, K, Ctx) {} + MCContext &Ctx); public: static MCSectionMachO *Create(const StringRef &Name, bool IsDirective, SectionKind K, MCContext &Ctx); + const std::string &getName() const { return Name; } + bool isDirective() const { return IsDirective; } + virtual void PrintSwitchToSection(const TargetAsmInfo &TAI, raw_ostream &OS) const; }; class MCSectionCOFF : public MCSection { + std::string Name; + + /// IsDirective - This is true if the section name is a directive, not + /// something that should be printed with ".section". + /// + /// FIXME: This is a hack. Switch to a semantic view of the section instead + /// of a syntactic one. + bool IsDirective; + MCSectionCOFF(const StringRef &Name, bool IsDirective, SectionKind K, - MCContext &Ctx) : MCSection(Name, IsDirective, K, Ctx) {} + MCContext &Ctx); public: static MCSectionCOFF *Create(const StringRef &Name, bool IsDirective, SectionKind K, MCContext &Ctx); + + const std::string &getName() const { return Name; } + bool isDirective() const { return IsDirective; } virtual void PrintSwitchToSection(const TargetAsmInfo &TAI, raw_ostream &OS) const; |