diff options
author | Chris Lattner <sabre@nondot.org> | 2009-08-01 21:11:14 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2009-08-01 21:11:14 +0000 |
commit | 968ff1196768c0b6dbcc5508025a2923bfa73fab (patch) | |
tree | fade5e6230db537ea51173a1cbeb55d17b554c28 /include/llvm/MC/MCSection.h | |
parent | d7f10d33610fbf226e6e9425c534d0914fd012d4 (diff) | |
download | external_llvm-968ff1196768c0b6dbcc5508025a2923bfa73fab.zip external_llvm-968ff1196768c0b6dbcc5508025a2923bfa73fab.tar.gz external_llvm-968ff1196768c0b6dbcc5508025a2923bfa73fab.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 'include/llvm/MC/MCSection.h')
-rw-r--r-- | include/llvm/MC/MCSection.h | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/include/llvm/MC/MCSection.h b/include/llvm/MC/MCSection.h index 5eb8559..a622bce 100644 --- a/include/llvm/MC/MCSection.h +++ b/include/llvm/MC/MCSection.h @@ -28,16 +28,27 @@ namespace llvm { /// 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, SectionKind K, MCContext &Ctx); + MCSection(const StringRef &Name, bool IsDirective, SectionKind K, + MCContext &Ctx); SectionKind Kind; public: virtual ~MCSection(); - static MCSection *Create(const StringRef &Name, SectionKind K, - MCContext &Ctx); + bool isDirective() const { return IsDirective; } + + static MCSection *Create(const StringRef &Name, bool IsDirective, + SectionKind K, MCContext &Ctx); const std::string &getName() const { return Name; } SectionKind getKind() const { return Kind; } |