diff options
author | Chris Lattner <sabre@nondot.org> | 2009-08-01 18:25:49 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2009-08-01 18:25:49 +0000 |
commit | 4a7bc1e5aafbb543a9a535bce54fc62d18723b35 (patch) | |
tree | 950136749ff57f13b332aabbba572695d4dcc8e7 | |
parent | f67e84edefe240bb1d30cfb63cf46f2d5631a072 (diff) | |
download | external_llvm-4a7bc1e5aafbb543a9a535bce54fc62d18723b35.zip external_llvm-4a7bc1e5aafbb543a9a535bce54fc62d18723b35.tar.gz external_llvm-4a7bc1e5aafbb543a9a535bce54fc62d18723b35.tar.bz2 |
All MCSections are now required to have a SectionKind.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@77787 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | include/llvm/MC/MCSection.h | 23 | ||||
-rw-r--r-- | lib/MC/MCSection.cpp | 13 | ||||
-rw-r--r-- | lib/Target/TargetLoweringObjectFile.cpp | 2 | ||||
-rw-r--r-- | tools/llvm-mc/AsmParser.cpp | 8 | ||||
-rw-r--r-- | tools/llvm-mc/llvm-mc.cpp | 4 |
5 files changed, 17 insertions, 33 deletions
diff --git a/include/llvm/MC/MCSection.h b/include/llvm/MC/MCSection.h index 06d7e6a..5eb8559 100644 --- a/include/llvm/MC/MCSection.h +++ b/include/llvm/MC/MCSection.h @@ -31,35 +31,20 @@ namespace llvm { MCSection(const MCSection&); // DO NOT IMPLEMENT void operator=(const MCSection&); // DO NOT IMPLEMENT protected: - MCSection(const StringRef &Name, MCContext &Ctx); - // FIXME: HACK. + MCSection(const StringRef &Name, SectionKind K, MCContext &Ctx); SectionKind Kind; public: virtual ~MCSection(); - static MCSection *Create(const StringRef &Name, MCContext &Ctx); + static MCSection *Create(const StringRef &Name, SectionKind K, + MCContext &Ctx); const std::string &getName() const { return Name; } SectionKind getKind() const { return Kind; } }; - /// MCSectionWithKind - This is used by targets that use the SectionKind enum - /// to classify their sections. - class MCSectionWithKind : public MCSection { - MCSectionWithKind(const StringRef &Name, SectionKind K, MCContext &Ctx) - : MCSection(Name, Ctx) { - Kind = K; - } - public: - - static MCSectionWithKind *Create(const StringRef &Name, SectionKind K, - MCContext &Ctx); - - }; - - - typedef MCSectionWithKind MCSectionELF; + typedef MCSection MCSectionELF; } // end namespace llvm diff --git a/lib/MC/MCSection.cpp b/lib/MC/MCSection.cpp index 2a2b0b6..006546f 100644 --- a/lib/MC/MCSection.cpp +++ b/lib/MC/MCSection.cpp @@ -14,18 +14,15 @@ using namespace llvm; MCSection::~MCSection() { } -MCSection::MCSection(const StringRef &N, MCContext &Ctx) : Name(N) { +MCSection::MCSection(const StringRef &N, SectionKind K, MCContext &Ctx) + : Name(N), Kind(K) { MCSection *&Entry = Ctx.Sections[Name]; assert(Entry == 0 && "Multiple sections with the same name created"); Entry = this; } -MCSection *MCSection::Create(const StringRef &Name, MCContext &Ctx) { - return new (Ctx) MCSection(Name, Ctx); +MCSection *MCSection::Create(const StringRef &Name, SectionKind K, + MCContext &Ctx) { + return new (Ctx) MCSection(Name, K, Ctx); } - -MCSectionWithKind * -MCSectionWithKind::Create(const StringRef &Name, SectionKind K, MCContext &Ctx){ - return new (Ctx) MCSectionWithKind(Name, K, Ctx); -} diff --git a/lib/Target/TargetLoweringObjectFile.cpp b/lib/Target/TargetLoweringObjectFile.cpp index 9ba12bb..025e3f2 100644 --- a/lib/Target/TargetLoweringObjectFile.cpp +++ b/lib/Target/TargetLoweringObjectFile.cpp @@ -249,7 +249,7 @@ getOrCreateSection(const char *Name, bool isDirective, if (MCSection *S = Ctx->GetSection(Name)) return S; SectionKind K = SectionKind::get(Kind, false /*weak*/, !isDirective); - return MCSectionWithKind::Create(Name, K, *Ctx); + return MCSection::Create(Name, K, *Ctx); } diff --git a/tools/llvm-mc/AsmParser.cpp b/tools/llvm-mc/AsmParser.cpp index 19eaf35..46103ad 100644 --- a/tools/llvm-mc/AsmParser.cpp +++ b/tools/llvm-mc/AsmParser.cpp @@ -662,7 +662,7 @@ bool AsmParser::ParseDirectiveDarwinSection() { // FIXME: Arch specific. MCSection *S = Ctx.GetSection(Section); if (S == 0) - S = MCSection::Create(Section, Ctx); + S = MCSection::Create(Section, SectionKind(), Ctx); Out.SwitchSection(S); return false; @@ -683,7 +683,7 @@ bool AsmParser::ParseDirectiveSectionSwitch(const char *Section, // FIXME: Arch specific. MCSection *S = Ctx.GetSection(Section); if (S == 0) - S = MCSection::Create(Section, Ctx); + S = MCSection::Create(Section, SectionKind(), Ctx); Out.SwitchSection(S); return false; @@ -1074,7 +1074,7 @@ bool AsmParser::ParseDirectiveDarwinZerofill() { // FIXME: Arch specific. MCSection *S = Ctx.GetSection(Section); if (S == 0) - S = MCSection::Create(Section, Ctx); + S = MCSection::Create(Section, SectionKind(), Ctx); // Create the zerofill section but no symbol Out.EmitZerofill(S); @@ -1134,7 +1134,7 @@ bool AsmParser::ParseDirectiveDarwinZerofill() { // FIXME: Arch specific. MCSection *S = Ctx.GetSection(Section); if (S == 0) - S = MCSection::Create(Section, Ctx); + S = MCSection::Create(Section, SectionKind(), Ctx); // Create the zerofill Symbol with Size and Pow2Alignment Out.EmitZerofill(S, Sym, Size, Pow2Alignment); diff --git a/tools/llvm-mc/llvm-mc.cpp b/tools/llvm-mc/llvm-mc.cpp index 44a8319..745a64d 100644 --- a/tools/llvm-mc/llvm-mc.cpp +++ b/tools/llvm-mc/llvm-mc.cpp @@ -191,7 +191,9 @@ static int AssembleInput(const char *ProgName) { // FIXME: Target hook & command line option for initial section. Str.get()->SwitchSection(MCSection::Create("__TEXT,__text," - "regular,pure_instructions", Ctx)); + "regular,pure_instructions", + SectionKind::get(SectionKind::Text), + Ctx)); AsmParser Parser(SrcMgr, Ctx, *Str.get()); OwningPtr<TargetAsmParser> TAP(GetTargetAsmParser(ProgName, Parser)); |