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
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);
-}
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);
}
// 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;
// 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;
// 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);
// 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);
// 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));