const MCSection *DwarfRangesSection;
const MCSection *DwarfMacroInfoSection;
-protected:
- const MCSection *getOrCreateSection(const char *Name,
- bool isDirective,
- SectionKind K) const;
public:
+ MCContext &getContext() const { return *Ctx; }
+
+
virtual ~TargetLoweringObjectFile();
/// Initialize - this method must be called before any actual lowering is
const MCSection *MergeableConst4Section;
const MCSection *MergeableConst8Section;
const MCSection *MergeableConst16Section;
+
+protected:
+ const MCSection *getOrCreateSection(const char *Name,
+ bool isDirective,
+ SectionKind K) const;
public:
/// ELF Constructor - AtIsCommentChar is true if the CommentCharacter from TAI
/// is "@".
// FIXME: REMOVE AFTER UNIQUING IS FIXED.
bool hasCrazyBSS = false)
: AtIsCommentChar(atIsCommentChar), HasCrazyBSS(hasCrazyBSS) {}
-
- virtual void Initialize(MCContext &Ctx, const TargetMachine &TM);
+ virtual void Initialize(MCContext &Ctx, const TargetMachine &TM);
/// getSectionForConstant - Given a constant with the SectionKind, return a
/// section that it should be placed in.
const MCSection *FourByteConstantSection;
const MCSection *EightByteConstantSection;
const MCSection *SixteenByteConstantSection;
+protected:
+ const MCSection *getOrCreateSection(const char *Name,
+ bool isDirective,
+ SectionKind K) const;
public:
virtual void Initialize(MCContext &Ctx, const TargetMachine &TM);
class TargetLoweringObjectFileCOFF : public TargetLoweringObjectFile {
+protected:
+ const MCSection *getOrCreateSection(const char *Name,
+ bool isDirective,
+ SectionKind K) const;
public:
virtual void Initialize(MCContext &Ctx, const TargetMachine &TM);
#include "llvm/DerivedTypes.h"
#include "llvm/Module.h"
#include "llvm/MC/MCSection.h"
+#include "llvm/MC/MCContext.h"
using namespace llvm;
PIC16TargetObjectFile::PIC16TargetObjectFile()
: ExternalVarDecls(0), ExternalVarDefs(0) {
}
+const MCSection *PIC16TargetObjectFile::
+getOrCreateSection(const char *Name, bool isDirective, SectionKind Kind) const {
+ if (MCSection *S = getContext().GetSection(Name))
+ return S;
+ return MCSection::Create(Name, isDirective, Kind, getContext());
+}
+
+
void PIC16TargetObjectFile::Initialize(MCContext &Ctx, const TargetMachine &tm){
TargetLoweringObjectFile::Initialize(Ctx, tm);
TM = &tm;
class PIC16TargetObjectFile : public TargetLoweringObjectFile {
const TargetMachine *TM;
+
+ const MCSection *getOrCreateSection(const char *Name,
+ bool isDirective,
+ SectionKind K) const;
public:
mutable std::vector<PIC16Section*> BSSSections;
mutable std::vector<PIC16Section*> IDATASections;
}
-const MCSection *TargetLoweringObjectFile::
-getOrCreateSection(const char *Name, bool isDirective, SectionKind Kind) const {
- if (MCSection *S = Ctx->GetSection(Name))
- return S;
- return MCSection::Create(Name, isDirective, Kind, *Ctx);
-}
-
-
//===----------------------------------------------------------------------===//
// ELF
//===----------------------------------------------------------------------===//
+const MCSection *TargetLoweringObjectFileELF::
+getOrCreateSection(const char *Name, bool isDirective, SectionKind Kind) const {
+ if (MCSection *S = getContext().GetSection(Name))
+ return S;
+ return MCSection::Create(Name, isDirective, Kind, getContext());
+}
+
void TargetLoweringObjectFileELF::Initialize(MCContext &Ctx,
const TargetMachine &TM) {
TargetLoweringObjectFile::Initialize(Ctx, TM);
// MachO
//===----------------------------------------------------------------------===//
+const MCSection *TargetLoweringObjectFileMachO::
+getOrCreateSection(const char *Name, bool isDirective, SectionKind Kind) const {
+ if (MCSection *S = getContext().GetSection(Name))
+ return S;
+ return MCSection::Create(Name, isDirective, Kind, getContext());
+}
+
const MCSection *TargetLoweringObjectFileMachO::
getMachOSection(const char *Name, bool isDirective, SectionKind K) {
// FOR NOW, Just forward.
// COFF
//===----------------------------------------------------------------------===//
+const MCSection *TargetLoweringObjectFileCOFF::
+getOrCreateSection(const char *Name, bool isDirective, SectionKind Kind) const {
+ if (MCSection *S = getContext().GetSection(Name))
+ return S;
+ return MCSection::Create(Name, isDirective, Kind, getContext());
+}
+
const MCSection *TargetLoweringObjectFileCOFF::
getCOFFSection(const char *Name, bool isDirective, SectionKind K) {
return getOrCreateSection(Name, isDirective, K);